|
|
|
@ -714,10 +714,10 @@ bool deviceNodeCamera::fusion_validateROI( uint64_t cts, CAM_ROI *ptr ){ |
|
|
|
|
|
|
|
CAM_ROI *deviceNodeCamera::fusion_fetchROI( void ){ |
|
|
|
CAM_ROI *tVAL = NULL; |
|
|
|
uint64_t cts = 0; |
|
|
|
m_mROIsProtector.lock(); |
|
|
|
vCAM_ROIS::iterator sRec; |
|
|
|
m_mROIsProtector.lock(); |
|
|
|
if( m_vROIS.size() ){ |
|
|
|
vCAM_ROIS::iterator sRec; |
|
|
|
uint64_t cts = 0; |
|
|
|
for( vCAM_ROIS::iterator idx = m_vROIS.begin(); idx < m_vROIS.end(); idx++ ){ |
|
|
|
if ( tVAL == NULL ) { |
|
|
|
sRec = idx; |
|
|
|
@ -746,21 +746,16 @@ DBC_SNAPSHOT_DATA *deviceNodeCamera::fusion_translate_ROI( CAM_ROI *(&ptr) ){ |
|
|
|
DBC_SNAPSHOT_DATA *rVal = NULL; |
|
|
|
if( ptr == NULL ) return NULL; |
|
|
|
if( ptr->targets.size() ){ |
|
|
|
//if( m_bSourceConnected ){
|
|
|
|
rVal = (DBC_SNAPSHOT_DATA *)malloc(sizeof(DBC_SNAPSHOT_DATA)); |
|
|
|
if( rVal ){ |
|
|
|
memset( rVal, 0, sizeof(DBC_SNAPSHOT_DATA) ); |
|
|
|
//rVal->stream_id = m_nActiveStreamID;
|
|
|
|
rVal->stream_id = m_sNodeData.aux_parameter; |
|
|
|
for( vCAM_TRACK_RECORDS::iterator idx = ptr->targets.begin(); idx < ptr->targets.end(); idx++ ) { |
|
|
|
LOG("Added Event ID"); |
|
|
|
rVal->assoc_event_ids.push_back( (*idx)->evt_db_ID ); |
|
|
|
}; |
|
|
|
}; |
|
|
|
//};
|
|
|
|
rVal = (DBC_SNAPSHOT_DATA *)malloc(sizeof(DBC_SNAPSHOT_DATA)); |
|
|
|
if( rVal ){ |
|
|
|
memset( rVal, 0, sizeof(DBC_SNAPSHOT_DATA) ); |
|
|
|
rVal->stream_id = m_sNodeData.aux_parameter; |
|
|
|
for( vCAM_TRACK_RECORDS::iterator idx = ptr->targets.begin(); idx < ptr->targets.end(); idx++ ) |
|
|
|
rVal->assoc_event_ids.push_back( (*idx)->evt_db_ID ); |
|
|
|
}; |
|
|
|
ptr->targets.clear(); |
|
|
|
} else { |
|
|
|
LOG("No Events ID to ROI"); |
|
|
|
LOG_ERROR("No Events ID to ROI"); |
|
|
|
}; |
|
|
|
utilizeROI( ptr ); |
|
|
|
// Not Setting MD5 and TS -> will set at capture time
|
|
|
|
@ -768,6 +763,7 @@ DBC_SNAPSHOT_DATA *deviceNodeCamera::fusion_translate_ROI( CAM_ROI *(&ptr) ){ |
|
|
|
}; |
|
|
|
|
|
|
|
void deviceNodeCamera::fusion_validate( void ){ |
|
|
|
if ( m_bNoAbsPositionning ) return; |
|
|
|
m_mROIsProtector.lock(); |
|
|
|
if( m_vROIS.size() ){ |
|
|
|
#ifdef DEBUG_EXTRA
|
|
|
|
@ -1007,6 +1003,7 @@ void deviceNodeCamera::m_fThreadProc( void ){ |
|
|
|
m_bCameraOnHomePosition = false; |
|
|
|
setWM( CAM_WS_BUSY ); |
|
|
|
if( m_pCurrentROI != NULL ){ |
|
|
|
//LOG("ROI Ok");
|
|
|
|
m_nHomingCounter = 0; |
|
|
|
if( m_pBEH ){ |
|
|
|
EVENT_CONTAINER *tEVT = createBasicEvent( |
|
|
|
@ -1020,23 +1017,26 @@ void deviceNodeCamera::m_fThreadProc( void ){ |
|
|
|
}; |
|
|
|
}; |
|
|
|
if( m_bNoAbsPositionning ){ |
|
|
|
//LOG("ABS to PRESET");
|
|
|
|
uint8_t COL, ROW; |
|
|
|
translateROI2PRESET( |
|
|
|
m_pCurrentROI->cam_orientation.pan, |
|
|
|
m_pCurrentROI->cam_orientation.tilt, |
|
|
|
m_pCurrentROI->cam_orientation.zoom, COL, ROW ); |
|
|
|
char tB[64]; |
|
|
|
sprintf( tB, "Get ABS Preset Col %d Row %d!", COL, ROW ); |
|
|
|
LOG( tB ); |
|
|
|
sprintf( tB, "Old Preset Col %d Row %d!", m_bCurrentPresetCol, m_bCurrentPresetRow ); |
|
|
|
LOG( tB ); |
|
|
|
//char tB[64];
|
|
|
|
//sprintf( tB, "Get ABS Preset Col %d Row %d!", COL, ROW );
|
|
|
|
//LOG( tB );
|
|
|
|
//sprintf( tB, "Old Preset Col %d Row %d!", m_bCurrentPresetCol, m_bCurrentPresetRow );
|
|
|
|
//LOG( tB );
|
|
|
|
if ( ( m_bCurrentPresetCol == COL ) && ( m_bCurrentPresetRow == ROW ) ) { |
|
|
|
m_fCP_Pan = m_pCurrentROI->cam_orientation.pan; |
|
|
|
m_fCP_Tilt = m_pCurrentROI->cam_orientation.tilt; |
|
|
|
m_fCP_Zoom = m_pCurrentROI->cam_orientation.zoom; |
|
|
|
#ifdef DEBUG_EXTRA
|
|
|
|
LOG("INSTANT BCAST CAM ONPOS"); |
|
|
|
#endif
|
|
|
|
// Send Capture event
|
|
|
|
DBC_SNAPSHOT_DATA *tData = fusion_translate_ROI( m_pCurrentROI ); |
|
|
|
setWM( CAM_WS_READY ); |
|
|
|
if( tData != NULL ) { |
|
|
|
if( m_pBEH ){ |
|
|
|
EVENT_CONTAINER *tEVT = createBasicEvent( |
|
|
|
@ -1045,10 +1045,6 @@ void deviceNodeCamera::m_fThreadProc( void ){ |
|
|
|
EVT_CAMERA_ON_POSITION, |
|
|
|
NULL, NULL, tData ); |
|
|
|
if( tEVT ){ |
|
|
|
#ifdef DEBUG
|
|
|
|
LOG("INSTANT BCAST CAM ONPOS"); |
|
|
|
#endif
|
|
|
|
//tEVT->m_db_id = tTASK->source_evt_id; // EVT ids embed in DATA
|
|
|
|
m_pBEH->broadcast( tEVT ); |
|
|
|
} else { |
|
|
|
free( tData ); |
|
|
|
@ -1057,12 +1053,10 @@ void deviceNodeCamera::m_fThreadProc( void ){ |
|
|
|
free( tData ); |
|
|
|
}; |
|
|
|
}; |
|
|
|
setWM( CAM_WS_READY ); |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
CSTR token = getPresetToken( COL, ROW ); |
|
|
|
if ( token ) { |
|
|
|
LOG("Have One!"); |
|
|
|
//update position Info
|
|
|
|
m_bCurrentPresetCol = COL; |
|
|
|
m_bCurrentPresetRow = ROW; |
|
|
|
@ -1075,9 +1069,11 @@ void deviceNodeCamera::m_fThreadProc( void ){ |
|
|
|
} else { |
|
|
|
// Waiting Movement finish
|
|
|
|
if( m_bSkeepPositioningWait ){ |
|
|
|
#ifdef DEBUG_EXTRA
|
|
|
|
LOG("INSTANT BCAST CAM ONPOS"); |
|
|
|
#endif
|
|
|
|
// Send Capture event
|
|
|
|
DBC_SNAPSHOT_DATA *tData = fusion_translate_ROI( m_pCurrentROI ); |
|
|
|
setWM( CAM_WS_READY ); |
|
|
|
if( tData != NULL ) { |
|
|
|
if( m_pBEH ){ |
|
|
|
EVENT_CONTAINER *tEVT = createBasicEvent( |
|
|
|
@ -1086,10 +1082,6 @@ void deviceNodeCamera::m_fThreadProc( void ){ |
|
|
|
EVT_CAMERA_ON_POSITION, |
|
|
|
NULL, NULL, tData ); |
|
|
|
if( tEVT ){ |
|
|
|
#ifdef DEBUG
|
|
|
|
LOG("INSTANT BCAST CAM ONPOS"); |
|
|
|
#endif
|
|
|
|
//tEVT->m_db_id = tTASK->source_evt_id; // EVT ids embed in DATA
|
|
|
|
m_pBEH->broadcast( tEVT ); |
|
|
|
} else { |
|
|
|
free( tData ); |
|
|
|
@ -1098,6 +1090,7 @@ void deviceNodeCamera::m_fThreadProc( void ){ |
|
|
|
free( tData ); |
|
|
|
}; |
|
|
|
}; |
|
|
|
setWM( CAM_WS_READY ); |
|
|
|
} else { |
|
|
|
setWM(CAM_WS_WAIT_ONPOS); |
|
|
|
}; |
|
|
|
@ -1124,9 +1117,11 @@ void deviceNodeCamera::m_fThreadProc( void ){ |
|
|
|
} else { |
|
|
|
// Waiting Movement finish
|
|
|
|
if( m_bSkeepPositioningWait ){ |
|
|
|
#ifdef DEBUG_EXTRA
|
|
|
|
LOG("INSTANT BCAST CAM ONPOS"); |
|
|
|
#endif
|
|
|
|
// Send Capture event
|
|
|
|
DBC_SNAPSHOT_DATA *tData = fusion_translate_ROI( m_pCurrentROI ); |
|
|
|
setWM( CAM_WS_READY ); |
|
|
|
if( tData != NULL ) { |
|
|
|
if( m_pBEH ){ |
|
|
|
EVENT_CONTAINER *tEVT = createBasicEvent( |
|
|
|
@ -1135,10 +1130,6 @@ void deviceNodeCamera::m_fThreadProc( void ){ |
|
|
|
EVT_CAMERA_ON_POSITION, |
|
|
|
NULL, NULL, tData ); |
|
|
|
if( tEVT ){ |
|
|
|
#ifdef DEBUG
|
|
|
|
LOG("INSTANT BCAST CAM ONPOS"); |
|
|
|
#endif
|
|
|
|
//tEVT->m_db_id = tTASK->source_evt_id; // EVT ids embed in DATA
|
|
|
|
m_pBEH->broadcast( tEVT ); |
|
|
|
} else { |
|
|
|
free( tData ); |
|
|
|
@ -1147,6 +1138,7 @@ void deviceNodeCamera::m_fThreadProc( void ){ |
|
|
|
free( tData ); |
|
|
|
}; |
|
|
|
}; |
|
|
|
setWM( CAM_WS_READY ); |
|
|
|
} else { |
|
|
|
setWM(CAM_WS_WAIT_ONPOS); |
|
|
|
}; |
|
|
|
@ -1180,7 +1172,7 @@ void deviceNodeCamera::m_fThreadProc( void ){ |
|
|
|
EVT_CAMERA_ON_POSITION, |
|
|
|
NULL, NULL, tData ); |
|
|
|
if( tEVT ){ |
|
|
|
#ifdef DEBUG
|
|
|
|
#ifdef DEBUG_EXTRA
|
|
|
|
LOG("BCAST CAM ONPOS"); |
|
|
|
#endif
|
|
|
|
//tEVT->m_db_id = tTASK->source_evt_id; // EVT ids embed in DATA
|
|
|
|
@ -1199,12 +1191,16 @@ void deviceNodeCamera::m_fThreadProc( void ){ |
|
|
|
CSTR TK = getPresetToken( ARGUS_PRESET_TYPE_HOME ); |
|
|
|
if( TK ) { |
|
|
|
if ( !m_bCameraOnHomePosition ) { |
|
|
|
#ifdef DEBUG_EXTRA
|
|
|
|
LOG("Go Home!"); |
|
|
|
LOG( TK ); |
|
|
|
#endif
|
|
|
|
if( !m_pProtocol->goPreset( TK )){ |
|
|
|
LOG_ERROR("Cannot Issue goPreset Command!"); |
|
|
|
}; |
|
|
|
m_bCameraOnHomePosition = true; |
|
|
|
m_bCurrentPresetCol = 0; |
|
|
|
m_bCurrentPresetRow = 0; |
|
|
|
}; |
|
|
|
}; |
|
|
|
setWM( CAM_WS_READY ); |
|
|
|
@ -1239,10 +1235,10 @@ void deviceNodeCamera::m_fThreadProc( void ){ |
|
|
|
setWM( CAM_WS_READY ); |
|
|
|
break; |
|
|
|
}; |
|
|
|
case CAM_WS_READY:{ |
|
|
|
case CAM_WS_READY:{ |
|
|
|
m_pCurrentROI = fusion_fetchROI(); |
|
|
|
if( m_pCurrentROI != NULL ) { |
|
|
|
#ifdef DEBUG_EXTRA__
|
|
|
|
#ifdef DEBUG_EXTRA
|
|
|
|
LOG("HAVE ROI to see!"); |
|
|
|
#endif
|
|
|
|
setWM( CAM_WS_GO_ABS_POSITION ); |
|
|
|
@ -1638,10 +1634,9 @@ bool deviceNodeCamera::lookAt( uint32_t TargetRefID, C3D_SPH_DEGREES L ){ |
|
|
|
EVT_CAMERA_ON_POSITION, |
|
|
|
NULL, NULL, tData ); |
|
|
|
if( tEVT ){ |
|
|
|
#ifdef DEBUG
|
|
|
|
#ifdef DEBUG_EXTRA
|
|
|
|
LOG("INSTANT BCAST CAM ONPOS"); |
|
|
|
#endif
|
|
|
|
//tEVT->m_db_id = tTASK->source_evt_id; // EVT ids embed in DATA
|
|
|
|
#endif
|
|
|
|
m_pBEH->broadcast( tEVT ); |
|
|
|
} else { |
|
|
|
free( tData ); |
|
|
|
@ -1697,9 +1692,10 @@ bool deviceNodeCamera::lookAt( uint32_t TargetRefID, C3D_SPH_DEGREES L ){ |
|
|
|
m_vROIS.push_back( tROI ); |
|
|
|
m_mROIsProtector.unlock(); |
|
|
|
} else { |
|
|
|
LOG_ERROR("No MEM 4 TARGTEG DATA"); |
|
|
|
utilizeROI( tROI ); |
|
|
|
}; |
|
|
|
}; |
|
|
|
} else LOG_ERROR("No MEM 4 ROI"); |
|
|
|
return true; |
|
|
|
}; |
|
|
|
return fusion_consumeData(TargetRefID, L); |
|
|
|
|