@ -76,7 +76,7 @@ void device2DSensor::cleanupDeviceStructures(void)
LOG ( " Clean Basic Structures! " ) ;
LOG ( " Clean Basic Structures! " ) ;
# endif
# endif
// m_eCurrentSequence = NO_SEQUENCE;
// m_eCurrentSequence = NO_SEQUENCE;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
m_bInitialFlips = LGS_INITIAL_FLIPS ;
m_bInitialFlips = LGS_INITIAL_FLIPS ;
m_nCurrentAngle = 0 ;
m_nCurrentAngle = 0 ;
m_bDrawType = 0 ;
m_bDrawType = 0 ;
@ -280,14 +280,17 @@ void device2DSensor::connectMode()
# endif
# endif
if ( tRES - > isValid ( ) )
if ( tRES - > isValid ( ) )
{
{
m_pPort = stat ic_cast< basicTransport * > ( static_cast < hardwareResourceSerialProvider * > ( tRES ) ) ;
m_pPort = dynam ic_cast< basicTransport * > ( tRES ) ;
# ifdef DEBUG_EXTRA
# ifdef DEBUG_EXTRA
// Bind To Proto
// Bind To Proto
char tB [ 64 ] ;
char tB [ 64 ] ;
sprintf ( tB , " PortOBJ: %p " , m_pPort ) ;
sprintf ( tB , " PortOBJ: %p " , m_pPort ) ;
LOG ( tB ) ;
LOG ( tB ) ;
# endif
# endif
if ( ! setTransport ( m_pPort , false ) )
// Through a network gateway the replies take longer: wait longer per attempt
m_nTOCounterBase = ( m_pPort ! = NULL & & m_pPort - > isNetworkLink ( ) ) ? LGS_NETWORK_TO_COUNTER : LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( m_pPort = = NULL | | ! setTransport ( m_pPort , false ) )
{
{
LOG_ERROR ( " Binding Port Failure! " ) ;
LOG_ERROR ( " Binding Port Failure! " ) ;
}
}
@ -329,7 +332,7 @@ void device2DSensor::connectMode()
} ;
} ;
case LRF_WS_STAGE_1 :
case LRF_WS_STAGE_1 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
cleanupDeviceStructures ( ) ;
cleanupDeviceStructures ( ) ;
m_bRequestedDeviceWM = MODE_DETECTOR ;
m_bRequestedDeviceWM = MODE_DETECTOR ;
if ( ! setMode ( MODE_DETECTOR ) )
if ( ! setMode ( MODE_DETECTOR ) )
@ -375,7 +378,7 @@ void device2DSensor::handshakeMode()
{
{
if ( m_bActualDeviceWM ! = MODE_DETECTOR )
if ( m_bActualDeviceWM ! = MODE_DETECTOR )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
m_bRequestedDeviceWM = MODE_DETECTOR ;
m_bRequestedDeviceWM = MODE_DETECTOR ;
if ( ! setMode ( MODE_DETECTOR ) )
if ( ! setMode ( MODE_DETECTOR ) )
{
{
@ -396,7 +399,7 @@ void device2DSensor::handshakeMode()
} ;
} ;
case LRF_WS_STAGE_1 :
case LRF_WS_STAGE_1 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! getSerialNumber ( ) )
if ( ! getSerialNumber ( ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -410,7 +413,7 @@ void device2DSensor::handshakeMode()
} ;
} ;
case LRF_WS_STAGE_2 :
case LRF_WS_STAGE_2 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! getVersionString ( ) )
if ( ! getVersionString ( ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -461,7 +464,7 @@ void device2DSensor::readMode()
case LRF_WS_INIT :
case LRF_WS_INIT :
{
{
LOG ( " TryProfiles " ) ;
LOG ( " TryProfiles " ) ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! getDetectionProfile ( ) )
if ( ! getDetectionProfile ( ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -476,7 +479,7 @@ void device2DSensor::readMode()
case LRF_WS_STAGE_1 :
case LRF_WS_STAGE_1 :
{
{
LOG ( " Get ParamMaster " ) ;
LOG ( " Get ParamMaster " ) ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! getParameters ( true ) )
if ( ! getParameters ( true ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -493,7 +496,7 @@ void device2DSensor::readMode()
LOG ( " Get ParamSlave " ) ;
LOG ( " Get ParamSlave " ) ;
if ( m_sNodeData . type = = ARGUS_ALS_SENSOR )
if ( m_sNodeData . type = = ARGUS_ALS_SENSOR )
{ // Read Slave Just for ALS series
{ // Read Slave Just for ALS series
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! getParameters ( false ) )
if ( ! getParameters ( false ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -513,7 +516,7 @@ void device2DSensor::readMode()
case LRF_WS_STAGE_3 :
case LRF_WS_STAGE_3 :
{
{
LOG ( " Get RELAY " ) ;
LOG ( " Get RELAY " ) ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! getRelayParameters ( ) )
if ( ! getRelayParameters ( ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -528,7 +531,7 @@ void device2DSensor::readMode()
case LRF_WS_STAGE_4 :
case LRF_WS_STAGE_4 :
{
{
LOG ( " Get WidthTable " ) ;
LOG ( " Get WidthTable " ) ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! getWidthTable ( ) )
if ( ! getWidthTable ( ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -543,7 +546,7 @@ void device2DSensor::readMode()
case LRF_WS_STAGE_5 :
case LRF_WS_STAGE_5 :
{
{
LOG ( " Get ShadowInfo " ) ;
LOG ( " Get ShadowInfo " ) ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! getShadowInfo ( m_sShadowHelper . m_bSequence ) )
if ( ! getShadowInfo ( m_sShadowHelper . m_bSequence ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -561,7 +564,7 @@ void device2DSensor::readMode()
// Have Info -> If No Poly - Skeep to go get DC
// Have Info -> If No Poly - Skeep to go get DC
if ( m_sShadow . pPolygones )
if ( m_sShadow . pPolygones )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! getShadowPoly ( m_sShadowHelper . m_bSequence , m_sShadowHelper . m_nCurrentPolygon ) )
if ( ! getShadowPoly ( m_sShadowHelper . m_bSequence , m_sShadowHelper . m_nCurrentPolygon ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -585,7 +588,7 @@ void device2DSensor::readMode()
{
{
if ( m_sShadowHelper . m_nCurrentPoint < m_sShadow . pPolygones [ m_sShadowHelper . m_nCurrentPolygon ] . wCount )
if ( m_sShadowHelper . m_nCurrentPoint < m_sShadow . pPolygones [ m_sShadowHelper . m_nCurrentPolygon ] . wCount )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! getShadowPolyPoint ( m_sShadowHelper . m_bSequence , m_sShadowHelper . m_nCurrentPolygon , m_sShadowHelper . m_nCurrentPoint ) )
if ( ! getShadowPolyPoint ( m_sShadowHelper . m_bSequence , m_sShadowHelper . m_nCurrentPolygon , m_sShadowHelper . m_nCurrentPoint ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -650,7 +653,7 @@ bool device2DSensor::reset(){
setWM ( LRF_WM_CONNECTION ) ;
setWM ( LRF_WM_CONNECTION ) ;
return false ;
return false ;
} else {
} else {
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
updateDataStatus ( ARGUS_DS_BUSY ) ;
updateDataStatus ( ARGUS_DS_BUSY ) ;
DELAY_10MS ( 1 ) ; // 10 ms
DELAY_10MS ( 1 ) ; // 10 ms
} ;
} ;
@ -817,7 +820,7 @@ void device2DSensor::syncMode()
if ( m_bActualDeviceWM ! = MODE_MASK )
if ( m_bActualDeviceWM ! = MODE_MASK )
{
{
LOG ( " Set Mask Mode " ) ;
LOG ( " Set Mask Mode " ) ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
m_bRequestedDeviceWM = MODE_MASK ;
m_bRequestedDeviceWM = MODE_MASK ;
if ( ! setMode ( MODE_MASK ) )
if ( ! setMode ( MODE_MASK ) )
{
{
@ -849,10 +852,10 @@ void device2DSensor::syncMode()
} ;
} ;
case LRF_WS_STAGE_1 :
case LRF_WS_STAGE_1 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( m_bActualDeviceWM ! = MODE_MASK )
if ( m_bActualDeviceWM ! = MODE_MASK )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
m_bRequestedDeviceWM = MODE_MASK ;
m_bRequestedDeviceWM = MODE_MASK ;
if ( ! setMode ( MODE_MASK ) )
if ( ! setMode ( MODE_MASK ) )
{
{
@ -872,7 +875,7 @@ void device2DSensor::syncMode()
} ;
} ;
case LRF_WS_STAGE_2 :
case LRF_WS_STAGE_2 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! setShadowInfo ( m_sShadowHelper . m_bSequence , m_sShadow ) )
if ( ! setShadowInfo ( m_sShadowHelper . m_bSequence , m_sShadow ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -889,7 +892,7 @@ void device2DSensor::syncMode()
if ( m_sShadowHelper . m_nCurrentPolygon < m_sShadow . m_nPolygonCount )
if ( m_sShadowHelper . m_nCurrentPolygon < m_sShadow . m_nPolygonCount )
{
{
m_sShadowHelper . m_nCurrentPoint = 0 ;
m_sShadowHelper . m_nCurrentPoint = 0 ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! setShadowPoly ( m_sShadowHelper . m_bSequence , m_sShadow , m_sShadowHelper . m_nCurrentPolygon ) )
if ( ! setShadowPoly ( m_sShadowHelper . m_bSequence , m_sShadow , m_sShadowHelper . m_nCurrentPolygon ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -924,7 +927,7 @@ void device2DSensor::syncMode()
} ;
} ;
case LRF_WS_STAGE_4 :
case LRF_WS_STAGE_4 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
# ifdef DEBUG_EXTRA
# ifdef DEBUG_EXTRA
char tBuff [ 128 ] ;
char tBuff [ 128 ] ;
sprintf ( tBuff , " Send Point %d of %d " , m_sShadowHelper . m_nCurrentPoint + 1 , m_sShadow . pPolygones [ m_sShadowHelper . m_nCurrentPolygon ] . wCount ) ;
sprintf ( tBuff , " Send Point %d of %d " , m_sShadowHelper . m_nCurrentPoint + 1 , m_sShadow . pPolygones [ m_sShadowHelper . m_nCurrentPolygon ] . wCount ) ;
@ -933,7 +936,7 @@ void device2DSensor::syncMode()
if ( m_sShadowHelper . m_nCurrentPoint < m_sShadow . pPolygones [ m_sShadowHelper . m_nCurrentPolygon ] . wCount )
if ( m_sShadowHelper . m_nCurrentPoint < m_sShadow . pPolygones [ m_sShadowHelper . m_nCurrentPolygon ] . wCount )
{
{
LOG ( " Senfing Point " ) ;
LOG ( " Senfing Point " ) ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! setShadowPolyPoint ( m_sShadowHelper . m_bSequence , m_sShadow , m_sShadowHelper . m_nCurrentPolygon , m_sShadowHelper . m_nCurrentPoint ) )
if ( ! setShadowPolyPoint ( m_sShadowHelper . m_bSequence , m_sShadow , m_sShadowHelper . m_nCurrentPolygon , m_sShadowHelper . m_nCurrentPoint ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -954,7 +957,7 @@ void device2DSensor::syncMode()
} ;
} ;
case LRF_WS_STAGE_5 :
case LRF_WS_STAGE_5 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
# ifdef DEBUG_EXTRA
# ifdef DEBUG_EXTRA
char tBuff [ 128 ] ;
char tBuff [ 128 ] ;
sprintf ( tBuff , " Send Shadow for angle %d [%d rays] " , m_sShadowHelper . m_nCurrentRayLine , m_sShadow . ray_lines [ m_sShadowHelper . m_nCurrentRayLine ] . nCount ) ;
sprintf ( tBuff , " Send Shadow for angle %d [%d rays] " , m_sShadowHelper . m_nCurrentRayLine , m_sShadow . ray_lines [ m_sShadowHelper . m_nCurrentRayLine ] . nCount ) ;
@ -973,7 +976,7 @@ void device2DSensor::syncMode()
} ;
} ;
case LRF_WS_STAGE_6 :
case LRF_WS_STAGE_6 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
# ifdef DEBUG_EXTRA
# ifdef DEBUG_EXTRA
char tBuff [ 128 ] ;
char tBuff [ 128 ] ;
sprintf ( tBuff , " Send Shadow RayLine %d for angle %d " , m_sShadowHelper . m_nCurrentRay , m_sShadowHelper . m_nCurrentRayLine ) ;
sprintf ( tBuff , " Send Shadow RayLine %d for angle %d " , m_sShadowHelper . m_nCurrentRay , m_sShadowHelper . m_nCurrentRayLine ) ;
@ -1012,7 +1015,7 @@ void device2DSensor::syncMode()
} ;
} ;
case LRF_WS_STAGE_7 :
case LRF_WS_STAGE_7 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! setShadowDone ( m_sShadowHelper . m_bSequence ) )
if ( ! setShadowDone ( m_sShadowHelper . m_bSequence ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -1050,7 +1053,7 @@ void device2DSensor::syncMode()
PLGS_2D_PARAMETERS tData = m_pDBC - > getLRFDetectionProfile ( m_sNodeData . aux_id , m_nActiveDetectionProfile , true ) ;
PLGS_2D_PARAMETERS tData = m_pDBC - > getLRFDetectionProfile ( m_sNodeData . aux_id , m_nActiveDetectionProfile , true ) ;
if ( tData )
if ( tData )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER < < 2 ;
m_bTimeOutCounter = m_nTOCounterBase < < 2 ;
if ( ! setParameters ( tData , true , m_nActiveDetectionProfile ) )
if ( ! setParameters ( tData , true , m_nActiveDetectionProfile ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -1075,7 +1078,7 @@ void device2DSensor::syncMode()
PLGS_2D_PARAMETERS tData = m_pDBC - > getLRFDetectionProfile ( m_sNodeData . aux_id , m_nActiveDetectionProfile , false ) ;
PLGS_2D_PARAMETERS tData = m_pDBC - > getLRFDetectionProfile ( m_sNodeData . aux_id , m_nActiveDetectionProfile , false ) ;
if ( tData )
if ( tData )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER < < 2 ;
m_bTimeOutCounter = m_nTOCounterBase < < 2 ;
if ( ! setParameters ( tData , false , m_nActiveDetectionProfile ) )
if ( ! setParameters ( tData , false , m_nActiveDetectionProfile ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -1253,7 +1256,7 @@ void device2DSensor::save_ini()
// ANODE_WM_2D_SET_GETFILE_MODE
// ANODE_WM_2D_SET_GETFILE_MODE
if ( m_bActualDeviceWM ! = MODE_GETFILE )
if ( m_bActualDeviceWM ! = MODE_GETFILE )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
m_bRequestedDeviceWM = MODE_GETFILE ;
m_bRequestedDeviceWM = MODE_GETFILE ;
if ( ! setMode ( MODE_GETFILE ) )
if ( ! setMode ( MODE_GETFILE ) )
{
{
@ -1385,7 +1388,7 @@ void device2DSensor::save_ini()
break ;
break ;
} ;
} ;
} ;
} ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! sendGF_package ( m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > state | m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > index , m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > data_size ,
if ( ! sendGF_package ( m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > state | m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > index , m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > data_size ,
m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > data ) )
m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > data ) )
{
{
@ -1424,7 +1427,7 @@ void device2DSensor::save_ini()
case LRF_WS_STAGE_4 :
case LRF_WS_STAGE_4 :
{
{
// Issue Full Reset
// Issue Full Reset
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! doFullReset ( ) )
if ( ! doFullReset ( ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -1520,7 +1523,7 @@ void device2DSensor::save_detection()
PLGS_2D_PARAMETERS tData = m_pDBC - > getLRFDetectionProfile ( m_sNodeData . aux_id , m_nActiveDetectionProfile , true ) ;
PLGS_2D_PARAMETERS tData = m_pDBC - > getLRFDetectionProfile ( m_sNodeData . aux_id , m_nActiveDetectionProfile , true ) ;
if ( tData )
if ( tData )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! setParameters ( tData , true , m_nActiveDetectionProfile ) )
if ( ! setParameters ( tData , true , m_nActiveDetectionProfile ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -1546,7 +1549,7 @@ void device2DSensor::save_detection()
PLGS_2D_PARAMETERS tData = m_pDBC - > getLRFDetectionProfile ( m_sNodeData . aux_id , m_nActiveDetectionProfile , false ) ;
PLGS_2D_PARAMETERS tData = m_pDBC - > getLRFDetectionProfile ( m_sNodeData . aux_id , m_nActiveDetectionProfile , false ) ;
if ( tData )
if ( tData )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! setParameters ( tData , false , m_nActiveDetectionProfile ) )
if ( ! setParameters ( tData , false , m_nActiveDetectionProfile ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -1605,7 +1608,7 @@ void device2DSensor::wait_device()
{
{
case LRF_WS_INIT :
case LRF_WS_INIT :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! getState ( ) )
if ( ! getState ( ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -1760,10 +1763,10 @@ void device2DSensor::save_masks()
} ;
} ;
case LRF_WS_STAGE_1 :
case LRF_WS_STAGE_1 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( m_bActualDeviceWM ! = MODE_MASK )
if ( m_bActualDeviceWM ! = MODE_MASK )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
m_bRequestedDeviceWM = MODE_MASK ;
m_bRequestedDeviceWM = MODE_MASK ;
if ( ! setMode ( MODE_MASK ) )
if ( ! setMode ( MODE_MASK ) )
{
{
@ -1783,7 +1786,7 @@ void device2DSensor::save_masks()
} ;
} ;
case LRF_WS_STAGE_2 :
case LRF_WS_STAGE_2 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
char tB [ 129 ] ;
char tB [ 129 ] ;
sprintf ( tB , " Masks Status: 0x%08X " , m_sShadow . m_nEnabled ) ;
sprintf ( tB , " Masks Status: 0x%08X " , m_sShadow . m_nEnabled ) ;
@ -1803,7 +1806,7 @@ void device2DSensor::save_masks()
// V 3 4 ... B 5 6 .. E 7
// V 3 4 ... B 5 6 .. E 7
case LRF_WS_STAGE_5 :
case LRF_WS_STAGE_5 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( m_sShadowHelper . m_nCurrentPolygon < m_sShadow . m_nPolygonCount )
if ( m_sShadowHelper . m_nCurrentPolygon < m_sShadow . m_nPolygonCount )
{
{
m_sShadowHelper . m_nCurrentPoint = 0 ;
m_sShadowHelper . m_nCurrentPoint = 0 ;
@ -1846,7 +1849,7 @@ void device2DSensor::save_masks()
} ;
} ;
case LRF_WS_STAGE_6 :
case LRF_WS_STAGE_6 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
# ifdef DEBUG_EXTRA
# ifdef DEBUG_EXTRA
char tBuff [ 128 ] ;
char tBuff [ 128 ] ;
sprintf ( tBuff , " Send Point %d of %d " , m_sShadowHelper . m_nCurrentPoint + 1 , m_sShadow . pPolygones [ m_sShadowHelper . m_nCurrentPolygon ] . wCount ) ;
sprintf ( tBuff , " Send Point %d of %d " , m_sShadowHelper . m_nCurrentPoint + 1 , m_sShadow . pPolygones [ m_sShadowHelper . m_nCurrentPolygon ] . wCount ) ;
@ -1874,7 +1877,7 @@ void device2DSensor::save_masks()
case LRF_WS_STAGE_3 :
case LRF_WS_STAGE_3 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
# ifdef DEBUG_EXTRA
# ifdef DEBUG_EXTRA
char tBuff [ 128 ] ;
char tBuff [ 128 ] ;
sprintf ( tBuff , " Send Shadow for angle %d [%d rays] " , m_sShadowHelper . m_nCurrentRayLine , m_sShadow . ray_lines [ m_sShadowHelper . m_nCurrentRayLine ] . nCount ) ;
sprintf ( tBuff , " Send Shadow for angle %d [%d rays] " , m_sShadowHelper . m_nCurrentRayLine , m_sShadow . ray_lines [ m_sShadowHelper . m_nCurrentRayLine ] . nCount ) ;
@ -1893,7 +1896,7 @@ void device2DSensor::save_masks()
} ;
} ;
case LRF_WS_STAGE_4 :
case LRF_WS_STAGE_4 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
# ifdef DEBUG_EXTRA
# ifdef DEBUG_EXTRA
char tBuff [ 128 ] ;
char tBuff [ 128 ] ;
sprintf ( tBuff , " Send Shadow RayLine %d for andle %d " , m_sShadowHelper . m_nCurrentRay , m_sShadowHelper . m_nCurrentRayLine ) ;
sprintf ( tBuff , " Send Shadow RayLine %d for andle %d " , m_sShadowHelper . m_nCurrentRay , m_sShadowHelper . m_nCurrentRayLine ) ;
@ -1933,7 +1936,7 @@ void device2DSensor::save_masks()
} ;
} ;
case LRF_WS_STAGE_7 :
case LRF_WS_STAGE_7 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! setShadowDone ( m_sShadowHelper . m_bSequence ) )
if ( ! setShadowDone ( m_sShadowHelper . m_bSequence ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -2033,7 +2036,7 @@ void device2DSensor::fileTransferSpecialWait()
LOG ( " ATTEMPT RECOVER " ) ;
LOG ( " ATTEMPT RECOVER " ) ;
# endif
# endif
m_bOpRetryCnt - - ;
m_bOpRetryCnt - - ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
registerCommError ( false ) ;
registerCommError ( false ) ;
m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > state | = GF_ERRORMODE ;
m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > state | = GF_ERRORMODE ;
}
}
@ -2081,7 +2084,7 @@ void device2DSensor::fileTransferMode()
{
{
if ( m_bActualDeviceWM ! = MODE_GETFILE )
if ( m_bActualDeviceWM ! = MODE_GETFILE )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
m_bRequestedDeviceWM = MODE_GETFILE ;
m_bRequestedDeviceWM = MODE_GETFILE ;
if ( ! setMode ( MODE_GETFILE ) )
if ( ! setMode ( MODE_GETFILE ) )
{
{
@ -2211,7 +2214,7 @@ void device2DSensor::fileTransferMode()
{
{
m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > state & = ( ~ GF_ERRORMODE ) ;
m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > state & = ( ~ GF_ERRORMODE ) ;
} ;
} ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
char tB [ 256 ] ;
char tB [ 256 ] ;
sprintf ( tB , " Current Index: %d " , m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > index ) ;
sprintf ( tB , " Current Index: %d " , m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > index ) ;
LOG ( tB ) ;
LOG ( tB ) ;
@ -2256,7 +2259,7 @@ void device2DSensor::fileTransferMode()
if ( m_sGetFileTransfers . transfer_ending_mode = = GF_EM_ISSUE_RESET )
if ( m_sGetFileTransfers . transfer_ending_mode = = GF_EM_ISSUE_RESET )
{
{
LOG ( " Must Issue Reset " ) ;
LOG ( " Must Issue Reset " ) ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! doFullReset ( ) )
if ( ! doFullReset ( ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -2307,7 +2310,7 @@ void device2DSensor::getfileMode()
case LRF_WS_INIT : {
case LRF_WS_INIT : {
m_nCurrentAngle = 0 ;
m_nCurrentAngle = 0 ;
if ( m_bActualDeviceWM ! = MODE_GETFILE ) {
if ( m_bActualDeviceWM ! = MODE_GETFILE ) {
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
m_bRequestedDeviceWM = MODE_GETFILE ;
m_bRequestedDeviceWM = MODE_GETFILE ;
if ( ! setMode ( MODE_GETFILE ) ) {
if ( ! setMode ( MODE_GETFILE ) ) {
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -2428,7 +2431,7 @@ void device2DSensor::getfileMode()
break ;
break ;
} ;
} ;
} ;
} ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! sendGF_package (
if ( ! sendGF_package (
( m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > state | m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > index ) ,
( m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > state | m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > index ) ,
m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > data_size ,
m_sGetFileTransfers . helpers [ m_sGetFileTransfers . current ] - > data_size ,
@ -2459,7 +2462,7 @@ void device2DSensor::getfileMode()
if ( m_bOpRetryCnt ) {
if ( m_bOpRetryCnt ) {
m_bOpRetryCnt - - ;
m_bOpRetryCnt - - ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
registerCommError ( false ) ;
registerCommError ( false ) ;
LRF_WORK_STAGE pS = getPrevStage ( ) ;
LRF_WORK_STAGE pS = getPrevStage ( ) ;
@ -2517,7 +2520,7 @@ void device2DSensor::drawMode()
{
{
if ( m_bActualDeviceWM ! = MODE_BORDER )
if ( m_bActualDeviceWM ! = MODE_BORDER )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
m_bRequestedDeviceWM = MODE_BORDER ;
m_bRequestedDeviceWM = MODE_BORDER ;
if ( ! setMode ( MODE_BORDER ) )
if ( ! setMode ( MODE_BORDER ) )
{
{
@ -2546,7 +2549,7 @@ void device2DSensor::drawMode()
} ;
} ;
case LRF_WS_STAGE_2 :
case LRF_WS_STAGE_2 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER < < 4 ;
m_bTimeOutCounter = m_nTOCounterBase < < 4 ;
# ifdef DEBUG_EXTRA
# ifdef DEBUG_EXTRA
LOG ( " DRAW GET ANGLE " ) ;
LOG ( " DRAW GET ANGLE " ) ;
# endif
# endif
@ -2575,7 +2578,7 @@ void device2DSensor::drawMode()
AK - > releaseExplicitChannel ( m_sNodeData . node_id , m_sLRF_DATA . uart_id ) ;
AK - > releaseExplicitChannel ( m_sNodeData . node_id , m_sLRF_DATA . uart_id ) ;
}
}
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
m_bRequestedDeviceWM = MODE_DETECTOR ;
m_bRequestedDeviceWM = MODE_DETECTOR ;
if ( ! setMode ( MODE_DETECTOR ) )
if ( ! setMode ( MODE_DETECTOR ) )
{
{
@ -2629,7 +2632,7 @@ void device2DSensor::fullDrawMode()
# ifdef DEBUG
# ifdef DEBUG
LOG ( " SET MODE BORDER! " ) ;
LOG ( " SET MODE BORDER! " ) ;
# endif
# endif
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
m_bRequestedDeviceWM = MODE_BORDER ;
m_bRequestedDeviceWM = MODE_BORDER ;
if ( ! setMode ( MODE_BORDER ) )
if ( ! setMode ( MODE_BORDER ) )
{
{
@ -2649,7 +2652,7 @@ void device2DSensor::fullDrawMode()
} ;
} ;
case LRF_WS_STAGE_1 :
case LRF_WS_STAGE_1 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER < < 4 ;
m_bTimeOutCounter = m_nTOCounterBase < < 4 ;
# ifdef DEBUG
# ifdef DEBUG
LOG ( " FULL DRAW GET ANGLE " ) ;
LOG ( " FULL DRAW GET ANGLE " ) ;
# endif
# endif
@ -2669,7 +2672,7 @@ void device2DSensor::fullDrawMode()
# ifdef DEBUG
# ifdef DEBUG
LOG ( " FULL DRAW FINISHING " ) ;
LOG ( " FULL DRAW FINISHING " ) ;
# endif
# endif
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
m_bRequestedDeviceWM = MODE_DETECTOR ;
m_bRequestedDeviceWM = MODE_DETECTOR ;
if ( ! setMode ( MODE_DETECTOR ) )
if ( ! setMode ( MODE_DETECTOR ) )
{
{
@ -2743,7 +2746,7 @@ void device2DSensor::maskMode()
{
{
case LRF_WS_INIT :
case LRF_WS_INIT :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
uint8_t cm = m_pDBC - > getLRFMasksStatus ( m_sLRF_DATA . id ) ;
uint8_t cm = m_pDBC - > getLRFMasksStatus ( m_sLRF_DATA . id ) ;
EVENT_CONTAINER * bEVT = NULL ;
EVENT_CONTAINER * bEVT = NULL ;
TARGET_DATA * tData = prepareTargetData ( 0 , 0 , 0 , 0 ) ;
TARGET_DATA * tData = prepareTargetData ( 0 , 0 , 0 , 0 ) ;
@ -2838,7 +2841,7 @@ void device2DSensor::alarmMode()
{
{
if ( m_bActualDeviceWM ! = MODE_DETECTOR )
if ( m_bActualDeviceWM ! = MODE_DETECTOR )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
m_bRequestedDeviceWM = MODE_DETECTOR ;
m_bRequestedDeviceWM = MODE_DETECTOR ;
if ( ! setMode ( MODE_DETECTOR ) )
if ( ! setMode ( MODE_DETECTOR ) )
{
{
@ -2858,7 +2861,7 @@ void device2DSensor::alarmMode()
} ;
} ;
case LRF_WS_STAGE_1 :
case LRF_WS_STAGE_1 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! getState2 ( ) )
if ( ! getState2 ( ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -2933,7 +2936,7 @@ void device2DSensor::idleMode()
{
{
if ( m_bActualDeviceWM ! = MODE_DETECTOR )
if ( m_bActualDeviceWM ! = MODE_DETECTOR )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
m_bRequestedDeviceWM = MODE_DETECTOR ;
m_bRequestedDeviceWM = MODE_DETECTOR ;
if ( ! setMode ( MODE_DETECTOR ) )
if ( ! setMode ( MODE_DETECTOR ) )
{
{
@ -2953,7 +2956,7 @@ void device2DSensor::idleMode()
} ;
} ;
case LRF_WS_STAGE_1 :
case LRF_WS_STAGE_1 :
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
if ( ! getState2 ( ) )
if ( ! getState2 ( ) )
{
{
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
LOG_ERROR ( " Fall Back to Disconnected! " ) ;
@ -2998,7 +3001,7 @@ void device2DSensor::proceedDBCommands()
}
}
else
else
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
updateDataStatus ( ARGUS_DS_BUSY ) ;
updateDataStatus ( ARGUS_DS_BUSY ) ;
// transactionWaitResult();
// transactionWaitResult();
DELAY_10MS ( 10 ) ; // 100 ms
DELAY_10MS ( 10 ) ; // 100 ms
@ -3024,7 +3027,7 @@ void device2DSensor::proceedDBCommands()
}
}
else
else
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
updateDataStatus ( ARGUS_DS_STUDY ) ;
updateDataStatus ( ARGUS_DS_STUDY ) ;
// transactionWaitResult();
// transactionWaitResult();
DELAY_10MS ( 10 ) ; // 100 ms
DELAY_10MS ( 10 ) ; // 100 ms
@ -3352,7 +3355,7 @@ bool device2DSensor::packetHandler(protocolPackage * Package)
# endif
# endif
// Have Some Replay from device -> Reset Timeouts
// Have Some Replay from device -> Reset Timeouts
m_bOpRetryCnt = LGS_CMD_RETRY_COUNT ;
m_bOpRetryCnt = LGS_CMD_RETRY_COUNT ;
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
switch ( Package - > m_pData [ CMD_IDX ] )
switch ( Package - > m_pData [ CMD_IDX ] )
{
{
case CMD_STATE : transactionSetResult ( TRANSACTION_RESULT_OK ) ; break ;
case CMD_STATE : transactionSetResult ( TRANSACTION_RESULT_OK ) ; break ;
@ -3835,7 +3838,7 @@ bool device2DSensor::packetHandler(protocolPackage * Package)
// setStage( LRF_WS_STAGE_2 );
// setStage( LRF_WS_STAGE_2 );
while ( Package - > m_nSize > ( cIDX + 2 ) )
while ( Package - > m_nSize > ( cIDX + 2 ) )
{
{
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER ;
m_bTimeOutCounter = m_nTOCounterBase ;
switch ( Package - > m_pData [ cIDX + 1 ] )
switch ( Package - > m_pData [ cIDX + 1 ] )
{
{
case 0x00 :
case 0x00 :