NB-IoT Test Tool

Last Updated on : 2024-11-20 02:17:38download

This topic describes how to use the test tool to test your code.

Testing commands

> help
commands:
  help [command] = show usage help
  ping = ping the peer socket
  init = iot sdk init
  start = iot sdk start
  stop = iot sdk stop
  reset = iot sdk reset
  reconnect = iot sdk reconnect
  destroy = iot sdk destroy
  yield = iot sdk yield
  dp_report <cycle> <value> <interval> <value>= iot sdk dp report
  is_actived = iot sdk is actived
  actived_date_rm = iot sdk actived date remove
  hb_send <rssi> <value> <cellid> <value> = iot sdk heart beat send
  retention_store = iot sdk retention store
  get_stage = iot sdk get current stage
  file_download <name> <value> <offset> <value> <param> <value> = iot sdk file download start
  get_devid = iot sdk get device id
  get_local_key = iot sdk get authen key
  get_sec_key = iot sdk get security key
  get_time_zone = iot sdk get time zone

Enable the testing tool and build the code

Build the code

mkdir build && cd build
cmake -DLOCAL_PLATFORM:STRING=NB -DUNIT_TEST:STRING=unit_test …
make

After the code is built, two executable files are generated in the folder build/bin/.

tuya_nbiot_demo             The executable file of the demo.
tuya_nbiot_unit_test        The executable file of the test tool.

Open two terminal windows to run these two executable files respectively.

NB-IoT Test Tool

Description of testing commands

Commands Description Example
help List all the supported testing commands. help
ping Test the connectivity and reachability between devices. ping
init Initialization (implemented by default) init
start Startup (implemented by default) start
reset Reset the device reset
reconnect LwM2M reconnect reconnect
destroy Disconnect (not processed currently) destroy
yield (Not processed currently) yield
dp_report Report data to the cloud
cycle: The number of times to report data.
  • <0: Report data for unlimited times.
  • =0: Stop reporting data.
interval: The interval between data reporting.
dp_report cycle 5 interval 10000 indicates data is reported for five times with an interval of 10,000 ms.
is_actived Query the activation status is_actived
actived_date_rm Remove the activation information. After that, a reset command can be sent to reactivate the device. actived_date_rm
hb_send Send heartbeat data.
rssi: The heartbeat signal strength.
cellid: The base ID.
hb_send rssi -102 cellid ac76768768
retention_store Store the connection information. retention_store
get_stage Get the running stage. get_stage
file_download Download files.
name: File name.
offset: Offset.
param: Parameters.
file_download name tuya.device.giscenter.ephemeris offset 0 param [{“rtAssistance”:{“format”:“rtcm”,“msgs”:[“GPS:1NAF”,“BDS:2NAF”]}}]
get_devid Get the device ID get_devid
get_local_key Get the AuthKey get_local_key
get_sec_key Get the SecKey get_sec_key
get_time_zone Get the time zone get_time_zone