Skip to content

DPAJsonConvertor

Martin Strouhal edited this page Aug 27, 2016 · 1 revision

This page describes format of json data for DPAJsonConvertor.

Requests

Topic

Earlier: [mid]/dpa/requests Now: gateway/[mac]/tx

Structure

{ "nadr": 0, "per": 5, "cmd": 1, "hwpid": 65535, "data": [0,1,2] }

Element Description
nadr node address
per peripheral id
cmd command id
hwpid hardware profiles id
data user data (array)

The message in example is request for writing 2 bytes (0x01, 0x02) into RAM to address 0x00.

Confirmations

Topic

Earlier: [mid]/dpa/confirmations Now: gateway/[mac]/rx

Structure

{ "timestamp": "2016-07-26 20:59:34.741", "nadr": 1, "per": 5, "cmd": 1, "hwpid": 65535, "dpaValue": 0, "hops": 0, "timeslotLength": 3, "hopsResponse": 0 }

Element Description
timestamp timestamp of converting from iqrf to json
nadr node address
per peripheral id
cmd command id
hwpid hardware profiles id
dpaValue DPA value, see DPA tech guide.
hops Count of hops used to deliver the DPA request to the addressed node.
timeslotLength Timeslot length used to deliver the DPA request to the addressed node.
hopsResponse Count of hops used to deliver the DPA response from the addressed node back to the coordinator. In the case of broadcast, this parameter is 0 as there is no response sent back to the coordinator.

Responses

Topic

Earlier: [mid]/dpa/responses Now: gateway/[mac]/rx

Structure

{ "timestamp": "2016-07-26 20:53:54.734", "nadr": 0, "per": 5, "cmd": 129, "hwpid": 0, "data": [7,0] }

Element Description
timestamp timestamp of converting from iqrf to json
nadr node address
per peripheral id
cmd command id
hwpid hardware profiles id
data user data (array)

Next examples

There are next examples of requests:

Request Description
{ "nadr": 0, "per": 6, "cmd": 1, "hwpid": 65535, "data": []} Turn red LED on
{ "nadr": 0, "per": 6, "cmd": 0, "hwpid": 65535, "data": []} Turn red LED off
{ "nadr": 0, "per": 7, "cmd": 1, "hwpid": 65535, "data": []} Turn green LED on
{ "nadr": 0, "per": 7, "cmd": 0, "hwpid": 65535, "data": []} Turn green LED off