Changeset 15 in flair-src for trunk/lib/FlairSensorActuator/src/TargetEthController.h
- Timestamp:
- Apr 8, 2016, 3:40:57 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSensorActuator/src/TargetEthController.h
r3 r15 12 12 // 13 13 // purpose: class that gets remote controls through an ethernet connection. 14 // Typical use case: a remote control is plugged in a workstation and sends remote control 14 // Typical use case: a remote control is plugged in a workstation 15 // and sends remote control 15 16 // data to a distant target (this class) through Wifi 16 17 // … … 24 25 25 26 namespace flair { 26 27 28 29 30 31 32 33 34 35 36 27 namespace core { 28 class FrameworkManager; 29 class cvmatrix; 30 class TcpSocket; 31 class Socket; 32 } 33 namespace gui { 34 class Tab; 35 class TabWidget; 36 class DataPlot1D; 37 } 37 38 } 38 39 39 namespace flair { namespace sensor { 40 /*! \class TargetController 41 * 42 * \brief Base Class for target side remote controls 43 * 44 */ 45 class TargetEthController : public TargetController { 46 public: 47 TargetEthController(const core::FrameworkManager* parent,std::string name,uint16_t port,uint8_t priority=0); 48 ~TargetEthController(); 49 //void DrawUserInterface(); 50 protected: 51 bool IsConnected() const; 52 //axis stuff 53 std::string GetAxisName(unsigned int axisId) const; 54 //button stuff 55 std::string GetButtonName(unsigned int axisId) const; 56 //controller state stuff 57 bool ProcessMessage(core::Message *msg); 58 bool IsControllerActionSupported(ControllerAction action) const; 40 namespace flair { 41 namespace sensor { 42 /*! \class TargetController 43 * 44 * \brief Base Class for target side remote controls 45 * 46 */ 47 class TargetEthController : public TargetController { 48 public: 49 TargetEthController(const core::FrameworkManager *parent, std::string name, 50 uint16_t port, uint8_t priority = 0); 51 ~TargetEthController(); 52 // void DrawUserInterface(); 53 protected: 54 bool IsConnected() const; 55 // axis stuff 56 std::string GetAxisName(unsigned int axisId) const; 57 // button stuff 58 std::string GetButtonName(unsigned int axisId) const; 59 // controller state stuff 60 bool ProcessMessage(core::Message *msg); 61 bool IsControllerActionSupported(ControllerAction action) const; 59 62 60 bool IsDataFrameReady(); 61 void AcquireAxisData(core::cvmatrix &axis); //responsible for getting the axis data from the hardware 62 void AcquireButtonData(core::cvmatrix &button); //responsible for getting the button data from the hardware 63 bool IsDataFrameReady(); 64 void AcquireAxisData(core::cvmatrix &axis); // responsible for getting the 65 // axis data from the hardware 66 void AcquireButtonData(core::cvmatrix &button); // responsible for getting the 67 // button data from the 68 // hardware 63 69 64 70 bool ControllerInitialization(); 65 71 66 private: 67 uint16_t readBits(uint8_t offsetInBits,uint8_t valueSizeInBits,char *buffer,size_t bufferSize); 68 uint8_t getByteOrNull(char *buffer,int byte,size_t bufferSize); 69 uint32_t charBufferToUint32(char *buffer, size_t bufferSize); 70 core::TcpSocket *listeningSocket; 71 int listeningPort; 72 core::TcpSocket *controlSocket=NULL; 73 core::Socket *dataSocket; 74 std::string *axisName=NULL; 75 std::string *buttonName=NULL; 76 size_t dataFrameSize; 77 char *dataFrameBuffer; 78 char *receiveFrameBuffer; 79 size_t receiveCurrentPosition; 80 uint8_t buttonOffset; 81 }; 82 83 }} 72 private: 73 uint16_t readBits(uint8_t offsetInBits, uint8_t valueSizeInBits, char *buffer, 74 size_t bufferSize); 75 uint8_t getByteOrNull(char *buffer, int byte, size_t bufferSize); 76 uint32_t charBufferToUint32(char *buffer, size_t bufferSize); 77 core::TcpSocket *listeningSocket; 78 int listeningPort; 79 core::TcpSocket *controlSocket = NULL; 80 core::Socket *dataSocket; 81 std::string *axisName = NULL; 82 std::string *buttonName = NULL; 83 size_t dataFrameSize; 84 char *dataFrameBuffer; 85 char *receiveFrameBuffer; 86 size_t receiveCurrentPosition; 87 uint8_t buttonOffset; 88 }; 89 } 90 } 84 91 85 92 #endif // TARGETCONTROLLER_H
Note:
See TracChangeset
for help on using the changeset viewer.