Writing Device Agents
For the hardware of a specific device type to lucidly communicate with WSO2 IoT Server, it is necessary to install/burn a software program into the hardware device. Additionally, the code corresponding to this software program needs to be written in a way that it relates to the device type specific APIs. For more information, see Writing Device APIs. The software program is known as the device agent. The agent can be written in any programming language that is supported by the device, such as Java, C, Arduino-C, Python, Lua and more.
The device agent functionality can be explained via the below use cases.
Use case 1 - Device agent pre-installed on the device by the device manufacturer
A device will have its device type plugin installed on the device and deployed on WSO2 IoTS. Let's take a look at how it works.
A user purchases a device that has the agent pre-installed. He/she is then considered a device owner.
The device owner logs into WSO2 IoTS and creates an instance of this device by providing the serial number on the device when enrolling it.
- Boot the device for it to start communicating via the API's that were written by the device manufacturer.
- For more information on how it works, try out the connected cup sample.
- For more information on how the agent was configured for Connected Cup, see the Connected Cup implementation on GitHub.
Use case 2 - Download and install the device agent on the device
Let's take a look at how this works:
Implement the downloadable device agent for a device, such as an Arduino UNO board or a Raspberry Pi board.
Write the UI, so that a device owner (the individual who owns the device) can download the agent when enrolling or registering the device type.
The device owner will download the device agent and install/burn it on to the device type.
The device then starts communicating with the WSO2 IoTS after it boots up using the API's that were written for the device.
- For more information, try out the Android Sense device types.
- For more information on how the agent was configured for Raspberry Pi, see the Android Sense implementation on GitHub.