Skip to content

Sparrow Object Model

Joakim Eriksson edited this page Jun 14, 2016 · 25 revisions

#The Sparrow Object Model The object model allow any IoT device 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 others are specific for the object type. Some of the common variables are for discovery and are listed below:

  • Product/Object Type (0x00) - the object type (64-bit) - for instance zero it is a product type for other instances it is the object type.
  • Device Id (0x01) - only used in instance zero where it is defining the device ID (128-bit).
  • Object label (0x02) - a string describing the object
  • Number of instances (0x03)- only valid for instance zero - number of object instances in this IoT device

Other variables are specific for the object they are in - such as these from the LEDs instance:

  • 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

The specific variables start at 0x100 while the discovery variables are between 0x00 and 0xC0. There are also a set of variables specifically for instance zero - that are used for device management - these are the ones between 0xc0 and 0x100.

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 instance it implements. The Zolertia Re-mote example device have the following instances:

  • Instance Zero with product ID: XYZ.
  • Instance 1 with object ID: 0090da0303010010 (Flash instance) - primary image
  • Instance 2 with object ID: 0090da0303010010 (Flash instance) - secondary image
  • Instance 3 with object ID: 0090da030201001e LEDs instance (control of the RGB LED)
  • Instance 4 with object ID: 0090da030201001d Button instance (the user button of Re-Mote)
  • Instance 5 with object ID: 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 make 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 all the instances implement.

  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.