Apama Connectivity with Device Integration Platform Documentation 10.0 : Integrating with IoT Analytics Kit : Using the Transformers Bridge
Using the Transformers Bridge
If the Apama Connectivity with Device Integration Platform to Transformer Bridge bundle is added, then the device event is automatically translated to com.industry.iot.Asset event and measurement event is automatically translated to com.industry.iot.Measure event. The control events in the Device Integration Platform package can be used to control subscriptions or request measures.
For measurements which contain multiple values, the value with the lowest key name is used as the top-level value, and further values are available in the parameters dictionary. For events and alarms, the dValue is 0 and the sValue of the measure contains the message text. Note that for measure events, the events are only sent to the channel of the name (the first field in the event), which is the type of the measurement. Applications must subscribe to that channel to consume the events.
Example events:
com.industry.iot.Asset("12557881","c8y_Linux","RaspPi BCM2709 00000000e2cbada2",
"",["12475995","12560654","12560655","12599092","12599527","12475994"],
{"attrs.c8y_ActiveAlarmsStatus":"{major=2}","attrs.c8y_Availability":
"c8y.Availability@355cadd7",
"attrs.c8y_Configuration":"c8y.Configuration@2bd6f193",
"attrs.c8y_Firmware":"c8y.Firmware@14750fc4","attrs.c8y_Hardware":
"c8y.Hardware@de0caeca",
"attrs.c8y_IsDevice":"c8y.IsDevice@7ab33eef",
"attrs.c8y_RequiredAvailability":"c8y.RequiredAvailability@3",
"attrs.c8y_Software":"{pi4j-device=pi4j-device-0.0.5.jar,
rest-representation=rest-representation-5.19.0.jar,
jersey-multipart=jersey-multipart-1.8-5.19.0.jar, jsr311-api=jsr311-api-1.1.1.jar,
device-capability-model=device-capability-model-5.19.0.jar,
pi4j-gpio-extension=pi4j-gpio-extension-0.0.5.jar,
common-notification=common-notification-5.19.0.jar,
commons-io=commons-io-2.4.jar, pi4j-example=pi4j-example-0.0.5.jar,
svenson=svenson-1.3.8-5.19.0.jar,
slf4j-api=slf4j-api-1.7.0.jar, jcl-over-slf4j=jcl-over-slf4j-1.6.1.jar,
commons-codec=commons-codec-1.4.jar,
jetty-client=jetty-client-7.6.14.v20131031.jar,
jersey-apache-client=jersey-apache-client-1.8-5.19.0.jar,
core-model=core-model-5.19.0.jar, jersey-core=jersey-core-1.8-5.19.0.jar,
tinkerforge=tinkerforge-2.1.2.jar,
bayeux-api=bayeux-api-2.8.0.jar, cometd-java-common=cometd-java-common-2.8.0.jar,
rpi-driver=rpi-driver-5.20.0.jar, logback-classic=logback-classic-1.0.13.jar,
commons-httpclient=commons-httpclient-3.1-5.19.0.jar, joda-time=joda-time-1.6.2.jar,
pi4j-core=pi4j-core-0.0.5.jar, jssc=jssc-2.6.0.jar,
cometd-java-client=cometd-java-client-2.8.0.jar,
jv-agent=jv-agent-5.20.0.jar, commons-beanutils=commons-beanutils-1.8.0.jar,
jetty-io=jetty-io-7.6.14.v20131031.jar, mimepull=mimepull-1.4-5.19.0.jar,
jersey-client=jersey-client-1.8-5.19.0.jar,
tinkerforge-driver=tinkerforge-driver-5.20.0.jar,
common-rest=common-rest-5.19.0.jar, logback-core=logback-core-1.0.13.jar,
java-client=java-client-5.19.0.jar,
piface-driver=piface-driver-5.20.0.jar, jv-driver=jv-driver-5.20.0.jar,
jetty-util=jetty-util-7.6.14.v20131031.jar,
jetty-http=jetty-http-7.6.14.v20131031.jar}",
"attrs.c8y_SupportedOperations":"[c8y_Restart, c8y_Firmware,
c8y_Configuration, c8y_Software]",
"attrs.com_cumulocity_model_Agent":"com.cumulocity.model.Agent@13a00e5c",
"owner":"device_00000000e2cbada2",
"supportedOperations":"[\"c8y_Restart\",\"c8y_Firmware\",\"c8y_Configuration\",
\"c8y_Software\"]"})

com.industry.iot.Asset("12475995","c8y_TinkerForge_DistanceIR",
"RaspPi BCM2709 00000000e2cbada2 DistanceIR p1c","",[],
{"attrs.c8y_DistanceSensor":"c8y.DistanceSensor@3bd8011",
"attrs.c8y_Hardware":"c8y.Hardware@721b36b0","owner":"device_00000000e2cbada2"})

com.industry.iot.Asset("12475994","c8y_TinkerForge_Display",
"RaspPi BCM2709 00000000e2cbada2 Display ofV","",[],
{"attrs.c8y_Hardware":"c8y.Hardware@fc2f1534","attrs.c8y_Message":"c8y.Message@e6ffa71a",
"attrs.c8y_Relay":"Relay{relayState=CLOSED}","attrs.c8y_SupportedOperations":
"[c8y_Message, _Relay]",
"owner":"device_00000000e2cbada2","supportedOperations":"[\"c8y_Message\",\"c8y_Relay\"]"})

com.industry.iot.Measure("c8y_DistanceMeasurement","r","12346082",1464864899.311,142,"",
{"unit":"mm"})

com.industry.iot.Measure("c8y_EntranceEvent","r","12346082",1464865646.145,0,
"Entrance event triggered.",{"distance":"95"})

com.industry.iot.Measure("c8y_UnavailabilityAlarm","r","12669915",
1464871160.286,0,"No communication with device since 2016-06-02T14:35:16.664+02:00",
{"count":"1","severity":"MAJOR"})
The Apama Connectivity with Device Integration Platform to Transformer Bridge bundle also includes a DisplayOperation transform for sending measure values to a Device Integration Platform display. Configuration parameters specify either a single assetId or a deviceName. The transform will send operations to all devices which match the device name. A sample demonstration is included in the demo directory which:
*Sends data from all distance measurements to a dataview
*Calculates a smoothed value using the MovingAverage transform and a smoothed velocity using the 'Gradient' transform
The events to configure the transforms are given below:
com.industry.iot.Transform("Gradient", ["c8y_DistanceMeasurement"],
["SmoothedVelocity"], {"bucketTimeWindow":"0.0"})
com.industry.iot.Transform("MovingAverage", ["c8y_DistanceMeasurement"],
["SmoothedDistance"], {"timeWindow":"5.0"})
com.industry.iot.Transform("CumulocityDisplayOperation", ["SmoothedVelocity"],
[], {"deviceName":"c8y_TinkerForge_Display"})
com.industry.iot.Transform("DataViewer", ["SmoothedVelocity"], ["SmoothedVelocity"], {})
com.industry.iot.Transform("DataViewer", ["c8y_DistanceMeasurement"], ["Distance"], {})
com.industry.iot.Transform("DataViewer", ["SmoothedDistance"], ["SmoothedDistance"], {})
You can modify the above events if you have a different type of sensor input or display. You can also modify the timeWindow of the moving average or the sensor's polling interval to obtain suitable smoothing. Configuration can be modified using the Device Integration Platform application and changing the gateway's configuration).
Monitors and a dashboard are included in the Apama/connectivity/samples/DeviceIntegrationPlatform directory. Copy all the monitor files and dashboard into a project with the Apama Connectivity With Device Integration Platform and Apama Connectivity with Device Integration Platform to Transformer Bridge added. Mark the dashboard as the default dashboard in the Run Project configuration and run the project. The dashboard should display a table of all distance measurements.
Copyright © 2013-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback