waitModbusValue v5.2.1
Wait for a named internal Modbus register to be written.
The request returns as soon as the register's generation differs from
generation. If generation is omitted, or already differs, the request
returns immediately. A client can follow all writes to a register by passing
the generation from the previous reply in the next request.
Parameter
| Key | Type | Description |
|---|---|---|
| name | string | Register name. |
| generation | number | Optional. The last seen generation. The request waits until the generation differs from it. |
| timeout | number | Optional. Maximum time to wait, in seconds. If omitted, the request waits indefinitely. |
Return value
| Key | Type | Description |
|---|---|---|
| name | string | Register name. |
| value | number|string|array | Current value, see Modbus. |
| generation | number | Number of writes since the printer started. |
If the timeout expires, the current state is returned with an unchanged generation. Compare the returned generation with the one passed in to tell whether the register was written.
The request fails if there is no register with the given name, including if the register is removed while waiting.
Example
waitModbusValue {"name": "batch", "generation": 3, "timeout": 10}
Returns, after the register has been written:
OK {"name":"batch","value":1236,"generation":4}