Skip to main content

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​

KeyTypeDescription
namestringRegister name.
generationnumberOptional. The last seen generation. The request waits until the generation differs from it.
timeoutnumberOptional. Maximum time to wait, in seconds. If omitted, the request waits indefinitely.

Return value​

KeyTypeDescription
namestringRegister name.
valuenumber|string|arrayCurrent value, see Modbus.
generationnumberNumber 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}