Difference between revisions of "How to develop a new Device"

From AGILE IoT Wiki
Jump to: navigation, search
 
Line 1: Line 1:
 
[[File:Work-in-progress.png|50px]]
 
[[File:Work-in-progress.png|50px]]
  
Assuming you already have the protocol, you need a device implementation. There are (at least) two possible ways.
+
To support a specific device (e.g. SensorTag with default TI BLE GATT firmware and characteristics) on top of a generic protocol (e.g. BLE GATT), AGILE requires a device type implementation to be deployed in the system. Device types are deployed in device factories (one factory can implement several device types) and device representations are instantiated by the factory when a device is registered in the system. Device factories and the device registration is managed by the device manager. Once the device is instantiated it is also registered on the D-Bus. Communication with the device implementation is direct and does not involve the device manager after the registration step.  
  
A) Implement the new device in Java, like the SensorTag.
+
The system currently contains one Java based DeviceFactory only. Other factories (e.g. one in Python) can be added to the system by modifying the DeviceManager.
In this case, you should write one class, inheriting from the base device class (or some more specific class in the hierarchy).
 
Currently, this is included in the DeviceManager of the core, but we are working on moving it out of the core. The target is that you only need to drop a class file
 
  
B) Implement the device interface right on the D-Bus, i.e. in whatever language.
+
=== Implementing a device type in the default DeviceFactory ===
This is a bit more complex, but there are examples for Python.
+
 
 +
Implement the new device in the DeviceFactory (part of agile-core) in Java, like the SensorTag. You should write one class implementing the device type, inheriting from the base device class (or some more specific class in the hierarchy). Please follow the example at https://github.com/Agile-IoT/agile-core/pull/45

Latest revision as of 09:06, 6 March 2018

Work-in-progress.png

To support a specific device (e.g. SensorTag with default TI BLE GATT firmware and characteristics) on top of a generic protocol (e.g. BLE GATT), AGILE requires a device type implementation to be deployed in the system. Device types are deployed in device factories (one factory can implement several device types) and device representations are instantiated by the factory when a device is registered in the system. Device factories and the device registration is managed by the device manager. Once the device is instantiated it is also registered on the D-Bus. Communication with the device implementation is direct and does not involve the device manager after the registration step.

The system currently contains one Java based DeviceFactory only. Other factories (e.g. one in Python) can be added to the system by modifying the DeviceManager.

Implementing a device type in the default DeviceFactory

Implement the new device in the DeviceFactory (part of agile-core) in Java, like the SensorTag. You should write one class implementing the device type, inheriting from the base device class (or some more specific class in the hierarchy). Please follow the example at https://github.com/Agile-IoT/agile-core/pull/45