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.
72 lines
2.3 KiB
72 lines
2.3 KiB
#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
|