To get events from items, you need to add them to the session. To stop watching item state, remove it from the session. To add/remove items to/from a session, use the command core/update_data_flags:
svc=core/update_data_flags¶ms={"spec":[ { "type":<text>, "data":<long|text|[long]>, "flags":<long>, "mode":<uint>, "max_items":<uint> } ]}
You can find an example of this request in the sample Item events management.
Name | Description |
---|---|
spec | array of item configurations |
type | method of transmitting items to the session (see the list below) |
data | data (depends on the value of the “type” parameter) |
flags | flags that define what part of item data will be added to the session (data for- mats of all item types and their flags are described in the chapter Data format) |
mode | flags application mode (see the list below) |
max_items | param is available when type='type', defines max quantity of subscribed items |
Methods of item transmission:
Flags application mode:
Flags are set to watch changes of specific item properties. The number of observed flags depend on your needs. If you want to get all events from an item, you should set up all flags. You can get events using the request avl_evts.
[ /* array of items */ { "i":<long>, /* ID */ "d":{ /* other fields */ ... }, "f":<long> /* applied data flags */ }, ... ]
The format of “d” depends on item type. All formats are described in the chapter Data format.
If you call this command with flags application mode set to “2”, the field “d” will be null.
|