-
Notifications
You must be signed in to change notification settings - Fork 15
Sparrow Beacon Format
The 802.15.4 beacons are useful for automatically discovering a network that is providing the services requested by a joining device. In Sparrow there is a specific format to use in the beacons to make joining devices understand what services are available.
#Basic Beacon Format IEEE 802.15.4 specifies an optional beacon payload. This is used for meta data about the network. The first byte in the payload describes the payload data protocol type. In order to be compatible with existing ZigBee payload formats first data byte in the payload is, 0xFE, for Yanzi/Sparrow defined payloads. The Data is created in a TLV / “Length, Type and Value” manner and there can be multiple entries in a beacon payload. All integers are in Network Byte Order. All strings are UTF-8 encoded.
-------------------------------------------
| Length | Type | Value |
| 1-byte | 1-byte | |
-------------------------------------------
A typical beacon payload will be like the following:
0xfe [T L V] [T L V] 0x00
Where the last byte is a terminating zero length entry.
Specification of the types are as follows:
-
Length - single byte representing the number of bytes in this TLV entry. Note that it includes the length of the length byte and the type byte. E.g. minimal length is 2 on valid TLVs except the null TLV which has the length of 1 but encodes it as zero (special case).
-
Type - a single byte type representing the type of the field - defined types are:
- 0x01 - 6LoWPAN network type - signalling a 6lowpan network. Data is always: 0x02, 0x01
- 0x02 - OUI defined format.
- 0x03 - Location/Network identifier EUI64. Data is 8 bytes EUI64.
- 0x04 - Probe destination (not used in Sparrow)
- 0x05 - ETX * 128 of node transmitting this beacon reply. 16 bit unsigned integer in network byte order, representing the fixed point value of ETX * 128 (not used in Sparrow)
- 0x06 - OUI-36bit defined format.
- 0x07 - IPv6 Service - a service of a specific type including IPv6 and port for the service host.
-
Value - a byte sequence that is defined by the type field.
The Probe destination address and port encoded in 18 bytes when running Sparrow over 6LoWPAN.
Address port
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 16 bytes | 2 bytes |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The service description contains type, address and port encoded in 19 bytes.
Type Address port
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 1 byte | 16 bytes | 2 bytes |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
This include the type argument that describe which type of service that is in the 6LoWPAN network.
Types:
- 0x01 - LWM2M server (CoAP)
- 0x02 - LWM2M server (CoAPs)
- 0x03 - LWM2M bootstrap server (CoAP)
- 0x04 - LWM2M bootstrap server (CoAPs)
- 0x05 - Sparrow device server (UDP / Encap)
The OUI-based payload is based on the OUI of the defining part. Yanzi Networks have defined a set of OUI-based types and SICS has acquired a OUI-36 range for use with Sparrow to define new types. Normally an OUI is 3-bytes, e.g. 24-bits. Then the 0x02 type is used and the first few bytes of the data will then be a part of the type. For Yanzi - that owns the OUI 0x00 0x90 0xDA using Yanzi-type 1 and a 4-byte value would be:
| L | T | OUI | T V1 V2 V3 V4 |
0x0A 0x02 0x00 0x90 0xDA 0x01 0x01 0x02 0x03 0x04
Note that there is no need for an extra length within the OUI-based TLV as the T is just extended to include the OUI + and extra type. For an OUI-36 there will be two extra bytes defining the full OUI. (followed by the type byte).