2010-02-21 08:47:22 +08:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
|
|
|
|
//
|
|
|
|
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
|
|
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
|
|
|
// the license.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// UI utilities
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
#ifndef UI_H__
|
|
|
|
#define UI_H__
|
2016-04-23 19:02:20 +08:00
|
|
|
|
2016-02-19 03:08:34 +08:00
|
|
|
#include <pthread.h>
|
2020-05-03 18:46:46 +08:00
|
|
|
#include "common.h"
|
2020-05-28 08:13:21 +08:00
|
|
|
#include "comms.h"
|
2019-08-08 22:57:33 +08:00
|
|
|
#include "ansi.h"
|
|
|
|
|
2020-05-03 18:46:46 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-08-08 22:57:33 +08:00
|
|
|
#define _USE_MATH_DEFINES
|
2014-09-12 05:23:46 +08:00
|
|
|
|
2020-12-21 08:45:03 +08:00
|
|
|
typedef enum {STYLE_BAR, STYLE_MIXED, STYLE_VALUE} barMode_t;
|
2020-03-16 05:41:05 +08:00
|
|
|
typedef enum logLevel {NORMAL, SUCCESS, INFO, FAILED, WARNING, ERR, DEBUG, INPLACE, HINT} logLevel_t;
|
2021-01-09 21:00:58 +08:00
|
|
|
typedef enum emojiMode {EMO_ALIAS, EMO_EMOJI, EMO_ALTTEXT, EMO_NONE} emojiMode_t;
|
2020-04-21 06:50:04 +08:00
|
|
|
typedef enum clientdebugLevel {cdbOFF, cdbSIMPLE, cdbFULL} clientdebugLevel_t;
|
2020-04-24 14:56:35 +08:00
|
|
|
// typedef enum devicedebugLevel {ddbOFF, ddbERROR, ddbINFO, ddbDEBUG, ddbEXTENDED} devicedebugLevel_t;
|
2020-04-25 16:37:23 +08:00
|
|
|
//typedef enum savePaths {spDefault, spDump, spTrace, spItemCount} savePaths_t; // last item spItemCount used to auto map to number of files
|
2020-04-18 16:04:08 +08:00
|
|
|
typedef struct {int x; int y; int h; int w;} qtWindow_t;
|
2020-03-16 05:41:05 +08:00
|
|
|
|
2019-04-30 19:02:27 +08:00
|
|
|
typedef struct {
|
2020-04-12 11:07:25 +08:00
|
|
|
bool preferences_loaded;
|
2019-04-30 19:02:27 +08:00
|
|
|
bool stdinOnTTY;
|
|
|
|
bool stdoutOnTTY;
|
|
|
|
bool supports_colors;
|
2020-03-16 05:41:05 +08:00
|
|
|
emojiMode_t emoji_mode;
|
2019-05-01 05:52:40 +08:00
|
|
|
bool pm3_present;
|
2019-05-02 02:48:15 +08:00
|
|
|
bool help_dump_mode;
|
2020-03-17 01:42:34 +08:00
|
|
|
bool show_hints;
|
2020-04-13 14:17:57 +08:00
|
|
|
bool window_changed; // track if plot/overlay pos/size changed to save on exit
|
2020-04-18 16:04:08 +08:00
|
|
|
qtWindow_t plot;
|
|
|
|
qtWindow_t overlay;
|
2020-10-05 18:19:09 +08:00
|
|
|
bool overlay_sliders;
|
2020-10-07 00:11:45 +08:00
|
|
|
bool incognito;
|
2020-04-25 16:37:23 +08:00
|
|
|
// char *defaultPaths[spItemCount]; // Array should allow loop searching for files
|
2020-04-10 16:20:02 +08:00
|
|
|
clientdebugLevel_t client_debug_level;
|
2020-12-21 08:45:03 +08:00
|
|
|
barMode_t bar_mode;
|
2020-04-24 14:56:35 +08:00
|
|
|
// uint8_t device_debug_level;
|
2020-06-30 00:10:40 +08:00
|
|
|
char *history_path;
|
2020-05-28 08:13:21 +08:00
|
|
|
pm3_device *current_device;
|
2019-04-30 19:02:27 +08:00
|
|
|
} session_arg_t;
|
2020-04-10 11:58:57 +08:00
|
|
|
|
2019-04-30 19:02:27 +08:00
|
|
|
extern session_arg_t session;
|
2020-05-03 18:23:55 +08:00
|
|
|
extern bool showDemod;
|
2016-02-19 03:08:34 +08:00
|
|
|
#ifndef M_PI
|
|
|
|
#define M_PI 3.14159265358979323846264338327
|
|
|
|
#endif
|
2018-02-15 23:32:08 +08:00
|
|
|
#define MAX_PRINT_BUFFER 2048
|
|
|
|
|
2020-09-13 01:38:29 +08:00
|
|
|
#define PROMPT_CLEARLINE PrintAndLogEx(INPLACE, " \r")
|
2019-04-10 16:21:42 +08:00
|
|
|
void PrintAndLogOptions(const char *str[][2], size_t size, size_t space);
|
2019-04-10 03:25:11 +08:00
|
|
|
void PrintAndLogEx(logLevel_t level, const char *fmt, ...);
|
2018-09-07 03:43:20 +08:00
|
|
|
void SetFlushAfterWrite(bool value);
|
2019-04-30 06:41:52 +08:00
|
|
|
void memcpy_filter_ansi(void *dest, const void *src, size_t n, bool filter);
|
2020-05-09 00:12:10 +08:00
|
|
|
void memcpy_filter_rlmarkers(void *dest, const void *src, size_t n);
|
2020-03-16 05:41:05 +08:00
|
|
|
void memcpy_filter_emoji(void *dest, const void *src, size_t n, emojiMode_t mode);
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
|
2020-05-24 07:20:43 +08:00
|
|
|
int searchHomeFilePath(char **foundpath, const char *subdir, const char *filename, bool create_home);
|
2019-08-29 03:15:11 +08:00
|
|
|
|
2017-10-21 02:39:57 +08:00
|
|
|
extern pthread_mutex_t print_lock;
|
|
|
|
|
2020-12-21 08:45:03 +08:00
|
|
|
void print_progress(size_t count, uint64_t max, barMode_t style);
|
|
|
|
|
2019-04-06 06:38:22 +08:00
|
|
|
void iceIIR_Butterworth(int *data, const size_t len);
|
|
|
|
void iceSimple_Filter(int *data, const size_t len, uint8_t k);
|
2020-05-03 18:46:46 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
#endif
|