alarm.publish
The alarm.publish command is used to publish alarm states for a Thing.
TR50 Request
{
"cmd": {
"command": "alarm.publish",
"params": {
"thingKey": "mything",
"key": "myprop",
"state": 3,
"msg": "Message.",
"ts": "2014-04-05T02:03:04.322Z",
"corrId": "mycorrid",
"lat": 26.39489,
"lng": -80.11293,
"republish": false
}
}
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
thingKey | String | Yes* | The thing key. |
thingid | String | Id of the thing | |
esn | String | ESN of the connection. | |
iccid | String | ICCID of the connection. | |
imei | String | IMEI of the connection. | |
imsi | String | IMSI of the connection. | |
meid | String | MEID of the connection. | |
msisdn | String | MSISDN of the connection. | |
*One of the above parameters is required to identify the connection. | |||
key | String | Yes | The key for the alarm that you wish to publish. |
state | Integer | Yes | The state to publish. |
msg | String | The message to publish. | |
ts | String | The timestamp in which the value was recorded. | |
corrId | String | A correlation ID that can be used when querying to find related data objects. | |
lat | Float | Latitude coordinate of the alarm state event. | |
lng | Float | Longitude coordinate of the alarm state event. | |
republish | Boolean | If the publish is the latest value (ie the timestamp is newer than all other timestamps for the alarm), and republish is false, the publish will be suppressed and will not add an additional record. The default value is false. |
If two or more alarm states get published with the same time stamp (ts), they will only get published if the states are different, or if the republish flag is set to true.
TR50 Response
If the command is sent successfully a success message is returned. Otherwise, an error and error message will be returned.
{
"cmd": {
"success": true
}
}
C API
// basic API
int tr50_alarm_publish(void *tr50, const char * alarm_key, const int state);
// extended API
int tr50_alarm_publish_ex(void *tr50, const char * alarm_key, const int state, void* optional_params, void** optional_reply, char** error_msg);
JAVA API
// Synchronous
int publish(String thingKey, String timestamp, String corrId, String key, int state, String message, Object response);
// Asynchronous
int publish(String thingKey, String timestamp, String corrId, String key, int state, String message,DwOpenReceiveActionListener recv, Object response);
Response Objects: StringReply, DwOpenResponse