#ifndef __PROTOCOL_LRF_3D_INTERNAL_MASTER_SERVER_COMMUNICATION__ #define __PROTOCOL_LRF_3D_INTERNAL_MASTER_SERVER_COMMUNICATION__ //aliona //https://www.pornhub.com/view_video.php?viewkey=ph5dffcb1983567 #include "protocol.h" class protocolInternalLRF3D: public protocolParser { private: basicLogCollection *m_pLog; protected: int packetChecker( U8 *Buffer, size_t BufferSize ); protocolPackage *packetExtractor( U8 *Buffer, size_t BufferSize ); inline int FinishUpPackage( U8 *Buffer, size_t Size ){ Buffer[0] = 0xAA; Buffer[1] = ((Size - 3) >> 8) | SEND_TAG; Buffer[2] = (Size - 3) & 0xFF; Buffer[Size] = checksumLGS(Buffer, Size); return Size + 1; }; public: protocolInternalLRF3D(); virtual ~protocolInternalLRF3D(); bool create(void); }; #ifdef PRU_SLAVE class protocolInternalLRF3D_SLAVE: public protocolInternalLRF3D{ private: basicLogCollection *m_pLog; config_setting_t *m_pSettings; CSTR m_pMasterAddress; uint16_t m_nMasterPort; uint8_t m_bFailureReason; uint32_t m_nStatus; clientPort *m_pPort; bool m_bSettingsIsLoadded; bool sendTrasholdData( uint8_t lrf_id, uint32_t dataIdx = 0 ); bool sendTargets( void ); bool sendStatus( void ); protected: virtual bool packetHandler( protocolPackage *Package ); public: explicit protocolInternalLRF3D_SLAVE( config_setting_t *Settings = NULL ); virtual ~protocolInternalLRF3D_SLAVE(); bool create( void ); bool setTrasholdData( uint8_t lrf_id, uint32_t *ptr ); bool enqueueTarget( void ); uint8_t getFailureReason( void ){ return m_bFailureReason; }; }; #else class protocolInternalLRF3D_MASTER: public protocolInternalLRF3D{ private: basicLogCollection *m_pLog; config_setting_t *m_pSettings; protected: bool packetHandler( protocolPackage *Package ); public: explicit protocolInternalLRF3D_MASTER( config_setting_t *Settings = NULL ); virtual ~protocolInternalLRF3D_MASTER(); bool create(void); bool ackDataSegment( uint32_t dataIdx = 0 ); bool ackTargets( uint32_t pkgId ); bool requestTargets(void); bool requestTrasholdData( uint8_t lrf_id ); bool requestStatus( void ); }; #endif #endif