Srcp083Client Class Reference

Generate and parse SRCP 0.8.3 message. More...

#include <srcp083_client.h>

Inherits SrcpVirtualClient.

List of all members.

Public Slots

void setPower (const bool &power)
void requestNewRailState ()
void setNewEngineState ()

Public Member Functions

 Srcp083Client (QObject *parent=0)
 Simple constructor.
 ~Srcp083Client ()
 Simple destructor.

Private Slots

void srcpHandshake ()
 Implement the SRCP handshake.
void parseInfo (QString info)
Srcp083::MsgCode sendCommand (QString command)
Srcp083::MsgCode returnMsgCode (QString reply)

Static Private Attributes

static const int _bus = 1
 Store the SRCP bus.


Detailed Description

Generate and parse SRCP 0.8.3 message.

Srcp083Client implement a SRCP 0.8.3 client, it can generate and understand the SRCP messages.

Definition at line 63 of file srcp083_client.h.


Constructor & Destructor Documentation

Srcp083Client::Srcp083Client ( QObject *  parent = 0  ) 

Simple constructor.

Definition at line 4 of file srcp083_client.cpp.

Srcp083Client::~Srcp083Client (  ) 

Simple destructor.

Definition at line 9 of file srcp083_client.cpp.


Member Function Documentation

void Srcp083Client::setPower ( const bool &  power  )  [virtual, slot]

Set the power in the state power on the railroad model, need to be implement in a concrete class

Parameters:
power The power state to set

Implements VirtualClient.

Definition at line 107 of file srcp083_client.cpp.

References _bus, VirtualClient::errorOccured(), Srcp083::Ok, and sendCommand().

void Srcp083Client::requestNewRailState (  )  [virtual, slot]

Send a request to the server for setting the new rail state on the railroad model, need to be implement in a concrete class. The rail is the sender of the signal.

Implements VirtualClient.

Definition at line 115 of file srcp083_client.cpp.

References _bus, Rail::address(), Rail::decoder(), Rail::delay(), VirtualClient::errorOccured(), Rail::isOpen(), Srcp083::NoData, Srcp083::Ok, and sendCommand().

void Srcp083Client::setNewEngineState (  )  [virtual, slot]

Apply the new engine state on the railroad model, need to be implement in a concrete class

Implements VirtualClient.

Definition at line 145 of file srcp083_client.cpp.

References _bus, Engine::address(), Engine::decoder(), VirtualClient::errorOccured(), Engine::f2(), Engine::f3(), Engine::f4(), Engine::isReversed(), Engine::light(), Srcp083::NoData, Srcp083::Ok, sendCommand(), and Engine::speed().

void Srcp083Client::srcpHandshake (  )  [private, virtual, slot]

Implement the SRCP handshake.

It does an handshake with the SRCP server, sets the right protocol and checks if it is supported, then it set the right connection mode (i.e command or info). After that it send the GO to the server.

See also:
http://srcpd.sourceforge.net/srcp

Implements SrcpVirtualClient.

Definition at line 14 of file srcp083_client.cpp.

References Srcp083::ConnectionModeOk, VirtualClient::errorOccured(), Srcp083::Ok, Srcp083::ProtocolOk, returnMsgCode(), SrcpSocket::sendMsg(), SrcpVirtualClient::setConnection(), SrcpSocket::srcpReadLine(), SrcpSocket::start(), and SrcpSocket::type().

void Srcp083Client::parseInfo ( QString  info  )  [private, virtual, slot]

Parse the info received from the SRCP server

Parameters:
info The info received

Implements SrcpVirtualClient.

Definition at line 78 of file srcp083_client.cpp.

References Srcp083::Info, VirtualClient::infoReceivedEngineState(), VirtualClient::infoReceivedPower(), VirtualClient::infoReceivedRailState(), and returnMsgCode().

Srcp083::MsgCode Srcp083Client::sendCommand ( QString  command  )  [private, slot]

Send the requested command to the SRCP server

Parameters:
command The command to send
Returns:
The SRCP message code, or 0 if no answer code in found.
See also:
returnMsgCode(), Srcp083

Definition at line 101 of file srcp083_client.cpp.

References SrcpVirtualClient::commandClient(), returnMsgCode(), and SrcpSocket::sendMsg().

Referenced by requestNewRailState(), setNewEngineState(), and setPower().

Srcp083::MsgCode Srcp083Client::returnMsgCode ( QString  reply  )  [private, slot]

Parse the reply and return the SRCP message code

Parameters:
reply The reply received
Returns:
The SRCP message code, or 0 if no answer code in found.
See also:
Srcp083

Definition at line 68 of file srcp083_client.cpp.

Referenced by parseInfo(), sendCommand(), and srcpHandshake().


Member Data Documentation

const int Srcp083Client::_bus = 1 [static, private]

Store the SRCP bus.

Definition at line 117 of file srcp083_client.h.

Referenced by requestNewRailState(), setNewEngineState(), and setPower().


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

Generated on Sun Jun 22 23:46:29 2008 for OrK by  doxygen 1.5.6