You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

80 lines
2.3 KiB

#include "objectEventReport.h"
#include "../base/basicEventHeap.h"
#include "../../hardware/soc/general/3DLRF.h"
objectEventReport *objectEventReport::_instance = NULL;
/**
* Returns the single instance of the object.
*/
objectEventReport* objectEventReport::getInstance() {
// check if the instance has been created yet
if (0 == _instance) {
// if not, then create it
_instance = new objectEventReport();
}
// return the single instance
return _instance;
};
// Constructor implementation
objectEventReport::objectEventReport() : basicEventHandler(){
m_pStorageProvider = storageProvider::getInstance();
m_pStorageProvider->startNewSeries();
sprintf( m_pReportFileName, "%s", m_pStorageProvider->getNewFileName());
};
// Destructor implementation
objectEventReport::~objectEventReport(){
};
void objectEventReport::dispatchEvent( basicEvent *Evt ){
if( Evt == NULL ) return;
if (Evt->m_eClass == EVT_CLASS_SENSOR || Evt->m_eClass == EVT_CLASS_SYSTEM){
addGenericEvent( Evt );
};
};
bool objectEventReport::addGenericEvent( basicEvent *Evt ){
FILE *FD;
FD = fopen(m_pReportFileName, "a+");
if( FD != NULL ){
if( Evt->m_pEvtData == NULL ){
fprintf( FD, "%d,\"%s\"\n", Evt->m_nSourceUID, Evt->m_pHumanReadableMsg );
} else {
CLIENT_EVENT *tData;
float fRange, fAzimuth, fElevation;
uint16_t cX, cY;
bool lMaster;
tData = (CLIENT_EVENT*)Evt->m_pEvtData;
uint8_t kid;
kid = tData->k_id & 0x07;
lMaster = ((tData->k_id & 0x08) == 0x08 );
fRange = 300.0 / 4095.0 * tData->range;
//makeCds( tData->mStartID, sX, sY, m_bIsMaster );
//makeCds( tData->mEndID, eX, eY, m_bIsMaster );
//cX = ((sX+eX)>>1);
//cY = ((sY+eY)>>1);
makeXY( tData->th_id, cX, cY, lMaster );
fAzimuth = 360.0 - (360.0 / TH_LINE_NODES )*cX;
fElevation = 90.0 - (Q_DEGREE_FOV/Q_SCAN_COUNT )*cY + Q_SHIFT_DOWN_FOV;
fprintf( FD, "%d,%d:%d,%c,%d,%c,%0.3f,%0.3f,%0.3f,%d\n",
Evt->m_nSourceUID,
tData->uts,
tData->ums,
(lMaster?'M':'S'),
kid,
((tData->type == EVT_TARGET_WHITE )?'W':'B'),
fRange,
fAzimuth,
fElevation,
tData->w_cnt*tData->range
);
};
fclose( FD );
};
return true;
};
bool objectEventReport::addVideoRecord( CSTR fileName ){
return true;
};