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.
148 lines
5.8 KiB
148 lines
5.8 KiB
#ifndef __OBJECT_NET_NODE_2D_HEADERS__
|
|
#define __OBJECT_NET_NODE_2D_HEADERS__
|
|
|
|
#include "deviceNodeSensor.h"
|
|
#include <cfloat> //For DBL_MAX
|
|
#include <stdlib.h>
|
|
|
|
#include "../../components/base/basicObject.h"
|
|
#include "../../components/base/basicMutex.h"
|
|
#include "../../components/base/basicThread.h"
|
|
#include "../../components/base/basicLogCollection.h"
|
|
#include "../../components/base/basicSettingsProvider.h"
|
|
#include "../../alg/lgs/mask.h"
|
|
#include "../../data/protocol/protocolLGS2D.h"
|
|
|
|
#define LGS_DEFAULT_SLEEP_TIME 100
|
|
#define LGS_ALERT_SLEEP_TIME 1
|
|
#define LGS_DEFAULT_TO_COUNTER 10
|
|
#define LGS_INITIAL_FLIPS 8
|
|
|
|
#define ANODE_WM_2D_BEFORE_START 0
|
|
#define ANODE_WM_2D_CREATE_PORT 1
|
|
#define ANODE_WM_2D_CONNECT 2
|
|
#define ANODE_WM_2D_WAIT_CONNECT 3
|
|
#define ANODE_WM_2D_SET_INIT_MODE 4
|
|
#define ANODE_WM_2D_GET_SERIAL_NUM 6
|
|
#define ANODE_WM_2D_GET_VERSION 8
|
|
#define ANODE_WM_2D_GET_DETECTION_PROFILE 10
|
|
#define ANODE_WM_2D_GET_MASTER_PARAM 12
|
|
#define ANODE_WM_2D_GET_SLAVE_PARAM 14
|
|
#define ANODE_WM_2D_GET_MASK_INFO 16
|
|
#define ANODE_WM_2D_SET_MASK_INFO 18
|
|
|
|
|
|
|
|
#define ANODE_WM_2D_SET_BORDER_MODE 32
|
|
#define ANODE_WM_2D_GET_FAST_DRAW 34
|
|
#define ANODE_WM_2D_SET_DETECTION_MODE 36
|
|
#define ANODE_WM_2D_SET_FILESYSTEM_MODE 38
|
|
#define ANODE_WM_2D_FS_TRANSFER_MODE 39
|
|
|
|
#define ANODE_WM_2D_SET_SHADOW_DONE 40
|
|
#define ANODE_WM_2D_GET_SHADOW_POLY_INFO 41
|
|
#define ANODE_WM_2D_GET_SHADOW_POLY_POINT 43
|
|
#define ANODE_WM_2D_SET_SHADOW_POLY_INFO 45
|
|
#define ANODE_WM_2D_SET_SHADOW_POLY_POINT 47
|
|
#define ANODE_WM_2D_SET_SHADOW_RAY_LINE 48
|
|
#define ANODE_WM_2D_SET_SHADOW_RAY 49
|
|
|
|
#define ANODE_WM_2D_SET_GETFILE_MODE 50
|
|
#define ANODE_WM_2D_SEND_GETFILE_MODE 52
|
|
#define ANODE_WM_2D_SET_MASTER_PARAM 58
|
|
#define ANODE_WM_2D_SET_SLAVE_PARAM 59
|
|
#define ANODE_WM_2D_ISSUE_FULL_RESET 64
|
|
|
|
#define ANODE_WM_2D_ISSUE_RESET 66
|
|
|
|
#define ANODE_WM_2D_PING 128
|
|
#define ANODE_WM_2D_PONG 129
|
|
|
|
#define ANODE_WM_2D_SLEEP_AND_RECONNECT 130
|
|
#define ANODE_WM_2D_WAIT_DEVICE_REPLAY 254
|
|
#define ANODE_WM_2D_WAIT_CHECK_REPLAY 255
|
|
|
|
#define ANODE_2D_MAX_DRAW_ANGLES 6000
|
|
|
|
#define ARGUS_DS_NONE 0
|
|
#define ARGUS_DS_CREATED 1
|
|
#define ARGUS_DS_GET_CONFIG 2
|
|
#define ARGUS_DS_VALID 3
|
|
#define ARGUS_DS_CONF_MISTMATCH 4
|
|
|
|
typedef struct S_SHADOW_IO_HELPER{
|
|
uint16_t m_nCurrentPolygon;
|
|
uint16_t m_nCurrentPoint;
|
|
uint16_t m_nCurrentRayLine;
|
|
uint16_t m_nCurrentRay;
|
|
}SHADOW_IO_HELPER;
|
|
|
|
typedef struct S_GETFILE_IO_HELPER{
|
|
uint32_t fileSize;
|
|
uint32_t index;
|
|
char destName[33];
|
|
char sourceName[33];
|
|
uint8_t state;
|
|
FILE * fd;
|
|
uint8_t data[250];
|
|
uint8_t data_size;
|
|
}GETFILE_IO_HELPER;
|
|
|
|
typedef struct S_TEST_POINT{
|
|
float x;
|
|
float y;
|
|
}TEST_POINT;
|
|
|
|
class device2DSensor: public deviceNodeSensor, public basicThread, public protocolLGS_2D{
|
|
private:
|
|
//basicLogCollection * m_pLog;
|
|
uint8_t m_bPortType;
|
|
basicTransport * m_pPort;
|
|
|
|
uint8_t m_bDeviceWM;
|
|
uint32_t m_nSleepTime;
|
|
uint16_t m_bTimeOutCounter;
|
|
uint8_t m_bInitialFlips;
|
|
uint16_t m_nCurrentAngle;
|
|
uint8_t m_bDrawType;
|
|
uint8_t m_bOpRetryCnt;
|
|
uint32_t m_nProcessingCmdId;
|
|
uint32_t m_vDrawRanges[ANODE_2D_MAX_DRAW_ANGLES];
|
|
bool m_bDeviceIsSynced;
|
|
bool m_bSerialStringValid;
|
|
bool m_bVersionStringValid;
|
|
char m_tSN[65];
|
|
char m_tSV[129];
|
|
char m_sCurrentFile[MAX_PATH];
|
|
uint32_t m_nUploadID;
|
|
uint8_t m_nActiveDetectionProfile;
|
|
//Shadow
|
|
SHADOW_IO_HELPER m_sShadowHelper;
|
|
SHADOW m_sShadow;
|
|
//GetFile
|
|
GETFILE_IO_HELPER m_sGetFileHelper;
|
|
|
|
TARGET_DATA * prepareTargetData( uint16_t AZ, uint16_t RANGE, uint32_t WIDTH, uint8_t LRFID = 0 );
|
|
//void saveRawDrawData( uint16_t alngles );
|
|
void cleanupDeviceStructures();
|
|
CSTR generateSettingFile();
|
|
void cleanShadowStructs();
|
|
bool PtInPolygons( TEST_POINT& point, uint8_t F );
|
|
bool PtInPolygon( SHADOW_POLY& Poly, TEST_POINT& point );
|
|
bool rasterizeShadow();
|
|
#ifdef DEBUG_EXTRA
|
|
void makeShadowPic( CSTR picname );
|
|
#endif
|
|
protected:
|
|
virtual bool packetHandler( protocolPackage *Package );
|
|
virtual void m_fThreadProc( void );
|
|
public:
|
|
explicit device2DSensor( uint32_t id );
|
|
~device2DSensor();
|
|
virtual bool startService();
|
|
virtual bool stopService();
|
|
virtual bool validate();
|
|
virtual void simulateTarget( void );
|
|
};
|
|
|
|
#endif
|