|
|
|
@ -5,26 +5,26 @@ |
|
|
|
#define LOGS( X ) basicLogCollection::getInstance()->Log( "RGoose", NULL, X )
|
|
|
|
#define LOG_ERROR( X ) m_pLog->Log( "RGoose", this, _LOG_ERROR, X )
|
|
|
|
|
|
|
|
CSTR defenderStatusMode[] = { |
|
|
|
CSTR RGooseStatusMode[] = { |
|
|
|
"Operational", |
|
|
|
"Degraded" |
|
|
|
}; |
|
|
|
CSTR defenderFaultCode[] = { |
|
|
|
CSTR RGooseFaultCode[] = { |
|
|
|
"Critical", |
|
|
|
"Warning", |
|
|
|
"Info" |
|
|
|
}; |
|
|
|
CSTR defenderCategories[] = { |
|
|
|
CSTR RGooseCategories[] = { |
|
|
|
"STATUS", |
|
|
|
"ALARM", |
|
|
|
"ERROR" |
|
|
|
}; |
|
|
|
CSTR defenderTypeDescription[] = { |
|
|
|
CSTR RGooseTypeDescription[] = { |
|
|
|
"Status Message", |
|
|
|
"Target Detection Event", |
|
|
|
"Fault Event" |
|
|
|
}; |
|
|
|
CSTR defenderTypeSeverity[] = { |
|
|
|
CSTR RGooseTypeSeverity[] = { |
|
|
|
"very-low", |
|
|
|
"low", |
|
|
|
"medium", |
|
|
|
@ -43,7 +43,7 @@ static int g_iTimeDiff = 0; |
|
|
|
#define UNIX_TimeStamp_2_WINDOWS_FileTime_SHIFT 116444736000000000
|
|
|
|
|
|
|
|
#ifdef __linux__
|
|
|
|
unsigned long long getSHDTimeValue( void ){ |
|
|
|
unsigned long long getRSHDTimeValue( void ){ |
|
|
|
unsigned long long tMilliseconds; |
|
|
|
struct timeval tData; |
|
|
|
struct timezone tTZ; |
|
|
|
@ -63,7 +63,7 @@ void TimetToFileTime( time_t t, LPFILETIME pft ){ |
|
|
|
pft->dwLowDateTime = (DWORD) ll; |
|
|
|
pft->dwHighDateTime = ll >>32; |
|
|
|
}*/ |
|
|
|
unsigned __int64 getSHDTimeValue( void ){ |
|
|
|
unsigned __int64 getRSHDTimeValue( void ){ |
|
|
|
unsigned __int64 tMilliseconds; |
|
|
|
SYSTEMTIME Ztime; |
|
|
|
GetSystemTime(&Ztime); |
|
|
|
@ -75,7 +75,7 @@ unsigned __int64 getSHDTimeValue( void ){ |
|
|
|
return tMilliseconds; |
|
|
|
}; |
|
|
|
|
|
|
|
CSTR getSHDTimeStamp( void ){ |
|
|
|
CSTR getRSHDTimeStamp( void ){ |
|
|
|
CSTR RetVal = NULL; |
|
|
|
time_t rawtime; |
|
|
|
uint32_t msec; |
|
|
|
@ -102,7 +102,7 @@ CSTR getSHDTimeStamp( void ){ |
|
|
|
return RetVal; |
|
|
|
}; |
|
|
|
|
|
|
|
bool correctSHDTime( int diff ){ |
|
|
|
bool correctRSHDTime( int diff ){ |
|
|
|
#ifdef __linux__
|
|
|
|
struct timeval tData; |
|
|
|
struct timezone tTZ; |
|
|
|
@ -142,7 +142,7 @@ CSTR protocolRGoose::buildURL( CSTR templ, int dim, CSTR devID ){ |
|
|
|
CSTR protocolRGoose::buildUniqID( void ){ |
|
|
|
CSTR RetVal; |
|
|
|
RetVal = (CSTR) malloc(64); |
|
|
|
sprintf( RetVal, "%s", MD5String( getSHDTimeStamp() ) ); |
|
|
|
sprintf( RetVal, "%s", MD5String( getRSHDTimeStamp() ) ); |
|
|
|
return RetVal; |
|
|
|
}; |
|
|
|
|
|
|
|
@ -251,7 +251,7 @@ CSTR protocolRGoose::assembleStatusData( bool StatusOK ){ |
|
|
|
CSTR tID; |
|
|
|
RetVal = (CSTR) malloc(CLOG); |
|
|
|
if ( RetVal != NULL ) { |
|
|
|
tBuf = getSHDTimeStamp(); |
|
|
|
tBuf = getRSHDTimeStamp(); |
|
|
|
if( tBuf != NULL ) { |
|
|
|
tTARGET = (CSTR) malloc(128); |
|
|
|
if( tTARGET!= NULL) { |
|
|
|
@ -261,10 +261,10 @@ CSTR protocolRGoose::assembleStatusData( bool StatusOK ){ |
|
|
|
if( tID != NULL ) { |
|
|
|
sprintf( tID, "%s", MD5String( tBuf ) ); |
|
|
|
sprintf( tSRC, DFSL_SensorSourceDto, DFSL_HARDWARE_TYPE, DFSL_SOURCE_NAME, m_pScannerName ); |
|
|
|
sprintf( tTARGET, "{ \"status\": \"%s\" }", defenderStatusMode[((StatusOK)?1:0)] ); |
|
|
|
sprintf( tTARGET, "{ \"status\": \"%s\" }", RGooseStatusMode[((StatusOK)?1:0)] ); |
|
|
|
sprintf( RetVal, |
|
|
|
PACKAGE_SE_DATA_STATUS_ELEMENT, |
|
|
|
defenderTypeDescription[DC_STATUS], |
|
|
|
RGooseTypeDescription[DC_STATUS], |
|
|
|
tBuf, |
|
|
|
tSRC, |
|
|
|
"DFSL_STATUS_DATA", |
|
|
|
@ -306,7 +306,7 @@ CSTR protocolRGoose::assembleFaultData( uint8_t Code, CSTR Desc ){ |
|
|
|
CSTR tID; |
|
|
|
RetVal = (CSTR) malloc(CLOG); |
|
|
|
if ( RetVal != NULL ) { |
|
|
|
tBuf = getSHDTimeStamp(); |
|
|
|
tBuf = getRSHDTimeStamp(); |
|
|
|
if( tBuf != NULL ) { |
|
|
|
tTARGET = (CSTR) malloc(128); |
|
|
|
if( tTARGET!= NULL) { |
|
|
|
@ -319,7 +319,7 @@ CSTR protocolRGoose::assembleFaultData( uint8_t Code, CSTR Desc ){ |
|
|
|
sprintf( tTARGET, "{ \"code\": %d, \"description\": \"%s\" }", Code, Desc ); |
|
|
|
sprintf( RetVal, |
|
|
|
PACKAGE_SE_DATA_STATUS_ELEMENT, |
|
|
|
defenderTypeDescription[DC_ERROR], |
|
|
|
RGooseTypeDescription[DC_ERROR], |
|
|
|
tBuf, |
|
|
|
tSRC, |
|
|
|
"DFSL_FAULT_DATA", |
|
|
|
@ -361,7 +361,7 @@ CSTR protocolRGoose::assembleTargetData( int targetID, int Range, int Width, int |
|
|
|
CSTR tID; |
|
|
|
RetVal = (CSTR) malloc(CLOG); |
|
|
|
if ( RetVal != NULL ) { |
|
|
|
tBuf = getSHDTimeStamp(); |
|
|
|
tBuf = getRSHDTimeStamp(); |
|
|
|
if( tBuf != NULL ) { |
|
|
|
tTARGET = (CSTR) malloc(128); |
|
|
|
if( tTARGET!= NULL) { |
|
|
|
@ -374,7 +374,7 @@ CSTR protocolRGoose::assembleTargetData( int targetID, int Range, int Width, int |
|
|
|
sprintf( tTARGET, DFSL_LidarTargetDto, targetID, Azimuth, Elevation, Range, Width ); |
|
|
|
sprintf( RetVal, |
|
|
|
PACKAGE_SE_DATA_ELEMENT, |
|
|
|
defenderTypeDescription[DC_ALARM], |
|
|
|
RGooseTypeDescription[DC_ALARM], |
|
|
|
tBuf, |
|
|
|
tSRC, |
|
|
|
"DFSL_TARGET_DATA", |
|
|
|
@ -414,7 +414,7 @@ size_t protocolRGoose::assembleDefenderJSON( CSTR Buffer, defenderCategoryTypes |
|
|
|
size_t RetVal; |
|
|
|
CSTR tBuf; |
|
|
|
RetVal = 0; |
|
|
|
tBuf = getSHDTimeStamp(); |
|
|
|
tBuf = getRSHDTimeStamp(); |
|
|
|
DEFENDER_MESSAGE_ID++; |
|
|
|
//memset( tBuffer, 0, CLOG );
|
|
|
|
if( tBuf != NULL ){ |
|
|
|
@ -436,8 +436,8 @@ size_t protocolRGoose::assembleDefenderJSON( CSTR Buffer, defenderCategoryTypes |
|
|
|
sprintf( tBuffer, |
|
|
|
DFSL_SE_ENVELOPE, |
|
|
|
DEFENDER_MESSAGE_ID, |
|
|
|
defenderCategories[Type], |
|
|
|
defenderTypeSeverity[Severity], |
|
|
|
RGooseCategories[Type], |
|
|
|
RGooseTypeSeverity[Severity], |
|
|
|
tBuf, tBuf, tBuf, tBuf, |
|
|
|
Location, |
|
|
|
Data |
|
|
|
|