Skip to content
This repository was archived by the owner on Aug 25, 2020. It is now read-only.

SWAP Protocol Decoder Encoder

danbim edited this page Apr 6, 2011 · 7 revisions

SWAP Protocol Decoder Encoder

The SSD WSN Application Protocol (SWAP) Protocol

The SWAP protocol provides an easy and lightweight alternative to service oriented application level protocols like the Constrained Application Protocol (CoAP).

Implementations

Message Types

Request Message

0:   CMD_TYPE = 70
1:   REQUEST_ID
2:   REQUEST_TYPE
3:   REQUEST_OPTIONS_LENGTH
4-n: REQUEST_OPTIONS

Response Message

0:   CMD_TYPE = 71
1:   REQUEST_ID
2:   RESPONSE_CODE
3:   RESPONSE_PAYLOAD_LENGTH
4-n: RESPONSE_PAYLOAD

Push Message

0:   CMD_TYPE = 72
1:   SUBSCRIPTION_ID
2:   PAYLOAD_LENGTH
3-n: PAYLOAD

Possible Values for Requests, Responses and Push Messages

Request -> Response

The following table shows the possible values for the various fields of request and response messages:

REQUEST_TYPE REQUEST_OPTIONS RESPONSE_PAYLOAD
0x00 GET_SENSORS newline character-separated string of sensor names and associated key-value pairs, e.g., "temp=1\nhumid=2\nacc=3"
0x01 GET_SENSORNODE_META_DATA key-value pairs, newline character-separated, e.g., "type=isense\nrevision=jennic85391"
0x02 GET_SENSOR_VALUE 1 byte uint_8, identifying the sensor, e.g. "1", see GET_SENSORS sensor-specific binary representation of a sensor value, see below
0x03 GET_SENSOR_META_DATA 1 byte uint_8, identifying the sensor, e.g. "1", see GET_SENSORS key-value pairs, newline character-separated, e.g., "type=temperature\nunit=degreecelsius"
0x04 SUBSCRIBE key-value pairs, newline character-separated, e.g., "method=push\nduration=7200000" 1 byte subscription ID
0x05 UNSUBSCRIBE 1 byte subscription ID
0x06 PUT_SENSOR_META_DATA 1 byte identifying the sensor, e.g., "1", 1 byte string length, string with meta data as key-value pair, e.g., "type=temperature" empty response with an appropriate response code
Clone this wiki locally