fork test

Dependencies:   BLE_API WIFI_API_32kRAM mbed nRF51822

Fork of NNN40_CLI by Delta

Revision:
0:5c195ab2f696
Child:
3:38ec8ad317f4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CLI_Source/command-interpreter.h	Fri Sep 11 07:29:31 2015 +0000
@@ -0,0 +1,99 @@
+/** @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
+
+