2014-08-29 07:52:33 -07:00
|
|
|
/**
|
|
|
|
* @file cli_registry.h
|
|
|
|
* @brief Command-line interface commands registry
|
|
|
|
*
|
|
|
|
* @date Nov 15, 2012
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2014
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RFICONSOLE_LOGIC_H_
|
|
|
|
#define RFICONSOLE_LOGIC_H_
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
#define CONSOLE_MAX_ACTIONS 128
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
NO_PARAMETER,
|
2014-09-17 13:03:04 -07:00
|
|
|
NO_PARAMETER_P,
|
2014-08-29 07:52:33 -07:00
|
|
|
ONE_PARAMETER,
|
|
|
|
FLOAT_PARAMETER,
|
|
|
|
STRING_PARAMETER,
|
|
|
|
STRING2_PARAMETER,
|
2014-09-20 12:03:00 -07:00
|
|
|
STRING2_PARAMETER_P,
|
2014-08-29 07:52:33 -07:00
|
|
|
STRING3_PARAMETER,
|
|
|
|
STRING5_PARAMETER,
|
|
|
|
TWO_INTS_PARAMETER,
|
2014-09-20 12:03:00 -07:00
|
|
|
TWO_INTS_PARAMETER_P,
|
|
|
|
FLOAT_FLOAT_PARAMETER,
|
|
|
|
FLOAT_FLOAT_PARAMETER_P,
|
2014-09-15 09:03:05 -07:00
|
|
|
} action_type_e;
|
2014-08-29 07:52:33 -07:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const char *token;
|
2014-09-15 09:03:05 -07:00
|
|
|
action_type_e parameterType;
|
2014-08-29 07:52:33 -07:00
|
|
|
void (*callback)(void);
|
2014-09-17 13:03:04 -07:00
|
|
|
void *param;
|
2014-08-29 07:52:33 -07:00
|
|
|
} TokenCallback;
|
|
|
|
|
|
|
|
//void addDefaultConsoleActions(void);
|
|
|
|
//void handleActionWithParameter(TokenCallback *current, char *parameter);
|
|
|
|
int tokenLength(const char *msgp);
|
|
|
|
|
2014-09-17 13:03:04 -07:00
|
|
|
typedef void (*VoidPtr)(void*);
|
|
|
|
|
|
|
|
|
2014-08-29 07:52:33 -07:00
|
|
|
typedef void (*Void)(void);
|
|
|
|
typedef void (*VoidInt)(int);
|
|
|
|
typedef void (*VoidFloat)(float);
|
|
|
|
typedef void (*VoidFloatFloat)(float, float);
|
2014-10-21 09:04:13 -07:00
|
|
|
typedef void (*VoidFloatFloatVoidPtr)(float, float, void*);
|
2014-08-29 07:52:33 -07:00
|
|
|
typedef void (*VoidIntInt)(int, int);
|
2014-10-21 09:04:13 -07:00
|
|
|
|
2014-09-11 06:02:51 -07:00
|
|
|
typedef void (*VoidCharPtr)(const char *);
|
2014-10-21 09:04:13 -07:00
|
|
|
typedef void (*VoidCharPtrVoidPtr)(const char *, void*);
|
2014-09-20 12:03:00 -07:00
|
|
|
|
2014-08-29 07:52:33 -07:00
|
|
|
typedef void (*VoidCharPtrCharPtr)(const char *, const char *);
|
2014-09-20 12:03:00 -07:00
|
|
|
typedef void (*VoidCharPtrCharPtrVoidPtr)(const char *, const char *, void*);
|
|
|
|
|
2014-08-29 07:52:33 -07:00
|
|
|
typedef void (*VoidCharPtrCharPtrCharPtr)(const char *, const char *, const char *);
|
|
|
|
typedef void (*VoidCharPtrCharPtrCharPtrCharPtrCharPtr)(const char *, const char *, const char *, const char *, const char *);
|
|
|
|
|
|
|
|
char *validateSecureLine(char *line);
|
|
|
|
void resetConsoleActions(void);
|
|
|
|
void helpCommand(void);
|
|
|
|
void initConsoleLogic(void);
|
|
|
|
void handleConsoleLine(char *line);
|
2014-10-11 06:02:57 -07:00
|
|
|
int findEndOfToken(const char *line);
|
2014-10-12 15:02:54 -07:00
|
|
|
char *unquote(char *line);
|
2014-10-11 06:02:57 -07:00
|
|
|
|
2014-08-29 07:52:33 -07:00
|
|
|
void addConsoleAction(const char *token, Void callback);
|
2014-09-17 13:03:04 -07:00
|
|
|
void addConsoleActionP(const char *token, VoidPtr callback, void *param);
|
|
|
|
|
2014-08-29 07:52:33 -07:00
|
|
|
void addConsoleActionI(const char *token, VoidInt callback);
|
|
|
|
void addConsoleActionII(const char *token, VoidIntInt callback);
|
|
|
|
void addConsoleActionF(const char *token, VoidFloat callback);
|
2014-10-21 09:04:13 -07:00
|
|
|
|
2014-08-29 07:52:33 -07:00
|
|
|
void addConsoleActionFF(const char *token, VoidFloatFloat callback);
|
2014-10-21 09:04:13 -07:00
|
|
|
void addConsoleActionFFP(const char *token, VoidFloatFloatVoidPtr callback, void *param);
|
|
|
|
|
2014-08-29 07:52:33 -07:00
|
|
|
void addConsoleActionS(const char *token, VoidCharPtr callback);
|
2014-10-21 09:04:13 -07:00
|
|
|
void addConsoleActionSP(const char *token, VoidCharPtrVoidPtr callback);
|
2014-09-20 12:03:00 -07:00
|
|
|
|
2014-08-29 07:52:33 -07:00
|
|
|
void addConsoleActionSS(const char *token, VoidCharPtrCharPtr callback);
|
2014-09-20 12:03:00 -07:00
|
|
|
void addConsoleActionSSP(const char *token, VoidCharPtrCharPtrVoidPtr callback, void *param);
|
|
|
|
|
2014-08-29 07:52:33 -07:00
|
|
|
void addConsoleActionSSS(const char *token, VoidCharPtrCharPtrCharPtr callback);
|
|
|
|
void addConsoleActionSSSSS(const char *token, VoidCharPtrCharPtrCharPtrCharPtrCharPtr callback);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
#endif /* RFICONSOLE_H_ */
|