5#include "BaseSettings.h"
7#include "BaseDataExtractor.h"
10#define MONITORING_ENABLED
14#ifdef STARFLEETTOOLBOX_EXPORTS
15#define BASECOMM __declspec(dllexport)
17#define BASECOMM __declspec(dllimport)
20#define MONITORING_TIMESLEEP 500
22#define MONITORING_MODE unsigned int
23#define MONITORING_OFF 0
24#define MONITORING_ON 1
25#define AUTO_RECONNECT 2
27#define CONNECTION_LOST 3
28#define DISCONNECTING 4
32#define CONNECTION_BACK 8
33#define NO_CONNECTION 9
39class BASECOMM BaseCommunication
abstract
150 bool _connectHasBeenCalled =
false;
151 volatile int _connectionState = DISCONNECTED;
180 virtual void Connect(
bool forceMoninoring) = 0;
184 volatile int _connStatus = 0;
189 MONITORING_MODE _monitoringMode = MONITORING_OFF;
190 thread _monitoringWorker;
197 bool _monitoringExit =
false;
200 BaseSettings* _settings;
201 BaseDataExtractor* _dataExtractor;
void StartMonitoring()
Starts the monitoring process.
int GetConnectionState()
Returns the actual connection state. /!\: monitoring must be turned to ON to get the realtime status....
BaseCommunication()
Base constructor.
virtual void Disconnect()=0
Pure virtual method that will help the caller to proceed to media disconection.
void SetConnectionState(int connectionState)
Indicates the default value for connection state flag.
void SetDataExtractor(BaseDataExtractor *pDataExtractor)
Sets the data extractor.
BaseDataExtractor * GetDataExtractor()
Gets the data extractir.
virtual RawData WaitForRawData(int waitTimeout, unsigned long *semStatus)=0
Pure virtual method that will help the caller to wait for RAW data comming from the media.
void SetHeartBeatCallback(void(*pCallback)(CONNECTION_CALLBACK *))
Sets the caller program static method that will be called by the HEARTBEAT internal process.
bool IsConnected()
Indicates rather or not connect or disconnect method has been called.
void AllocCallbackCaller(CONNECTION_CALLBACK *caller)
Allocate the callback structure for the caller program Allocating the callback structure is mandatori...
BaseSettings * GetSettings()
Gets the communication settings.
virtual void Connect(bool forceMoninoring)=0
Proceed to TCP and UDP connection semaphores and mutex creation and Threads launching force monitorin...
virtual int GetCommunicationStatus()=0
Returns the communication status.
virtual void Connect()=0
Pure virtual method that will help the caller to proceed to the connection to media.
void StopMonitoring()
Stops the monitoring process.
void * _mutexMonitoring
Definition BaseCommunication.h:182
MONITORING_MODE GetMonitoringMode()
Returns the monitoring mode.
virtual string SendCommand(string commandToSend)=0
Pure virtual method that will help the caller to send command on the media.
~BaseCommunication()
Destructor.
BaseCommunication(MONITORING_MODE monitor)
Base constructor.
void * _mutexConnectState
The mutex for the monitoring flag.
Definition BaseCommunication.h:183
void SetSettings(BaseSettings *settings)
Sets the communication settings.
The base class encapsulating sensor's RAW data.
Definition RawData.h:14