|
|
|
@ -39,7 +39,7 @@ servaLifeMonitoring::servaLifeMonitoring():basicValidatable(),basicThread(){ |
|
|
|
tHZ->platform_id = *idx; |
|
|
|
uint8_t cid = 0; |
|
|
|
tHZ->lvl = 255; // To clean prev State
|
|
|
|
tHZ->validation_ts = getMilliseconds();//Set Next Validation Cycle
|
|
|
|
tHZ->validated = false; |
|
|
|
for ( DBC_UINT64_LIST::iterator jdx = tML->begin(); jdx != tML->end(); jdx++ ) { |
|
|
|
tHZ->module_id[cid] = *jdx; |
|
|
|
tHZ->module_monitored[cid] = true; |
|
|
|
@ -90,6 +90,7 @@ bool servaLifeMonitoring::validateZone( HEALTH_MONITORING_ZONE *ptr ){ |
|
|
|
ptr->lvl = min_lvl; |
|
|
|
ptr->lvl_id = min_id; |
|
|
|
}; |
|
|
|
ptr->validated = false; |
|
|
|
}; |
|
|
|
return retVal; |
|
|
|
}; |
|
|
|
@ -110,7 +111,7 @@ uint8_t servaLifeMonitoring::validateModule( uint64_t module_id ){ |
|
|
|
} else { |
|
|
|
switch ( ms ) { |
|
|
|
case ARGUS_CLOUD_STATUS_E_GENERIC: break; |
|
|
|
case ARGUS_CLOUD_STATUS_E_CAM_GENERIC: |
|
|
|
case ARGUS_CLOUD_STATUS_E_CAM_GENERIC: |
|
|
|
case ARGUS_CLOUD_STATUS_E_CAM_NC: |
|
|
|
case ARGUS_CLOUD_STATUS_E_CAM_NPTZ: |
|
|
|
case ARGUS_CLOUD_STATUS_E_CAM_NIM: retVal = ARGUS_LIFE_STATUS_LVL_1; break; |
|
|
|
@ -148,7 +149,9 @@ bool servaLifeMonitoring::validate(){ |
|
|
|
m_mMonitoringZonesProtector.lock(); |
|
|
|
for ( V_HEALTH_MONITORING_ZONES::iterator idx = m_vMonitoringZones.begin(); idx != m_vMonitoringZones.end(); idx++ ) { |
|
|
|
if (!validateZone(*idx)) { |
|
|
|
#ifdef DEBUG
|
|
|
|
LOG("Zone Health is Changed"); |
|
|
|
#endif
|
|
|
|
MODULE_HEALTH_STATUS *tData = (MODULE_HEALTH_STATUS*) malloc(sizeof(MODULE_HEALTH_STATUS)); |
|
|
|
if ( tData ) { |
|
|
|
tData->status = (*idx)->lvl; |
|
|
|
@ -179,6 +182,7 @@ bool servaLifeMonitoring::validate(){ |
|
|
|
void servaLifeMonitoring::m_fThreadProc( void ){ |
|
|
|
m_bThreadStatus = TH_WORKING; |
|
|
|
uint32_t ots = time(NULL); |
|
|
|
pthread_setname_np( pthread_self(), "LifeMonitoring" ); |
|
|
|
while( m_bThreadStatus < TH_ENDED ) { |
|
|
|
uint32_t cts = time(NULL); |
|
|
|
if ( ( cts - m_nStartupTS ) > LM_SKEEP_MONITORING_SECONDS ){ |
|
|
|
@ -193,8 +197,10 @@ void servaLifeMonitoring::m_fThreadProc( void ){ |
|
|
|
}; |
|
|
|
m_mMonitoringZonesProtector.unlock(); |
|
|
|
if ( tCWZ ) { |
|
|
|
for ( uint8_t i = 0; i < 4; i++ ) { |
|
|
|
if (tCWZ->module_monitored[i]) tCWZ->module_status[i] = validateModule( tCWZ->module_id[i] ); |
|
|
|
if ( !tCWZ->validated ) { |
|
|
|
for (uint8_t i = 0; i < 4; i++) { |
|
|
|
if (tCWZ->module_monitored[i]) tCWZ->module_status[i] = validateModule( tCWZ->module_id[i] ); |
|
|
|
}; |
|
|
|
}; |
|
|
|
m_mMonitoringZonesProtector.lock(); |
|
|
|
m_vMonitoringZones.push_back( tCWZ ); |
|
|
|
|