00001 
00008 
00009 #ifndef SRCP083_CLIENT_H
00010 #define SRCP083_CLIENT_H
00011 
00012 #include "srcp_virtual_client.h"
00013 
00014 #include <cmath>
00015 
00021 namespace Srcp083
00022 {
00023         enum MsgCode
00024         {
00025                 None = 0,
00026                 Info = 100,
00027                 Initialization = 101,
00028                 Termination = 102,
00029                 Ok = 200,
00030                 ProtocolOk = 201,
00031                 ConnectionModeOk = 202,
00032                 UnsupportedProtocol = 400,
00033                 UnsupportedConnectionMode = 401,
00034                 UnsufficientData = 402,
00035                 UnknownCommand = 410,
00036                 UnknownValue = 411,
00037                 WrongValue = 412,
00038                 TemporarilyProhibited = 413,
00039                 DeviceLocked = 414,
00040                 Forrbidden = 415,
00041                 NoData = 416,
00042                 Timeout = 417,
00043                 ListTooLong = 418,
00044                 ListTooShort = 419,
00045                 UnsupportedDeviceProtocol = 420,
00046                 UnsupportedDevice = 421,
00047                 UnsupportedDeviceGroup = 422,
00048                 UnsupportedOperation = 423,
00049                 DeviceRenitialized = 424,
00050                 NotSupported = 425,
00051                 UnspecifiedError = 499,
00052                 OutOfRessources = 500
00053         } ;
00054 } ;
00055 
00063 class Srcp083Client : public SrcpVirtualClient
00064 {
00065 
00066         Q_OBJECT
00067 
00068         public :
00069 
00071                 Srcp083Client( QObject* parent = 0 ) ;
00072 
00074                 ~Srcp083Client() ;
00075 
00076         public slots :
00077 
00078                 
00079                 void setPower( const bool &power ) ;
00080                 
00081                 
00082                 void requestNewRailState() ;
00083                 
00084                 
00085                 void setNewEngineState() ;
00086         
00087         private slots :
00088         
00097                 void srcpHandshake() ;
00098                 
00101                 void parseInfo( QString info ) ;
00102                 
00107                 Srcp083::MsgCode sendCommand( QString command ) ;
00108                 
00113                 Srcp083::MsgCode returnMsgCode( QString reply ) ;
00114                 
00115         private :
00117                 static const int _bus = 1 ;  
00118 
00119 } ;
00120 
00121 
00122 #endif          // SRCP083_CLIENT_H