WSO2 EMM Siddhi Extensions
WSO2 IoT Server's analytics feature allows you to publish operations to devices via the external or internal events that come through analytics. Once published, an operation entry is created in the WSO2 IoT Server's core profile. These operations are delivered to the device via Firebase Cloud Messaging (FCM) or local polling for android devices and via Apple Push Notification Service (APNS) for iOS.
To expose basic functions in the WSO2 IoT Server's device management core to the Siddhi runtime, you need the following WSO2 IoT Server Siddhi extensions. You can use them according to your scenario:
Confirming enrolled devices
Description | This extension returns true if a device matches the given device ID of a device that is already enrolled with WSO2 IoT Server and device type, such as Android, iOS, and Windows. Else, it returns false. |
---|---|
Extension | device:isEnrolled(deviceId, deviceType) |
Usage | It is assumed that the input stream has the from inputStream[device:isEnrolled(deviceId, deviceType)] select deviceId insert into outputStream; |
Confirming if the device is in a device group
Description | This extension returns true if the given device that has the specified device ID and device type, such as Android, iOS, and Windows, is in the specified group. |
---|---|
Extension | device:isInGroup(groupId, deviceId, deviceType) |
Usage | It is assumed that the input stream has the from inputStream[device:isInGroup(groupId, deviceId, deviceType)] select deviceId insert into outputStream; |
Confirming if a user has a specific device type enrolled
Description | This extension checks if a user having the specified username has already enrolled a specific device type, such as Android, iOS, and Windows. Optionally, you are able to specify the status of the device too, such as active, inactive, and removed. |
---|---|
Extension | device:hasDevicesOfUser(user, deviceType [, status]) |
Usage | It is assumed that the input stream has the |
Getting the list of devices enrolled by a user
Description | This extension returns a list of devices in the JSON format if it belongs to the specified device type and is owned by the specified user. Optionally, you are able to specify the status of the device too, such as active, inactive, and removed. |
---|---|
Extension | device:getDevicesOfUser(user, deviceType [, status]) |
Usage | It is assumed that the input stream has the |
Checking forĀ devices that belong to a specified device status
Description | This extension checks if there are any enrolled devices that belong to the specified device status. Optionally, you are able to specify the device type too, such as Android, iOS, and Windows. |
---|---|
Extension |
|
Usage | It is assumed that the input stream has the |
Getting the list of devices based on the device status
Description | This extension returns a list of devices in the JSON format if it belongs to specified device status, such as active, inactive, and removed. Optionally, you are able to specify the device type too, such as Android, iOS, and Windows. |
---|---|
Extension | device:getDevicesOfStatus(status [, deviceType]) |
Usage | It is assumed that the input stream has the |
Getting the property from the JSON string
Description | Returns the value of the property from the given JSON string. |
---|---|
Extension | json:getProperty(payload, 'property name') |
Usage | from inputStream select id, json:getProperty(payload, 'property_name') as property_name insert into outputStream; Example: from inputStream select id, json:getProperty(payload, 'latitude') as latitude insert into outputStream; |
Getting the JSON array
Description | Returns JSON array for objects in the argument, such as |
---|---|
Extension |
|
Usage | It is assumed that the input stream has the from inputStream select json:getArray(arg1, arg2) as array insert into outputStream; |
Checking if the specified coordinates are within the geo location
Description | This extension checks if the specified longitude and latitude are within the geo fence specified by the geoJson . |
---|---|
Extension | geo:within(longitude,latitude,geoJson) |
Usage | from inputStream [geo:within(longitude,latitude,"{geoJSOn}")] select deviceId insert into outputStream; Example from inputStream [geo:within(longitude,latitude,"{'type':'Polygon','coordinates' :[[[79.85213577747345, 6.909673257977737],[79.85266149044037,6.909673257977737], [79.85266149044037,6.91003538888127],[79.85213577747345,6.91003538888127], [79.85213577747345,6.909673257977737]]]}")] select deviceId insert into outputStream; |
What's next?
- For more information on the WSO2 Siddhi extensions, see theĀ Sidhhi extensions guide.
- Try out the tutorials listed below and see how the extensions described above are put into use.