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.
66 lines
2.1 KiB
66 lines
2.1 KiB
#ifndef __LRF_TWINCONNECTOR_H_INCL__
|
|
#define __LRF_TWINCONNECTOR_H_INCL__
|
|
|
|
#include "../../data/protocol/protocolInternalLRF3D.h"
|
|
|
|
#ifdef PRU_SLAVE
|
|
#include "../../data/net/clientPort.h"
|
|
#else
|
|
#include "../../data/net/serverPort.h"
|
|
#endif
|
|
|
|
#define TWI_QUICK_LOOP_SLEEP 5
|
|
#define TWI_SLOW_LOOP_SLEEP 100
|
|
#define TWI_STATUS_LOOP_MS 500
|
|
#define TWI_RECONNECT_LOOP_SLEEP 1000
|
|
|
|
|
|
#define STORAGE_DIR_MODE 0x1FF
|
|
#define STORAGE_FILE_MODE 0x1B6
|
|
|
|
class LRF_Kernel;
|
|
class LRF_TargetTracker;
|
|
|
|
class LRF_TwinConnector: public basicThread {
|
|
private:
|
|
basicLogCollection * m_pLog;
|
|
config_setting_t * m_pSettings;
|
|
TWIN_COMMAND_QUEUE m_qCMD;
|
|
TWIN_COMMAND m_bCCMD;
|
|
basicMutex CMD_PROTEC;
|
|
LRF_Kernel * m_pEngine;
|
|
#ifdef PRU_SLAVE
|
|
protocolInternalLRF3D_SLAVE * m_pProtocol;
|
|
clientPort * m_pPort;
|
|
uint16_t m_nMasterPort;
|
|
CSTR m_pMasterAddress;
|
|
#else
|
|
protocolInternalLRF3D_MASTER * m_pProtocol;
|
|
serverPort * m_pPort;
|
|
int m_nMainSocket;
|
|
LRF_TargetTracker * m_pTracker;
|
|
uint16_t m_nBindPort;
|
|
CSTR m_pBindAddress;
|
|
targetRecord m_pTargets[TWI_TARGET_QUEUE_SIZE];
|
|
#endif
|
|
protected:
|
|
void m_fThreadProc( void );
|
|
public:
|
|
explicit LRF_TwinConnector( config_setting_t *Settings = NULL );
|
|
virtual ~LRF_TwinConnector();
|
|
bool create();
|
|
void setKernel( LRF_Kernel *ptr ){ m_pEngine = ptr; };
|
|
bool cleanTHData( uint8_t kid );
|
|
bool loadTHData( uint8_t kid, thresholdNode *ptr );
|
|
bool saveTHData( uint8_t kid, thresholdNode *ptr );
|
|
#ifdef PRU_SLAVE
|
|
bool sendCurrentSettings( void );
|
|
#else
|
|
bool attachTargetTracker( LRF_TargetTracker *ptr );
|
|
bool requestSettings( void );
|
|
#endif
|
|
};
|
|
|
|
|
|
|
|
#endif
|