#ifndef __PROTOCOL_LGS_3D_99sd8_HEADERS__ #define __PROTOCOL_LGS_3D_99sd8_HEADERS__ #include "../../alg/lgs/detectorStructures.h" #include "protocol.h" #include "protocolLGS_data.h" // #define DUBUG_COMMUNICATION class protocolLGS_3D : public protocolParser { private: basicLogCollection * m_pLog; protected: basicMutex m_mBufferProtector; uint8_t m_pWorkingBuffer[4096];//ToDo: May Be moved to each package creation function .... or must be protected by mutex .... either way must be changed uint8_t m_bDeviceID; inline int FinishUpPackage(uint8_t * Buffer, size_t Size, uint8_t DeviceID) { Buffer[0] = 0x55; Buffer[1] = ((Size - 3) >> 8) | SEND_TAG; Buffer[2] = (Size - 3) & 0xFF; Buffer[3] = DeviceID; Buffer[Size] = checksumLGS(Buffer, Size); return Size + 1; } int packetChecker(uint8_t * Buffer, size_t BufferSize); protocolPackage * packetExtractor(uint8_t * Buffer, size_t BufferSize); public: explicit protocolLGS_3D(uint8_t DeviceID = 0); virtual ~protocolLGS_3D(); virtual bool create(void) { return protocolParser::create(); } uint8_t getProtocolID(void) { return m_bDeviceID; } bool setProtocolID(uint8_t DeviceID) { m_bDeviceID = DeviceID; return true; } bool sendACK(uint8_t CMD); bool sendNACK(uint8_t CMD); bool sendIDONK(uint8_t CMD); }; #endif