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 Oct 02 10:36:29 2015 +0000
Revision:
3:38ec8ad317f4
Parent:
0:5c195ab2f696
Child:
4:b52035367aee
Gill Wei commit 20151002 update with WIFI_API_32kRAM Rev. 12, provide Scan, Read version and other wifi function, Set AP mode not ready.

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