From 14b8231397d927c05ee033707eec1c03c65b1618 Mon Sep 17 00:00:00 2001 From: Gagua on MyIR master Date: Fri, 23 Oct 2020 10:37:28 +0000 Subject: [PATCH] Sucessful build MASTER/SLAVE TWI --- Projects/LRF_Server/Debug/server.conf | 5 +- Projects/LRF_Slave/Debug/server.conf | 1 + Projects/LRF_Slave/LRF_Slave.vpj | 1 + Projects/LRF_Slave/makefile | 12 +- lib/App/3dSERVER/LRF_HardwareManager.cpp | 44 ++-- lib/App/3dSERVER/LRF_HardwareManager.h | 1 - lib/App/3dSERVER/LRF_Kernel.cpp | 245 ++++++++++++-------- lib/App/3dSERVER/LRF_Kernel.h | 20 +- lib/App/3dSERVER/LRF_TwinConnector.cpp | 155 ++++++------- lib/App/3dSERVER/LRF_TwinConnector.h | 24 +- lib/data/protocol/protocolInternalLRF3D.cpp | 64 +++-- lib/data/protocol/protocolInternalLRF3D.h | 43 ++-- 12 files changed, 360 insertions(+), 255 deletions(-) diff --git a/Projects/LRF_Server/Debug/server.conf b/Projects/LRF_Server/Debug/server.conf index 4d27f4a9..da14d1b5 100644 --- a/Projects/LRF_Server/Debug/server.conf +++ b/Projects/LRF_Server/Debug/server.conf @@ -36,7 +36,7 @@ KERNEL : { ENABLE_SAFE_SHORE = false; ENABLE_DEFENDER = false; - ENABLE_INFOSTRESS = true; + ENABLE_INFOSTRESS = false; DETECTOR_WIDTH = 1000; ENABLED_LRF = 255; DETECTOR_SST = 0; @@ -98,6 +98,3 @@ SSDP : GENERAL : { }; -PROTOCOL : -{ -}; diff --git a/Projects/LRF_Slave/Debug/server.conf b/Projects/LRF_Slave/Debug/server.conf index 3c38899f..13961638 100644 --- a/Projects/LRF_Slave/Debug/server.conf +++ b/Projects/LRF_Slave/Debug/server.conf @@ -38,4 +38,5 @@ KERNEL : MASTER_ADDRESS = "10.0.0.1"; MASTER_PORT = 6060; }; + DETECTOR_WIDTH = 1000; }; diff --git a/Projects/LRF_Slave/LRF_Slave.vpj b/Projects/LRF_Slave/LRF_Slave.vpj index 713b62f2..623eb2e6 100644 --- a/Projects/LRF_Slave/LRF_Slave.vpj +++ b/Projects/LRF_Slave/LRF_Slave.vpj @@ -236,6 +236,7 @@ + diff --git a/Projects/LRF_Slave/makefile b/Projects/LRF_Slave/makefile index e4ed45cd..b4656e06 100644 --- a/Projects/LRF_Slave/makefile +++ b/Projects/LRF_Slave/makefile @@ -33,7 +33,8 @@ COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/basicTransport.o $(OUTDIR)/classSOC.o \ $(OUTDIR)/clientPort.o $(OUTDIR)/detector.o $(OUTDIR)/LRF_Detector.o \ $(OUTDIR)/LRF_HardwareManager.o $(OUTDIR)/LRF_Kernel.o \ - $(OUTDIR)/LRF_Server.o $(OUTDIR)/LRF_TwinConnector.o $(OUTDIR)/md5.o \ + $(OUTDIR)/LRF_Server.o $(OUTDIR)/LRF_TwinConnector.o \ + $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/protocol.o \ $(OUTDIR)/protocolInternalLRF3D.o $(OUTDIR)/pru_ss.o \ $(OUTDIR)/pwm_ss.o $(OUTDIR)/transportSocket.o @@ -48,7 +49,8 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/basicTransport.o $(OUTDIR)/classSOC.o \ $(OUTDIR)/clientPort.o $(OUTDIR)/detector.o $(OUTDIR)/LRF_Detector.o \ $(OUTDIR)/LRF_HardwareManager.o $(OUTDIR)/LRF_Kernel.o \ - $(OUTDIR)/LRF_Server.o $(OUTDIR)/LRF_TwinConnector.o $(OUTDIR)/md5.o \ + $(OUTDIR)/LRF_Server.o $(OUTDIR)/LRF_TwinConnector.o \ + $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/protocol.o \ $(OUTDIR)/protocolInternalLRF3D.o $(OUTDIR)/pru_ss.o \ $(OUTDIR)/pwm_ss.o $(OUTDIR)/transportSocket.o @@ -163,7 +165,8 @@ COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/basicTransport.o $(OUTDIR)/classSOC.o \ $(OUTDIR)/clientPort.o $(OUTDIR)/detector.o $(OUTDIR)/LRF_Detector.o \ $(OUTDIR)/LRF_HardwareManager.o $(OUTDIR)/LRF_Kernel.o \ - $(OUTDIR)/LRF_Server.o $(OUTDIR)/LRF_TwinConnector.o $(OUTDIR)/md5.o \ + $(OUTDIR)/LRF_Server.o $(OUTDIR)/LRF_TwinConnector.o \ + $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/protocol.o \ $(OUTDIR)/protocolInternalLRF3D.o $(OUTDIR)/pru_ss.o \ $(OUTDIR)/pwm_ss.o $(OUTDIR)/transportSocket.o @@ -178,7 +181,8 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/basicTransport.o $(OUTDIR)/classSOC.o \ $(OUTDIR)/clientPort.o $(OUTDIR)/detector.o $(OUTDIR)/LRF_Detector.o \ $(OUTDIR)/LRF_HardwareManager.o $(OUTDIR)/LRF_Kernel.o \ - $(OUTDIR)/LRF_Server.o $(OUTDIR)/LRF_TwinConnector.o $(OUTDIR)/md5.o \ + $(OUTDIR)/LRF_Server.o $(OUTDIR)/LRF_TwinConnector.o \ + $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/protocol.o \ $(OUTDIR)/protocolInternalLRF3D.o $(OUTDIR)/pru_ss.o \ $(OUTDIR)/pwm_ss.o $(OUTDIR)/transportSocket.o diff --git a/lib/App/3dSERVER/LRF_HardwareManager.cpp b/lib/App/3dSERVER/LRF_HardwareManager.cpp index 0ff7a902..547256d6 100644 --- a/lib/App/3dSERVER/LRF_HardwareManager.cpp +++ b/lib/App/3dSERVER/LRF_HardwareManager.cpp @@ -1678,7 +1678,7 @@ bool LRF_HardwareManager::validateCores( void ){ #ifndef ONPC_TOTTAL_SIMULATOR if( !m_bInitOK ) return false; if( m_pSOC != NULL ){ -#ifndef PRU_SLAVE + #ifndef PRU_SLAVE *((uint32_t*)&m_sCS_Motors) = m_pSOC->getMotorStatus(); if( m_sCS_Motors.online ){ bool tErrors = false; @@ -1696,24 +1696,24 @@ bool LRF_HardwareManager::validateCores( void ){ }; if( tErrors )return false; }; -#endif + #endif *((uint32_t*)&m_sCS_Detector) = m_pSOC->getThCoreStatus(); *((uint32_t*)&m_sCP_Detector) = m_pSOC->getThCoreParams(); if( m_sCP_Detector.self_build_ena ) { m_nDetectionFilter = 0xFF; }; if( m_sCS_Detector.online ) { -#ifdef SIMULATE_FLIPS + #ifdef SIMULATE_FLIPS if( ( pips_counter % 100 ) == 0 ){ LOG("INJECT Flip Request!"); m_pSOC->injectThCoreRequest( CORE3_REQ_FLIP_TH ); }; -#endif -#ifdef THREADED_FLIP - if( m_bFlipUnlockRequested ){ - #ifdef DEBUG - LOG("Unlocking Flip protecting Mutex"); #endif + #ifdef THREADED_FLIP + if( m_bFlipUnlockRequested ){ + #ifdef DEBUG + LOG("Unlocking Flip protecting Mutex"); + #endif if( m_pFlipMutex != NULL ){ if( 0 != pthread_mutex_unlock( m_pFlipMutex ) ){ LOG_ERROR("Error Unlocking Flip protecting Mutex!"); @@ -1721,16 +1721,16 @@ bool LRF_HardwareManager::validateCores( void ){ }; m_bFlipUnlockRequested = false; }; -#endif + #endif if( m_sCS_Detector.req ) { -#ifdef DEBUG + #ifdef DEBUG LOG("Detector CORE REQ"); -#endif + #endif uint32_t mCoreReq; mCoreReq = m_pSOC->getThCoreRequest(); switch( mCoreReq ) { case CORE3_REQ_FLIP_TH:{ -#ifdef THREADED_FLIP + #ifdef THREADED_FLIP if( m_pFlipMutex != NULL ) { if( 0 == pthread_mutex_trylock( m_pFlipMutex ) ){ if( !m_bWaitFirstFlip ) { @@ -1755,28 +1755,28 @@ bool LRF_HardwareManager::validateCores( void ){ #endif }; } -#else - #ifdef DEBUG + #else //!THREADED_FLIP + #ifdef DEBUG LOG("Build Working Threshold Memories NT Mode!"); - #endif + #endif if( performFlip() ){ - #ifdef DEBUG + #ifdef DEBUG LOG("CORE REQ Done."); - #endif + #endif } else { LOG_ERROR("Building Detector's TH Error!"); }; -#endif + #endif//!THREADED_FLIP break; }; case CORE3_REQ_CLEAR_TH:{ -#ifdef DEBUG + #ifdef DEBUG LOG("Clear Threshold Memories"); -#endif + #endif if( cleanTH(0) ){ -#ifdef DEBUG + #ifdef DEBUG //LOG("CORE REQ Done."); -#endif + #endif } else { LOG_ERROR("Cleanup Detector's TH Error!"); } diff --git a/lib/App/3dSERVER/LRF_HardwareManager.h b/lib/App/3dSERVER/LRF_HardwareManager.h index b36f344b..7cba7f06 100644 --- a/lib/App/3dSERVER/LRF_HardwareManager.h +++ b/lib/App/3dSERVER/LRF_HardwareManager.h @@ -175,7 +175,6 @@ class LRF_HardwareManager { #ifdef PRU_SLAVE bool isMaster( void ){ return false; }; #else - //bool isMaster( void ){ return (bool)m_sPARAMETERS.flags.isMaster; }; bool isMaster( void ){ return true; }; #endif bool getDetectionStatus( DT_STATUS &Status ); diff --git a/lib/App/3dSERVER/LRF_Kernel.cpp b/lib/App/3dSERVER/LRF_Kernel.cpp index c9a1126a..97b28c26 100644 --- a/lib/App/3dSERVER/LRF_Kernel.cpp +++ b/lib/App/3dSERVER/LRF_Kernel.cpp @@ -38,6 +38,7 @@ LRF_Kernel::LRF_Kernel( LRF_HardwareManager *HM ): basicThread(){ m_nFlipCounter = 0; m_nFlipSavierID = 0; m_pShadow = NULL; + m_pTWIC = NULL; #ifdef __EU_PROJECT__ m_pSafeShoreHandler = NULL; @@ -47,13 +48,15 @@ LRF_Kernel::LRF_Kernel( LRF_HardwareManager *HM ): basicThread(){ m_pKafkaHandler = NULL; m_bKafkaSupport = false; #endif - +#ifdef PRU_SLAVE +#else m_pTracker = NULL; m_pNetClientsServer = NULL; + m_nSST = 0; +#endif m_pThreshold = NULL; m_eWorkMode = WM_NONE; - m_nWidth = 800; - m_nSST = 0; + m_nWidth = 800; }; // Destructor implementation @@ -80,31 +83,40 @@ LRF_Kernel::~LRF_Kernel(){ LOG("KAFKA - Done"); #endif #endif - + if( m_pTWIC ) delete( m_pTWIC ); +#ifdef DEBUG + LOG("Twin Connector - Done"); +#endif if( m_pShadow ) delete( m_pShadow ); #ifdef DEBUG LOG("Shadow Mask - Done"); +#endif +#ifdef DEBUG LOG("Destructor Finished"); #endif }; -bool LRF_Kernel::attachNetServer( networkServer *srvPort ){ - if( srvPort != NULL ) { - m_pNetClientsServer = srvPort; - }; - if( m_pNetClientsServer!= NULL ) { - return srvPort->attachEngine( (basicEngine *)this ); +#ifdef PRU_SLAVE + bool LRF_Kernel::create( LRF_HardwareManager *ptr ){ +#else + bool LRF_Kernel::attachNetServer( networkServer *srvPort ){ + if( srvPort != NULL ) { + m_pNetClientsServer = srvPort; + }; + if( m_pNetClientsServer!= NULL ) { + return srvPort->attachEngine( (basicEngine *)this ); + }; + return false; }; - return false; -}; - -bool LRF_Kernel::create( LRF_HardwareManager *ptr, networkServer *srvPort ){ + bool LRF_Kernel::create( LRF_HardwareManager *ptr, networkServer *srvPort ){ +#endif if( m_pSettings != NULL ) { config_setting_t *pSetting; int tVal; char tBuffer[256]; LOG("Getting Settings ..."); -#ifdef __EU_PROJECT__ +#ifndef PRU_SLAVE + #ifdef __EU_PROJECT__ if( !config_setting_lookup_bool( m_pSettings, KNL_SETTINGS_SAFE_SHORE, &tVal ) ){ tVal = m_bSafeShoreSupport = true; pSetting = config_setting_add( m_pSettings, KNL_SETTINGS_SAFE_SHORE, CONFIG_TYPE_BOOL ); @@ -116,7 +128,6 @@ bool LRF_Kernel::create( LRF_HardwareManager *ptr, networkServer *srvPort ){ sprintf( tBuffer, "Safe-Shore support Read From Settings: %d", tVal ); LOG( tBuffer ); }; -#endif if( !config_setting_lookup_bool( m_pSettings, KNL_SETTINGS_DEFENDER, &tVal ) ){ tVal = m_bDefenderSupport = true; pSetting = config_setting_add( m_pSettings, KNL_SETTINGS_DEFENDER, CONFIG_TYPE_BOOL ); @@ -128,7 +139,30 @@ bool LRF_Kernel::create( LRF_HardwareManager *ptr, networkServer *srvPort ){ sprintf( tBuffer, "Defender support Read From Settings: %d", tVal ); LOG( tBuffer ); }; - + if( !config_setting_lookup_bool( m_pSettings, KNL_SETTINGS_KAFKA, &tVal ) ){ + tVal = m_bKafkaSupport = true; + pSetting = config_setting_add( m_pSettings, KNL_SETTINGS_KAFKA, CONFIG_TYPE_BOOL ); + config_setting_set_bool( pSetting, tVal ); + m_pSettingsProvider->compromise(); + LOG("KAFKA support not defined"); + } else { + m_bKafkaSupport = (bool)tVal; + sprintf( tBuffer, "KAFKA support Read From Settings: %d", tVal ); + LOG( tBuffer ); + }; + #endif + if (!config_setting_lookup_int(m_pSettings, KNL_SETTINGS_DETECTOR_SST, &tVal )){ + tVal = m_nSST = 0; + pSetting = config_setting_add(m_pSettings, KNL_SETTINGS_DETECTOR_SST, CONFIG_TYPE_INT); + config_setting_set_int(pSetting, tVal ); + m_pSettingsProvider->compromise(); + LOG("No Detector SST"); + } else { + m_nSST = tVal; + sprintf( tBuffer, "Detector SST Read From Settings: %d", tVal ); + LOG( tBuffer ); + }; +#endif if (!config_setting_lookup_int(m_pSettings, KNL_SETTINGS_DETECTOR_WIDTH, &tVal )){ tVal = m_nWidth = 1000; pSetting = config_setting_add(m_pSettings, KNL_SETTINGS_DETECTOR_WIDTH, CONFIG_TYPE_INT); @@ -150,17 +184,6 @@ bool LRF_Kernel::create( LRF_HardwareManager *ptr, networkServer *srvPort ){ m_nKernelFilter = tVal; sprintf( tBuffer, "Filter Kernels Read From Settings: %d", tVal ); LOG( tBuffer ); - }; - if (!config_setting_lookup_int(m_pSettings, KNL_SETTINGS_DETECTOR_SST, &tVal )){ - tVal = m_nSST = 0; - pSetting = config_setting_add(m_pSettings, KNL_SETTINGS_DETECTOR_SST, CONFIG_TYPE_INT); - config_setting_set_int(pSetting, tVal ); - m_pSettingsProvider->compromise(); - LOG("No Detector SST"); - } else { - m_nSST = tVal; - sprintf( tBuffer, "Detector SST Read From Settings: %d", tVal ); - LOG( tBuffer ); }; if( m_pSettingsProvider->isCompromised() ) { LOG("Save Settings"); @@ -208,34 +231,32 @@ bool LRF_Kernel::create( LRF_HardwareManager *ptr, networkServer *srvPort ){ }; }; #endif - if( !attachNetServer( srvPort ) ) { - LOG_ERROR("No Network manager attached!"); - return false; - }; - - m_lCycleCounter = 2; -#ifdef __EU_PROJECT__ - if( m_bSafeShoreSupport ){ - m_pSafeShoreHandler = new LRF_SafeShoreHandler( m_pSettings ); - if( m_pSafeShoreHandler == NULL ) { - LOG_ERROR("SafeShore Protocol failed!"); - }; - }; - if( m_bDefenderSupport ) { - m_pDefenderHandler = new LRF_DefenderHandler( m_pSettings ); - if( m_pDefenderHandler == NULL ) { - LOG_ERROR("Defender Protocol failed!"); - }; - }; - if( m_bKafkaSupport ) { - m_pKafkaHandler = new LRF_KafkaHandler( m_pSettings ); - if( m_pKafkaHandler == NULL ) { - LOG_ERROR("Kafka Protocol failed!"); - }; - }; -#endif - + m_lCycleCounter = 2; #ifndef PRU_SLAVE + if( !attachNetServer( srvPort ) ) { + LOG_ERROR("No Network manager attached!"); + return false; + }; + #ifdef __EU_PROJECT__ + if( m_bSafeShoreSupport ){ + m_pSafeShoreHandler = new LRF_SafeShoreHandler( m_pSettings ); + if( m_pSafeShoreHandler == NULL ) { + LOG_ERROR("SafeShore Protocol failed!"); + }; + }; + if( m_bDefenderSupport ) { + m_pDefenderHandler = new LRF_DefenderHandler( m_pSettings ); + if( m_pDefenderHandler == NULL ) { + LOG_ERROR("Defender Protocol failed!"); + }; + }; + if( m_bKafkaSupport ) { + m_pKafkaHandler = new LRF_KafkaHandler( m_pSettings ); + if( m_pKafkaHandler == NULL ) { + LOG_ERROR("Kafka Protocol failed!"); + }; + }; + #endif #ifdef DEBUG LOG( "Target Tracker about to be created" ); #endif @@ -249,6 +270,34 @@ bool LRF_Kernel::create( LRF_HardwareManager *ptr, networkServer *srvPort ){ #endif #endif // !PRU_SLAVE +#ifdef DEBUG + LOG( "Twin Connector about to be created" ); +#endif + m_pTWIC = new LRF_TwinConnector( m_pSettings ); + if( m_pTWIC == NULL ) { + LOG_ERROR("Error creating TWIN object!"); + return false; + } else { +#ifdef DEBUG + LOG( "TWIN object - OK" ); +#endif + if( m_pTWIC->create() ){ +#ifdef DEBUG + LOG( "TWIN create - OK" ); +#endif + m_pTWIC->setKernel( this ); +#ifndef PRU_SLAVE + m_pTWIC->attachTargetTracker( m_pTracker ); +#endif + } else { + LOG_ERROR("Error in TWIN create!"); + return false; + }; + }; +#ifdef DEBUG + LOG( "TWIN connector Created" ); +#endif + #ifdef DEBUG LOG( "Trhead about to be created" ); #endif @@ -297,7 +346,7 @@ void LRF_Kernel::m_fThreadProc( void ){ LOG( "Cores Became OK!" ); #endif m_eWorkMode = WM_INIT; - } + }; #ifdef SIMULATE_TARGETS #ifdef SIMULATE_DOS_TARGETS if( m_lCycleCounter % 10 == 0 ) { @@ -339,12 +388,17 @@ void LRF_Kernel::m_fThreadProc( void ){ m_pSafeShoreHandler->SetStatus( true ); }; }; -#endif if( m_bDefenderSupport ) { if( m_pDefenderHandler != NULL ) { m_pDefenderHandler->SetStatus( true ); }; }; + if( m_bKafkaSupport ) { + if( m_pKafkaHandler != NULL ) { + m_pKafkaHandler->SetStatus( true ); + }; + }; +#endif thresholdNode *ptr; ptr = m_pHardwareManager->getWorkingMemory(); if( ptr!= NULL ){ @@ -425,7 +479,10 @@ void LRF_Kernel::m_fThreadProc( void ){ uint16_t cPointX, cPointY; makeXY( cNode.begin_id, cPointX, cPointY, m_pHardwareManager->isMaster() ); if( m_pShadow->isOutside( cPointX, cPointY )){ +#ifdef PRU_SLAVE +#else cTrackID = m_pTracker->validateTarget( &cNode, m_pHardwareManager->isMaster()); +#endif #ifndef SKIP_TARGET_LOG #ifdef DEBUG sprintf( Buffer, "Assigned ID [%d] area: %d CNT: %d bID: %d eID: %d", @@ -444,7 +501,10 @@ void LRF_Kernel::m_fThreadProc( void ){ #endif }; } else { // Shadow is Disabled +#ifdef PRU_SLAVE +#else cTrackID = m_pTracker->validateTarget( &cNode, m_pHardwareManager->isMaster()); +#endif #ifndef SKIP_TARGET_LOG #ifdef DEBUG sprintf( Buffer, "Assigned ID [%d] area: %d CNT: %d bID: %d eID: %d", @@ -526,7 +586,10 @@ void LRF_Kernel::m_fThreadProc( void ){ #endif // NO_BLACK_TARGETS case SCAN_COMPLETE: +#ifdef PRU_SLAVE +#else m_pTracker->ScanComplete(); +#endif sprintf( Buffer,"Scan Complete [%d,%d]", cNode.width, cNode.begin_id ); #ifdef DEBUG LOG( Buffer ); @@ -534,7 +597,10 @@ void LRF_Kernel::m_fThreadProc( void ){ tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR, EVT_SCAN, Buffer, NULL ); break; case SCAN_FROZEN: +#ifdef PRU_SLAVE +#else m_pTracker->ScanComplete(); +#endif sprintf( Buffer,"Scan was Frozen", cNode.width, cNode.begin_id ); #ifdef DEBUG LOG( Buffer ); @@ -549,10 +615,12 @@ void LRF_Kernel::m_fThreadProc( void ){ #endif tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR, EVT_FLIP, Buffer, NULL ); break; +#ifndef PRU_SLAVE case MIRROR_FINISHED: //LOG("Mirror"); m_pTracker->MirrorComplete(); break; +#endif case ERROR_ANGLE: sprintf( Buffer,"Error Angle [%d,%d]", cNode.width, cNode.begin_id ); #ifdef DEBUG @@ -649,6 +717,7 @@ PLGS_PARAMETERS LRF_Kernel::getDetectionParameters( void ){ }; return tParam; }; + bool LRF_Kernel::setDetectionParameters( PLGS_PARAMETERS ptr ){ bool isCompromised = false; HW_PARAMS tHwParams; @@ -736,6 +805,9 @@ bool LRF_Kernel::setDetectionParameters( PLGS_PARAMETERS ptr ){ }; thresholdNode *LRF_Kernel::getTreshold( uint32_t &size, uint8_t kID ){ + if( m_pTWIC != NULL ) { + + }; if( m_pHardwareManager!= NULL ) { thresholdNode *ptr; ptr = m_pHardwareManager->getWorkingMemory(); @@ -783,46 +855,29 @@ bool LRF_Kernel::shutdown( bool Restart ){ return true; }; -bool LRF_Kernel::stopMotors( void ){ -#ifndef ONPC_TOTTAL_SIMULATOR - if( m_pHardwareManager!= NULL ) { - return m_pHardwareManager->stopMotors( false ); - }; - return false; -#else - return true; -#endif -}; +#ifndef PRU_SLAVE //Just Master Stuff + bool LRF_Kernel::stopMotors( void ){ + #ifndef ONPC_TOTTAL_SIMULATOR + if( m_pHardwareManager!= NULL ) { + return m_pHardwareManager->stopMotors( false ); + }; + return false; + #else + return true; + #endif + }; -bool LRF_Kernel::startMotors( void ){ -#ifndef ONPC_TOTTAL_SIMULATOR - if( m_pHardwareManager!= NULL ) { - return m_pHardwareManager->startMotors( false ); - }; - return false; -#else - return true; + bool LRF_Kernel::startMotors( void ){ + #ifndef ONPC_TOTTAL_SIMULATOR + if( m_pHardwareManager!= NULL ) { + return m_pHardwareManager->startMotors( false ); + }; + return false; + #else + return true; + #endif + }; #endif -}; - - -/* -bool LRF_Kernel::getTarget( TARGET *t ){ - return false; -}; - -uint32_t LRF_Kernel::getErrorAngle( void ){ - return 0; -}; - -void LRF_Kernel::clearErrorAngle( void ){ - -}; - -bool LRF_Kernel::isErrorAngle( void ){ - return false; -}; -*/ #undef LOG #undef LOG_ERROR diff --git a/lib/App/3dSERVER/LRF_Kernel.h b/lib/App/3dSERVER/LRF_Kernel.h index 66179d95..8ff6cedc 100644 --- a/lib/App/3dSERVER/LRF_Kernel.h +++ b/lib/App/3dSERVER/LRF_Kernel.h @@ -24,9 +24,9 @@ #include "LRF_HardwareManager.h" #include "LRF_TwinConnector.h" #include "../../alg/lgs/detector.h" +#include "../../alg/lgs/mask.h" -#ifndef PRU_SLAVE - #include "../../alg/lgs/mask.h" +#ifndef PRU_SLAVE #include "../../data/net/netServer.h" #include "LRF_TargetTracker.h" #ifdef __EU_PROJECT__ @@ -90,11 +90,11 @@ class LRF_Kernel: public basicThread { // Argus/LGS proto networkServer * m_pNetClientsServer; // Detection Stuff - uint32_t m_nWidth; uint32_t m_nSST; +#endif + uint32_t m_nWidth; // Shadow ShadowMask * m_pShadow; -#endif thresholdNode * m_pThreshold; uint32_t m_nThresholdSize; protected: @@ -121,14 +121,10 @@ class LRF_Kernel: public basicThread { bool askReset( void ); LRF_WORK_MODE getMode( void ){ return m_eWorkMode; }; bool getParameters( void ); - thresholdNode * getTreshold( uint32_t &size, uint8_t kID=0 ); - //bool getTarget( TARGET *t ); - //uint32_t getErrorAngle( void ); - //void clearErrorAngle( void ); - //bool isErrorAngle( void ); - bool setMode( LRF_WORK_MODE nMode ); - bool setOffset( uint8_t nOffset ); - bool setOrder( uint8_t nOrder ); + thresholdNode * getTreshold( uint32_t &size, uint8_t kID=0 ); + bool setMode( LRF_WORK_MODE nMode ); + bool setOffset( uint8_t nOffset ); + bool setOrder( uint8_t nOrder ); PLGS_PARAMETERS getDetectionParameters( void ); bool setDetectionParameters( PLGS_PARAMETERS ptr ); diff --git a/lib/App/3dSERVER/LRF_TwinConnector.cpp b/lib/App/3dSERVER/LRF_TwinConnector.cpp index f7e38a0c..21412bd7 100644 --- a/lib/App/3dSERVER/LRF_TwinConnector.cpp +++ b/lib/App/3dSERVER/LRF_TwinConnector.cpp @@ -22,10 +22,12 @@ LRF_TwinConnector::LRF_TwinConnector( config_setting_t *Settings ): basicThread( #ifdef PRU_SLAVE m_nMasterPort = 0; m_pMasterAddress = (CSTR) malloc( 16 ); + m_bWorkingMode = TWI_STAGE_WAITING_CONNECTION; #else m_nMainSocket = -1; m_nBindPort = 0; m_pBindAddress = (CSTR) malloc( 16 ); + m_bWorkingMode = TWI_STAGE_BEFORE_BIND; #endif }; @@ -158,6 +160,7 @@ bool LRF_TwinConnector::create(){ LOG( "Can't set N-Blocking Mode of Accepting Socket" ); }; #endif // PRU_SLAVE + m_bWorkingMode = TWI_STAGE_WAITING_CONNECTION; return init(); }; @@ -182,6 +185,7 @@ bool LRF_TwinConnector::create(){ }; if( m_pPort != NULL ){ if( m_pPort->getConnectionStatus() == CS_DISCONNECTED ){ + m_bWorkingMode = TWI_STAGE_WAITING_CONNECTION; if( tCMD!= NULL ){ //reset commands on disconnect m_bCCMD = TWC_NO_COMMAND; @@ -225,13 +229,13 @@ bool LRF_TwinConnector::create(){ m_pPort = new clientPort( m_pMasterAddress, m_nMasterPort, true ); if( m_pPort!= NULL ){ m_pProtocol->setTransport( m_pPort ); + m_bWorkingMode = TWI_STAGE_CONNECTED; }; }; }; }; #else //Master void LRF_TwinConnector::m_fThreadProc( void ){ - TWIN_CMD_REC * tCMD = NULL; int ClientSocket = -1; struct sockaddr ClientAddress; socklen_t ClientAddressSize; @@ -244,76 +248,83 @@ bool LRF_TwinConnector::create(){ cMilliseconds = getMilliseconds(); - if( m_bCCMD == TWC_NO_COMMAND && tCMD == NULL ){ - // No CMD is EXEC so check new cmds - CMD_PROTEC.lock(); - if( m_qCMD.size() > 0 ){ - tCMD = m_qCMD.front(); - m_qCMD.pop(); - }; - CMD_PROTEC.unlock(); - }; - + // Port exists - SLAVE is connected if( m_pPort != NULL ){ + // Check if still connected if( m_pPort->getConnectionStatus() == CS_DISCONNECTED ){ - if( tCMD!= NULL ){ - //reset commands on disconnect - m_bCCMD = TWC_NO_COMMAND; - if( tCMD->PTR == NULL ) free( tCMD->PTR ); - free( tCMD ); - tCMD = NULL; - }; + // Handle Disconnection + m_bWorkingMode = TWI_STAGE_WAITING_CONNECTION; delete( m_pPort ); m_pPort = NULL; continue; }; - if( tCMD!= NULL ){ - if( m_bCCMD == TWC_NO_COMMAND ){ - // CMD not issued yet! - switch( tCMD->CMD ){ - case TWC_GET_STATUS:{ - if( m_pProtocol->requestStatus() ){ - m_bCCMD = tCMD->CMD; - }; - break; - }; - case TWC_GET_CONFIG:{ - break; - }; - case TWC_SET_CONFIG:{ - break; - }; - case TWC_GET_THDRAW:{ - break; - }; - case TWC_DO_REBOOT:{ - break; - }; - }; - } else { - // Waiting CMD exe status - switch( m_bCCMD ){ - case TWC_GET_STATUS:{ - if( m_pProtocol->getLastPackageType() == TWIN_STATUS_ACK ){ - m_bCCMD = TWC_NO_COMMAND; + if( m_bCCMD == TWC_NO_COMMAND ){ + // No Current Request Issued + switch( m_bWorkingMode ) { + case TWI_STAGE_CONNECTED:{ + if( m_pProtocol->requestSoftwareVersion() ){ + m_bCCMD = TWC_ACK_VERSION; + }; + break; + }; + case TWI_STAGE_INIT_1:{ + if( m_pProtocol->requestCurrentSettings() ){ + m_bCCMD = TWC_ACK_CONFIG; + }; + break; + }; + case TWI_STAGE_INIT_2:{ + if( m_pProtocol->requestShadow() ){ + m_bCCMD = TWC_ACK_SHADOW; + }; + break; + }; + case TWI_STAGE_MAIN_LOOP:{ + if( ( cMilliseconds - cStatusTO ) > TWI_STATUS_LOOP_MS ) { + cStatusTO = cMilliseconds; + m_pProtocol->requestStatus(); + m_bCCMD = TWC_ACK_STATUS; + LOG("Req Status"); + } else { + SLEEP( TWI_SLOW_LOOP_SLEEP ); + }; + break; + }; + }; + } else { + // Waiting CMD ACK status + if( m_pProtocol->getLastPackageType() == m_bCCMD ) { + switch( m_bCCMD ){ + case TWC_ACK_VERSION:{ + m_bWorkingMode = TWI_STAGE_INIT_1; + break; + }; + case TWC_ACK_CONFIG:{ + m_bWorkingMode = TWI_STAGE_INIT_2; + break; + }; + case TWC_ACK_SHADOW:{ + m_bWorkingMode = TWI_STAGE_MAIN_LOOP; + break; + }; + case TWC_ACK_STATUS:{ #ifdef DEBUG - LOG("Registered Ack Status"); + LOG("Registered Ack Status"); #endif - uint32_t nStatus = m_pProtocol->getStatus(); - if( ( nStatus & TWI_STATUS_TARGET_MASK ) > 0 ){ + uint32_t nStatus = m_pProtocol->getStatus(); + if( ( nStatus & TWI_STATUS_TARGET_MASK ) > 0 ){ #ifdef DEBUG - LOG("Have new Targets!"); + LOG("Have new Targets!"); #endif - m_pProtocol->setTData( m_pTargets ); - m_pProtocol->requestTargets(); - m_bCCMD = TWC_GET_TARGETS; - continue; - }; - }; - break; - }; + m_pProtocol->setTData( m_pTargets ); + m_pProtocol->requestTargets(); + m_bCCMD = TWC_GET_TARGETS; + continue; + }; + break; + }; case TWC_GET_TARGETS:{ - if( m_pProtocol->getLastPackageType() == TWIN_TARGETS_DATA ){ + if( m_pProtocol->getLastPackageType() == TWC_TARGETS_DATA ){ m_bCCMD = TWC_NO_COMMAND; #ifdef DEBUG LOG("Registered Ack Targets"); @@ -328,25 +339,11 @@ bool LRF_TwinConnector::create(){ }; break; }; - }; - if( m_bCCMD == TWC_NO_COMMAND && tCMD != NULL ){ - // The command is finished - Will fetch next command from queue - if( tCMD->PTR == NULL ) free( tCMD->PTR ); - free( tCMD ); - tCMD = NULL; - }; - }; - SLEEP( TWI_QUICK_LOOP_SLEEP ); - } else { - if( ( cMilliseconds - cStatusTO ) > TWI_STATUS_LOOP_MS ) { - cStatusTO = cMilliseconds; - m_pProtocol->requestStatus(); - m_bCCMD = TWC_GET_STATUS; - LOG("Req Status"); - } else { - SLEEP( TWI_SLOW_LOOP_SLEEP ); + }; + m_bCCMD = TWC_NO_COMMAND; }; - }; + SLEEP( TWI_QUICK_LOOP_SLEEP ); + }; } else { // (re)Establish Connection ClientAddressSize = (socklen_t) sizeof( struct sockaddr_in ); @@ -387,6 +384,8 @@ bool LRF_TwinConnector::create(){ }; if( m_pPort!= NULL ){ m_pProtocol->setTransport( m_pPort ); + // Reset Stage + m_bWorkingMode = TWI_STAGE_CONNECTED; }; }; }; diff --git a/lib/App/3dSERVER/LRF_TwinConnector.h b/lib/App/3dSERVER/LRF_TwinConnector.h index eacc8f88..670acdc7 100644 --- a/lib/App/3dSERVER/LRF_TwinConnector.h +++ b/lib/App/3dSERVER/LRF_TwinConnector.h @@ -18,6 +18,21 @@ #define STORAGE_DIR_MODE 0x1FF #define STORAGE_FILE_MODE 0x1B6 +typedef struct S_SW_VERSION{ + CSTR MASTER; + CSTR SLAVE; +} SW_VERSION; + +typedef enum E_TWI_WM{ + TWI_STAGE_BEFORE_BIND = 0, + TWI_STAGE_WAITING_CONNECTION = 1, + TWI_STAGE_CONNECTED = 2, + TWI_STAGE_INIT_1, + TWI_STAGE_INIT_2, + TWI_STAGE_INIT_3, + TWI_STAGE_MAIN_LOOP +}TWI_WM; + class LRF_Kernel; class LRF_TargetTracker; @@ -25,11 +40,12 @@ 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; + uint8_t m_bWorkingMode; #ifdef PRU_SLAVE + TWIN_COMMAND_QUEUE m_qCMD; protocolInternalLRF3D_SLAVE * m_pProtocol; clientPort * m_pPort; uint16_t m_nMasterPort; @@ -42,6 +58,7 @@ class LRF_TwinConnector: public basicThread { uint16_t m_nBindPort; CSTR m_pBindAddress; targetRecord m_pTargets[TWI_TARGET_QUEUE_SIZE]; + LGS_PARAMETERS m_sPARAMETERS[2]; #endif protected: void m_fThreadProc( void ); @@ -55,9 +72,12 @@ class LRF_TwinConnector: public basicThread { bool saveTHData( uint8_t kid, thresholdNode *ptr ); #ifdef PRU_SLAVE bool sendCurrentSettings( void ); + bool sendSoftwareVersion( void ); #else bool attachTargetTracker( LRF_TargetTracker *ptr ); - bool requestSettings( void ); + bool requestCurrentSettings( void ); + bool requestSoftwareVersion( void ); + bool updateCurrentSettings( void ); #endif }; diff --git a/lib/data/protocol/protocolInternalLRF3D.cpp b/lib/data/protocol/protocolInternalLRF3D.cpp index fdea929b..b9d8f89f 100644 --- a/lib/data/protocol/protocolInternalLRF3D.cpp +++ b/lib/data/protocol/protocolInternalLRF3D.cpp @@ -202,7 +202,7 @@ uint32_t protocolInternalLRF3D::getStatus(){ uint8_t Buffer[PROTOCOL_PARSER_BUFFER_SIZE]; uint32_t node_index = Idx; uint32_t index = 8; - Buffer[3] = TWIN_TH_DATA; + Buffer[3] = TWC_TH_DATA; Buffer[4] = ( node_index >> 24 ) & 0xFF; Buffer[5] = ( node_index >> 16 ) & 0xFF; Buffer[6] = ( node_index >> 8 ) & 0xFF; @@ -223,7 +223,7 @@ uint32_t protocolInternalLRF3D::getStatus(){ bool protocolInternalLRF3D_SLAVE::sendTargets( void ){ uint8_t Buffer[PROTOCOL_PARSER_BUFFER_SIZE]; if( m_nTargetCount > 0 ) { - Buffer[3] = TWIN_TARGETS_DATA; + Buffer[3] = TWC_PUSH_TARGET; uint32_t index = 5; uint8_t target_index = 0; m_mTargetProtector.lock(); @@ -254,9 +254,12 @@ uint32_t protocolInternalLRF3D::getStatus(){ m_nStatus = ( m_nStatus & 0x00fffffe ) | ( m_nTargetCount << 24 ); m_mTargetProtector.unlock(); Buffer[4] = target_index; +#ifdef DEBUG + LOG("Targets"); +#endif return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, index ) ); } else { - Buffer[3] = TWIN_TARGETS_DATA; + Buffer[3] = TWC_PUSH_TARGET; Buffer[4] = 0; return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 5 ) ); }; @@ -265,7 +268,7 @@ uint32_t protocolInternalLRF3D::getStatus(){ bool protocolInternalLRF3D_SLAVE::sendStatus( void ){ if( m_oDataTransport == NULL ) return false; uint8_t Buffer[16]; - Buffer[3] = TWIN_STATUS_ACK; + Buffer[3] = TWC_ACK_STATUS; Buffer[4] = ( m_nStatus >> 24 ) & 0xFF; Buffer[5] = ( m_nStatus >> 16 ) & 0xFF; Buffer[6] = ( m_nStatus >> 8 ) & 0xFF; @@ -278,9 +281,9 @@ uint32_t protocolInternalLRF3D::getStatus(){ bool protocolInternalLRF3D_SLAVE::packetHandler( protocolPackage *Package ){ if( Package == NULL ) return false; - uint8_t cCMD = Package->m_pData[3]; + TWIN_COMMAND cCMD = (TWIN_COMMAND) Package->m_pData[3]; switch( cCMD ) { - case TWIN_STATUS_REQ:{ + case TWC_GET_STATUS:{ sendStatus(); break; }; @@ -311,7 +314,7 @@ uint32_t protocolInternalLRF3D::getStatus(){ bool protocolInternalLRF3D_MASTER::ackDataSegment( uint32_t dataIdx ){ if( m_oDataTransport == NULL ) return false; uint8_t Buffer[16]; - Buffer[3] = TWIN_TH_DATA; + Buffer[3] = TWC_TH_DATA; Buffer[4] = ( dataIdx >> 8 ) & 0xFF; Buffer[5] = ( dataIdx & 0xFF ); #ifdef DEBUG @@ -323,7 +326,7 @@ uint32_t protocolInternalLRF3D::getStatus(){ bool protocolInternalLRF3D_MASTER::ackTargets( uint32_t pkgId ){ if( m_oDataTransport == NULL ) return false; uint8_t Buffer[16]; - Buffer[3] = TWIN_TARGETS_REQ; + Buffer[3] = TWC_ACK_TARGETS; Buffer[4] = ( pkgId >> 24 ) & 0xFF; Buffer[5] = ( pkgId >> 16 ) & 0xFF; Buffer[6] = ( pkgId >> 8 ) & 0xFF; @@ -337,7 +340,7 @@ uint32_t protocolInternalLRF3D::getStatus(){ bool protocolInternalLRF3D_MASTER::requestTargets(void){ if( m_oDataTransport == NULL ) return false; uint8_t Buffer[16]; - Buffer[3] = TWIN_TARGETS_REQ; + Buffer[3] = TWC_GET_TARGETS; #ifdef DEBUG LOG("Target Req"); #endif @@ -347,7 +350,7 @@ uint32_t protocolInternalLRF3D::getStatus(){ bool protocolInternalLRF3D_MASTER::requestTrasholdData( uint8_t lrf_id ){ if( m_oDataTransport == NULL ) return false; uint8_t Buffer[16]; - Buffer[3] = TWIN_TH_GETDATA; + Buffer[3] = TWC_GET_THDRAW; Buffer[4] = lrf_id; #ifdef DEBUG LOG("Treshold Req"); @@ -358,7 +361,7 @@ uint32_t protocolInternalLRF3D::getStatus(){ bool protocolInternalLRF3D_MASTER::requestStatus( void ){ if( m_oDataTransport == NULL ) return false; uint8_t Buffer[16]; - Buffer[3] = TWIN_STATUS_REQ; + Buffer[3] = TWC_GET_STATUS; #ifdef DEBUG LOG("Status Req"); #endif @@ -367,9 +370,9 @@ uint32_t protocolInternalLRF3D::getStatus(){ bool protocolInternalLRF3D_MASTER::packetHandler( protocolPackage *Package ){ if( Package == NULL ) return false; - uint8_t cCMD = Package->m_pData[3]; + TWIN_COMMAND cCMD = (TWIN_COMMAND)Package->m_pData[3]; switch( cCMD ) { - case TWIN_STATUS_ACK:{ + case TWC_ACK_STATUS:{ uint32_t tStatus; #ifdef DEBUG LOG("Status ACK reseived"); @@ -380,22 +383,49 @@ uint32_t protocolInternalLRF3D::getStatus(){ m_mStatusProtector.unlock(); break; }; - case TWIN_TH_DATA:{ + case TWC_TH_DATA:{ }; }; m_mLastTypeProtector.lock(); - m_bLastPackageType = (TWIN_PCMD) cCMD; + m_bLastPackageType = cCMD; m_mLastTypeProtector.unlock(); return true; }; - TWIN_PCMD protocolInternalLRF3D_MASTER::getLastPackageType( void ){ - TWIN_PCMD RetVal; + TWIN_COMMAND protocolInternalLRF3D_MASTER::getLastPackageType( void ){ + TWIN_COMMAND RetVal; m_mLastTypeProtector.lock(); RetVal = m_bLastPackageType; m_mLastTypeProtector.unlock(); return RetVal; }; + bool protocolInternalLRF3D_MASTER::requestSoftwareVersion( void ){ + if( m_oDataTransport == NULL ) return false; + uint8_t Buffer[16]; + Buffer[3] = TWC_GET_VERSION; +#ifdef DEBUG + LOG("Version Req"); +#endif + return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 4 ) ); + }; + bool protocolInternalLRF3D_MASTER::requestCurrentSettings( void ){ + if( m_oDataTransport == NULL ) return false; + uint8_t Buffer[16]; + Buffer[3] = TWC_GET_CONFIG; +#ifdef DEBUG + LOG("Settings Req"); +#endif + return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 4 ) ); + }; + bool protocolInternalLRF3D_MASTER::requestShadow( void ){ + if( m_oDataTransport == NULL ) return false; + uint8_t Buffer[16]; + Buffer[3] = TWC_GET_SHADOW; +#ifdef DEBUG + LOG("Shadow Req"); +#endif + return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 4 ) ); + }; #endif #undef LOG diff --git a/lib/data/protocol/protocolInternalLRF3D.h b/lib/data/protocol/protocolInternalLRF3D.h index f9e9e0e6..fddfbabb 100644 --- a/lib/data/protocol/protocolInternalLRF3D.h +++ b/lib/data/protocol/protocolInternalLRF3D.h @@ -18,15 +18,25 @@ #define TWI_MAX_PACKAGE_SIZE_BYTES ( PROTOCOL_PARSER_BUFFER_SIZE >> 1 ) typedef enum E_TWIN_COMMAND{ - TWC_NO_COMMAND = 0, - TWC_GET_STATUS = 1, - TWC_GET_TARGETS = 2, - TWC_GET_CONFIG = 3, - TWC_SET_CONFIG = 4, - TWC_GET_THDRAW = 5, - TWC_SET_THDRAW = 6, - TWC_PUSH_TARGET = 7, - TWC_DO_REBOOT = 255 + TWC_NO_COMMAND = 0, + TWC_GET_STATUS = 1, + TWC_ACK_STATUS = 2, + TWC_GET_TARGETS = 3, + TWC_ACK_TARGETS = 4, + TWC_GET_CONFIG = 5, + TWC_SET_CONFIG = 6, + TWC_ACK_CONFIG = 7, + TWC_GET_THDRAW = 8, + TWC_SET_THDRAW = 9, + TWC_PUSH_TARGET = 10, + TWC_TH_DATA = 11, + TWC_TARGETS_DATA = 12, + TWC_GET_VERSION = 13, + TWC_ACK_VERSION = 14, + TWC_GET_SHADOW = 15, + TWC_ACK_SHADOW = 16, + TWC_SET_SHADOW = 17, + TWC_DO_REBOOT = 255 } TWIN_COMMAND; typedef struct S_TWIN_CMD_RECORD{ @@ -36,15 +46,6 @@ typedef struct S_TWIN_CMD_RECORD{ typedef std::queue TWIN_COMMAND_QUEUE; -typedef enum E_TWIN_PCMD{ - TWIN_NO_CMD = 0, - TWIN_STATUS_REQ = 1, - TWIN_STATUS_ACK = 2, - TWIN_TH_GETDATA, - TWIN_TH_DATA, - TWIN_TARGETS_REQ, - TWIN_TARGETS_DATA -} TWIN_PCMD; #define TWI_STATUS_ERROR_MASK 0x000000ff #define TWI_STATUS_TARGET_MASK 0x0000ff00 @@ -113,7 +114,7 @@ class protocolInternalLRF3D: public protocolParser { class protocolInternalLRF3D_MASTER: public protocolInternalLRF3D{ private: basicLogCollection * m_pLog; - TWIN_PCMD m_bLastPackageType; + TWIN_COMMAND m_bLastPackageType; basicMutex m_mLastTypeProtector; targetRecord * m_pTargets; thresholdNode * m_pTrashold; @@ -125,7 +126,9 @@ class protocolInternalLRF3D: public protocolParser { virtual bool create(void); bool ackDataSegment( uint32_t dataIdx = 0 ); bool ackTargets( uint32_t pkgId ); - TWIN_PCMD getLastPackageType( void ); + TWIN_COMMAND getLastPackageType( void ); + bool requestCurrentSettings( void ); + bool requestShadow( void ); bool requestSoftwareVersion(void); bool requestStatus( void ); bool requestTargets(void);