TestCenter Reference
TestCenterAdvanced.IPC.Communicator Class Reference

The Communicator is the superclass for the communicating entities. More...

Inheritance diagram for TestCenterAdvanced.IPC.Communicator:
TestCenterAdvanced.IPC.ComMaster TestCenterAdvanced.IPC.ComSlave

Public Member Functions

def __init__ (self)
 
def getPort (self)
 Get the port used for connections. More...
 
def isConnected (self)
 Get the connection status of the IPC client. More...
 
def send (self, data, timeout)
 Send the data via the socket using the given timeout. More...
 
def recv (self, timeout)
 Receive data via the socket using the given timeout. More...
 
def getLastError (self)
 Get a tuple describing the last error. More...
 
def getLastErrorWithMessage (self)
 Get a tuple describing the last error. More...
 

Detailed Description

The Communicator is the superclass for the communicating entities.

This class contains the fundamental routines for sending messages between the two entities master and slave. The communication protocol consists of two parts. First the length of the message is sent via a string with exactly 16 bytes. This fixed length is essential as with asynchronous communication many non obvious things can happen (like only parts of messages being transmitted or concatenation of successivly sent messages). The second part of the communication protocol sends the actual data in junks of a given size.

Definition at line 51 of file IPC.py.

Constructor & Destructor Documentation

◆ __init__()

Member Function Documentation

◆ getLastError()

def TestCenterAdvanced.IPC.Communicator.getLastError (   self)

Get a tuple describing the last error.

Each failure event sets an internal error code which can be read using this method.

Definition at line 203 of file IPC.py.

References TestCenterAdvanced.IPC.Communicator._mErrorCode, and TestCenterAdvanced.IPC.ComMaster._mErrorCode.

◆ getLastErrorWithMessage()

def TestCenterAdvanced.IPC.Communicator.getLastErrorWithMessage (   self)

◆ getPort()

def TestCenterAdvanced.IPC.Communicator.getPort (   self)

Get the port used for connections.

Definition at line 78 of file IPC.py.

References TestCenterAdvanced.IPC.Communicator._mPort, and TestCenterAdvanced.IPC.ComMaster._mPort.

◆ isConnected()

def TestCenterAdvanced.IPC.Communicator.isConnected (   self)

◆ recv()

def TestCenterAdvanced.IPC.Communicator.recv (   self,
  timeout 
)

Receive data via the socket using the given timeout.

This method implements the receiving part of the protocol specified in the description of send. This method returns True if it succeeded sending the data, False otherwise.

Definition at line 147 of file IPC.py.

References TestCenterAdvanced.IPC.Communicator._csocket, TestCenterAdvanced.IPC.ComSlave._csocket, TestCenterAdvanced.IPC.Communicator._handleError(), TestCenterAdvanced.IPC.Communicator._mConnected, TestCenterAdvanced.IPC.ComMaster._mConnected, TestCenterAdvanced.IPC.ComSlave._mConnected, and TestCenterAdvanced.IPC.Communicator._recv().

◆ send()

def TestCenterAdvanced.IPC.Communicator.send (   self,
  data,
  timeout 
)

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