00001 #ifndef _REC_ROBOTINO_SERVER_V1_SERVER_H_ 00002 #define _REC_ROBOTINO_SERVER_V1_SERVER_H_ 00003 00004 #include "rec/robotino/server/defines.h" 00005 #include "rec/robotino/server/ServerImpl.h" 00006 #include "rec/iocontrol/remotestate/SensorState.h" 00007 #include "rec/iocontrol/remotestate/SetState.h" 00008 00009 #include <QObject> 00010 #include <QMutex> 00011 #include <QWaitCondition> 00012 #include <QTime> 00013 #include <QHostAddress> 00014 00015 namespace rec 00016 { 00017 namespace robotino 00018 { 00019 namespace server 00020 { 00021 namespace v1 00022 { 00023 class Server : public rec::robotino::server::ServerImpl 00024 { 00025 Q_OBJECT 00026 public: 00027 Server( bool isMaster ); 00028 00032 void setSensorState( const rec::iocontrol::remotestate::SensorState& sensorState ); 00033 00034 void run( QTcpSocket& socket, const QByteArray& alreadyReceived ); 00035 00036 Q_SIGNALS: 00037 void setStateReceived( const rec::iocontrol::remotestate::SetState& ); 00038 00039 void cameraControlReceived( unsigned int width, unsigned int height ); 00040 00041 void clientImageRequest( bool enable, quint32 address, quint16 port ); 00042 00043 private: 00044 bool readMessageData( QTcpSocket& socket, const QByteArray& headerData ); 00045 00046 void cleanup(); 00047 00048 int _readTimeout; 00049 00050 rec::iocontrol::remotestate::SensorState _sensorState; 00051 00052 QTime _setSensorStateTimer; 00053 QMutex _mutex; 00054 QWaitCondition _sensorStateSet; 00055 00056 rec::iocontrol::remotestate::SetState _setState; 00057 00058 bool _isImageRequest; 00059 quint32 _imageReceiverAddress; 00060 quint16 _imageReceiverPort; 00061 }; 00062 } 00063 } 00064 } 00065 } 00066 00067 #endif //_REC_ROBOTINO_SERVER_V1_SERVER_H_