Skip to content

Sparrow Object Model

Simon Duquennoy edited this page Dec 11, 2018 · 25 revisions

The Sparrow Object Model

The object model allow any IoT device to describe itself via a set of object instances (similar to LWM2M). Any IoT device have one to N instances and the first instance (called instance zero) is used for discovery of the device / product type and for device management.

Each object defines a number of variables. Some are common with all Sparrow objects and others are specific for each object type. Some of the common variables are for discovery and are mandatory.

Discovery variables (0x000 - 0x01F)

There are 5 mandatory variables that all object instances must support.

Variable ID Description
Product/Object Type 0x000 the object type (64 bit) - for instance zero it is a product type and for the other instances it is the object type
Object Id 0x001 the object identifier (128 bit) - for instance zero it is the unique device identifier (128 bit)
Object label 0x002 a string describing the object
Number of sub-instances 0x003 for instance zero it is the number of object instances in this IoT device excluding instance zero, which always exists
Object subtype 0x004 the object subtype (32 bit)
Event Array 0x005 64 bit event information that describes if the object instance is armed, trigged, etc. For instance zero, it can be used to enable or disable events from all instances in this IoT device.

Common variables (0x020 - 0x0FF)

There is a set of variables that are optional but common for all instances. If such a variable exists, it has the same specification regardless of which instance it belongs to. An example of such variable is the Unit Boot Timer (0x0c9) that gives the time since boot of the device.

Object type specific variables (0x100 - 0xFFFF)

The variables starting at 0x100 are specific for the object they are in - such as these from the LEDs instance:

Variable ID Description
Number of LEDs 0x100 gets the number of LEDs that can be controlled via this object instance
LED control 0x101 control the state of the LEDs
LED set 0x102 set the specific LED to on
LED clear 0x103 set the specific LED to off

Sparrow Devices and Discovery

A Sparrow IoT device have at least one instance - the instance zero. Using the Sparrow protocol (Encap and TLV) it is possible to discover what type of device it is and which object instances it implements. The Zolertia Re-mote example device have the following instances:

  • Instance Zero with product type: 70b3d57d53000001.
  • Instance 1 with object type: 0090da0303010010 Flash instance (primary image)
  • Instance 2 with object type: 0090da0303010010 Flash instance (secondary image)
  • Instance 3 with object type: 0090da030201001e LEDs instance (control of the RGB LED)
  • Instance 4 with object type: 0090da030201001d Button instance (the user button of Re-Mote)
  • Instance 5 with object type: 0090da0303010023 Network statistics (data about the RPL network)

Running the discovery tool on it will show the following output:

 > ./tlvdiscovery.py fd00::212:4b00:615:9abf
 HOST:  fd00::212:4b00:615:9abf
 Product label: Zoul RE-Mote  type: 70b3d57d53000001  instances: 5
 Booted at: 2016-06-14 19:57:56 - 4 sec 778 msec
 Instance 1: type: 0090da0303010010   Primary firmware
 Instance 2: type: 0090da0303010010   Backup firmware
 Instance 3: type: 0090da030201001e   LEDs
    leds are set to 0x00 (3 user leds)
 Instance 4: type: 0090da030201001d   Button
    button is pressed, has been pressed 0 times
 Instance 5: type: 0090da0303010023   Network Statistics
    Version: 0 	Capabilities: 0x700  ROUTER PUSH

This shows the name of the device and its type. The number of instances (5) and then all the instances and the object types of them in this device.

Sparrow ID range

Sparrow makes use of EUI-64 ID for all the object types and also image types. This means that anyone that owns a OUI ID range can create their own non-overlapping object IDs. SICS have a ID range defined 70-B3-D5-70-5 and using this EUI-64 can be defined like:

70-B3-D5-70-5X-<24-bit ID>

Where the 24-bit ID is defining the type of the object and the prefix ensures that it is globally unique so that there is no need for having a registry for objects. The whole 64-bit identifier is read out in the discovery to identify which object it is that any given instance implements.

  1. Image type - for firmware images to ensure that only correct image types are uploaded to a specific device
  2. Object type - any functional object such as temperature sensor object, lamp object, etc.
  3. Product type - any type of product such as a Zolertia Re-mote or Yanzi LED Lamp

The ID's starting with 0090da are Yanzi Networks IDs with their own schema for the different types.