Basic abstract communication class. Must be implemented by subclasses in charge of communication. More...
#include <BaseCommunication.h>
Public Member Functions | |
| BaseCommunication () | |
| Base constructor. | |
| BaseCommunication (MONITORING_MODE monitor) | |
| Base constructor. | |
| ~BaseCommunication () | |
| Destructor. | |
| void | SetSettings (BaseSettings *settings) |
| Sets the communication settings. | |
| BaseSettings * | GetSettings () |
| Gets the communication settings. | |
| void | SetDataExtractor (BaseDataExtractor *pDataExtractor) |
| Sets the data extractor. | |
| BaseDataExtractor * | GetDataExtractor () |
| Gets the data extractir. | |
| virtual CommunicationStatus | Connect ()=0 |
| Pure virtual method that will help the caller to proceed to the connection to media. | |
| virtual void | Disconnect ()=0 |
| Pure virtual method that will help the caller to proceed to media disconection. | |
| virtual CommunicationStatus | GetConnectionStatus ()=0 |
| Returns the actual connection state. | |
| bool | IsConnected () |
| Indicates rather or not connect or disconnect method has been called. | |
| virtual string | SendCommand (string commandToSend)=0 |
| Pure virtual method that will help the caller to send command on the media. | |
| 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 | StartMonitoring () |
| Starts the monitoring process. | |
| void | StopMonitoring () |
| Stops the monitoring process. | |
| void | SetCommunicationCallback (ConnectionCheckerCallback) |
| void | SetCommunicationCallback (void(*ConnectionCheckerCallbackMethod)(CommunicationStatus *)) |
| virtual RawData | ExtractData (vector< string >pDataToExtract)=0 |
| Pure virtual method that will help the caller to extract the rawdata from a stream. | |
| virtual bool | IsCommandAcknowledgment (string pDataToVerify)=0 |
| Pure virtual method that will help the caller to discriminate rawdata header from acknowledgment command data. | |
| virtual bool | IsHeader (string pDataToVerify)=0 |
| Pure virtual method that will thel the caller to check if the packet is a BEA Header. | |
| virtual bool | IsEndOfPacket (string pDataToVerify)=0 |
| Pure virtual method that will help the caller to check if stream packet is the end of stream. | |
| virtual bool | IsFirstPacket (string pDataToVerify)=0 |
| virtual int | GetPacketHeaderSizeToRead ()=0 |
| Returns a pointer on an array with a determined size. | |
| virtual int | CountToReadForLength (char *pHeaderBuffer)=0 |
| Indicates how much byte must be read in order to obtain packet len. | |
| virtual int | GetPacketLengthToRead (char *pLenHeaderBuffer, int pPacketType)=0 |
| Retrieve, in the pLenHeaderBuffer, the amount of data to read. | |
| BaseDataRecorder () | |
| Base constructor. | |
| ~BaseDataRecorder () | |
| Destructor. | |
| virtual int | GetStatus ()=0 |
| Returns the recorder's status (STOPPED, PLAYING, RECORDING) | |
| virtual void | Play ()=0 |
| Plays a record from the file. | |
| virtual void | Pause ()=0 |
| Pause the playback. | |
| virtual void | Stop ()=0 |
| Stops either playing or recording. | |
| virtual void | Record ()=0 |
| Start recording data. | |
| virtual void | ExportToCsv (string pPathToExport, MEASURMENT_UNIT pMeasurmentSystem)=0 |
| Exports record file to CSV only if recorder is in STOP mode. | |
| virtual void | FetchRecord (RawData data)=0 |
| Records RawData in the file (internal usage only) | |
| virtual RawData | WaitForRawData ()=0 |
| Wait for a data comming from the player. | |
| void | SetFrameRate (int pFrameRate) |
| Sets the framerate (thread safe) | |
| int | GetFrameRate () |
| Gets the current framerate (thread safe) | |
| long | GetTotalFrame () |
| Returns the total frames contained in the record. | |
| long | GetCurrentFramePosition () |
| Returns the actual frame position in the record whilm being played. | |
| BaseSensor () | |
| Base constructor. | |
| BaseSensor (BaseCommunication *comm) | |
| Copy constructor (sets the communication layer) | |
| ~BaseSensor () | |
| Destructor. | |
| BaseCommunication * | GetCommunication () |
| Returns the communication layer. | |
| void | SetCommunication (BaseCommunication *pCom) |
| Sets the communication layer. | |
| BaseDataRecorder * | GetDataRecorder () |
| Returns the data recorder. | |
| void | SetDataRecorder (BaseDataRecorder *pDataRecorder) |
| Sets the data recorder. | |
| virtual CommunicationStatus | Initialize ()=0 |
| Pure virtual definition of a function that will initialise the extend class (connection, threads creation etc.) | |
| virtual void | Close ()=0 |
| Pure virtual method that closes all communication stops all threads and cleanup memory This method must be called when finishing usage of sensor. | |
| virtual RawData | RetrieveRawData ()=0 |
| Pure virtual definition of a function that will help the caller to retrieve the data. | |
| vector< AvailableResolution > | GetAvailableResolutions () |
| Gets available ensor resolutions. | |
| virtual SoftwareVersion | GetVersion ()=0 |
| Gets the sensor version data. | |
| BaseSettings () | |
| Base constructor. | |
| ~BaseSettings () | |
| Destructor. | |
| void | SetTranslateCode (string translateCode) |
| string | GetTranslateCode () |
Static Public Member Functions | |
| static vector< AvailableResolution > | GetAvailableResolutions (PRODUCT_IDENTIFICATION productIdentifier) |
Static Public Attributes | |
| static const int | STOPPED = 0 |
| static const int | PLAYING = 1 |
| static const int | RECORDING = 2 |
| static const int | FAILED_START_RECORDING = 3 |
| static const int | FAILED_INITIALIZE = 4 |
| static const int | PAUSED = 5 |
Protected Member Functions | |
| MONITORING_MODE | GetMonitoringMode () |
| Returns the monitoring mode. | |
| virtual CommunicationStatus | Reconnect ()=0 |
| void | SetTotalFrame (long pTotalFrame) |
| Sets the total frame of the record. | |
| void | SetCurrentFramePosition (long pCurrentFramePosition) |
| Sets the current frame being read. | |
| char | ComputeChecksum (string pTocompute) |
| string | ComputeBinaryCommand (string pToCompute) |
Protected Attributes | |
| std::atomic< bool > | _connected |
| std::atomic< bool > | _reconnecting |
| bool | _connectHasBeenCalled = false |
| void * | _mutexMonitoring |
| void * | _mutexConnectState |
| The mutex for the monitoring flag. | |
| volatile int | _connStatus = 0 |
| The mutex for the connection state value. | |
| string | HEADER = { 0x02 , 0x02, (char)0xBE,(char)0xA0, 0x12, 0x34 } |
| string | CHECKSUM = { 0x03 } |
| string | cRN = { 0x63, 0x52, 0x4E } |
| string | cWN = { 0x63, 0x57, 0x4E } |
| string | cRA = { 0x63, 0x52, 0x41 } |
| string | cWA = { 0x63, 0x57, 0x41 } |
| string | SPC = { 0x20 } |
| string | SendMDI = { 0x53 ,0x65 ,0x6E ,0x64 ,0x4D ,0x44 ,0x49 } |
| string | StopMDI = { 0x53 ,0x74 ,0x6F ,0x70 ,0x4D ,0x44 ,0x49 } |
| string | GetIP = { 0x47, 0x65, 0x74, 0x49, 0x50 } |
| string | GetGW = { 0x47 ,0x65 ,0x74 ,0x47 ,0x57 } |
| string | GetMask = { 0x47 ,0x65 ,0x74 ,0x4D ,0x61 ,0x73 ,0x6B } |
| string | GetDHCP = { 0x47 ,0x65 ,0x74 ,0x44 ,0x48 ,0x43 ,0x50 } |
| string | GetProto = { 0x47 ,0x65 ,0x74 ,0x50 ,0x72 ,0x6F ,0x74 ,0x6F } |
| string | GetPort = { 0x47 ,0x65 ,0x74 ,0x50 ,0x6F ,0x72 ,0x74 } |
| string | GetPType = { 0x47 ,0x65 ,0x74 ,0x50 ,0x54 ,0x79 ,0x70, 0x65 } |
| string | GetResol = { 0x47 ,0x65 ,0x74 ,0x52 ,0x65 ,0x73 ,0x6F, 0x6C } |
| string | GetDir = { 0x47 ,0x65 ,0x74 ,0x44 ,0x69 ,0x72 } |
| string | GetRange = { 0x47 ,0x65 ,0x74 ,0x52, 0x61, 0x6E, 0x67, 0x65 } |
| string | GetSkip = { 0x47 ,0x65 ,0x74 ,0x53, 0x6B, 0x69, 0x70 } |
| string | GetCont = { 0x47 ,0x65 ,0x74 ,0x43, 0x6F, 0x6E, 0x74 } |
| string | GetStat = { 0x47 ,0x65 ,0x74 ,0x53, 0x74, 0x61, 0x74 } |
| string | GetVer = { 0x47 ,0x65 ,0x74 ,0x56, 0x65, 0x72 } |
| string | GetTem = { 0x47 ,0x65 ,0x74 ,0x54, 0x65, 0x6D } |
| string | GetELog = { 0x47 ,0x65 ,0x74 ,0x45, 0x4C, 0x6F, 0x67 } |
| string | GetLED = { 0x47 ,0x65 ,0x74 ,0x4C, 0x45, 0x44 } |
| string | GetLamp = { 0x47 ,0x65 ,0x74 ,0x4C, 0x61, 0x6D, 0x70 } |
| string | GetEthCfg = { 0x47 ,0x65 ,0x74 ,0x45 ,0x74 ,0x68, 0x43, 0x66, 0x67 } |
| string | GetHours = { 0x47 ,0x65 ,0x74 ,0x48 ,0x6F ,0x75, 0x72, 0x73 } |
| string | GetName = { 0x47 ,0x65 ,0x74 ,0x4E ,0x61 ,0x6D, 0x65 } |
| string | GetFilter = { 0x47 ,0x65 ,0x74 ,0x46 ,0x69 ,0x6C, 0x74, 0x65 , 0x72 } |
| string | GetWCalib = { 0x47 ,0x65 ,0x74, 0x57, 0x43, 0x61, 0x6C, 0x69, 0x62 } |
| string | GetECode = { 0x47 ,0x65 ,0x74 ,0x45 ,0x43 ,0x6F, 0x64, 0x65 } |
| string | SetIP = { 0x53, 0x65, 0x74, 0x49, 0x50 } |
| string | SetGW = { 0x53, 0x65, 0x74, 0x47, 0x57 } |
| string | SetMask = { 0x53, 0x65, 0x74, 0x4D, 0x61, 0x73, 0x6B } |
| string | SetDHCP = { 0x53, 0x65, 0x74, 0x44, 0x48, 0x43, 0x50 } |
| string | SetProto = { 0x53, 0x65, 0x74, 0x50, 0x72, 0x6F, 0x74,0x6F } |
| string | SetPort = { 0x53, 0x65, 0x74, 0x50, 0x6F, 0x72, 0x74 } |
| string | SetPType = { 0x53, 0x65, 0x74, 0x50, 0x54, 0x79, 0x70, 0x65 } |
| string | SetResol = { 0x53, 0x65, 0x74, 0x52,0x65, 0x73, 0x6F, 0x6C } |
| string | SetDir = { 0x53, 0x65, 0x74, 0x44, 0x69, 0x72 } |
| string | SetRange = { 0x53, 0x65, 0x74, 0x52, 0x61, 0x6E, 0x67, 0x65 } |
| string | SetSkip = { 0x53, 0x65, 0x74, 0x53, 0x6B, 0x69, 0x70 } |
| string | SetCont = { 0x53, 0x65, 0x74, 0x43, 0x6F, 0x6E, 0x74 } |
| string | SetLED = { 0x53, 0x65, 0x74, 0x4C, 0x45, 0x44 } |
| string | SetEthCfg = { 0x53 ,0x65 ,0x74 ,0x45 ,0x74 ,0x68, 0x43, 0x66, 0x67 } |
| string | SetName = { 0x53 ,0x65 ,0x74 ,0x4E ,0x61 ,0x6D, 0x65 } |
| string | SetFilter = { 0x53 ,0x65 ,0x74 ,0x46 ,0x69 ,0x6C, 0x74, 0x65 , 0x72 } |
| string | SetWCalib = { 0x53 ,0x65 ,0x74, 0x57, 0x43, 0x61, 0x6C, 0x69, 0x62 } |
| string | Reset = { 0x52, 0x65, 0x73, 0x65, 0x74 } |
| string | Reboot = { 0x52, 0x65, 0x62, 0x6F, 0x6F, 0x74 } |
Basic abstract communication class. Must be implemented by subclasses in charge of communication.
Basic abstract communication settings class. Must be implemented by subclasses in charge of communication settings.
Basic representation of a sensor. Must be inherited by subclasses in charge of sensor implementation This base class encapsulate the communication mechanism.
A basic data extractor used by the communication classes to know HOW to extract RAW data from a stream.
| abstract::~BaseCommunication | ( | ) |
Destructor.
| abstract::~BaseDataRecorder | ( | ) |
Destructor.
| abstract::~BaseSensor | ( | ) |
Destructor.
| abstract::~BaseSettings | ( | ) |
Destructor.
| abstract::BaseCommunication | ( | ) |
Base constructor.
| abstract::BaseCommunication | ( | MONITORING_MODE | monitor | ) |
Base constructor.
| abstract::BaseDataRecorder | ( | ) |
Base constructor.
| abstract::BaseSensor | ( | ) |
Base constructor.
| abstract::BaseSensor | ( | BaseCommunication * | comm | ) |
Copy constructor (sets the communication layer)
| comm | The communication layer to be used |
| abstract::BaseSettings | ( | ) |
Base constructor.
|
pure virtual |
Pure virtual method that closes all communication stops all threads and cleanup memory This method must be called when finishing usage of sensor.
|
protected |
|
protected |
|
pure virtual |
Pure virtual method that will help the caller to proceed to the connection to media.
|
pure virtual |
Indicates how much byte must be read in order to obtain packet len.
|
pure virtual |
Pure virtual method that will help the caller to proceed to media disconection.
|
pure virtual |
Exports record file to CSV only if recorder is in STOP mode.
| pPathToExport | The fulle filepath name to export the data |
|
pure virtual |
Pure virtual method that will help the caller to extract the rawdata from a stream.
| pDataToExtract | A vector representing the data frames |
|
pure virtual |
Records RawData in the file (internal usage only)
| data | The rawdata to be recorded |
| vector< AvailableResolution > abstract::GetAvailableResolutions | ( | ) |
Gets available ensor resolutions.
|
static |
| BaseCommunication * abstract::GetCommunication | ( | ) |
Returns the communication layer.
|
pure virtual |
Returns the actual connection state.
| long abstract::GetCurrentFramePosition | ( | ) |
Returns the actual frame position in the record whilm being played.
| BaseDataExtractor * abstract::GetDataExtractor | ( | ) |
Gets the data extractir.
| BaseDataRecorder * abstract::GetDataRecorder | ( | ) |
Returns the data recorder.
| int abstract::GetFrameRate | ( | ) |
Gets the current framerate (thread safe)
|
protected |
Returns the monitoring mode.
|
pure virtual |
Returns a pointer on an array with a determined size.
|
pure virtual |
Retrieve, in the pLenHeaderBuffer, the amount of data to read.
| pLenHeaderBuffer | |
| pPacketType |
| BaseSettings * abstract::GetSettings | ( | ) |
Gets the communication settings.
|
pure virtual |
Returns the recorder's status (STOPPED, PLAYING, RECORDING)
| long abstract::GetTotalFrame | ( | ) |
Returns the total frames contained in the record.
| string abstract::GetTranslateCode | ( | ) |
|
pure virtual |
Gets the sensor version data.
|
pure virtual |
Pure virtual definition of a function that will initialise the extend class (connection, threads creation etc.)
|
pure virtual |
Pure virtual method that will help the caller to discriminate rawdata header from acknowledgment command data.
| pDataToVerify | A string representing the stream result |
| bool abstract::IsConnected | ( | ) |
Indicates rather or not connect or disconnect method has been called.
|
pure virtual |
Pure virtual method that will help the caller to check if stream packet is the end of stream.
| pDataToVerify | A string representing the setream packet |
|
pure virtual |
Pure virtual method that will help the caller to check if stream packet is the first packet of stream
| pDataToVerify | A string representing the setream packet |
|
pure virtual |
Pure virtual method that will thel the caller to check if the packet is a BEA Header.
| pDataToVerify | A string representing the stream packet |
|
pure virtual |
Pause the playback.
|
pure virtual |
Plays a record from the file.
|
protectedpure virtual |
|
pure virtual |
Start recording data.
|
pure virtual |
Pure virtual definition of a function that will help the caller to retrieve the data.
|
pure virtual |
Pure virtual method that will help the caller to send command on the media.
| commandToSend | A string representing the command to be sent |
| void abstract::SetCommunication | ( | BaseCommunication * | pCom | ) |
Sets the communication layer.
| pCom | The communication layer to be set |
| void abstract::SetCommunicationCallback | ( | ConnectionCheckerCallback | ) |
| void abstract::SetCommunicationCallback | ( | void(* | ConnectionCheckerCallbackMethod )(CommunicationStatus *) | ) |
|
protected |
Sets the current frame being read.
| pCurrentFramePosition | The current frame position |
| void abstract::SetDataExtractor | ( | BaseDataExtractor * | pDataExtractor | ) |
Sets the data extractor.
| pDataExtractor | The data extractor to be set |
| void abstract::SetDataRecorder | ( | BaseDataRecorder * | pDataRecorder | ) |
Sets the data recorder.
| pDataRecorder | The data recorder layer to be set |
| void abstract::SetFrameRate | ( | int | pFrameRate | ) |
Sets the framerate (thread safe)
| pFrameRate | an integer representing the framerate |
| void abstract::SetSettings | ( | BaseSettings * | settings | ) |
Sets the communication settings.
| settings | The communication settings to be set |
|
protected |
Sets the total frame of the record.
| pTotalFrame | The total frame |
| void abstract::SetTranslateCode | ( | string | translateCode | ) |
| void abstract::StartMonitoring | ( | ) |
Starts the monitoring process.
|
pure virtual |
Stops either playing or recording.
| void abstract::StopMonitoring | ( | ) |
Stops the monitoring process.
|
pure virtual |
Wait for a data comming from the player.
|
pure virtual |
Pure virtual method that will help the caller to wait for RAW data comming from the media.
| waitTimeout | The amount of miliseconds the process has to wait befor being released |
| semStatus | The status of the semaphore (updated by reference) |
|
protected |
|
protected |
|
protected |
The mutex for the connection state value.
|
protected |
The mutex for the monitoring flag.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
|
static |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
|
static |
|
protected |
|
static |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |