YANE-Framework 1.1.0
Public Member Functions | Static Public Attributes | Static Protected Member Functions | Protected Attributes

yane::NetworkedControl::IOInterfaceTCP Class Reference

Class for connecting components in a distributed plant - sensor - controller - actuator setting with a TCP network connection.

Inheritance diagram for yane::NetworkedControl::IOInterfaceTCP:
Collaboration diagram for yane::NetworkedControl::IOInterfaceTCP:

List of all members.

Public Member Functions

void closeConnection ()
 Function to close the connection to a process.
void connectToModel (yane::Model::Model *model, const char *addr, int port=41923)
 Function to connect to a process.
 IOInterfaceTCP (int seqlengthhint, yane::Utils::DebugMaster *dm=0, yane::Utils::StatisticsMaster *sm=0, int buffersize=8192)
virtual bool isConnected ()
 Function to return whether network connection has been established.
yane::Model::Modelmodel ()
 Function to return the used class yane::Model::Model pointer.
virtual void readActor (T_ACTORPACKET *response)
 Function to read actuator responds from network connection.
virtual void readInput (T_INPUTPACKET *indata, double *data)
 Function to read sensor input from network connection.
virtual double samplingTime ()
 Function to return the sampling period.
virtual int sequenceLength ()
 Function to return the length of the sent control sequence.
virtual void writeOutput (T_OUTPUTPACKET *outdata, double *data)
 Function to send output from controller to network connection.
virtual ~IOInterfaceTCP ()

Static Public Attributes

static const int ACTORERRORCODE = 0x2EE878B8
 Actuator error code.
static const int ACTORSUCCESSCODE = 0x7E004BC2
 Actuator success code.
static const int INPUTCODE = 0x9A10092F
 Input error code.
static const int OUTPUTCODE = 0xF02891C2
 Output error code.

Static Protected Member Functions

static void tcp_callback (char *packetdata, int packetlength, void *ptr)
 Callback function to handle incoming data packets.

Protected Attributes

 Pointer of the actuator data buffer.
 Pointer of the actuator semaphore.
 Pointer of the TCP network client.
 Pointer of the debug client of class yane::Utils::DebugClient.
 Pointer of the sensor data buffer.
 Pointer of the sensor semaphore.
 Pointer of the used class yane::Model::Model model.
char * _outputbuffer
 Name of the output buffer.
double _samplingTime
 Sampling period.
int _seqlengthhint
 Indicator of the length of the sensor packet to receive.
int _sequenceLength
 Length of the control sequence.

Constructor & Destructor Documentation

LIB_EXPORT yane::NetworkedControl::IOInterfaceTCP::IOInterfaceTCP ( int  seqlengthhint,
yane::Utils::DebugMaster dm = 0,
yane::Utils::StatisticsMaster sm = 0,
int  buffersize = 8192 


seqlengthhintLength of the control sequence
dmPointer of the debugmanager of class yane::Utils::DebugMaster
smPointer of the statistics manager of class yane::Utils::StatisticsMaster
buffersizeSize of the buffer for storing control values

Member Function Documentation

LIB_EXPORT void yane::NetworkedControl::IOInterfaceTCP::connectToModel ( yane::Model::Model model,
const char *  addr,
int  port = 41923 

Function to cause an internal network client to connect to a process

modelPointer of the model of class yane::Model::Model which shall be connected
addrAddress of the process to connect to
portLocal port to connect the network connection to
LIB_EXPORT bool yane::NetworkedControl::IOInterfaceTCP::isConnected ( ) [virtual]

Function to return whether network connection has been established

Implements yane::NetworkedControl::IOInterface.

LIB_EXPORT yane::Model::Model * yane::NetworkedControl::IOInterface::model ( ) [inherited]

Function to return the used class yane::Model::Model pointer

LIB_EXPORT void yane::NetworkedControl::IOInterfaceTCP::readActor ( T_ACTORPACKET response) [virtual]

Function to read actuator responds from network connection

responseActuator responds packet

Implements yane::NetworkedControl::IOInterface.

LIB_EXPORT void yane::NetworkedControl::IOInterfaceTCP::readInput ( T_INPUTPACKET indata,
double *  data 
) [virtual]

Function to read sensor input from network connection

indataSensor input packet
dataAdditional data information

Implements yane::NetworkedControl::IOInterface.

LIB_EXPORT double yane::NetworkedControl::IOInterfaceTCP::samplingTime ( ) [virtual]

Function to return the sampling period

Implements yane::NetworkedControl::IOInterface.

LIB_EXPORT int yane::NetworkedControl::IOInterfaceTCP::sequenceLength ( ) [virtual]

Function to return the length of the sent control sequence

Implements yane::NetworkedControl::IOInterface.

LIB_EXPORT void yane::NetworkedControl::IOInterfaceTCP::tcp_callback ( char *  packetdata,
int  packetlength,
void *  ptr 
) [static, protected]

Callback function to handle incoming data packets

packetdataIdentifier and data packet of incoming data
packetlengthLength of incoming data
ptrBase pointer of the class yane::NetworkedControl::IOInterfaceTCP network connection handler
LIB_EXPORT void yane::NetworkedControl::IOInterfaceTCP::writeOutput ( T_OUTPUTPACKET outdata,
double *  data 
) [virtual]

Function to send output from controller to network connection

outdataOutput data package
dataAdditional data information

Implements yane::NetworkedControl::IOInterface.