#ifndef __PROTOCOL_LGS_HEADERS__ #define __PROTOCOL_LGS_HEADERS__ #include "../../components/base/basicFunctionality.h" #include "../../components/base/basicTransport.h" #include "../../components/base/basicMutex.h" #include "../../components/base/basicEventHeap.h" #include "../../hardware/soc/general/3DLRF.h" #include "../../alg/lgs/mask.h" #include "protocol.h" #define TARGET_WITH_WIDTH #define MAXIMAL_SOCKET_PACKET_LENGTH 102400 #define BOARDDATA_PACKAGE_SIZE_BYTES 0x4000 #define BOARDDATA_PACKAGE_SIZE_NODES 0x1000 /* typedef struct S_LGS_PARAMETERS{ uint8_t nOrder; uint8_t nOffset; uint8_t nDelta; uint8_t nSun; uint8_t bSST; uint16_t nFlip; // For Quick models (pls30) must be up to 1024 uint32_t nWidth; // With future devices may gain big numbers // 3D LRF Specific uint8_t bBuildThByCore; uint8_t nGPointSamples; } LGS_PARAMETERS, *PLGS_PARAMETERS; */ typedef enum{ STG_DISCONNECTED = 0x00, STG_CONNECTED = 0x01, STG_STUDY = 0x02, STG_REDY = 0x04, STG_BUSY = 0x06, STG_NONE = 0xFF }E_LGS_STAGE; typedef enum{ CWM_INIT = 0, CWM_PINGPONG = 1, CWM_BORDER = 2, CWM_FILE = 3, CWM_MASK = 4, CWM_PARAMS = 5, CWM_INITIAL_PARAM = 252, CWM_INITIAL_MASKS_INFO = 253, CWM_INITIAL_MASKS_DATA = 254, CWM_ERROR = 255 } E_CLIENT_WORK_MODE; typedef enum{ SUB_DATA_INTEGRITY_UNKNOWN = 0x00, SUB_DATA_INTEGRITY_ERROR = 0xA5, SUB_DATA_INTEGRITY_VALID = 0xFF }E_LGS_DATA_INTEGRITY_FLAG; // commands typedef enum{ CMD_STATE = 0x00, CMD_QUIT = 0x01, CMD_RESET = 0x02, CMD_BORDER = 0x03, CMD_MODE = 0x04, CMD_GETFILE = 0x05, CMD_RESTART = 0x06, CMD_PARAMETERS = 0x07, CMD_GET_SERIAL_NUMBER = 0x08, CMD_SET_ADDRESS = 0x09, CMD_GET_SOFTWARE_VERSION = 0x0A, CMD_UNSUPPORTED = 0x0B, CMD_SET_COMM_SPEED = 0x0C, CMD_FULL_BORDER = 0x0D, CMD_FULL_RESET = 0x0E, CMD_CAMERA = 0x0F, CMD_SET_SERIAL_NUMBER = 0x10, CMD_BOARDDATA = 0x11, CMD_GET_CAMERA_PARAMETERS = 0x12, CMD_SET_CAMERA_PARAMETERS = 0x13, CMD_RELAY = 0x14, CMD_GET_RELAY_PARAMETERS = 0x15, CMD_SET_RELAY_PARAMETERS = 0x16, CMD_FS_SUB_PACKET = 0x17, CMD_STATE_2 = 0x18, CMD_GET_WIDTH_TABLE = 0x19, CMD_SET_WIDTH_TABLE = 0x1A, CMD_GET_VOLTAGE = 0x1B, CMD_GET_VOLTAGE_PARAMETERS = 0x1C, CMD_SET_VOLTAGE_PARAMETERS = 0x1D, CMD_GET_HZ_DATA = 0x1E, CMD_SET_HZ_DATA = 0x1F, CMD_GET_CALIBRATION_TABLE = 0x20, CMD_SET_CALIBRATION_TABLE = 0x21, CMD_GET_LRF_DISABLE = 0x22, CMD_SET_LRF_DISABLE = 0x23, CMD_GET_ZOOM_TABLE = 0x24, CMD_SET_ZOOM_TABLE = 0x25, CMD_GET_TILT_TABLE = 0x26, CMD_SET_TILT_TABLE = 0x27, CMD_GET_HZ_ENABLE = 0x28, CMD_SET_HZ_ENABLE = 0x29, CMD_EVT = 0x2A, CMD_GET_PARAMETERS = 0x2B, CMD_SET_PARAMETERS = 0x2C, CMD_FLIP_COMPLETE = 0x2D, CMD_SCAN_COMPLETE = 0x2E, CMD_TARGET = 0x2F, CMD_TARGET_WW = 0x30, CMD_TARGET_MW = 0x31, CMD_TARGET_MB = 0x32, CMD_TARGET_ZZ = 0x33, CMD_GET_HZ_INFO = 0x34, CMD_HZ_INFO = 0x35, CMD_GET_HZ_POLY = 0x36, CMD_SET_HZ_POLY = 0x37, CMD_SET_HZ_POLY_ACK = 0x38, CMD_GET_HZ_STATUS = 0x39, CMD_SET_HZ_STATUS = 0x3A, CMD_DHWM_START_MOTORS = 0x50, CMD_DHWM_STOP_MOTORS = 0x51, CMD_ACK = 0xFA, CMD_NACK = 0xFB, CMD_NONE = 0xFF } E_LGS_CMD; // modes enum{ MODE_SET = 0x80, // 10000000 set/get mode MODE_MASK = 0x0F, // 00001111 mode mask MODE_DETECTOR = 0x01, // 00000001 detecting mode - default MODE_BORDER = 0x02, // 00000010 border of visibilite draw mode MODE_FILESYSTEM = 0x03, // 00000011 remote file system server mode MODE_GETFILE = 0x04, // 00000100 get file mode MODE_SENDBOARDDATA1 = 0x05, // 00000101 send board data for external processing MODE_SENDBOARDDATA2 = 0x06, // 00000110 send board data for external processing MODE_BOARDDATA = 0x07 // 00000111 board data for external processing }; // --------------- CMD_STATE ---------------------- // information type enum{ IT_MASK = 0x80, // 10000000 IT_ERROR = 0x00, // 00000000 IT_TARGET = 0x80 // 10000000 }; // device id enum{ ID_MASK = 0x40, // 01000000 ID_DEVICE0 = 0x00, // 00000000 ID_DEVICE1 = 0x40 // 01000000 }; // target type enum{ TT_MASK = 0x3C, // 00111100 TT_NORMAL = 0x00, // 00000000 TT_WIDE = 0x04, // 00000100 TT_FLIP = 0x08, // 00001000 TT_CAMERA = 0x0C, // 00001100 TT_TEST = 0x10, // 00010000 TT_BLIND = 0x14 // 00010100 }; // target data enum{ TD_MASK = 0x03, // 00000011 TD_ANGLE = 0x02, // 00000010 TD_RANGE = 0x01 // 00000001 }; // errors enum{ ER_MASK = 0x3F, // 00111111 ER_NONE = 0x00, // 00000000 ER_ANGLE = 0x01, // 00000001 ER_SUNBIT = 0x02, // 00000010 ER_OVERFLOW = 0x04, // 00000100 ER_SSTOVERFLOW = 0x08, // 00001000 ER_MODE = 0x10, // 00010000 ER_NOIRQ = 0x20 // 00100000 }; // --------------- CMD_BORDER ---------------------- enum{ BD_ERRORMASK = 0xE0, // 11100000 BD_ERRORMODE = 0x80, // 10000000 BD_ERRORANGLE = 0x40, // 01000000 BD_NOTREADY = 0x20, // 00100000 BD_ANGLEMASK = 0x10, // 00010000 BD_RANGE0MASK = 0x0C, // 00001100 BD_RANGE1MASK = 0x03, // 00000011 }; // --------------- CMD_FILE ------------------ enum{ GF_ERRORMASK = 0xC0, // 11000000 GF_ERRORMODE = 0x80, // 10000000 GF_ERRORFILE = 0x40, // 01000000 GF_OP_INDEX = 0x3C, // 00111100 GF_OP_MASK = 0x03, // 00000011 GF_OP_OK = 0x00, // 00000000 GF_OP_OPEN = 0x01, // 00000001 GF_OP_DATA = 0x02, // 00000010 GF_OP_CLOSE = 0x03, // 00000011 }; // --------------- CMD_PARAMETERS ------------------ enum{ DP_OP_MASK = 0x80, DP_OP_GET = 0x00, DP_OP_SET = 0x80, DP_DEVICE_MASK = 0x40, DP_DEVICE_0 = 0x00, DP_DEVICE_1 = 0x40, DP_SST = 0x01, }; enum{ FB_READY_MASK = 0x80, // 10000000 FB_READY = 0x80, // 10000000 FB_NOT_READY = 0x00, // 10000000 FB_ANGLE_MASK = 0x1F, // 00011111 FB_RANGE_MASK = 0xF00, // 00011111 FB_RANGE_1_SHIFT = 4, // 11110000 FB_RANGE_2_SHIFT = 8, // 00001111 }; // --------------- CMD_CAMERA ------------------ /* typedef enum{ CMD_CAMERA_GET_STATUS = 0, CMD_CAMERA_GET_PTZ = 1, CMD_CAMERA_SET_PTZ = 2, CMD_CAMERA_MOVE_PAN = 3, CMD_CAMERA_MOVE_TILT = 4, CMD_CAMERA_MOVE_ZOOM = 5, CMD_CAMERA_SET_IRIS = 6, CMD_CAMERA_BUSY = 7, CMD_CAMERA_ERROR = 8, CMD_CAMERA_WIPER = 9, CMD_CAMERA_SET_FOCUS = 10, CMD_CAMERA_GET_FOCUS = 11, CMD_CAMERA_MOVE_FOCUS = 12, CMD_CAMERA_GET_DOPLER = 13, CMD_CAMERA_SET_DOPLER = 14, CMD_CAMERA_DOPLER_ALARM = 15, CMD_CAMERA_GET_DOPLER_MASK = 16, CMD_CAMERA_SET_DOPLER_MASK = 17, }E_CAMERA_CMD; */ enum{ CAMERA_ERROR_NO_CAMERA = 0 }; enum{ CAMERA_MAX_DOPLER_MASK = 8 }; typedef struct CAMERA_POS_PTZ{ U16 posPan; U16 posTilt; U16 posZoom; }CAMERA_POS_PTZ; typedef struct CAMERA_MOVE_PAN{ U16 panSpeed; U8 panRight; }CAMERA_MOVE_PAN; typedef struct CAMERA_MOVE_TILT{ U16 tiltSpeed; U8 tiltUp; }CAMERA_MOVE_TILT; typedef struct CAMERA_MOVE_ZOOM{ U16 zoomSpeed; U8 zoomTele; }CAMERA_MOVE_ZOOM; typedef struct CAMERA_MOVE_FOCUS{ U16 focusSpeed; U8 focusFar; }CAMERA_MOVE_FOCUS; typedef struct CAMERA_POS_IRIS{ U16 irisValue; }CAMERA_POS_IRIS; typedef struct CAMERA_POS_FOCUS{ U16 focusValue; }CAMERA_POS_FOCUS; typedef struct CAMERA_BUSY{ U8 busyCommand; }CAMERA_BUSY; typedef struct CAMERA_ERROR{ U16 errID; }CAMERA_ERROR; typedef struct CAMERA_WIPER{ U8 wiperOn; }CAMERA_WIPER; typedef struct CAMERA_DOPLER{ U8 doplerOn; U16 doplerPanStep; U32 doplerTimeout; }CAMERA_DOPLER; typedef struct CAMERA_DOPLER_ALARM{ U8 doplerAlarm; U16 doplerPan; }CAMERA_DOPLER_ALARM; typedef struct CAMERA_DOPLER_MASK{ U16 nStart; U16 nStop; }CAMERA_DOPLER_MASK; typedef struct CAMERA_DOPLER_MASK_ARRAY{ U8 bEnabled; U8 nCount; CAMERA_DOPLER_MASK pMask[CAMERA_MAX_DOPLER_MASK]; }CAMERA_DOPLER_MASK_ARRAY; typedef struct CAMERA_DATA{ U8 nCommand; union { CAMERA_POS_PTZ posPTZ; CAMERA_MOVE_PAN movePan; CAMERA_MOVE_TILT moveTilt; CAMERA_MOVE_ZOOM moveZoom; CAMERA_POS_IRIS posIris; CAMERA_BUSY busy; CAMERA_ERROR error; CAMERA_WIPER wiper; CAMERA_POS_FOCUS posFocus; CAMERA_MOVE_FOCUS moveFocus; CAMERA_DOPLER dopler; CAMERA_DOPLER_ALARM doplerAlarm; CAMERA_DOPLER_MASK_ARRAY doplerMask; }; } CAMERA_DATA, *PCAMERA_DATA; // --------------- CMD_GET_CAMERA_PARAMETERS / CMD_SET_CAMERA_PARAMETERS ------------------ typedef enum{ CAMERA_TYPE_MIGVAN_878 = 0x00, CAMERA_TYPE_MIGVAN_KD6Z = 0x01, CAMERA_TYPE_MIC1300 = 0x02, CAMERA_TYPE_JVC_TKS576 = 0x03, CAMERA_TYPE_PHILIPS_G3AD_NEW= 0x04, CAMERA_TYPE_VICON = 0x05, CAMERA_TYPE_PELCO = 0x06, CAMERA_TYPE_HEBRON = 0x07, CAMERA_TYPE_3_TRACK = 0x08, CAMERA_TYPE_AMERICAN_DYNAMICS = 0x09, CAMERA_TYPE_PHILIPS_G3AD_OLD= 0x0A, CAMERA_TYPE_NESHER = 0x0B, CAMERA_TYPE_NONE = 0xFF, }E_CAMERA_TYPE; // ------------------------------------ CMD_RELAY --------------------------------------- typedef enum{ CMD_RELAY_GET = 0, CMD_RELAY_SET = 1, }E_RELAY_CMD; typedef struct RELAY_DATA{ U8 nCommand; U8 bOutput; }RELAY_DATA, *PRELAY_DATA; typedef struct RELAY_PARAMETERS{ U8 bAuto; // allow auto relay U8 bNormallyClose; U16 nAutoDelay; // in 0.1 sec (0,0 .. 3000,0 sec) }RELAY_PARAMETERS, *PRELAY_PARAMETERS; // --------------- CMD_STATE_2 ------------------------ typedef enum S2_INFO_TYPE{ S2_IT_TARGET_POLAR = 0, S2_IT_TARGET_DEKART = 1, S2_IT_FLAGS = 2, S2_IT_DEVICE_FLAGS = 3, S2_IT_ERROR_ANGLE = 4, S2_IT_FLIP = 5, S2_IT_BLIND = 6, S2_IT_TARGET_POLAR_WIDTH = 7, // SERGEY 2008/05/02 S2_IT_TARGET_DEKART_WIDTH = 8 // SERGEY 2008/05/02 }S2_INFO_TYPE; typedef enum S2_INFO_TYPE_FLAGS{ S2_ITF_ERROR_MODE = 0x01, S2_ITF_ERROR_NO_IRQ = 0x02, S2_ITF_ERROR_NO_ZERO_MARK = 0x04, S2_ITF_CAMERA = 0x08, S2_ITF_VOLTAGE = 0x10, }S2_INFO_TYPE_FLAGS; typedef enum S2_INFO_TYPE_DEVICE_FLAGS{ S2_ITDF_ERROR_SUN = 0x01, S2_ITDF_ERROR_OVERFLOW = 0x02, S2_ITDF_ERROR_SST_OVERFLOW = 0x04, }S2_INFO_TYPE_DEVICE_FLAGS; typedef enum S2_INFO_TYPE_TARGET{ S2_ITT_NORMAL = 0x00, S2_ITT_WIDE = 0x10, S2_ITT_TYPE_MASK = 0xF0, S2_ITT_DEVICE_MASK = 0x0F, }S2_INFO_TYPE_TARGET; typedef enum S2_INFO_TYPE_BLIND{ S2_ITB_STATE_MASK = 0x80, S2_ITB_START = 0x00, S2_ITB_STOP = 0x80, S2_ITB_REASON_MASK = 0x7F, S2_ITB_MEDIUM_RANGE = 0x01, S2_ITB_180_DEGREE = 0x02, S2_ITB_FOG_SPIKES = 0x03, S2_ITB_PD = 0x04, }S2_INFO_TYPE_BLIND; typedef enum S2_REQUEST_TYPE{ S2_RT_TARGET_MASK = 0x01, S2_RT_TARGET_POLAR = 0x00, S2_RT_TARGET_DEKART = 0x01, }S2_REQUEST_TYPE; typedef enum S2_REQUEST_WIDTH{ S2_RW_MASK = 0x02, S2_RW_DISABLE = 0x00, S2_RW_ENABLE = 0x02, }S2_REQUEST_WIDTH; typedef struct S_S2_PACKAGE{ uint32_t aaa; }S2_PACKAGE; // --------------- CMD_INFO ------------ // --------------- CMD_FS_SUB_PACKET ------------------ enum{ FS_CMD_SEND_CMD = 0, FS_CMD_SEND_EVT = 1, FS_CMD_RECEIVE_CMD = 2, FS_CMD_RECEIVE_EVT = 3, FS_ERROR_SUCCESS = 0x00, // 00000000 FS_ERROR_MODE = 0x01, // 00000001 }; typedef struct FS_SEND_CMD{ U8 nOrder; U8 nLast; U16 nPosition; U8 nSubSize; U8 pSubBuffer[1]; }FS_SEND_CMD; typedef struct FS_SEND_EVT{ U8 nError; U8 nOrder; }FS_SEND_EVT; typedef struct FS_RECEIVE_CMD{ U8 nOrder; U16 nPosition; }FS_RECEIVE_CMD; typedef struct FS_RECEIVE_EVT{ U8 nError; U8 nOrder; U8 nLast; U16 nPosition; U8 nSubSize; U8 pSubBuffer[1]; }FS_RECEIVE_EVT; typedef struct FS_DATA{ U8 nCommand; union { FS_SEND_CMD sendcmd; FS_SEND_EVT sendevt; FS_RECEIVE_CMD receivecmd; FS_RECEIVE_EVT receiveevt; }; }FS_DATA, *PFS_DATA; typedef struct FS_DATA_EX : public FS_DATA { U8 pReserved[MAX_PATH]; }FS_DATA_EX, *PFS_DATA_EX; // --------------- CMD_GET_WIDTH_TABLE & CMD_SET_WIDTH_TABLE ------------------------ enum { WIDTH_TABLE_SIZE = 16 }; typedef struct WIDTH_TABLE{ U8 nCount; U16 pTable[WIDTH_TABLE_SIZE]; }WIDTH_TABLE, *PWIDTH_TABLE; // --------------- CMD_VOLTAGE ------------------ typedef enum VOLTAGE_STATUS{ VS_OK = 0, VS_FAILURE = 1, }VOLTAGE_STATUS; // --------------- CMD_GET_VOLTAGE_PARAMETERS / CMD_SET_VOLTAGE_PARAMETERS ------------------ typedef struct VOLTAGE_PARAMETERS{ U8 bControl; }VOLTAGE_PARAMETERS, *PVOLTAGE_PARAMETERS; // -------------- CMD_HZ_GET_DATA / CMD_HZ_SET_DATA ----------------------------- typedef enum HZ_INFO_TYPE{ HZIT_CMD_GET_HEADER = 0, HZIT_EVT_GET_HEADER = 1, HZIT_CMD_GET_POLYGON = 2, HZIT_EVT_GET_POLYGON = 3, HZIT_CMD_GET_POLYGON_POINT = 4, HZIT_EVT_GET_POLYGON_POINT = 5, HZIT_CMD_GET_RAY = 6, HZIT_EVT_GET_RAY = 7, HZIT_CMD_GET_RAY_LINE = 8, HZIT_EVT_GET_RAY_LINE = 9, HZIT_CMD_SET_HEADER = 10, HZIT_EVT_SET_HEADER = 11, HZIT_CMD_SET_POLYGON = 12, HZIT_EVT_SET_POLYGON = 13, HZIT_CMD_SET_POLYGON_POINT = 14, HZIT_EVT_SET_POLYGON_POINT = 15, HZIT_CMD_SET_RAY = 16, HZIT_EVT_SET_RAY = 17, HZIT_CMD_SET_RAY_LINE = 18, HZIT_EVT_SET_RAY_LINE = 19, HZIT_CMD_SET_DONE = 20, HZIT_EVT_SET_DONE = 21, HZIT_EVT_ERROR = 255, }HZ_INFO_TYPE; typedef struct HZ_POINT{ U16 wX; // 0..4095 U16 wY; // 0..4095 }HZ_POINT, *LPHZ_POINT; typedef struct HZ_LINE{ U8 bType; // region type U16 wMin; // 0..2047 U16 wMax; // 0..2047 }HZ_LINE, *LPHZ_LINE; typedef struct HZ_PACKET{ U8 bSubSize; U8 bType; U8 bSequence; }HZ_PACKET, *PHZ_PACKET; // --------- CMD_HZ_GET_DATA ----------- typedef HZ_PACKET HZ_CMD_GET_HEADER, *PHZ_CMD_GET_HEADER; typedef struct HZ_EVT_GET_HEADER : public HZ_PACKET{ U16 wPolygonCount; U16 wRayCount; U32 dwTypeOn; }HZ_EVT_GET_HEADER, *PHZ_EVT_GET_HEADER; typedef struct HZ_CMD_GET_POLYGON : public HZ_PACKET{ U16 wPolygonIndex; }HZ_CMD_GET_POLYGON, *PHZ_CMD_GET_POLYGON; typedef struct HZ_EVT_GET_POLYGON : public HZ_PACKET{ U8 bPolygonType; U16 wPointCount; }HZ_EVT_GET_POLYGON, *PHZ_EVT_GET_POLYGON; typedef struct HZ_CMD_GET_POLYGON_POINT : public HZ_PACKET{ U16 wPolygonIndex; U16 wPointIndex; }HZ_CMD_GET_POLYGON_POINT, *PHZ_CMD_GET_POLYGON_POINT; typedef struct HZ_EVT_GET_POLYGON_POINT : public HZ_PACKET{ HZ_POINT Point; }HZ_EVT_GET_POLYGON_POINT, *PHZ_EVT_GET_POLYGON_POINT; typedef struct HZ_CMD_GET_RAY : public HZ_PACKET{ U16 wRayIndex; }HZ_CMD_GET_RAY, *PHZ_CMD_GET_RAY; typedef struct HZ_EVT_GET_RAY : public HZ_PACKET{ U16 wLineCount; }HZ_EVT_GET_RAY, *PHZ_EVT_GET_RAY; typedef struct HZ_CMD_GET_RAY_LINE : public HZ_PACKET{ U16 wRayIndex; U16 wLineIndex; }HZ_CMD_GET_RAY_LINE, *PHZ_CMD_GET_RAY_LINE; typedef struct HZ_EVT_GET_RAY_LINE : public HZ_PACKET{ HZ_LINE Line; }HZ_EVT_GET_RAY_LINE, *PHZ_EVT_GET_RAY_LINE; // ----------- CMD_HZ_SET_DATA -------------- typedef struct HZ_CMD_SET_HEADER : public HZ_PACKET{ U16 wPolygonCount; U16 wRayCount; U32 dwTypeOn; }HZ_CMD_SET_HEADER, *PHZ_CMD_SET_HEADER; typedef HZ_PACKET HZ_EVT_SET_HEADER, *PHZ_EVT_SET_HEADER; typedef struct HZ_CMD_SET_POLYGON : public HZ_PACKET{ U16 wPolygonIndex; U8 bPolygonType; U16 wPointCount; }HZ_CMD_SET_POLYGON, *PHZ_CMD_SET_POLYGON; typedef HZ_PACKET HZ_EVT_SET_POLYGON, *PHZ_EVT_SET_POLYGON; typedef struct HZ_CMD_SET_POLYGON_POINT : public HZ_PACKET{ U16 wPolygonIndex; U16 wPointIndex; HZ_POINT Point; }HZ_CMD_SET_POLYGON_POINT, *PHZ_CMD_SET_POLYGON_POINT; typedef HZ_PACKET HZ_EVT_SET_POLYGON_POINT, *PHZ_EVT_SET_POLYGON_POINT; typedef struct HZ_CMD_SET_RAY : public HZ_PACKET{ U16 wRayIndex; U16 wLineCount; }HZ_CMD_SET_RAY, *PHZ_CMD_SET_RAY; typedef HZ_PACKET HZ_EVT_SET_RAY, *PHZ_EVT_SET_RAY; typedef struct HZ_CMD_SET_RAY_LINE : public HZ_PACKET{ U16 wRayIndex; U16 wLineIndex; HZ_LINE Line; }HZ_CMD_SET_RAY_LINE, *PHZ_CMD_SET_RAY_LINE; typedef HZ_PACKET HZ_EVT_SET_RAY_LINE, *PHZ_EVT_SET_RAY_LINE; typedef HZ_PACKET HZ_CMD_SET_DONE, *PHZ_CMD_SET_DONE; typedef HZ_PACKET HZ_EVT_SET_DONE, *PHZ_EVT_SET_DONE; // ----------- CMD_HZ_GET_DATA / CMD_HZ_SET_DATA -------------- enum{ HZER_NONE = 0, HZER_OUT_OF_MEMORY = 1, HZER_RAY_COUNT = 2, HZER_RAY_INDEX = 3, HZER_RAY_LINE_INDEX = 4, HZER_POLYGON_INDEX = 5, HZER_POLYGON_POINT_INDEX = 6, }; typedef struct HZ_EVT_ERROR : public HZ_PACKET{ U8 bCmdType; U8 bErrorId; }HZ_EVT_ERROR, *PHZ_EVT_ERROR; // ----------- CMD_GET_CT_TABLE / CMD_SET_CT_TABLE -------------- enum{ CIT_NONE = 0, CIT_CMD_SET_HEADER = 1, CIT_EVT_SET_HEADER = 2, CIT_EVT_SET_ITEM = 3, CIT_CMD_SET_ITEM = 4, CIT_CMD_SET_DONE = 5, CIT_EVT_SET_DONE = 6, CIT_CMD_GET_HEADER = 7, CIT_EVT_GET_HEADER = 8, CIT_CMD_GET_ITEM = 9, CIT_EVT_GET_ITEM = 10, CIT_EVT_ERROR = 255, }; enum{ CER_NONE = 0, CER_OUT_OF_MEMORY = 1, CER_INDEX = 2, }; typedef struct CT_PACKET{ U8 bSize; U8 bType; U8 bSequence; }CT_PACKET, *PCT_PACKET; // error typedef struct CT_ERROR_EVT : public CT_PACKET{ U8 bCmdType; U8 bErrorId; }CT_ERROR_EVT, *PCT_ERROR_EVT; // set header typedef struct CT_SET_HEADER_CMD : public CT_PACKET{ U8 bCount; }CT_SET_HEADER_CMD, *PCT_SET_HEADER_CMD; typedef struct CT_SET_HEADER_EVT : public CT_PACKET{ }CT_SET_HEADER_EVT, *PCT_SET_HEADER_EVT; // set item typedef struct CT_SET_ITEM_CMD : public CT_PACKET{ U8 bIndex; U16 wReal; U16 wA2D; }CT_SET_ITEM_CMD, *PCT_SET_ITEM_CMD; typedef struct CT_SET_ITEM_EVT : public CT_PACKET{ }CT_SET_ITEM_EVT, *PCT_SET_ITEM_EVT; // set done typedef struct CT_SET_DONE_CMD : public CT_PACKET{ }CT_SET_DONE_CMD, *PCT_SET_DONE_CMD; typedef struct CT_SET_DONE_EVT : public CT_PACKET{ }CT_SET_DONE_EVT, *PCT_SET_DONE_EVT; // get header typedef struct CT_GET_HEADER_CMD : public CT_PACKET{ }CT_GET_HEADER_CMD, *PCT_GET_HEADER_CMD; typedef struct CT_GET_HEADER_EVT : public CT_PACKET{ U8 bCount; }CT_GET_HEADER_EVT, *PCT_GET_HEADER_EVT; // get item typedef struct CT_GET_ITEM_CMD : public CT_PACKET{ U8 bIndex; }CT_GET_ITEM_CMD, *PCT_GET_ITEM_CMD; typedef struct CT_GET_ITEM_EVT : public CT_PACKET{ U16 wReal; U16 wA2D; }CT_GET_ITEM_EVT, *PCT_GET_ITEM_EVT; // ----------- CMD_GET_LRF_ENABLE / CMD_SET_LRF_ENABLE -------------- typedef struct LRF_DISABLE{ uint8_t bMaster; uint8_t bSlave; }LRF_DISABLE, *PLRF_DISABLE; // ----------- CMD_GET_ZOOM_TABLE / CMD_SET_ZOOM_TABLE -------------- enum { ZOOM_TILT_TABLE_SIZE = 10 }; typedef struct ZOOM_TABLE{ uint8_t nCount; uint8_t pTable[ZOOM_TILT_TABLE_SIZE]; }ZOOM_TABLE, *PZOOM_TABLE; // ----------- CMD_GET_TILT_TABLE / CMD_SET_TILT_TABLE -------------- typedef struct TILT_TABLE{ uint8_t nCount; uint8_t pTable[ZOOM_TILT_TABLE_SIZE]; }TILT_TABLE, *PTILT_TABLE; #define MASTER_TAG 0x80 #define SENSOR_TAG 0x00 #define SIZE_IDX_A 1 #define SIZE_IDX_B 2 #define DEV_ID_IDX 3 #define CMD_IDX 4 #define SUB_CMD_IDX 5 #define DATA_BEGIN_IDX 6 #ifdef _CLIENT_APPLICATION_ #define SEND_TAG MASTER_TAG #define ACCEPT_TAG SENSOR_TAG #else #define SEND_TAG SENSOR_TAG #define ACCEPT_TAG MASTER_TAG #endif class protocolLGS: public protocolParser{ private: basicLogCollection *m_pLog; basicMutex m_mInquiryMutex; protected: uint8_t m_bDeviceID; basicTransport *m_oDataTransport; int packetChecker( uint8_t *Buffer, size_t BufferSize); protocolPackage *packetExtractor( uint8_t *Buffer, size_t BufferSize); public: explicit protocolLGS( basicTransport *Transport = NULL, uint8_t DeviceID = 0 ); virtual ~protocolLGS(); virtual bool create(void){ return protocolParser::create(); }; uint8_t getDeviceID(void) { return m_bDeviceID; }; basicTransport * getTransport(void) { return m_oDataTransport; }; bool setDeviceID( uint8_t DeviceID ){ m_bDeviceID = DeviceID; return true; }; bool setTransport(basicTransport* m_oDataTransport); }; class protocolLGS_CLIENT: public protocolLGS{ private: basicLogCollection *m_pLog; public: explicit protocolLGS_CLIENT( basicTransport *Transport = NULL, uint8_t DeviceID = 0 ); virtual ~protocolLGS_CLIENT(); public: /* Query Issuer Methods */ bool doFullReset( void ); bool doReset( void ); bool doStartMotors( void ); bool doStopMotors( void ); bool create(void){ return protocolLGS::create(); }; bool getDraw( uint32_t SampleID, uint8_t KernelID = 0 ); bool getParameters( void ); bool getShadowPoly( uint8_t PolyID ); bool getShadowStatus( uint8_t MaskID = 0 ); bool getShadowInfo( void ); bool getState( void ); bool getState2( void ); bool setMode( U8 Mode ); bool setShadowPoly( simplePolygone *SP ); bool setShadowStatus( bool Status, uint8_t MaskID = 0 ); bool setShadowTrace( vectorZoneMask *VM ); bool setParameters( PLGS_PARAMETERS ptr ); }; class protocolLGS_SERVER: public protocolLGS{ private: basicLogCollection *m_pLog; public: explicit protocolLGS_SERVER( basicTransport *Transport = NULL, U8 DeviceID = 0 ); virtual ~protocolLGS_SERVER(); public: bool create(void){ return protocolLGS::create(); }; bool sendBorderError( uint8_t Error ); bool sendBorderData( uint32_t SampleID, uint8_t KernelID, thresholdNode *WorkingSAF); bool sendEvent( uint8_t Code); bool sendFlip( uint16_t Count); bool sendMode( uint8_t Mode); bool sendParameters( PLGS_PARAMETERS ptr ); bool sendScan( void ); bool sendShadowInfo( ShadowMask *ShObj ); bool sendShadowStatus( bool Status, uint8_t ShadowID = 0 ); bool sendShadowPoly( simplePolygone *SP ); bool sendSetPolyACK( uint8_t id ); bool sendResetACK( void ); bool sendFullResetACK( void ); bool sendGenericACK( bool Status ); bool sendState( uint8_t State); bool sendState2( uint8_t State, uint8_t Coumt = 0, uint8_t *Data = NULL ); bool sendTarget( uint16_t Angle, uint16_t Azimuth, uint16_t Range ); bool sendTargetW( uint16_t Angle, uint16_t Azimuth, uint16_t Range, uint32_t Width); bool sendTargetM( uint32_t SampleID, uint8_t Kernel, uint16_t Range, uint32_t Width, bool isBlack = false ); bool sendTargetZ( TARGET_DATA *ptr ); /* Proto Object Things */ void setTransport( basicTransport *tPtr ){ m_oDataTransport = tPtr; }; }; #endif