source: flair-src/trunk/lib/FlairSensorActuator/src/TargetEthController.h@ 216

Last change on this file since 216 was 214, checked in by Sanahuja Guillaume, 6 years ago

matrix

File size: 2.6 KB
RevLine 
[3]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[3]4// %flair:license}
5// created: 2015/04/14
6// filename: TargetEthController.h
7//
8// author: Gildas Bayard
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: class that gets remote controls through an ethernet connection.
[15]14// Typical use case: a remote control is plugged in a workstation
15// and sends remote control
[3]16// data to a distant target (this class) through Wifi
17//
18//
19/*********************************************************************/
20
21#ifndef TARGETETHCONTROLLER_H
22#define TARGETETHCONTROLLER_H
23
24#include "TargetController.h"
25
26namespace flair {
[15]27namespace core {
28class FrameworkManager;
[214]29class Matrix;
[15]30class TcpSocket;
[178]31class UdpSocket;
[3]32}
[15]33namespace gui {
34class Tab;
35class TabWidget;
36class DataPlot1D;
37}
38}
[3]39
[15]40namespace flair {
41namespace sensor {
42/*! \class TargetController
43*
44* \brief Base Class for target side remote controls
45*
46*/
47class TargetEthController : public TargetController {
48public:
[137]49 TargetEthController(std::string name,
[15]50 uint16_t port, uint8_t priority = 0);
51 ~TargetEthController();
52 // void DrawUserInterface();
53protected:
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;
[3]62
[15]63 bool IsDataFrameReady();
[214]64 void AcquireAxisData(core::Matrix &axis); // responsible for getting the
[16]65 // axis data from the hardware
[214]66 void AcquireButtonData(core::Matrix &button); // responsible for getting the
[15]67 // button data from the
68 // hardware
[3]69
[15]70 bool ControllerInitialization();
[3]71
[15]72private:
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;
[178]80 core::UdpSocket *dataSocket;
[15]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}
[3]91
92#endif // TARGETCONTROLLER_H
Note: See TracBrowser for help on using the repository browser.