get
After loading the events into the session, you can view them by executing the events/get command.
svc=events/get¶ms={
"selector":{
"type":<text>,
"expr":<text>,
"timeFrom":<uint>,
"timeTo":<uint>,
"detalization":<uint>
},
...
}
Parameters
Parameter | Description |
type | Sensor group: lls, trips, ignition, sensors, counters. To specify all the groups, use the asterisk (*). |
expr | Interval group expression. Used instead of the type parameter to get custom event intervals. See below. |
timeFrom | Interval start, UNIX-time. |
timeTo | Interval end, UNIX-time. |
detalization | Output flags (see below). |
indexFrom | Index of the first requested event. |
indexTo | Index of the last requested event. |
filter1 | Sensor ID. |
Flags
Flag | Description |
0x1 | Basic JSON: event start and end. |
0x2 | Data of a specific detector. |
0x4 | User parameters (that the user specified for this event). |
0x8 | Track data in the trips parameter. |
0x10 | Full JSON. Every detector interprets it in its own way. |
0x20 | Formatted value. |
0x40 | Grouping the intersections of intervals with the tf and tt parameters. |
0x80 | Summary. |
Custom event intervals
To get custom event intervals, specify an expression in the “expr”:
Operator | Description | Example |
{} | Used for selecting intervals with the specified value of the detalization parameter. See the example for selecting trip intervals in which the speed value exceeds 100. | trips{s>100} |
- | Used for specifying a custom interval in the start-end format, UNIX-time. | 1451953325-1451953525 |
| | Used as a separator when specifying multiple custom intervals. | (1615849200-1615935599|1615935601-1616022000) |
[] | Sensor ID. If no ID is specified, the first sensor is used. | sensors[3] |
Response
If the request is completed successfully, you will receive the response corresponding to the sensor group specified in the type parameter. Otherwise, an error code is returned.
0x1 flag
Returns basic JSON (the same 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 data of a specific detector.
"ignition": {
"<sensor_id>": {
"state": <uint>, /* state: 0 — off, 1 — 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 */
}
...
}
Below are the possible sensor types for sensors.
"sensors": {
"<sensor_id1>": {
"state": <uint>, /* state: 0 — off, 1 — 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 */
},
"<sensor_id2>": {
"type": 2, /* sensor type: instant sensor */
"counter": <uint>, /* number of sequent messages in the event */
"summary": <uint>, /* sum of values in the event */
"total_counter": <uint>, /* total number of messages in all history */
"total_summary": <uint>, /* total value sum in all history */
"value": <double> /* last value; if -348201.3876, the value is unknown */
},
"<sensor_id3>": {
"type": 3, /* sensor type: differential sensor */
"counter": <uint>, /* sum of values in the event */
"total_counter": <uint>, /* sum of values in the history */
"value": <double> /* last value; if -348201.3876, the value is unknown */
},
"<sensor_id4>": {
"type": 4, /* sensor type: analog sensor */
"value": <double> /* last value; if -348201.3876, the value is unknown */
}
}
"lls": {
"<sensor_id>": {
"value": <double>, /* last message value with the calculated level */
"level": <double>, /* average median value (FLS filtration applied) */
"filled": <double> /* amount of fuel filled */
}
}
"trips": {
"state": <bool>, /* state: 0 — parking, 1 — trip, 2 — stop */
"max_speed": <uint>, /* maximum speed during the trip */
"curr_speed": <uint>, /* current speed */
"avg_speed": <uint>, /* average speed based on distance */
"distance": <uint>, /* GPS mileage during the trip */
"odometer": <uint>, /* total distance for all trips in the history */
"course": <uint>, /* course */
"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 the parameters the user has specified for the event.
"<type_name>": {
"<sensor_id>": {
"p": { /* user-defined object content */
"test": 2,
"foo": "bar",
"trips": 1
}
}
}
0x8 flag
Returns JSON with additional parameters. For trips, returns a unit track in Google notation.
{
"trips": {
"0": [
{
"track": "wspnGgvcv@??oey@kwl@~dtBkeRwjzF??~ja@_qo]??g~g^????????????~bV???????"
}
]
}
}
0x10 flag
Returns full JSON.
For sensors with type=2
and type=3
(except fuel level sensors), the response looks as follows:
"sensors": {
"<sensor_id>": {
"msgs": [
{
"tm": <uint>, /* message time, UNIX time */
"v": <double> /* value */
},
...
]
},
...
}
For a fuel level sensor, the response looks as follows:
"lls": {
"<sensor_id>": {
"msgs": [
{
"tm": <uint>, /* message time, UNIX time */
"v": <double>, /* value */
"l": <double> /* average median value (FLS filtration applied) */
},
...
]
}
},
...
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 based on the previous message */
"avg_speed": <text> /* average speed in relation 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 */
}
}
0x40 flag
"selector": [
{
"tf": <uint>, /* intersection interval start (UNIX time) */
"tt": <uint>, /* intersection interval end (UNIX time) */
"d": {
"<type_name>": {
"<sensor_id>": [
{ }
]
}
}
}
]
0x80 flag
"selector": {
"<type_name>": {
"sensor_id>": [
{ }
]
}
},
"summary": {
"<type_name>": {
"<sensor_id>": {
"<summary_param_value>": <uint>, /* summary, different for different detectors */
"format": {
"value": <text> /* formatted value, depends on the sensor type and format */
}
}
}
}
Error codes
Code | Description |
---|---|
1 | Invalid or obsolete request SID. |
4 | Parameter validation error. |
7 | Failed to load the adf_avl_events library. |