stec-platform
cyo::Transceiver Class Reference

The Transceiver class interprocess commununication transceiver. More...

#include <transceiver.h>

Inheritance diagram for cyo::Transceiver:
Collaboration diagram for cyo::Transceiver:

Public Member Functions

 Transceiver ()
 Transceiver.
 
void reset ()
 virtual makes blocksize 0
 
virtual void userDataPacket (const QVariantList &msg)
 called when there is a complete message received
 
void bytesReady (QTcpSocket *xm)
 this will throw and exception if error occurs, user can act on the exception or let the system die More...
 

Static Public Member Functions

static QByteArray encode (QVariantList vl, QTcpSocket *xm=nullptr)
 
static QVariantList decode (const QByteArray &txStream)
 

Detailed Description

The Transceiver class interprocess commununication transceiver.

Used with auto-reconnect Used with stdcom2 nextstep 2 communication

Member Function Documentation

◆ bytesReady()

void cyo::Transceiver::bytesReady ( QTcpSocket xm)

this will throw and exception if error occurs, user can act on the exception or let the system die

do this way incase of MAC coming in

there are 4 cases we need to handle:

  1. The socket did not receive enough data to be a complete message, we only received a partial
  2. There is exactly enough data in the socket buffer to read a message
  3. There is more than enough data in the socket buffer to read a message but not enough to read 2 messages
  4. There is enough data in the socket buffer to read multiple messages

Cases 2 we successfully read some data

number of bytes in the message

this is without the initial size

Cases 3 and 4 loop and try to read more data if they are available

Cases 1 just exit the function and wait for more data to come in commitTransaction() will actually rollback if it detects there was an error and return false


The documentation for this class was generated from the following files: