Tools


wbcmd

Description

wbcmd is an application used to directly communicate with the sensor by sending commands and receiving responses via the terminal. wbcmd can only be used with the programming jig.

Generally, each command consists of the following elements:

So the command syntax in its basic form will be as follows:

wbcmd --port <port number> --path <path> --op <for example GET or PUT>

For a full example, please refer to the example section below.

The response from the sensor will contain:

Please remember that wbcmd can be used only when:

Help

Wbcmd tool has a help function to display the set of available options and their syntax:

wbcmd --help

An example of output:

Usage: wbcmd [options] command[(parameter, ...)]

Common options:
  --port             Device address to use (instead of device discovery)
      Examples:
  --vid              Override USB VID to connect to.
  --pid              Override USB PID to connect to.
  --wait-dd timeout  Waits for device discovery to find a device (default 1000).
  --wait-dev timeout Waits for device communication to start
                     after discovering the device (default 5000).
                     Timeout specifies maximum wait duration in milliseconds.

General operations:
  GETRESOURCEID     Resolve resource identifier of resource path
  options:
   --timeout        Time to wait for completion in milliseconds [Default 15000]
   --path           Resource path (prefix /net/<deviceid> is added
                    automatically)

  GET               Execute GET request
  options:
   --timeout        Time to wait for completion in milliseconds [Default 15000]
   --path           Resource path (prefix /net/<deviceid> is added
                    automatically)
   --opdata         Parameter data
   --file           Input file to be read for parameter
   --opdatatype     Force parameter data type. (none, string, bool, double,
                    float, int8, uint8, int16, uint16, int32, uint32, int64,
                    uint64, bytestream or <id_num>)
   --target         Specifies local file name to save the contents of
                    bytestream get.

  PUT               Execute PUT request
  POST              Execute POST request
  DELETE            Execute DELETE request
  options:
   --timeout        Time to wait for completion in milliseconds [Default 15000]
   --path           Resource path (prefix /net/<deviceid> is added
                    automatically)
   --opdata         Parameter data
   --file           Input file to be read for parameter
   --opdatatype     Force parameter data type. (none, string, bool, double,
                    float, int8, uint8, int16, uint16, int32, uint32, int64,
                    uint64, bytestream or <id_num>)


Communication performance:
  PING              Perform latency test sequence
  options:
   --requests       number of requests to send [Default 60]
   --interval       interval between requests in milliseconds [Default 1000]

  THROUGHPUT        Perform throughput test sequence
  options:
   --requests       number of requests to send [Default 60]
   --simrequests    number of simultaneous requests [Default 8]


Misc operations:
  BYPASSED          List bypassed resources
  SUBSCRIBE         Subscribe resource and wait notifications
  TOP               Show thread runtime statistics

Download

wbcmd can be downloaded from Movesense device library repo.

Example

Wbcmd allows data to be requested from the sensor or passed to it using using GET or PUT operation. The example provided in this section will use the /Info path which supports only GET operation. So assuming that the programming jig with sensor is connected to COM port 4 the full command will be:

wbcmd --port COM4 --path /Info --op GET

And the response from the sensor will be as follows:

{
  "response": 200,
  "responsestring": "HTTP_CODE_OK",
  "operation": "get",
  "uri": "/net/ECKI6AF7F95A/Info",
  "content": {
    "manufacturerName": "Suunto",
    "brandName": null,
    "productName": "SmartSensor2",
    "variant": "Unknown",
    "design": null,
    "hwCompatibilityId": "C",
    "serial": "ECKI6AF7F95A",
    "pcbaSerial": "UNKNOWN",
    "sw": "1.0.0",
    "hw": "UNKNOWN",
    "additionalVersionInfo": null,
    "addressInfo": [
      {
        "name": "BLE",
        "address": "D3-1E-88-4C-BB-3A"
      },
      {
        "name": "DFU-BLE",
        "address": "D3-1E-88-4C-BB-3B"
      }
    ],
    "apiLevel": "1"
  },
  "querytimems": 49,
  "querytimens": 49168979
}

As seen from the example response, the operation completed without any problems (the response is 200 which stands for HTTP_CODE_OK) and the content of the response contains the requested information.

AdbBridge

AdbBridge is not a separate tool, but a part of Android Sample App. It can be used to Movesense communication.

Setup

The sample app binary can be found here

  1. Install ADB and drivers for the android mobile phone
  2. Install sample application ex.
$ adb install sampleapp-debug-1.5.1.apk

Commands

All responses you can see in ADB.

$ adb logcat | grep OUTPUT

ex:

...
D/AdbBridge( 3773): ID:1 Meas/Acc/13 OUTPUT: {"Body": {"Timestamp": 1410367, "ArrayAcc": [{"x": -1.05048668384552, "y": -0.11246667802333832, "z": 10.045428276062012}]}, "Uri": "ECKI2DE91685/Meas/Acc/13", "Method": "PUT"}
D/AdbBridge( 3773): ID:1 Meas/Acc/13 OUTPUT: {"Body": {"Timestamp": 1410444, "ArrayAcc": [{"x": -1.0361292362213135, "y": -0.0023929080925881863, "z": 10.954732894897461}]}, "Uri": "ECKI2DE91685/Meas/Acc/13", "Method": "PUT"}
...

GET

$ adb shell am broadcast -a android.intent.action.MOVESENSE --es type get --es path Info --es value ''''''

PUT

$ adb shell am broadcast -a android.intent.action.MOVESENSE --es type put --es path Component/Led --es value '''{\"isOn\":true}'''

SUBSCRIBE/UNSUBSCRIBE

You can subscribe and unsubscribe path by commands below:

adb shell am broadcast -a "android.intent.action.MOVESENSE"  --es type subscribe --es path Meas/Acc/13 --es value '''{}''' --es id 1
adb shell am broadcast -a "android.intent.action.MOVESENSE"  --es type unsubscribe --es path Meas/Acc/13 --es value '''{}''' --es id 1

Multisubscription:
You can try to use multisubscription by sending a few commands and changing the "id" value ex:

adb shell am broadcast -a "android.intent.action.MOVESENSE"  --es type subscribe --es path Meas/Acc/13 --es value '''{}''' --es id 1
adb shell am broadcast -a "android.intent.action.MOVESENSE"  --es type subscribe --es path Meas/Magn/13 --es value '''{}''' --es id 2

CONNECT

Also it is possible to connect from the ADB to the Movesense. It can be useful for automated tests.

adb shell am broadcast -a android.intent.action.MOVESENSE --es type connect --es address "macAddress"

DFU UPDATE (experimental)

It is possible to do a DFU update by AdbBridge.

adb push dfu.zip /sdcard/
adb shell am broadcast -a android.intent.action.MOVESENSE --es type dfu_update --es file_path "dfu.zip"  --es address "C4:A1:7F:5E:3B:67"  --es dfu_address "C4:A1:7F:5E:3B:68"