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.
169 lines
4.6 KiB
169 lines
4.6 KiB
#ifndef __DEVICE_NODE_3D_HEADERS__
|
|
#define __DEVICE_NET_NODE_3D_HEADERS__
|
|
|
|
#include "../alg/lgs/mask.h"
|
|
#include "../components/base/basicDualThread.h"
|
|
#include "../components/base/basicEngine.h"
|
|
#include "../components/base/basicEventHeap.h"
|
|
#include "../components/base/basicLogCollection.h"
|
|
#include "../components/base/basicPosition.h"
|
|
#include "../components/base/basicSettingsProvider.h"
|
|
#include "../components/object/objectSystemAnchor.h"
|
|
#include "../data/net/clientPort.h"
|
|
#include "../data/protocol/protocolLGS3D_client.h"
|
|
#include "../hardware/soc/general/3DLRF.h"
|
|
|
|
// #include "../hardware/sensors/lrf/lrf_3d.h"
|
|
|
|
#include "deviceNodeSensor.h"
|
|
|
|
// #define SIMULATE_3D_TARGETS
|
|
|
|
#ifdef SIMULATE_3D_TARGETS
|
|
#include "../components/base/basicSettingsProvider.h"
|
|
#endif
|
|
|
|
#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
|
|
|
|
class device3DSensor : public deviceNodeSensor, public protocolLGS3D_Client
|
|
{
|
|
private:
|
|
|
|
// basicLogCollection * m_pLog;
|
|
// basicEventHeap * m_pEventHeap;
|
|
|
|
// DBC_LRF_DATA m_sDATA;
|
|
|
|
// LGS_3D_PARAMETERS m_sLGS_MASTER_PARAMETERS;
|
|
// LGS_3D_PARAMETERS m_sLGS_SLAVE_PARAMETERS;
|
|
|
|
// DEVICE_STATUS m_sDeviceStatus;
|
|
// SOFTWARE_INFO m_sDeviceSoftNFO;
|
|
|
|
// char m_pHost[255];
|
|
// uint16_t m_nPort;
|
|
|
|
clientPort * m_pClientPort;
|
|
|
|
bool m_bTWINC;
|
|
uint8_t m_bSlaveConnectionStatus;
|
|
int m_nBusyCounter;
|
|
int m_nIdleCounter;
|
|
int m_nIdleTarget;
|
|
uint64_t m_nTimeDiff;
|
|
|
|
basicMutex m_mPackageMutex;
|
|
basicMutex m_mStatusMutex;
|
|
basicMutex m_mDataMutex;
|
|
|
|
thresholdNode * m_pThresholdData;
|
|
|
|
uint32_t m_nFullBorderDataIndex;
|
|
uint8_t m_nFullBorderKernelIndex;
|
|
|
|
uint8_t m_nDevicePolyCount;
|
|
uint32_t m_nCurrentPolyID;
|
|
uint32_t m_nCurrentMaskID;
|
|
uint32_t m_nProcessingCmdId;
|
|
ShadowMask * m_pShadow;
|
|
|
|
#ifdef SIMULATE_3D_TARGETS
|
|
config_setting_t * m_pSimulationConfig;
|
|
basicPosition m_oIntruder_Start;
|
|
basicPosition m_oIntruder_Finish;
|
|
|
|
basicPosition m_oIntruder_;
|
|
C3D_DECART m_dIntruderMove;
|
|
float m_dIntruderSpeed;
|
|
|
|
int m_nIntruder_time;
|
|
|
|
basicPosition m_oHunter_Home;
|
|
basicPosition m_oHunter_;
|
|
C3D_DECART m_dHunterMove;
|
|
float m_dHunterSpeed;
|
|
|
|
uint8_t m_bSymStage;
|
|
|
|
bool IntruderIsVisible();
|
|
bool HunterIsVisible();
|
|
void headIntruderTo(basicPosition & bp);
|
|
void headHunterTo(basicPosition & bp);
|
|
void restartSimulation(void);
|
|
TARGET_DATA * prepareSimData(basicPosition & bp);
|
|
uint32_t m_nAutoScript;
|
|
#endif
|
|
|
|
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);
|
|
bool saveTHPicture(thresholdNode * ptr, CSTR uid, bool master = true, bool byMinimum = false, bool monochrome = false);
|
|
|
|
protected:
|
|
|
|
virtual void connectMode();
|
|
virtual void handshakeMode();
|
|
// virtual void readMode();
|
|
virtual void syncMode();
|
|
virtual void drawMode();
|
|
// virtual void maskMode();
|
|
virtual void alarmMode();
|
|
virtual void idleMode();
|
|
// virtual void getfileMode();
|
|
virtual void proceedDBCommands();
|
|
|
|
// virtual void save_ini();
|
|
// virtual void save_detection();
|
|
// virtual void save_masks();
|
|
// virtual void save_eprom();
|
|
// virtual void wait_device();
|
|
virtual bool validateCommunicationRessource();
|
|
virtual bool packetHandler(protocolPackage * Package);
|
|
|
|
public:
|
|
|
|
TARGET_DATA * prepareTargetData(CLIENT_EVENT * CE);
|
|
explicit device3DSensor(uint32_t dbID);
|
|
virtual ~device3DSensor();
|
|
virtual bool startService();
|
|
virtual bool stopService();
|
|
virtual bool validate();
|
|
virtual void simulateTarget(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);
|
|
|
|
basicPosition * getPosition(void)
|
|
{
|
|
return &m_oPosition;
|
|
}
|
|
|
|
void updateSettings(void);
|
|
|
|
// New Order
|
|
thresholdNode * grabDataAccess(void);
|
|
void releaseDataAccess(void);
|
|
|
|
bool lastTaskComplete(void);
|
|
void cleanLastTaskStatus(void);
|
|
};
|
|
|
|
#endif
|