Delta DFCM-NNN40-DTxR Technical manual

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 1 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
BLE/WIFI Command Line Interface
Document

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 2 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
Index:
1. Introduction................................................................................................................ 6
2. Commands Status Responses.................................................................................8
2.1 OK..................................................................................................................................8
2.2 ERROR ..........................................................................................................................8
3. BLE Commands Description..................................................................................10
3.1 GPIO ............................................................................................................................10
3.2 System Off....................................................................................................................10
3.3 BLE Disconnection....................................................................................................... 11
3.4 Reset............................................................................................................................. 11
3.5 System Information.......................................................................................................12
3.6 Device Name ................................................................................................................12
3.7 BLE Advertising ...........................................................................................................13
3.8 TX Power .....................................................................................................................14
3.9 BLE Address.................................................................................................................15
3.10 BLE GATT Service.......................................................................................................16
3.11 GATT Update Characteristic Value................................................................................16
3.12 GATT Read Characteristic Value...................................................................................17
4. Wi-Fi Commands Description.................................................................................17
4.1 Wi-Fi Device Command ...............................................................................................18
4.1.1 Device Sleep.................................................................................................................18
4.1.2 Device Switch...............................................................................................................18
4.1.3 Device Network............................................................................................................19
4.2 Ethernet Interface Command.........................................................................................20
4.2.1 Ethernet Interface Initiation...........................................................................................20
4.2.2 Ethernet Interface Connection.......................................................................................21
4.2.3 Ethernet Interface Disconnection ..................................................................................21
4.2.4 Ethernet Interface MAC Address...................................................................................22
4.2.5 Ethernet Interface IPAddress........................................................................................22

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 3 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
4.3 Wi-Fi TCP Socket Server Command.............................................................................23
4.3.1 TCP Socket Server Bind................................................................................................23
4.3.2 TCP Socket Server Listen .............................................................................................23
4.3.3 TCP Socket Server Accept ............................................................................................24
4.3.4 TCP Socket Server Blocking.........................................................................................24
4.3.5 TCP Socket Server Close ..............................................................................................25
4.4 Wi-Fi TCP Socket Connection Command .....................................................................25
4.4.1 TCP Connection Connect..............................................................................................25
4.4.2 TCP Connection Is Connected.......................................................................................26
4.4.3 TCP Connection Send...................................................................................................26
4.4.4 TCP Connection Send All .............................................................................................27
4.4.5 TCP Connection Receive ..............................................................................................27
4.4.6 TCP Connection Receive All.........................................................................................28
4.4.7 TCP Connection Blocking.............................................................................................28
4.4.8 TCP Connection Close..................................................................................................29
4.5 Wi-Fi UDP Socket Command .......................................................................................29
4.5.1 UDP Client Socket Initiation.........................................................................................29
4.5.2 UDP Socket Server Bind...............................................................................................30
4.5.3 UDP Socket Broadcasting.............................................................................................30
4.5.4 UDP Socket Send..........................................................................................................31
4.5.5 UDP Socket Receive.....................................................................................................31
4.5.6 UDP Socket Blocking ...................................................................................................32
4.5.7 UDP Socket Close.........................................................................................................32
4.6 Wi-Fi UDP Endpoint.....................................................................................................33
4.6.1 UDP ENDPOINT RESET.............................................................................................33
4.6.2 UDP ENDPOINTADDRESS .......................................................................................33
4.6.3 UDP ENDPOINT PORT...............................................................................................34
5. BLE Example for creating a profile by command.................................................34
5.1 Tools Preparation ..........................................................................................................34
5.2 Procedure for creating an Profile...................................................................................35

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 4 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
6. WIFI Example for connecting to AP by command ................................................38
6.1 Tools Preparation ..........................................................................................................38
6.2 Wi-Fi Connection..........................................................................................................39
6.3 Wi-Fi Communication Protocol.....................................................................................39
6.4 TCP client.....................................................................................................................39
6.5 TCP server....................................................................................................................40
6.6 UDP client ....................................................................................................................40
6.7 UDP Server...................................................................................................................41
7. BLE Command Set Summary Table.......................................................................42
8. WIFI Command Set Summary Table.......................................................................43

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 5 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
Revision History
Version
Date
Reason of change
Maker
0.1
2015/01/16
Initial release (Internal)
MARCUS
CHIOU
0.2
2015/02/03
Modify command description, error message, and add
demonstration to create a GATT profile
Gill Wei
1.0
2015/02/11
Initial release
Gill Wei
1.1
2015/03/02
Add Wi-Fi Command Set
Marcus Chiou
1.2
2015/03/10
Add BLE profile overview to introduction and BLE
example for creating the sample by command
Gill Wei
1.3
2015/03/27
Modify WIFI Command description
Marcus Chiou

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 6 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
Wireless LAN/Bluetooth Low Energy Combo Module
Command Line Interface
A Command Line Interface (CLI) used to implement function of
Wi-Fi/BLE Combo Module.
1. Introduction
This document describes the function of each command within DFCM-NNN40-DTxR command
line interface; include BLE connection, Wi-Fi enable/disable, sleep mode, and so on. This
document also makes a demonstration of how to set up environment in PC and create a BLE
profile in GATT server; below we use Glucose Profile setting as example, and list the typical
procedure of standard profile setting.
Glucose profile is one of the officially defined BLE profile by Bluetooth official group “SIG”,
which is abbreviated of Special Interest Group. See Reference 2.
Profile define and explain stored data format, one profile contains one or several services,
each service contains data for communication.
Glucose profile composed of Glucose Service and Device Information Service(see Figure.1),
which with specific data format, for example, the Glucose Service contains data as Time,
Sequence number, Glucose concentration or other data related to Glucose measurement.
In this case, NNN40 with Glucose sensor can be seem as “Glucose Sensor”(see
Figure.1), the Central Device, like smart phone or laptop, can act as “Glucose Collector”, which
collect and display the glucose data transmitted from glucose sensor. Collector and sensor can
also be treated as “Central”and “Peripheral”, Reference 3 have BLE GATT overview and have
explain more detail.

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 7 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
Figure.1 Glucose role and services
After define all the data in Glucose sensor, let’s see how BLE device set up the connection and
transmit data, Figure.2 show how BLE device in and out from different state; only in connecting
state, sensor data will transfer in profile-defined format.

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 8 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
2. Commands Status Responses
Whenever a command is received by device, an “OK”or “ERROR”response will be send back
to host side. ERROR case will output with specific error string; OK will output with additional
response for some specific commands.
2.1 OK
OK
Function: All successful commands will respond with OK message
Example:
RESPONSE: OK<cr_lf>
<cr_lf>
2.2 ERROR
ERROR
Function: All failure commands will respond with ERROR response with mapping
error message
Command Format: ERROR;<error message>;
Response Values:
Error Message:
"No such command;",
"Wrong number of arguments;",
"Argument out of range;",
"Argument syntax error;",
“No matched argument;”,
"Wrong command order;",
“Invalid state to perform operation;”,
“Function call fail;”

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 9 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
Example:
RESPONSE: ERROR; Argument out of range;<cr_lf>
<cr_lf>

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 10 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
3. BLE Commands Description
This section describes the detail function of each command, including command format,
argument format, and command description.
3.1 GPIO
CONTROL GPIO PIN
Function: Set or Clear a specific GPIO pin on BLE module
Command Format: cynb gpio <GPIO-NO> <SET/CLEAR>
Example:
COMMAND: cynb gpio 25 set<cr>
RESPONSE: <cr_lf>
OK<cr_lf>
<cr_lf>
Note: Number of available pins are 4, 5, 6, 16, 17, 20, 21, 22, 23, 24, 25, 26, 27, 29
Currently PIN23、PIN25 set as UART communication pin, can not clear.
3.2 System Off
SLEEP MODE
Function: Go to system off mode, and if choose a specific pin, detect pin state
change for wake up.
Command Format: cynb sleep <GPIO-NO>
Example:
COMMAND: cynb sleep 23<cr>
RESPONSE: <cr_lf>
OK<cr_lf>
<cr_lf>
Note: When the state of pin is changed, module is wake up and reset, Number of
available pins are 0, 1, 2, 3, 4, 5, 6, 7, 13, 16, 17, 23, 24, 25, 29.
Default pin is UART RX pin. Whenever UART received interrupt, module will reset.

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 11 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
3.3 BLE Disconnection
BLE DISCONNECTION
Function: Disconnect from current BLE connection.
Command Format: cynb disconn
Example:
COMMAND: cynb disconn<cr>
RESPONSE: <cr_lf>
OK<cr_lf>
<cr_lf>
Note: If the connection does not create, system show error message for invalid
state.
3.4 Reset
RESET
Function: Reset BLE module.
Command Format: cynb reset
Example:
COMMAND: cynb reset<cr>
RESPONSE: <cr_lf>
OK<cr_lf>
<cr_lf>

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 12 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
3.5 System Information
MODULE INFORMATION
Function: List system information in DFCM-NNN40-DTxR, system information
include FW version and Module name
Command Format: cynb info
Example:
COMMAND: cynb info<cr>
RESPONSE: <cr_lf>
OK; F/W version:DELTA_CLI_V1.0;Module name:
DFCM-NNN40-DTxR; <cr_lf>
<cr_lf>
3.6 Device Name
SET BLE DEVICE NAME
Function: Set friendly name for BLE module.
Command Format: cynb name <NAME>
Example:
COMMAND: cynb name DELTA_CLI<cr>
RESPONSE: <cr_lf>
OK<cr_lf>
<cr_lf>

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 13 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
GET BLE DEVICE NAME
Function: Get the current device name for BLE module.
Command Format: cynb name
Example:
COMMAND: cynb name<cr>
RESPONSE: <cr_lf>
OK; DELTA_CLI;<cr_lf>
<cr_lf>
3.7 BLE Advertising
START DEVICE ADVERTISING
Function: Start BLE advertising with specific timeout and interval.
Command Format: cynb adv <START> <INTERVAL> <TIMEOUT>
Example:
COMMAND: cynb adv start 64 180<cr>
RESPONSE: <cr_lf>
OK<cr_lf>
<cr_lf>
Note: If the system is already in advertising state, error message show that the
system in invalid state for operation.The unit of INTERVAL is 0.625 ms, 64 means
64*0.625 = 40ms; The unit of TIMEOUT is second, 180 means the advertising stop
after 180 seconds.
Default interval value is 40 ms, default time-out value is 180 seconds.
INTERVAL range: Maximum: 16384 Minimum:32
TIMEOUT range: Maximum: 180 Minimum:1

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 14 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
STOP DEVICE ADVERTISING
Function: Stop BLE advertising.
Command Format: cynb adv <STOP>
Example:
COMMAND: cynb adv stop<cr>
RESPONSE: <cr_lf>
OK<cr_lf>
<cr_lf>
Note: If the system is not in advertising state, error message show that the system
in invalid state for operation.
3.8 TX Power
RF TX POWER
Function: Set RF TX power for BLE module.
Command Format: cynb txPow <TX POWER>
Example:
COMMAND: cynb txPow 0<cr>
RESPONSE: <cr_lf>
OK;<cr_lf>
<cr_lf>
Note: Available TX power are -40, -30, -20, -16, -12, -8, -4, 0, 4. (unit: dBm)

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 15 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
3.9 BLE Address
SET BLE Address
Function: Set BLE MAC address at run time.
Command Format: cynb bleAddr <BLEADDR>
Example:
COMMAND: cynb bleAddr 0xE6BCA12B322F<cr>
RESPONSE: <cr_lf>
OK<cr_lf>
<cr_lf>
Note: BLE MAC address should be 12 hex number.
GET BLE ADDRESS
Function: Get current BLE MAC address.
Command Format: cynb bleAddr
Example:
COMMAND: cynb bleAddr<cr>
RESPONSE: <cr_lf>
OK;[ E6 BC A1 2B 32 2F];<cr_lf>
<cr_lf>

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 16 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
3.10 BLE GATT Service
GATT SERVICE SETTING
Function: Set service UUID, characteristic UUID, characteristic property and value
for BLE module.
Command Format: cynb gattSet <SERVICE UUID> <CHAR UUID> <ATTR PROP> <ATTR VALUE>
Example:
COMMAND: cynb gattSet 0x180D 0x2A39 rw 0x1234<cr>
RESPONSE: <cr_lf>
OK<cr_lf>
<cr_lf>
Note: The characteristic property currently support 4 properties, including
r:Read; w:Write; n:Notify; i:Indicate; Set the appropriate and mandatory properties
to specific characteristic, and the order of characters will not affect the setting.
The total value field length is 10 bytes, equal to 20 hex numbers.
Attribute value type is uint8_t, so the input hex number must be even number,
ex. 0, 2, 4, etc.
GATT service setting must before the advertising and read/update
characteristic value command.
3.11 GATT Update Characteristic Value
UPDATE CHARACTERISTIC VALUE
Function: Change characteristic value and make an indication or notification
according to the property of characteristic.
Command Format: cynb update <SERVICE UUID> <CHAR UUID> <VALUE>
Example:
COMMAND: cynb update 0x180D 0x2A39 0x1234<cr>
RESPONSE: <cr_lf>
OK<cr_lf>
<cr_lf>

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 17 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
Note: If the specified characteristic property contains notify/indicate, data update
require Central (ex.mobile phone) enable the notify/indicate previously.
Attribute value type is uint8_t, so the input hex number must be even number,
ex. 0, 2, 4, etc.
Data update must after the advertising.
3.12 GATT Read Characteristic Value
READ CHARACTERITSTIC VALUE
Function: Read current characteristic value in BLE module.
Command Format: cynb readData <SERVICE UUID> <CHAR UUID>
Example:
COMMAND: cynb readData 0x180D 0x2A39<cr>
RESPONSE: <cr_lf>
OK;0x1234;<cr_lf>
<cr_lf>
Note: Read data must after system advertising. Max value field contains with 20 hex
numbers.
4. Wi-Fi Commands Description
This part describes the usage of each Wi-Fi command. Each Wi-Fi command is mapped to
Wi-Fi SDK (please see the SDK document). To use Wi-Fi SDK, you can call the Wi-Fi API on
mbed platform, or you can use the Wi-Fi command directly.

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 18 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
4.1 Wi-Fi Device Command
4.1.1 Device Sleep
WIFI DEVICE SLEEP
Function: Disable Wi-Fi and set into sleep mode (no Wi-Fi function is available).
Command Format: cynw device_sleep
Example:
COMMAND: cynw device_sleep<cr>
RESPONSE: <cr_lf>
OK;<cr_lf>
<cr_lf>
4.1.2 Device Switch
SET RF DEVICE SWITCH
Function: Set the position of RF switch between Wi-Fi and BLE.
Command Format: cynw device_switch <SWITCH>
Example:
COMMAND: cynw device_switch 1<cr>
RESPONSE: <cr_lf>
OK;<cr_lf>
<cr_lf>
Note: RF switch is set to 1 if Wi-Fi is selected, set to 0 if BLE is selected.

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 19 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
GET RF DEVICE SWITCH
Function: Get the RF switch setting.
Command Format: cynw device_switch
Example:
COMMAND: cynw device_switch<cr>
RESPONSE: <cr_lf>
OK;WIFI<cr_lf>
<cr_lf>
4.1.3 Device Network
SET WIFI DEVICE NETWORK
Function: Set SSID, password and priority to connect.
Command Format: cynw device_network <SSID> <PASSWORD> <PRIORITY>
Example:
COMMAND: cynw device_network DELTA_CLI 12345678 0<cr>
RESPONSE: <cr_lf>
OK;<cr_lf>
<cr_lf>
Note: The max length of SSID is 20, PASSWORD is 11. The valid PRIORITY is
range from 0 to 2. It is notice that even if the AP is set to Open Security, the
<PASSWORD> still need enter in the command.

DFCM-NNN40-DTxR
BLE/WIFI Command Line Interface Sheet 20 of 45 Feb 11, 2015
Proprietary Information and Specifications are Subject to Change
4.2 Ethernet Interface Command
4.2.1 Ethernet Interface Initiation
INITIALIZE ETHERNET INTERFACE WITH DHCP
Function: Initialize the interface and configure it to use DHCP (no connection at this
step).
Command Format: cynw ethernet_init
Example:
COMMAND: cynw ethernet_init<cr>
RESPONSE: <cr_lf>
OK;<cr_lf>
<cr_lf>
INITIALIZE ETHERNET INTERFACE WITH STATIC
Function: Initialize the interface and use the static configure (no connection at this
step).
Command Format: cynw ethernet_init <STATIC IP>
Example:
COMMAND: cynw ethernet_init 192.168.1.2<cr>
RESPONSE: <cr_lf>
OK;<cr_lf>
<cr_lf>
Note: The max length of STATIC IP is 15
Table of contents
Other Delta Recording Equipment manuals

Delta
Delta InsightPower SNMP IPv6 for UPS User manual

Delta
Delta DOP-107IV User manual

Delta
Delta UT-4 User manual

Delta
Delta DIGIVOX-2 User manual

Delta
Delta HMC08 User manual

Delta
Delta DOP-100 Series User manual

Delta
Delta 5CN-550L User manual

Delta
Delta PJT-27V150WBNA User manual

Delta
Delta DOP-B10 Series User manual

Delta
Delta DOP-B Operator's manual