set_prms_limit
To limit the number of message parameters that the server returns for each unit in the current session, use the core/set_prms_limit method.
The method is useful for units with a large number of message parameters, for example, units with BLE tags. With a limit, the server returns only the most recent parameters instead of the whole list, so the response gets much smaller.
The core/set_prms_limit method isn’t available in Wialon Local.
Endpoint
svc=core/set_prms_limit¶ms={
"prms_limit": <uint>
}
Parameters
The request must contain the following parameter:
| Parameter | Description |
|---|---|
prms_limit |
The maximum number of message parameters returned for each unit:
|
The limit applies to all the units of the session and only to the message parameters. It doesn’t affect other sessions, even the ones that receive data from the same units. It doesn’t apply to resources, even though the flag of geofence groups has the same value as the flag of message parameters.
The method only saves the limit. It doesn’t add units to the session and doesn’t return their data. To get the message parameters with the new limit, send the core/update_data_flags request with the flag of message parameters in mode 1. For details on the returned data, see Limited list of parameters.
To change the limit, send the core/set_prms_limit request again with a new value. The format of new events changes right away. To get the list of parameters with the new limit, do the following:
- If the new limit is a positive number, send the
core/update_data_flagsrequest with the flag of message parameters in mode 1. - If the new limit is
0, first remove the flag of message parameters from the session (mode 2), then add it again (mode 1). If the unit already has this flag, adding it in mode 1 without removing it first returns nothing.
Response
If the request is completed successfully, the response is returned in the following format:
{
"prms_limit": <uint> /* The saved limit. */
}
If the request fails, an error code is returned. In this case, the previous limit stays in effect.
Error codes
| Error code | Description |
|---|---|
| 1 | Invalid session. |
| 4 | The prms_limit parameter is missing or isn’t an integer. If the value is negative or exceeds the maximum, the response also contains "reason": "WRONG_PRMS_LIMIT". |
| 6 | Failed to save the limit. |
Example
In this example, the session gets no more than 100 of the most recent message parameters of a unit instead of the full list. To do this, first set the limit, then add the flag of message parameters for the unit to the session.
Limit the number of message parameters to 100:
svc=core/set_prms_limit¶ms={"prms_limit":100}
Response:
{
"prms_limit": 100
}
Then request the message parameters of a unit:
svc=core/update_data_flags¶ms={"spec":[{"type":"id","data":28877572,"flags":1048576,"mode":1}]}
Response:
[
{
"i": 28877572,
"d": {
"prms": {
"engine_temp": {
"v": 87,
"ct": 1790541264,
"at": 1790541264
},
...
},
"prms_total": 2450
},
"f": 1048576
}
]