check_updates
To get all event updates of all units added into the session, use the events/check_updates request.
svc=events/check_updates¶ms={
"lang": <text>,
"measure": <uint>,
"detalization": <uint>
}
Parameters
All parameters are optional.
Parameter | Description | Default value |
---|---|---|
lang | Language (2-symbol code). | en |
measure | Measurement system:
| 0 |
detalization | Output flags (see below). Must be specified in decimal format. | 0x7 |
Output flags
Flag | Description |
---|---|
0x1 | Basic JSON: event start - event end. |
0x2 | Specified detector data. |
0x4 | User parameters (which user specified for this event) |
0x10 | Full JSON. Every detector treats it in its own way. |
0x20 | Formatted value. |
Sensor type
Type value | Description | Event registration |
---|---|---|
1 | Switcher sensors:
| Events are registered from the ON state to the OFF state. |
2 | Instant sensors:
| Events are registered from the first non- zero value to the last non-zero one. |
3 | Differential sensors:
| Events are registered from the start of value increasing to the end of it. |
4 | Analog sensors:
| Events are not registered. |
Response
The response depends on the flag.
0x1 flag
Returns basic JSON (for all sensor groups).
"<type_name>": {
"<sensor_id>": {
"from": {
"t": <uint>, /* time (UNIX time) */
"y": <double>, /* latitude */
"x": <double> /* longitude */
},
"to": {
"t": <uint>, /* time (UNIX time) */
"y": <double>, /* latitude */
"x": <double> /* longitude */
},
"m": <uint>, /* last message time */
"f": <uint> /* service flag */
}
}
0x2 flag
Returns specified detector data.
"ignition": {
"<sensor_id>": {
"state": <uint>, /* state: 0 for off, 1 for on */
"type": 1, /* sensor type: switcher sensor */
"hours": <uint>, /* engine hours for all history, in seconds */
"switches": <uint>, /* number of switches for all history */
"value": <bool> /* current value */
}
...
}
All sensor types for sensors:
"sensors": {
"<sensor_id1>":
{
"state":<uint>, /* state: 0 for off, 1 for on */
"type": 1, /* sensor type: switcher sensor */
"hours":<uint>, /* engine hours for all history, s */
"switches":<uint>, /* number of switches for all history */
"value":<bool> /* current value */
},
"<sensor_id2>":
{
"type": 2, /* sensor type: instant sensor */
"counter":<uint>, /* message sequence counter in the event */
"summary":<uint>, /* sum of values in the event */
"total_counter":<uint>, /* number of messages in the history */
"total_summary"<uint>, /* sum of values in the history */
"value":<double> /* last value; if it's -348201.3876, the value is unknown */
},
"<sensor_id3>":
{
"type": 3, /* sensor type: differential sensor */
"counter":<uint>, /* value sum in the event */
"total_counter":<uint>, /* value sum in the history */
"value":<double> /* last value; if it's -348201.3876, the value is unknown */
},
"<sensor_id4>":
{
"type": 4, /* sensor type: analog sensor */
"value":<double> /* last value; if it's -348201.3876, the value is unknown */
}
}
"lls": {
"<sensor_id>":
{
"value":<double>, /* last message value with the calculated "level" */
"level":<double>, /* average median value (FLS filtering value is used) */
"filled":<double> /* fuel filled */
}
}
"trips": {
"state":<bool>, /* state: 0 for a parking interval, 1 for a trip, 2 for a stop */
"max_speed":<uint>, /* maximum speed in the trip */
"curr_speed":<uint>, /* current speed */
"avg_speed":<uint>, /* average speed according to "distance" */
"distance":<uint>, /* GPS mileage in trip */
"odometer":<uint>, /* distance for all trips */
"course":<uint>, /* movement direction*/
"altitude":<uint> /* altitude */
}
"counters": {
"engine_hours": <uint>, /* engine hours counter */
"mileage": <uint>, /* mileage counter */
"bytes": <uint> /* GPRS traffic counter */
}
0x4 flag
Returns user parameters. The response depends on user definitions for the current event.
"<type_name>": {
"<sensor_id>": {
"p":{ /* user-defined object content */
"test":2,
"foo":"bar",
"trips":1
}
}
}
0x10 flag
Returns the full JSON.
For sensors with both ‘‘type=2’’ and ‘‘type=3’’ (except fuel level sensors), the following response is returned:
"sensors": {
"<sensor_id>":
{
"msgs": [
{
"tm":<uint>, /* message time, UNIX-time */
"v":<double> /* value */
},
...
]
},
...
}
For fuel level sensors, the following response is returned:
"lls": {
"<sensor_id>": {
"msgs": [
{
"tm":<uint>, /* message time, UNIX-time */
"v":<double>, /* value */
"l":<double> /* average median value (FLS filtration value is used) */
},
...
]
}
},
...
}
0x20 flag
Returns formatted values
"ignition": {
"sensor_id": {
"format": {
"value":<text> /* formatted value (usually "On"/"Off") */
}
}
}
"sensors": {
"sensor_id": {
"format": {
"value":<text> /* formatted value, depends on the sensor type and format */
}
}
}
"trips": {
"format": {
"distance":<text>, /* distance according to the previous message */
"avg_speed":<text> /* average speed according to "distance" */
}
}
"lls": {
"sensor_id": {
"format": {
"value":<text>, /* formatted value, depends on the sensor type and format */
"filled":<text> /* fuel filled */
}
}
}
"counters": {
"format": {
"engine_hours":<uint>, /* formatted value of the engine hours counter */
"mileage":<text>, /* formatted value of the mileage counter */
"bytes":<uint> /* formatted value of the GPRS traffic counter */
}
}
Error codes
If the request is not completed, an error code is returned.
Error code | Description |
---|---|
1 | Invalid or obsolete request SID. |
4 | Parameter validation error. |
7 | The adf_avl_events library wasn't loaded, or failed to fetch the JSON writer. |