|
|
|
@ -15,12 +15,21 @@ |
|
|
|
|
|
|
|
#include "LRF_Kernel.h"
|
|
|
|
#include "LRF_Detector.h"
|
|
|
|
#include "LRF_ClientHandler.h"
|
|
|
|
|
|
|
|
#define LOG( X ) m_pLog->Log( "Kernel", this, X )
|
|
|
|
#define LOG_ERROR( X ) m_pLog->Log( "Kernel", this, _LOG_ERROR, X )
|
|
|
|
#ifdef DEBUG
|
|
|
|
#define LOG_ERROR( X ) {\
|
|
|
|
char _tBfrErrMSG234[256];\ |
|
|
|
sprintf( _tBfrErrMSG234, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\ |
|
|
|
m_pLog->Log( "Kernel", this, _LOG_ERROR, _tBfrErrMSG234 );\ |
|
|
|
} |
|
|
|
#else
|
|
|
|
#define LOG_ERROR( X ) m_pLog->Log( "Kernel", this, _LOG_ERROR, X );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Constructor implementation
|
|
|
|
LRF_Kernel::LRF_Kernel( LRF_HardwareManager *HM ): basicThread(){ |
|
|
|
LRF_Kernel::LRF_Kernel( LRF_HardwareManager *HM ): basicThread(), basicEngine(){ |
|
|
|
m_bExitCause = 0; |
|
|
|
m_pLog = basicLogCollection::getInstance(); |
|
|
|
m_pEventHeap = basicEventHeap::getInstance(); |
|
|
|
@ -323,7 +332,11 @@ void LRF_Kernel::WaitFinish( bool Force ){ |
|
|
|
}; |
|
|
|
waitThreadEnd( Force ); |
|
|
|
#ifdef DEBUG
|
|
|
|
LOG( "Thread is Detached" ); |
|
|
|
if( Force ) { |
|
|
|
LOG( "Thread forced to be Detached" ); |
|
|
|
} else { |
|
|
|
LOG( "Thread is Detached by itself" ); |
|
|
|
}; |
|
|
|
#endif
|
|
|
|
}; |
|
|
|
|
|
|
|
@ -858,7 +871,25 @@ bool LRF_Kernel::shutdown( bool Restart ){ |
|
|
|
return true; |
|
|
|
}; |
|
|
|
|
|
|
|
networkClientHandler *LRF_Kernel::attachNewClient( int SocketID ){ |
|
|
|
LOG("Creating Client Handler!"); |
|
|
|
LRF_ClientHandler *tal; |
|
|
|
tal = new LRF_ClientHandler( SocketID, this ); |
|
|
|
if( tal!= NULL ) { |
|
|
|
LOG("Client Handler Created!"); |
|
|
|
}; |
|
|
|
return (networkClientHandler *) tal; |
|
|
|
}; |
|
|
|
|
|
|
|
bool LRF_Kernel::detachClient( networkClientHandler *ptr ){ |
|
|
|
LOG("Delete Client Handler!"); |
|
|
|
if( ptr == NULL ) return false; |
|
|
|
delete( (LRF_ClientHandler *) ptr ); |
|
|
|
return true; |
|
|
|
}; |
|
|
|
|
|
|
|
#ifndef PRU_SLAVE //Just Master Stuff
|
|
|
|
|
|
|
|
bool LRF_Kernel::stopMotors( void ){ |
|
|
|
#ifndef ONPC_TOTTAL_SIMULATOR
|
|
|
|
if( m_pHardwareManager!= NULL ) { |
|
|
|
@ -882,5 +913,7 @@ bool LRF_Kernel::shutdown( bool Restart ){ |
|
|
|
}; |
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#undef LOG
|
|
|
|
#undef LOG_ERROR
|