Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of NNN40_CLI by
CLI_Source/command-interpreter.h
- Committer:
- gillwei7
- Date:
- 2015-09-11
- Revision:
- 0:5c195ab2f696
- Child:
- 3:38ec8ad317f4
File content as of revision 0:5c195ab2f696:
/** @file command-interpreter.h
* @brief Processes commands coming from the serial port.
* See @ref commands for documentation.
*
* Copyright 2014 by DELTA Corporation. All rights reserved.
*/
#ifndef COMMAND_INTERPRETER_H
#define COMMAND_INTERPRETER_H
#include <stdbool.h>
#include <stdint.h>
#define DELTA_BLE_ON 1
#define DELTA_WIFI_ON 1
#ifndef CYNTEC_COMMAND_BUFFER_LENGTH
#define CYNTEC_COMMAND_BUFFER_LENGTH 255
#endif
#ifndef MAX_TOKEN_COUNT
#define MAX_TOKEN_COUNT 16
#endif
#ifdef __cplusplus
extern "C" {
#endif
enum {
CYNTEC_CMD_SUCCESS,
CYNTEC_CMD_ERR_NO_SUCH_COMMAND,
CYNTEC_CMD_ERR_WRONG_NUMBER_OF_ARGUMENTS,
CYNTEC_CMD_ERR_ARGUMENT_OUT_OF_RANGE,
CYNTEC_CMD_ERR_ARGUMENT_SYNTAX_ERROR,
CYNTEC_CMD_ERR_NO_MATCHED_ARGUMENT,
CYNTEC_CMD_ERR_WRONG_CMD_ORDER,
CYNTEC_CMD_ERR_INVALID_STATE_TO_PERFORM_OPERATION,
CYNTEC_CMD_ERR_CALL_FAIL
};
typedef void (*CommandAction)(void);
typedef const struct {
/** Use letters, digits, and underscores, '_', for the command name.
* Command names are case-sensitive.
*/
const char *name;
/** A reference to a function in the application that implements the
* command.
* If this entry refers to a nested command, then action field
* has to be set to NULL.
*/
CommandAction action;
/*
* In case of a nested command (action is NULL), then this field
* contains a pointer to the nested CyntecCommandEntry array.
*/
const char *subMenu;
/** A description of the command.
*/
const char *description;
} CyntecCommandEntry;
extern CyntecCommandEntry cyntecCommandTable[];
uint8_t cyntecAtoi(uint8_t *str, uint8_t len);
uint8_t cyntecArgToUint8(uint8_t *str, uint8_t len);
uint16_t cyntecAtoiUint16(uint8_t *str, uint8_t len);
uint16_t cyntecArgToUint16(uint8_t *str, uint8_t len);
uint8_t cyntecStrCmp(uint8_t *src, uint8_t *dst, uint8_t len);
/**
* @brief Process the given char as a command.
**/
void cyntecProcessCommandInput(uint8_t input);
/** @brief Initialize the command interpreter.
*/
void cyntecCommandReaderInit(void);
/** Retrieves unsigned integer arguments. */
uint8_t *cyntecGetCommandArgument(uint8_t argNum, uint8_t *length);
uint8_t *cyntecGetMinusArgument(uint8_t argNum, uint8_t *length);
extern void clearBuffer(void);
/** Retrieves the token count. */
uint8_t cyntecGetCommandTokenCnt(void);
//gill
//uint8_t *cyntecGetCommandBuffer(void);
uint8_t *cyntecGetCommandTotalBuffer(void);
void cyntecWriteToTotalBuffer(uint8_t input);
uint8_t cyntecGetTotalIndex(void);
#ifdef __cplusplus
}
#endif
#endif
