You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
171 lines
5.6 KiB
171 lines
5.6 KiB
#ifndef __SENSOR_LRF_3D_HEADER__
|
|
#define __SENSOR_LRF_3D_HEADER__
|
|
|
|
#include "../../../components/base/basicObject.h"
|
|
#include "../../../components/base/basicMutex.h"
|
|
#include "../../../components/base/basicDualThread.h"
|
|
#include "../../../components/base/basicLogCollection.h"
|
|
#include "../../../components/base/basicEventHeap.h"
|
|
#include "../../../components/base/basicPosition.h"
|
|
#include "../../../components/object/objectSystemAnchor.h"
|
|
#include "../../../components/base/basicSettingsProvider.h"
|
|
#include "../../../alg/lgs/mask.h"
|
|
|
|
#include "../../../data/net/clientPort.h"
|
|
#include "../../../data/protocol/protocolLGS3D_client.h"
|
|
#include "../../soc/general/3DLRF.h"
|
|
|
|
|
|
#define LGS_TIMEOUT_COUNT 100
|
|
#define LGS_MAX_IDLE_DELAY 40 // x10 msec
|
|
#define LGS_MIN_IDLE_DELAY 1 // x10 msec
|
|
|
|
#define USE_MUTEX true
|
|
#define DONT_USE_MUTEX false
|
|
|
|
#define LGS_SETTINGS_NODE_MASTER "LGS_DEVICE_MASTER"
|
|
#define LGS_SETTINGS_NODE_SLAVE "LGS_DEVICE_SLAVE"
|
|
#define LGS_SET_FLIP "FLIP_SIZE"
|
|
#define LGS_SET_OFFSET "OFFSET_SIZE"
|
|
#define LGS_SET_ORDER "ORDER_SIZE"
|
|
#define LGS_SET_DELTA "DELTA_SIZE"
|
|
#define LGS_SET_SST "SST_SIZE"
|
|
#define LGS_SET_ADDRESS "IP_ADDRESS"
|
|
#define LGS_SET_PORT "IP_PORT"
|
|
|
|
|
|
|
|
class sensorLGS3D : public basicObject, basicThread, protocolLGS3D_Client{
|
|
private:
|
|
basicLogCollection * m_pLog;
|
|
basicEventHeap * m_pEventHeap;
|
|
|
|
//config_setting_t * m_pSettings;
|
|
|
|
clientPort * m_pTransport;
|
|
char m_pHost[255];
|
|
uint16_t m_nPort;
|
|
|
|
LGS_PARAMETERS m_sLGS_PARAMETERS;
|
|
CLIENT_WORK_MODE m_eWorkMode;
|
|
DEVICE_STATUS m_sDeviceStatus;
|
|
SOFTWARE_INFO m_sDeviceSoftNFO;
|
|
|
|
//bool m_bGetParamBusyFlag;
|
|
//bool m_bDeviceIsSynched;
|
|
|
|
//bool m_bTransportStatus;
|
|
//bool m_bMasksAreLoadded;
|
|
bool m_bIsMaster;
|
|
|
|
int m_nBusyCounter;
|
|
int m_nIdleCounter;
|
|
int m_nIdleTarget;
|
|
|
|
basicMutex m_mPackageMutex;
|
|
basicMutex m_mStatusMutex;
|
|
basicMutex m_mDataMutex;
|
|
|
|
basicPosition m_oPosition;
|
|
thresholdNode * m_pThresholdData;
|
|
|
|
uint32_t m_nFullBorderDataIndex;
|
|
uint8_t m_nFullBorderKernelIndex;
|
|
|
|
uint8_t m_nDevicePolyCount;
|
|
uint8_t m_nCurrentPolyID;
|
|
ShadowMask * m_pShadow;
|
|
|
|
bool setOperation( E_LGS_CMD opCode, bool fNOW = false );
|
|
bool forceOperation( E_LGS_CMD opCode );
|
|
void setCompelition( uint8_t Perc );
|
|
E_LGS_CMD getOperation( void );
|
|
void promoteOperation( void );
|
|
void completeOperation( bool success = true );
|
|
void cleanOperation( void );
|
|
void comSetIdle( bool useMutex = true );
|
|
void comSetBusy( bool useMutex = true );
|
|
bool comIsIdle( void );
|
|
void cleanDataTH( void );
|
|
TARGET_DATA * prepareTargetData(CLIENT_EVENT* CE);
|
|
|
|
protected:
|
|
virtual void m_fThreadProc( void );
|
|
virtual bool packetHandler( protocolPackage* Package );
|
|
public:
|
|
explicit sensorLGS3D( LGS_PARAMETERS *ptr = NULL, bool Master = true );
|
|
virtual ~sensorLGS3D();
|
|
bool create( void );
|
|
|
|
bool startGetScanData( uint8_t kID = 0, uint32_t *th_zone = NULL );
|
|
bool startGetParameters( uint32_t timeout=0 );
|
|
bool startUploadMask(void);
|
|
bool startDeviceReset( bool FullReset = true );
|
|
bool startStopMotors( void );
|
|
bool startStartMotors( void );
|
|
bool startMasksStatus(bool Active);
|
|
uint8_t getCompelition(void);
|
|
SOFTWARE_INFO * getSoftwareInfo(void){
|
|
return &m_sDeviceSoftNFO;
|
|
};
|
|
E_LGS_CMD getCurrentCMD(void){
|
|
E_LGS_CMD tVal;
|
|
m_mStatusMutex.lock();
|
|
tVal = m_sDeviceStatus.CurrentOperation;
|
|
m_mStatusMutex.unlock();
|
|
return tVal;
|
|
};
|
|
E_LGS_STAGE getCurrentSTG(void){
|
|
E_LGS_STAGE tVal;
|
|
m_mStatusMutex.lock();
|
|
tVal = m_sDeviceStatus.Status;
|
|
m_mStatusMutex.unlock();
|
|
return tVal;
|
|
};
|
|
PLGS_PARAMETERS getSettings(void){ return &m_sLGS_PARAMETERS; };
|
|
CSTR getHost( void ){ return m_pHost; };
|
|
int getPort( void ){ return m_nPort; };
|
|
bool getDeviceStatus(DEVICE_STATUS &STAT);
|
|
ShadowMask * getMask( void ){ return m_pShadow; };
|
|
bool setHost( CSTR Host );
|
|
bool setPort( int Port );
|
|
bool setSettings( PLGS_PARAMETERS Params );
|
|
bool isMaster( void ){
|
|
return m_bIsMaster;
|
|
};
|
|
bool areMasksLoadded(void){
|
|
//if( !m_bMasksAreLoadded ) SLEEP(10);
|
|
//return m_bMasksAreLoadded;
|
|
return false;
|
|
};
|
|
bool areMasksActive( void ){
|
|
//if( m_bMasksAreLoadded ){
|
|
// if( m_pShadow!= NULL ){
|
|
// return m_pShadow->isActive();
|
|
// };
|
|
//};
|
|
return false;
|
|
};
|
|
bool isConnected(void){
|
|
bool tVal;
|
|
m_mStatusMutex.lock();
|
|
tVal = (m_sDeviceStatus.Status > STG_DISCONNECTED);
|
|
m_mStatusMutex.unlock();
|
|
return tVal;
|
|
};
|
|
//void attachRadarWidget( GLRadar *ptr ){ m_pRadarWidget = ptr;};
|
|
//void attachMapWidget( RangeMapWidget *ptr ){ m_pMapWidget = ptr;};
|
|
basicPosition * getPosition(void){ return &m_oPosition; };
|
|
void updateSettings(void);
|
|
|
|
// New Order
|
|
thresholdNode * grabDataAccess( void );
|
|
void releaseDataAccess( void );
|
|
|
|
bool lastTaskComplete( void );
|
|
void cleanLastTaskStatus( void );
|
|
};
|
|
|
|
|
|
|
|
#endif
|