This CLI (Command Line Interface) is based mbed-os. Both NNN50 and NQ620 are supported.

Fork of NNN40_CLI by Delta

BLE CLI Document can be downloaded here .

Note that when evaluate using Windows PC as the host, the Serial driver need to be installed in advance. The instruction is explained in the link below

https://developer.mbed.org/handbook/Windows-serial-configuration

Once installed, a device called 'mbed Serial Port (COM#)' should be recognized in Device Manager, as shown below

/media/uploads/tsungta/mbed_serial_port_1.png

Please open the com port at 115200 8n1 as default

Committer:
gillwei7
Date:
Fri Sep 11 07:29:31 2015 +0000
Revision:
0:5c195ab2f696
Child:
3:38ec8ad317f4
Gill first commit 20150911 for NNN40_CLI Version 0; Merge mbed library to offline Keil Wifi/BLE CLI program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gillwei7 0:5c195ab2f696 1 /** @file command-interpreter.h
gillwei7 0:5c195ab2f696 2 * @brief Processes commands coming from the serial port.
gillwei7 0:5c195ab2f696 3 * See @ref commands for documentation.
gillwei7 0:5c195ab2f696 4 *
gillwei7 0:5c195ab2f696 5 * Copyright 2014 by DELTA Corporation. All rights reserved.
gillwei7 0:5c195ab2f696 6 */
gillwei7 0:5c195ab2f696 7
gillwei7 0:5c195ab2f696 8 #ifndef COMMAND_INTERPRETER_H
gillwei7 0:5c195ab2f696 9 #define COMMAND_INTERPRETER_H
gillwei7 0:5c195ab2f696 10
gillwei7 0:5c195ab2f696 11 #include <stdbool.h>
gillwei7 0:5c195ab2f696 12 #include <stdint.h>
gillwei7 0:5c195ab2f696 13
gillwei7 0:5c195ab2f696 14 #define DELTA_BLE_ON 1
gillwei7 0:5c195ab2f696 15 #define DELTA_WIFI_ON 1
gillwei7 0:5c195ab2f696 16
gillwei7 0:5c195ab2f696 17 #ifndef CYNTEC_COMMAND_BUFFER_LENGTH
gillwei7 0:5c195ab2f696 18 #define CYNTEC_COMMAND_BUFFER_LENGTH 255
gillwei7 0:5c195ab2f696 19 #endif
gillwei7 0:5c195ab2f696 20
gillwei7 0:5c195ab2f696 21 #ifndef MAX_TOKEN_COUNT
gillwei7 0:5c195ab2f696 22 #define MAX_TOKEN_COUNT 16
gillwei7 0:5c195ab2f696 23 #endif
gillwei7 0:5c195ab2f696 24
gillwei7 0:5c195ab2f696 25 #ifdef __cplusplus
gillwei7 0:5c195ab2f696 26 extern "C" {
gillwei7 0:5c195ab2f696 27 #endif
gillwei7 0:5c195ab2f696 28
gillwei7 0:5c195ab2f696 29 enum {
gillwei7 0:5c195ab2f696 30 CYNTEC_CMD_SUCCESS,
gillwei7 0:5c195ab2f696 31 CYNTEC_CMD_ERR_NO_SUCH_COMMAND,
gillwei7 0:5c195ab2f696 32 CYNTEC_CMD_ERR_WRONG_NUMBER_OF_ARGUMENTS,
gillwei7 0:5c195ab2f696 33 CYNTEC_CMD_ERR_ARGUMENT_OUT_OF_RANGE,
gillwei7 0:5c195ab2f696 34 CYNTEC_CMD_ERR_ARGUMENT_SYNTAX_ERROR,
gillwei7 0:5c195ab2f696 35 CYNTEC_CMD_ERR_NO_MATCHED_ARGUMENT,
gillwei7 0:5c195ab2f696 36 CYNTEC_CMD_ERR_WRONG_CMD_ORDER,
gillwei7 0:5c195ab2f696 37 CYNTEC_CMD_ERR_INVALID_STATE_TO_PERFORM_OPERATION,
gillwei7 0:5c195ab2f696 38 CYNTEC_CMD_ERR_CALL_FAIL
gillwei7 0:5c195ab2f696 39 };
gillwei7 0:5c195ab2f696 40
gillwei7 0:5c195ab2f696 41 typedef void (*CommandAction)(void);
gillwei7 0:5c195ab2f696 42
gillwei7 0:5c195ab2f696 43 typedef const struct {
gillwei7 0:5c195ab2f696 44 /** Use letters, digits, and underscores, '_', for the command name.
gillwei7 0:5c195ab2f696 45 * Command names are case-sensitive.
gillwei7 0:5c195ab2f696 46 */
gillwei7 0:5c195ab2f696 47 const char *name;
gillwei7 0:5c195ab2f696 48 /** A reference to a function in the application that implements the
gillwei7 0:5c195ab2f696 49 * command.
gillwei7 0:5c195ab2f696 50 * If this entry refers to a nested command, then action field
gillwei7 0:5c195ab2f696 51 * has to be set to NULL.
gillwei7 0:5c195ab2f696 52 */
gillwei7 0:5c195ab2f696 53 CommandAction action;
gillwei7 0:5c195ab2f696 54 /*
gillwei7 0:5c195ab2f696 55 * In case of a nested command (action is NULL), then this field
gillwei7 0:5c195ab2f696 56 * contains a pointer to the nested CyntecCommandEntry array.
gillwei7 0:5c195ab2f696 57 */
gillwei7 0:5c195ab2f696 58 const char *subMenu;
gillwei7 0:5c195ab2f696 59 /** A description of the command.
gillwei7 0:5c195ab2f696 60 */
gillwei7 0:5c195ab2f696 61 const char *description;
gillwei7 0:5c195ab2f696 62 } CyntecCommandEntry;
gillwei7 0:5c195ab2f696 63
gillwei7 0:5c195ab2f696 64 extern CyntecCommandEntry cyntecCommandTable[];
gillwei7 0:5c195ab2f696 65
gillwei7 0:5c195ab2f696 66 uint8_t cyntecAtoi(uint8_t *str, uint8_t len);
gillwei7 0:5c195ab2f696 67 uint8_t cyntecArgToUint8(uint8_t *str, uint8_t len);
gillwei7 0:5c195ab2f696 68 uint16_t cyntecAtoiUint16(uint8_t *str, uint8_t len);
gillwei7 0:5c195ab2f696 69 uint16_t cyntecArgToUint16(uint8_t *str, uint8_t len);
gillwei7 0:5c195ab2f696 70 uint8_t cyntecStrCmp(uint8_t *src, uint8_t *dst, uint8_t len);
gillwei7 0:5c195ab2f696 71
gillwei7 0:5c195ab2f696 72 /**
gillwei7 0:5c195ab2f696 73 * @brief Process the given char as a command.
gillwei7 0:5c195ab2f696 74 **/
gillwei7 0:5c195ab2f696 75 void cyntecProcessCommandInput(uint8_t input);
gillwei7 0:5c195ab2f696 76
gillwei7 0:5c195ab2f696 77 /** @brief Initialize the command interpreter.
gillwei7 0:5c195ab2f696 78 */
gillwei7 0:5c195ab2f696 79 void cyntecCommandReaderInit(void);
gillwei7 0:5c195ab2f696 80
gillwei7 0:5c195ab2f696 81 /** Retrieves unsigned integer arguments. */
gillwei7 0:5c195ab2f696 82 uint8_t *cyntecGetCommandArgument(uint8_t argNum, uint8_t *length);
gillwei7 0:5c195ab2f696 83 uint8_t *cyntecGetMinusArgument(uint8_t argNum, uint8_t *length);
gillwei7 0:5c195ab2f696 84 extern void clearBuffer(void);
gillwei7 0:5c195ab2f696 85
gillwei7 0:5c195ab2f696 86 /** Retrieves the token count. */
gillwei7 0:5c195ab2f696 87 uint8_t cyntecGetCommandTokenCnt(void);
gillwei7 0:5c195ab2f696 88
gillwei7 0:5c195ab2f696 89 //gill
gillwei7 0:5c195ab2f696 90 //uint8_t *cyntecGetCommandBuffer(void);
gillwei7 0:5c195ab2f696 91 uint8_t *cyntecGetCommandTotalBuffer(void);
gillwei7 0:5c195ab2f696 92 void cyntecWriteToTotalBuffer(uint8_t input);
gillwei7 0:5c195ab2f696 93 uint8_t cyntecGetTotalIndex(void);
gillwei7 0:5c195ab2f696 94 #ifdef __cplusplus
gillwei7 0:5c195ab2f696 95 }
gillwei7 0:5c195ab2f696 96 #endif
gillwei7 0:5c195ab2f696 97 #endif
gillwei7 0:5c195ab2f696 98
gillwei7 0:5c195ab2f696 99