Apama Connectivity For Cumulocity IoT  10.1 | Apama Connectivity For Cumulocity IoT Documentation 10.1 | Interacting with Cumulocity IoT Platform | Sending control events to Cumulocity IoT Platform
 
Sending control events to Cumulocity IoT Platform
The Apama Connectivity with Cumulocity IoT listens on the CumulocityIoT channel for most requests. For all events sent to the transport, a CHANNEL constant is defined on the event type with the correct channel to send the event to.
Refresh list of devices
See the com.apama.cumulocity.RequestAllDevices event for refreshing the list of devices. Note that the com.apama.cumulocity.RequestAllDevices event is sent to the channel defined by the CHANNEL constant on RequestAllDevices event. The device events are sent to the channel specified in the RequestAllDevices event and followed by a com.apama.cumulocity.RequestAllDevicesComplete event with the requestId sent in the RequestAllDevices event.
Subscribe to Measurements
The com.apama.cumulocity.SubscribeMeasurements and com.apama.cumulocity.UnsubscribeMeasurements events control subscriptions to measurements from assets. Specify the assetId as either an assetId from a device event or as "*" for a wildcard (use the WILDCARD constant). Subscriptions are reference counted by the transport, so send as many Unsubscribe events as Subscribe events have been sent to completely unsubscribe. Unless the subscribeToMeasurements configuration property is false, the transport automatically subscribes as if SubscribeMeasurements("*") had been sent at applicationInitialized time. Subscriptions to measurements also subscribe to events and alarms.
Sending device operations
Send a com.apama.cumulocity.DeviceOperation event to send an operation to a device. For example, to set a device's display and modify a set of relays, send:

com.apama.cumuclocity.DeviceOperation("12345",{"c8y_Meassage":<any>
{<any>"text":<any>"Hello Cumulocity device"}},
new dictionary<string, any>)

com.apama.cumuclocity.DeviceOperation("12345",{"c8y_RelayArray":<any>
["CLOSED","OPEN","CLOSED","OPEN"]},
new dictionary<string, any>)

com.apama.cumuclocity.DeviceOperation("12345",{"c8y_Meassage":<any>
{<any>"text":<any>"Hello cumulocity"},
"c8y_Relay":<any>{<any>"relayState":<any>"CLOSED"}},
new dictionary<string, any>)

Copyright © 2013-2017 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release