| FRAMES NO FRAMES | |||||||
| |||||||
| SUMMARY: IMPORT | CONSTANT | MEMBER | ACTION | DETAIL: IMPORT | CONSTANT | MEMBER | ACTION | ||||||
com.apama.cumulocity.ManagedObject("49","","temp_sensor",["c8y_Restart"],["c8y_Temperature","c8y_Light"], ["childDevRefIds"],["childAstRefIds"],["devParentIds"],["assetParentIds"],{"lat":1.0},{"c8y_IsDevice":{}})
// Create a ManagedObject:
ManagedObject createManagedObject := new ManagedObject;
createManagedObject.name := "myDevice";
createManagedObject.params.add("c8y_IsDevice", new dictionary<any, any>);
send createManagedObject to ManagedObject.SEND_CHANNEL;
When listening for events of this type from Cumulocity, use the isCreate() and/or isUpdate() actions within the listener to distinguish between create and update events.
// Update the name:
ManagedObject updateManagedObject := new ManagedObject;
updateManagedObject.id := "deviceId";
updateManagedObject.name := "myDevice_UpdatedName";
send updateManagedObject to ManagedObject.SEND_CHANNEL;
| Constant summary | |
|---|---|
string | CHANNEL := "cumulocity.devices"The channel to which ManagedObject events are sent from the transport.
|
string | NOTIFICATION_CREATED := "CREATED"Value of PARAM_NOTIFICATION that indicates this is a new object. |
string | NOTIFICATION_UPDATED := "UPDATED"Value of PARAM_NOTIFICATION that indicates this is an update to an existing object. |
string | PARAM_NOTIFICATION := ".apama_notificationType"Entry in params that identifies if this is a new object or an update to an existing object. Entry will have a value matching either NOTIFICATION_CREATED or NOTIFICATION_UPDATED. |
string | SEND_CHANNEL := "CumulocityIoTGenericChain"The channel to send a ManagedObject event to update an existing managed object in Cumulocity. |
string | SUBSCRIBE_CHANNEL := "cumulocity.devices"The channel to which ManagedObject events are sent from the transport. |
string | UPDATE_CHANNEL := "CumulocityIoTGenericChain"The channel to send a ManagedObject event to update an existing managed object in Cumulocity.
|
| Member summary | |
|---|---|
string | idThe unique identifier for this specific managed object (device). |
string | typeThe type of the device. |
string | nameThe name of this ManagedObject. Note: This does not have to be a unique value. |
sequence<string> | supportedOperationsList of supported operations for this device. |
sequence<string> | supportedMeasurementsList of supported measurements for this device. |
sequence<string> | childDeviceIdsIds of child devices. Note: This field cannot be set by sending ManagedObject events. |
sequence<string> | childAssetIdsIds of child devices. Note: This field cannot be set by sending ManagedObject events. |
sequence<string> | deviceParentIdsIds of parent devices. Note: This field cannot be set by sending ManagedObject events. |
sequence<string> | assetParentIdsIds of parent assets. Note: This field cannot be set by sending ManagedObject events. |
dictionary<string, float> | positionIf known, contains lat, lng, altitude and accuracy. |
dictionary<string, any> | paramsOther fragments for this ManagedObject. |
| Action summary | |
|---|---|
boolean | isCreate()Check if this ManagedObject instance was as a result of a managed object being created in Cumulocity. |
boolean | isUpdate()Check if this ManagedObject instance was as a result of a managed object being updated in Cumulocity. |
com.apama.cumulocity.ResponseWrapper | withChannelResponse(integer reqId, dictionary<string, string> headers)Create or update a ManagedObject in Cumulocity and receive a response event confirming the change on ManagedObject.SUBSCRIBE_CHANNEL channel. |
com.apama.cumulocity.ResponseWrapper | withResponse(integer reqId, dictionary<string, string> headers)Create or update a ManagedObject in Cumulocity and receive a response event on default channel, confirming the change.
|
| Constant detail |
|---|
string CHANNEL := "cumulocity.devices"
string NOTIFICATION_CREATED := "CREATED"Value of PARAM_NOTIFICATION that indicates this is a new object.
string NOTIFICATION_UPDATED := "UPDATED"Value of PARAM_NOTIFICATION that indicates this is an update to an existing object.
string PARAM_NOTIFICATION := ".apama_notificationType"Entry in params that identifies if this is a new object or an update to an existing object. Entry will have a value matching either NOTIFICATION_CREATED or NOTIFICATION_UPDATED.
string SEND_CHANNEL := "CumulocityIoTGenericChain"The channel to send a ManagedObject event to update an existing managed object in Cumulocity.
string SUBSCRIBE_CHANNEL := "cumulocity.devices"The channel to which ManagedObject events are sent from the transport.
string UPDATE_CHANNEL := "CumulocityIoTGenericChain"
| Member detail |
|---|
sequence<string> assetParentIdsIds of parent assets. Note: This field cannot be set by sending ManagedObject events.
sequence<string> childAssetIdsIds of child devices. Note: This field cannot be set by sending ManagedObject events.
sequence<string> childDeviceIdsIds of child devices. Note: This field cannot be set by sending ManagedObject events.
sequence<string> deviceParentIdsIds of parent devices. Note: This field cannot be set by sending ManagedObject events.
string idThe unique identifier for this specific managed object (device).
string nameThe name of this ManagedObject. Note: This does not have to be a unique value.
dictionary<string, any> paramsOther fragments for this ManagedObject.
dictionary<string, float> positionIf known, contains lat, lng, altitude and accuracy.
sequence<string> supportedMeasurementsList of supported measurements for this device.
sequence<string> supportedOperationsList of supported operations for this device.
string typeThe type of the device.
| Action detail |
|---|
boolean isCreate()Check if this ManagedObject instance was as a result of a managed object being created in Cumulocity.
boolean isUpdate()Check if this ManagedObject instance was as a result of a managed object being updated in Cumulocity.
com.apama.cumulocity.ResponseWrapper withChannelResponse(integer reqId, dictionary<string, string> headers)Create or update a ManagedObject in Cumulocity and receive a response event confirming the change on ManagedObject.SUBSCRIBE_CHANNEL channel.
monitor.subscribe(ManagedObject.SUBSCRIBE_CHANNEL);
ManagedObject m := new ManagedObject;
// set fields in m
integer reqId := com.apama.cumulocity.Util.generateReqId();
// myapp is the user application key
on ObjectCommitted(reqId=reqId) as commit and not ObjectCommitFailed(reqId=reqId) {
// do something
}
on ObjectCommitFailed(reqId=reqId) as failure and not ObjectCommitted(reqId=reqId) {
// do something
}
send m.withChannelResponse(reqId, {"X-Cumulocity-Application-Key": "myapp"}) to ManagedObject.SEND_CHANNEL;
com.apama.cumulocity.ResponseWrapper withResponse(integer reqId, dictionary<string, string> headers)
ManagedObject m := new ManagedObject;
// set fields in m
integer reqId := com.apama.cumulocity.Util.generateReqId();
// myapp is the user application key
on ObjectCommitted(reqId=reqId) as commit and not ObjectCommitFailed(reqId=reqId) {
// do something
}
on ObjectCommitFailed(reqId=reqId) as failure and not ObjectCommitted(reqId=reqId) {
// do something
}
send m.withResponse(reqId, {"X-Cumulocity-Application-Key": "myapp"}) to ManagedObject.SEND_CHANNEL;
| FRAMES NO FRAMES | |||||||
| |||||||
| SUMMARY: IMPORT | CONSTANT | MEMBER | ACTION | DETAIL: IMPORT | CONSTANT | MEMBER | ACTION | ||||||