com.apama.cumulocity
Event ManagedObject


Description of a device or other Managed Object.

Sent on startup or in response to a RequestAllDevices event, or if a new ManagedObject is detected (and configuration property subscribeToDevices is enabled). Example:
 ManagedObject("43026768","com_ublox_C027_REV-A","Mbed Test Device",["c8y_Relay","c8y_Configuration","c8y_Message"],[],[],[],{"alt":610.2,"lat":17.426479,"lng":78.33123},{,"c8y_Availability":any(dictionary,{any(string,"status"):any(string,"UNAVAILABLE")}), ,"c8y_Hardware":any(dictionary,{any(string,"model"):any(string,"Ublox C027"),any(string,"revision"):any(string,"1"),any(string,"serialNumber"):any(string,"352648069564516")}),"c8y_IsDevice":any(dictionary,{}),"c8y_Mobile":any(dictionary,{any(string,"cellId"):any(string,"14D80CD"),any(string,"iccid"):any(string,"89914905900016774658"),any(string,"imei"):any(string,"352648069564516")}),"c8y_MotionTracking":any(dictionary,{any(string,"active"):any(boolean,true),any(string,"interval"):any(integer,0)}),"c8y_RequiredAvailability":any(dictionary,{any(string,"responseInterval"):any(integer,20)}),"com_cumulocity_model_Agent":any(dictionary,{}),"owner":any(string,"device_352648069564516")}) 

Constant summary
 stringCHANNEL := "cumulocity.devices"

The channel to which ManagedObject events are sent from the transport.
Deprecated:
[This channel constant has been deprecated. Use SUBSCRIBE_CHANNEL instead.]
 stringNOTIFICATION_CREATED := "CREATED"

Value of PARAM_NOTIFICATION that indicates this a new object.
 stringNOTIFICATION_UPDATED := "UPDATED"

Value of PARAM_NOTIFICATION that indicates this an update to an existing object.
 stringPARAM_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.
 stringSEND_CHANNEL := "CumulocityIoTGenericChain"

The channel to send a ManagedObject event to update an existing managed object in Cumulocity.
 stringSUBSCRIBE_CHANNEL := "cumulocity.devices"

The channel to which ManagedObject events are sent from the transport.
 stringUPDATE_CHANNEL := "CumulocityIoTGenericChain"

The channel to send a ManagedObject event to update an existing managed object in Cumulocity.
Deprecated:
[This channel constant has been deprecated. Use SEND_CHANNEL instead.]
 
Member summary
 stringid

The unique identifier for this specific Device.
 stringtype

The type of the device.
 stringname

The name of this ManagedObject. Note: This does not have to be a unique value.
 sequence<string>supportedOperations

List of supported operations for this device.
 sequence<string>supportedMeasurements

List of supported measurements for this device.
 sequence<string>childDeviceIds

Ids of child devices.
 sequence<string>childAssetIds

Ids of child devices.
 sequence<string>deviceParentIds

Ids of parent devices.
 sequence<string>assetParentIds

Ids of parent assets.
 dictionary<stringfloat>position

If known, contains lat, lng, altitude and accuracy.
 dictionary<stringany>params

Other fragments for this ManagedObject.
 
Action summary
 com.apama.cumulocity.ResponseWrapperwithChannelResponse(integer reqId, dictionary<stringstring> headers)

Create or update a ManagedObject in Cumulocity and receive a response event confirming the change on ManagedObject.SUBSCRIBE_CHANNEL channel.
 com.apama.cumulocity.ResponseWrapperwithResponse(integer reqId, dictionary<stringstring> headers)

Create or update a ManagedObject in Cumulocity and receive a response event on default channel, confirming the change.
Deprecated:
[This API has been deprecated. Use withChannelResponse API to receive confirmation on ManagedObject.SUBSCRIBE_CHANNEL channel.]
 
Constant detail

CHANNEL

string CHANNEL := "cumulocity.devices"
Deprecated:
[This channel constant has been deprecated. Use SUBSCRIBE_CHANNEL instead.]
The channel to which ManagedObject events are sent from the transport.

NOTIFICATION_CREATED

string NOTIFICATION_CREATED := "CREATED"
Value of PARAM_NOTIFICATION that indicates this a new object.
Since:
10.5.4.0

NOTIFICATION_UPDATED

string NOTIFICATION_UPDATED := "UPDATED"
Value of PARAM_NOTIFICATION that indicates this an update to an existing object.
Since:
10.5.4.0

PARAM_NOTIFICATION

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.
Since:
10.5.4.0

SEND_CHANNEL

string SEND_CHANNEL := "CumulocityIoTGenericChain"
The channel to send a ManagedObject event to update an existing managed object in Cumulocity.
Since:
10.5.2.0

SUBSCRIBE_CHANNEL

string SUBSCRIBE_CHANNEL := "cumulocity.devices"
The channel to which ManagedObject events are sent from the transport.
Since:
10.5.2.0

UPDATE_CHANNEL

string UPDATE_CHANNEL := "CumulocityIoTGenericChain"
Deprecated:
[This channel constant has been deprecated. Use SEND_CHANNEL instead.]
The channel to send a ManagedObject event to update an existing managed object in Cumulocity.
Member detail

assetParentIds

sequence<stringassetParentIds
Ids of parent assets.

childAssetIds

sequence<stringchildAssetIds
Ids of child devices.

childDeviceIds

sequence<stringchildDeviceIds
Ids of child devices.

deviceParentIds

sequence<stringdeviceParentIds
Ids of parent devices.

id

string id
The unique identifier for this specific Device.

Supply as empty if creating a new ManagedObject.

name

string name
The name of this ManagedObject. Note: This does not have to be a unique value.

params

dictionary<stringanyparams
Other fragments for this ManagedObject.

position

dictionary<stringfloatposition
If known, contains lat, lng, altitude and accuracy.

supportedMeasurements

sequence<stringsupportedMeasurements
List of supported measurements for this device.

supportedOperations

sequence<stringsupportedOperations
List of supported operations for this device.

type

string type
The type of the device.
Action detail

withChannelResponse

com.apama.cumulocity.ResponseWrapper withChannelResponse(integer reqId, dictionary<stringstring> headers)
Create or update a ManagedObject in Cumulocity and receive a response event confirming the change on ManagedObject.SUBSCRIBE_CHANNEL channel.

Just sending a ManagedObject is fire and forget. If your application requires an acknowledgement or the ID of the ManagedObject created or updated on ManagedObject.SUBSCRIBE_CHANNEL channel, then use the withChannelResponse API. You will need to subscribe to ManagedObject.SUBSCRIBE_CHANNEL channel. This API will create an event that can be sent as normal and get a response from Cumulocity for the newly created or updated ManagedObject. The responses are either an ObjectCommitted event or an ObjectCommitFailed event. The withChannelResponse API also allows you to provide headers to the create or update request. For example:
ManagedObject m := new ManagedObject;
monitor.subscribe(ManagedObject.SUBSCRIBE_CHANNEL);
// set fields in m
integer reqId := com.apama.cumulocity.Util.generateReqId();
send m.withChannelResponse(reqId, {"X-Cumulocity-Application-Key": "myapp"}) to ManagedObject.SEND_CHANNEL;
// 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
}
Parameters:
reqId - A request identifier generated from Util.generateReqId(). The response from Cumulocity will have the matching request identifier.
headers - Set headers of the create/update request. This can be used to explicitly control the processing mode of the create/update request.
See Also:
com.apama.cumulocity.ObjectCommitted - Successfully created or updated a ManagedObject.
com.apama.cumulocity.ObjectCommitFailed - Failed to create or update a ManagedObject.

withResponse

com.apama.cumulocity.ResponseWrapper withResponse(integer reqId, dictionary<stringstring> headers)
Deprecated:
[This API has been deprecated. Use withChannelResponse API to receive confirmation on ManagedObject.SUBSCRIBE_CHANNEL channel.]
Create or update a ManagedObject in Cumulocity and receive a response event on default channel, confirming the change.

Just sending a ManagedObject is fire and forget. If your application requires an acknowledgement or the ID of the ManagedObject created or updated, then use the withResponse API. This API will create an event that can be sent as normal and get a response from Cumulocity for the newly created or updated ManagedObject. The responses are sent to default channel and hence can be listened for only in the main context. The responses are either an ObjectCommitted event or an ObjectCommitFailed event. The withResponse API also allows you to provide headers to the create or update request. For example:
ManagedObject m := new ManagedObject;
// set fields in m
integer reqId := com.apama.cumulocity.Util.generateReqId();
send m.withResponse(reqId, {"X-Cumulocity-Application-Key": "myapp"}) to ManagedObject.SEND_CHANNEL;
// 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
}
Parameters:
reqId - A request identifier generated from Util.generateReqId(). The response from Cumulocity will have the matching request identifier.
headers - Set headers of the create/update request. This can be used to explicitly control the processing mode of the create/update request.
See Also:
com.apama.cumulocity.ObjectCommitted - Successfully created or updated a ManagedObject.
com.apama.cumulocity.ObjectCommitFailed - Failed to create or update a ManagedObject.
com.apama.cumulocity.ManagedObject#withChannelResponse() - to receive confirmation on ManagedObject.SUBSCRIBE_CHANNEL channel.