Closed mancart closed 4 years ago
TIL that since v5.8 (2017) Qt has Modbus classes.
QModbus is an unrelated standalone Modbus Master program that uses the Qt GUI toolkit but not these classes.
A Modbus TCP server is a slave and only sends responses to the (single) master/client after it receives a request.
setData() is used by the slave side to update the values which can then be read by the master.
e.g. a refrigerator might write its current temperature using setData() every 5 seconds.
That data would only leave the device if a master device like a home automation controller made a request for it.
Looks like the slave would handle that request in QModbusServer::processRequest()
I am wracking my brain as to how the QModbusTcpServer is suppose to write to the slaves/clients? When I use QModbusTcpServer::setData() it does not send anything to the slaves as far as I can tell.
I can not find an example of how to do this anywhere. The Qt Examples seem like the slave is the only one writing and reading.
Thanks