Results 1 to 1 of 1

Thread: Modbus Protocol

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Modbus Protocol

    Hi,

    I'm trying to develop the Modbus protocol and I'm having a problem for a while.

    I want to know if I'm using a good approach.

    I have this classes:
    -CModbus(pointer to CModbusTCPTransport)
    -CModbusMaster : public CModbus
    -CModbusTCPMaster : public CModbusMaster
    -CModbusTCPTransport(has a TCP socket)

    Also I have a QTimer in the main thread and a worker thread.

    CModbusMaster has a QQueue to enqueue Modbus requests.
    CModbusMaster has a method "AddRequest" that enqueue a request.
    The worker thread does something and emits a signal connected to "AddRequest".
    The timer enqueue requests too.
    The socket is connected to a slot to recive data.
    When the socket slot is called I read the Modbus Header and some other bytes. I dequeue the Modbus request and I compare the transaction of the request(just dequeued) and the response(just arrived). This transaction must match. For a while requests it math but then it don't.

    Is this a good approach or maybe I have a bad design?

    Thanks,
    Last edited by ^NyAw^; 21st January 2008 at 10:44.
    Òscar Llarch i Galán

Similar Threads

  1. Modbus, QextSerialPort and QTimer
    By ^NyAw^ in forum General Programming
    Replies: 6
    Last Post: 27th October 2009, 16:14
  2. QUdpSocket error
    By mdecandia in forum Qt Programming
    Replies: 8
    Last Post: 25th October 2007, 10:47
  3. Qt and Uni-verse Networking Protocol
    By dvmorris in forum Qt Programming
    Replies: 0
    Last Post: 11th April 2007, 09:23
  4. Signalling Protocol
    By mahe2310 in forum Qt for Embedded and Mobile
    Replies: 7
    Last Post: 16th February 2006, 05:31

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.