textual
[RRG-proxmark3.git] / client / src / ui.h
blob632a818d3c1d90fc32b07f59e6720c2575b81f43
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
3 //
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
6 // the license.
7 //-----------------------------------------------------------------------------
8 // UI utilities
9 //-----------------------------------------------------------------------------
11 #ifndef UI_H__
12 #define UI_H__
14 #include <pthread.h>
15 #include "common.h"
16 #include "comms.h"
17 #include "ansi.h"
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
23 #define _USE_MATH_DEFINES
25 typedef enum {STYLE_BAR, STYLE_MIXED, STYLE_VALUE} barMode_t;
26 typedef enum logLevel {NORMAL, SUCCESS, INFO, FAILED, WARNING, ERR, DEBUG, INPLACE, HINT} logLevel_t;
27 typedef enum emojiMode {EMO_ALIAS, EMO_EMOJI, EMO_ALTTEXT, EMO_NONE} emojiMode_t;
28 typedef enum clientdebugLevel {cdbOFF, cdbSIMPLE, cdbFULL} clientdebugLevel_t;
29 // typedef enum devicedebugLevel {ddbOFF, ddbERROR, ddbINFO, ddbDEBUG, ddbEXTENDED} devicedebugLevel_t;
30 typedef enum savePaths {spDefault, spDump, spTrace, spItemCount} savePaths_t; // last item spItemCount used to auto map to number of files
31 typedef struct {int x; int y; int h; int w;} qtWindow_t;
33 typedef struct {
34 bool preferences_loaded;
35 bool stdinOnTTY;
36 bool stdoutOnTTY;
37 bool supports_colors;
38 emojiMode_t emoji_mode;
39 bool pm3_present;
40 bool help_dump_mode;
41 bool show_hints;
42 bool window_changed; // track if plot/overlay pos/size changed to save on exit
43 qtWindow_t plot;
44 qtWindow_t overlay;
45 bool overlay_sliders;
46 bool incognito;
47 char *defaultPaths[spItemCount]; // Array should allow loop searching for files
48 clientdebugLevel_t client_debug_level;
49 barMode_t bar_mode;
50 // uint8_t device_debug_level;
51 char *history_path;
52 pm3_device *current_device;
53 } session_arg_t;
55 extern session_arg_t session;
56 extern bool showDemod;
57 #ifndef M_PI
58 #define M_PI 3.14159265358979323846264338327
59 #endif
60 #define MAX_PRINT_BUFFER 2048
62 #define PROMPT_CLEARLINE PrintAndLogEx(INPLACE, " \r")
63 void PrintAndLogOptions(const char *str[][2], size_t size, size_t space);
64 void PrintAndLogEx(logLevel_t level, const char *fmt, ...);
65 void SetFlushAfterWrite(bool value);
66 void memcpy_filter_ansi(void *dest, const void *src, size_t n, bool filter);
67 void memcpy_filter_rlmarkers(void *dest, const void *src, size_t n);
68 void memcpy_filter_emoji(void *dest, const void *src, size_t n, emojiMode_t mode);
70 int searchHomeFilePath(char **foundpath, const char *subdir, const char *filename, bool create_home);
72 extern pthread_mutex_t print_lock;
74 void print_progress(size_t count, uint64_t max, barMode_t style);
76 void iceIIR_Butterworth(int *data, const size_t len);
77 void iceSimple_Filter(int *data, const size_t len, uint8_t k);
78 #ifdef __cplusplus
80 #endif
81 #endif