-
Notifications
You must be signed in to change notification settings - Fork 15
Sparrow Object Model
#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.
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: xxx-yyy (Flash instance) - primary image
- Instance 2 with object ID: xxx-yyy (Flash instance) - secondary image
- Instance 3 with object ID: xxx-yyy.
Running the discovery tool on it will show the following output:
>tlvdiscovery.py
>...
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.
- Image type - for firmware images to ensure that only correct image types are uploaded to a specific device
- Object type - any functional object such as temperature sensor object, lamp object, etc.
- Product type - any type of product such as a Zolertia Re-mote or Yanzi LED Lamp