To get messages from the message loader, use the command messages/get_messages:
svc=messages/get_messages¶ms={"indexFrom":<uint>, "indexTo":<uint>, "timeFrom:"<uint>, "timeTo":<uint>, "filter":<text>, "flags":<uint>, "flagsMask":<uint>, "loadCount":<uint>}
You can find an example of this request in the sample Messages.
Name | Description |
---|---|
indexFrom | index of the first message requested |
indexTo | index of the last message requested |
timeFrom | interval beginning |
timeTo | interval end |
filter | filter, search in “pos” and “p” |
flags | flags for loading messages (see below) |
flagsMask | mask (see below) |
loadCount | how many messages to return (0xffffffff - all found) |
Method logic extended: you can use both old indexFrom/indexTo logic and new ones:
- timeFrom/timeTo (we define message time to start and end);
- timeFrom/loadCount (we define message time to start, it will display loadCount number of last messages);
- timeTo/loadCount (we define message time to end , it will display loadCount number of last messages).
“Filter” option can be used for any logic. Search is available in “pos” and “p” params. Even if there is no params under search in messages then all messages will be shown with minimal info like (“t”,“f”,“tp”,“i”,“o”).
Response example (no filtering):
[ { "t": 1426233861, "f": 7, "tp": "ud", "pos": { "y": 53.84541, "x": 27.4470783333, "z": 0, "s": 25, "c": 285, "sc": 255 }, "i": 0, "o": 0, "p": { "adc1": 0, "pre2": 123, "param": 24, "param5": 43 } } ]
Filter example:
"filter":"pos.x,p.pre*,p.param?"
Filtered response:
[ { "t": 1426233861, "f": 7, "tp": "ud", "pos": { "x": 27.4470783333 }, "i": 0, "o": 0, "p": { "pre2": 123, "param5": 43 } } ]
After filtering we see pos.x value, values for parameters in pos-object with leading “pre” names, values for parameters in pos-object with leading “param” and one-more-following-symbol names (for example 'param1' but 'param' is invalid for search). Number of defined parameters using comma as delimiter is unlimited. * – wildcard for 0 or more symbols, ? - wildcard for exactly one symbol.
[ /* массив сообщений */ { ... }, /* сообщение */ { ... } /* сообщение */ ]
You can find message formats in the chapter Data format: Messages.
|