4/6/2023 0 Comments Qt serial port read example(Thread modified from QSerialPort BlockingMaster example. If device is desired type ("Light"), then we format the device ID to the intended QByteArray message structure. QObject::connect(&thread, SIGNAL(timeout(QString)),įunction used to iterate through QList of devices. QObject::connect(&thread, SIGNAL(error(QString)), In this example, the serial port is used to send the current time. Setup signal-slot connections: QObject::connect(&thread, SIGNAL(sendResponse(QByteArray)), The serial port only reads a complete data after reading the complete start and end flags. I have tried many different examples and configurations, currently I am using the following: Now, my problem – I must not have my function setup properly to send and then receive the response bytes. If off, the modem would send back 0x00 in the last byte position if the device was off. The returned message indicates exactly what I would expect, that the device is on. Using Docklight, I receive the response: 02 62 1D E9 4B 05 19 00 06 02 50 20 CB CF 1E DA F7 21 00 FF I send the following message to query the state of the device: 02 62 1D E9 4B 05 19 00 I have tested my message using DockLight ( ). When I send messages to my INSTEON modem (serial), upon reading my message the device sends back a copy of my message + 0x06 (ACK Byte) followed by a status message. I am using the QSerialPort ( ) module to instantiate device IO support. I am sending (writing) bytes to a device via my serial port.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |