update_units

For adding units into the session, use the events/update_units request.

Copied!
svc=events/update_units&params={"mode":"add",
                "units":[
                        {
                        "id":<long>,
                        "detect":
                            {
                                "trips":<uint>,
                                "lls":<uint>,
                                "sensors":<uint>,
                                "ignition":<uint>,
                                "counters":<uint>
                            }
                        },
                        ...
                ]}

To remove specific units from the session, use the following signature:

Copied!
svc=events/update_units&params={"mode":"remove",
                "units":[<long>]}

To remove all units from the session, use the following signature:

Copied!
svc=events/update_units&params={"mode":"clear"}

Parameters

Parameter Description
mode Mode: add, remove, clear.
id Unit ID.
detect Sensor types (what to monitor).
trips Trips (see below).
lls Fuel level sensor (see below).
ignition Ignition sensor (see below).
sensors Other sensors not mentioned above (see below).
counters Counters.
evt_flags Event flags. See the Event flags section.

To work with the “detect” elements (trips, lls, sensors, ignition) use a specific sensor ID or indicate 0 to add all the sensors of a certain type. For trips, always use 0 as there is no trip sensor.

To add all unit sensors, use:

Copied!
"detect":{"*":0}

Example 1

To add all ignition sensors and other sensors, use:

Copied!
"detect":{"ignition":0,"sensors":0}

or

Copied!
"detect":{"ignition,sensors":0}

Example 2

To add all fuel level sensors with ID 2 and other sensor with ID 6:

Copied!
"detect":{"lls":2,"sensors":6}

Event flags

The evt_flags parameter controls which event processing mode is used when events/check_updates is called.

Value Name Description
0 check_updates Default mode. The events/check_updates method polls detectors and returns event data.
0x200 evt_evts Alternative processing mode. When this bit is set, events/check_updates returns an empty result {} immediately (events are delivered through a different channel). The lower 9 bits (bits 0-8) are reserved for detail flags.

Detail flags are combinable via bitwise OR and used in the lower 9 bits when 0x200 is set. The following detail flags are available:

Flag Value Description
AVL_EVENTS_HISTORY_BASE_JSON 0x1 Event start and end time
AVL_EVENTS_HISTORY_DETECTOR_JSON 0x2 Base detector data
AVL_EVENTS_HISTORY_MSGS_PARAMS_JSON 0x4 Additional message parameters
AVL_EVENTS_HISTORY_EXTENDED_JSON 0x8 Extended information beyond base data
AVL_EVENTS_HISTORY_FULL_JSON 0x10 Full history JSON
AVL_EVENTS_HISTORY_FORMAT_TEXT 0x20 Format event values as human-readable text
AVL_EVENTS_HISTORY_GROUP_INTERVALS 0x40 Group results by intervals
AVL_EVENTS_HISTORY_SUMMARY 0x80 Include summary calculations
AVL_HISTORY_EXTENDED_EVENTS 0x100 Extended events

For example, evt_flags = 0x207 means using the evt_evts mode (0x200) with the base, detector, and message parameter detail flags enabled (0x1 | 0x2 | 0x4 = 0x7).

Response

If the request is completed successfully, the following response is returned:

Copied!
{
    units:<uint>        /* number of units added into session */
}

Otherwise, an error code is returned.

Error codes

CodeDescription
1Invalid or obsolete request SID.
4Parameter validation error.
7Failed to load the adf_avl_events library.

If you find a mistake in the text, please select it and press Ctrl+Enter.

Report a mistake

Your message was sent. Thank you!

An error occurred while submitting the form