Flair
Framework Libre Air
flair::sensor::HostEthController Class Referenceabstract

Base Class for host side remote controls that talks to target side through ethernet connection. More...

#include <HostEthController.h>

+ Inheritance diagram for flair::sensor::HostEthController:

Public Member Functions

 HostEthController (std::string name, std::string address, int port, uint32_t period=10, uint32_t _bitsPerAxis=7, uint8_t priority=0)
 
void DrawUserInterface ()
 
- Public Member Functions inherited from flair::core::Thread
 Thread (const Object *parent, std::string name, uint8_t priority, uint32_t stackSize=1024 *128)
 Constructor. More...
 
virtual ~Thread ()
 Destructor. More...
 
void Start (void)
 Start the thread. More...
 
void SafeStop (void)
 Set a stop flag. More...
 
bool ToBeStopped (void) const
 Set a stop flag. More...
 
void Join (void)
 Join the thread. More...
 
void SetPeriodUS (uint32_t period_us)
 Set the period in micro second. More...
 
uint32_t GetPeriodUS () const
 
void SetPeriodMS (uint32_t period_ms)
 Set the period in milli second. More...
 
uint32_t GetPeriodMS () const
 
bool IsPeriodSet (void)
 Returns if period was set. More...
 
void WaitPeriod (void) const
 Wait the period. More...
 
int WaitUpdate (const IODevice *device)
 Wait update of an IODevice. More...
 
void Suspend (void)
 Suspend the thread. More...
 
bool SuspendUntil (Time date)
 Suspend the thread with timeout. More...
 
void Resume (void)
 Resume the thread. More...
 
bool IsSuspended (void) const
 Is the thread suspended? More...
 
bool IsRunning (void) const
 Is the thread running? More...
 
void SleepUntil (Time time) const
 Sleep until absolute time. More...
 
void SleepUS (uint32_t time_us) const
 Sleep for a certain time in micro second. More...
 
void SleepMS (uint32_t time_ms) const
 Sleep for a cartain time in milli second. More...
 
- Public Member Functions inherited from flair::core::Object
 Object (const Object *parent=NULL, std::string name="", std::string type="")
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
std::string ObjectName (void) const
 Name. More...
 
std::string ObjectType (void) const
 Type. More...
 
const ObjectParent (void) const
 Parent. More...
 
std::vector< const Object * > * TypeChilds (void) const
 Childs of the same type. More...
 
std::vector< const Object * > * Childs (void) const
 Childs. More...
 
void Information (const char *function, int line, const char *format,...) const
 Formatted information. More...
 
void Warning (const char *function, const char *format,...) const
 Formatted warning. More...
 
void Error (const char *function, const char *format,...) const
 Formatted error. More...
 
bool ErrorOccured (bool recursive=true) const
 Has an errror occured? More...
 
- Public Member Functions inherited from flair::core::IODevice
 IODevice (const Object *parent, std::string name)
 Constructor. More...
 
virtual ~IODevice ()
 Destructor. More...
 
void AddDeviceToLog (const IODevice *device)
 Add an IODevice to the logs. More...
 
void AddDataToLog (const io_data *data)
 Add an io_data to the log. More...
 
void OutputToShMem (bool enabled)
 Send the output to a shared memory. More...
 
bool IsReady (void) const
 is device ready More...
 
virtual DataType const & GetInputDataType () const
 
virtual DataType const & GetOutputDataType () const
 

Protected Member Functions

virtual bool IsDataFrameReady ()
 
virtual void CompleteDataFrameGrab ()
 
virtual void ProcessMessage (core::Message *controllerAction)
 
virtual std::string GetAxisDescription (unsigned int axis)
 
virtual void GetAxisData ()=0
 
virtual std::string GetButtonDescription (unsigned int button)
 
virtual void GetButtonData ()=0
 
- Protected Member Functions inherited from flair::core::IODevice
void ProcessUpdate (io_data *data)
 Process the childs of type IODevice, and log if needed. More...
 
void SetIsReady (bool status)
 set is ready More...
 
virtual void UpdateFrom (const io_data *data)=0
 Update using provided datas. More...
 

Protected Attributes

std::string controllerName
 
core::TcpSocketcontrolSocket
 
core::UdpSocketdataSocket
 
std::string targetAddress
 
int targetPort
 
gui::Tabtab
 
gui::TabWidgettabWidget
 
char * dataFrameBuffer
 
size_t dataFrameSize
 
unsigned int axisNumber
 
core::Matrixaxis
 
gui::DataPlot1D ** axisPlot
 
uint32_t bitsPerAxis
 
uint32_t nativeBitsPerAxis
 
unsigned int buttonNumber
 
core::Matrixbutton
 
uint8_t buttonOffset
 
bool meaningfulDataAvailable
 

Additional Inherited Members

- Public Types inherited from flair::core::Object
enum  color_t { Auto = 0, Red = 31, Green = 32, Orange = 33 }
 
- Static Public Member Functions inherited from flair::core::Thread
static void WarnUponSwitches (bool enable)
 Warn if real time / non real time switches occur. More...
 

Detailed Description

Base Class for host side remote controls that talks to target side through ethernet connection.

There are 3 communication channels:

  • 1 connection with the ground station to display the values. Output for analog sticks is normalized in the range [-1, 1] (float values) (through DrawUserInterface, use a UDT socket)
  • 1 connection with the target to send the controller values (through udp socket - high bandwitdh, packets may be discarded)
  • 1 connection with the target to receive controller state modification requests (through tcp socket - low bandwidth, packets must not be discarded)