IoT Pinger
This is an upcoming feature and is not included yet in the public release.
The IoT (Internet of Things) pinger is a general purpose API consumer intended to aggregate data from several different sources providing data via HTTP. The IoT Panel is found in the Wandora menu bar and presents most of the pinger's configuration options. The Pinger searches the current Topic Map for topics with an occurrence with Source Occurrence Type. Those topics are expected to correspond to an API endpoint defined by corresponding occurrence data. The pinger queries each endpoint every specified time interval and saves the response as an occurrence with Target Occurrence Type. The pinger process can be configured to stop at a set time using the Expires toggle. Save on tick saves the current Topic Map in the specified folder after each tick of the pinger in the formiot_yyyy_mm_dd_hh_mm_ss.jtm
.
The log window lists starts, stops, runs and any errors the pinger might encounter.
In addition to ordinary web APIs the pinger supports several special local endpoints with special sources
- Time
http://wandora.org/si/iot/time
- Return the current time. The time is formatted using the parameter
format
. - Stats
-
http://wandora.org/si/iot/tm-stats
- Return the topic and association counts for the current Topic Map in the format
{ "num_topics": <num_topics>, "num_associations": <num_associations>; }
- Geolocation
-
http://wandora.org/si/iot/geolocation
- Return the current location in the form
<latitude>, <longitude>
All these special endpoints implement org.wandora.application.tools.iot.IoTSource
and are listed in org.wandora.application.tools.iot.SourceMapping.sources
. You can add your own by simply implementing the interface and appending the source to the sources list.
Example
A prepared sample Topic Map with appropriate occurrence type and endpoint topics is useful in demonstrating the functionality of the IoT Pinger.
The IoT Source Type and IoT Target Type topics are general occurrence type topics used to signal the pinger that the topic is an endpoint. The time topic simply uses the special time endpoint to fetch the current timestamp. The date topic uses the same service to fetch the current date. The stats and geolocation topics in turn use the respective services to fetch data.
To separate text and binary data, two separate pinger instances are used. The first one fetches text data for the before-mentioned topics. The second instance is used to fetch binary image data for the Wandora logo. Note the selected "is binary" toggle for the binary pinger instance.
The first pinger will process each topic containing a HTTP source occurrence with the appropriate source type. The pinger will then load text data from the given topics to their respective target occurrence fields.
The binary pinger operates in a similar fashion. However, the source is now defined to be binary and the pinger treats it as such. The image data is handled appropriately and presented as an image in the appropriate occurrence field.
The pinger also saves a snapshot of the current Topic Map on each tick if the "save on tick" option has been selected. Each snapshot is timestamped in the format of yyyy_mm_dd_hh_mm_ss
.