fix one too small
[RRG-proxmark3.git] / client / src / ui.h
blob09a107ba4b19ed0d37435223dd8a03f0fb7356ab
1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
16 // UI utilities
17 //-----------------------------------------------------------------------------
19 #ifndef UI_H__
20 #define UI_H__
22 #include <pthread.h>
23 #include "common.h"
24 #include "comms.h"
25 #include "ansi.h"
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
31 #define _USE_MATH_DEFINES
33 typedef enum {STYLE_BAR, STYLE_MIXED, STYLE_VALUE} barMode_t;
34 typedef enum logLevel {NORMAL, SUCCESS, INFO, FAILED, WARNING, ERR, DEBUG, INPLACE, HINT} logLevel_t;
35 typedef enum emojiMode {EMO_ALIAS, EMO_EMOJI, EMO_ALTTEXT, EMO_NONE} emojiMode_t;
36 typedef enum clientdebugLevel {cdbOFF, cdbSIMPLE, cdbFULL} clientdebugLevel_t;
37 // typedef enum devicedebugLevel {ddbOFF, ddbERROR, ddbINFO, ddbDEBUG, ddbEXTENDED} devicedebugLevel_t;
39 // last item spItemCount used to auto map to number of files
40 typedef enum savePaths {spDefault, spDump, spTrace, spItemCount} savePaths_t;
41 typedef struct {int x; int y; int h; int w;} qtWindow_t;
43 typedef struct {
44 bool preferences_loaded;
45 bool stdinOnTTY;
46 bool stdoutOnTTY;
47 bool supports_colors;
48 emojiMode_t emoji_mode;
49 bool pm3_present;
50 bool help_dump_mode;
51 bool show_hints;
52 bool dense_output;
53 bool window_changed; // track if plot/overlay pos/size changed to save on exit
54 qtWindow_t plot;
55 qtWindow_t overlay;
56 bool overlay_sliders;
57 bool incognito;
58 char *defaultPaths[spItemCount]; // Array should allow loop searching for files
59 clientdebugLevel_t client_debug_level;
60 barMode_t bar_mode;
61 // uint8_t device_debug_level;
62 uint16_t client_exe_delay;
63 char *history_path;
64 pm3_device_t *current_device;
65 uint32_t timeout;
66 } session_arg_t;
68 extern session_arg_t g_session;
70 #ifndef M_PI
71 #define M_PI 3.14159265358979323846264338327
72 #endif
73 #define MAX_PRINT_BUFFER 2048
75 #define PROMPT_CLEARLINE PrintAndLogEx(INPLACE, " \r")
76 void PrintAndLogOptions(const char *str[][2], size_t size, size_t space);
77 void PrintAndLogEx(logLevel_t level, const char *fmt, ...);
78 void SetFlushAfterWrite(bool value);
79 bool GetFlushAfterWrite(void);
80 void memcpy_filter_ansi(void *dest, const void *src, size_t n, bool filter);
81 void memcpy_filter_rlmarkers(void *dest, const void *src, size_t n);
82 void memcpy_filter_emoji(void *dest, const void *src, size_t n, emojiMode_t mode);
83 void free_grabber(void);
85 int searchHomeFilePath(char **foundpath, const char *subdir, const char *filename, bool create_home);
87 extern pthread_mutex_t g_print_lock;
89 void print_progress(uint64_t count, uint64_t max, barMode_t style);
91 void iceIIR_Butterworth(int *data, const size_t len);
92 void iceSimple_Filter(int *data, const size_t len, uint8_t k);
93 #ifdef __cplusplus
95 #endif
96 #endif