1 |
|
|
2 |
// Implementation of the TrkAlarmReader class. |
// Implementation of the TrkAlarmReader class. |
|
|
|
3 |
|
|
|
#define UINT unsigned int |
|
|
#define BYTE unsigned char |
|
|
#include <string> |
|
|
#include <log4cxx/logger.h> |
|
|
extern "C" { |
|
|
#include "CRC.h" |
|
|
} |
|
|
|
|
|
#include <fstream> |
|
|
#include "stdio.h" |
|
4 |
#include "ReaderAlgorithms.h" |
#include "ReaderAlgorithms.h" |
|
|
|
|
using namespace pamela; |
|
5 |
using namespace pamela::techmodel; |
using namespace pamela::techmodel; |
6 |
|
|
7 |
static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.TrkAlarmReader")); |
static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.TrkAlarmReader")); |
20 |
*/ |
*/ |
21 |
std::string TrkAlarmReader::GetVersionInfo(void) const { |
std::string TrkAlarmReader::GetVersionInfo(void) const { |
22 |
return |
return |
23 |
"$Trailer: /home/cvsmanager/yoda/techmodel/TrkAlarmReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $\n"; |
"$Trailer: /home/cvsmanager/yoda/techmodel/TrkAlarmReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 Maurizio Nagni Exp $\n"; |
24 |
} |
} |
25 |
|
|
26 |
/** |
/** |
36 |
/** |
/** |
37 |
* Unpack the TrkAlarm event from an input file. |
* Unpack the TrkAlarm event from an input file. |
38 |
*/ |
*/ |
39 |
void TrkAlarmReader::RunEvent(int EventNumber, long int length) { |
void TrkAlarmReader::RunEvent(int EventNumber, long int length) throw (WrongCRCException){ |
40 |
|
|
41 |
|
char subData[length]; |
42 |
|
InputFile->read(subData, sizeof(subData)); |
43 |
|
|
44 |
|
trkAlarm->TrigMask = (subData[0]&0xc0) >> 6; |
45 |
|
trkAlarm->DSPMask = (subData[0]&0x3f); |
46 |
|
|
47 |
|
|
48 |
|
trkAlarm->FlashShutdown = (subData[1]&0x80) >> 7; |
49 |
|
trkAlarm->FlashOn = (subData[1]&0x40) >> 6; |
50 |
|
trkAlarm->DSPBusy = (subData[1]&0x3f); |
51 |
|
|
52 |
|
trkAlarm->FlashUpset = (subData[2]&0x80) >> 7; |
53 |
|
trkAlarm->FlashData = (subData[2]&0x40) >> 6; |
54 |
|
trkAlarm->DSPSoft = (subData[2]&0x3f); |
55 |
|
|
56 |
|
trkAlarm->InterCheck = (subData[3]&0x80) >> 7; |
57 |
|
trkAlarm->FinalCheck = (subData[3]&0x40) >> 6; |
58 |
|
trkAlarm->CmdIDMA = (subData[3]&0x3f); |
59 |
|
|
60 |
|
trkAlarm->UnknownCmd = (subData[4]&0x80) >> 7; |
61 |
|
trkAlarm->CmdDuringTrig = (subData[4]&0x40) >> 6; |
62 |
|
trkAlarm->TrigIDMA = (subData[4]&0x3f); |
63 |
|
|
64 |
|
trkAlarm->PNum = (subData[5]&0xf0) >> 4; |
65 |
|
trkAlarm->CmdNum = (subData[5]&0x0f); |
66 |
|
|
67 |
|
for(int i=0 ; i<4 ; i++){ |
68 |
|
trkAlarm->BID[i] = (subData[6]&(0x03<<i*2)) >> i*2; |
69 |
|
}; |
70 |
|
|
71 |
|
for(int i=1 ; i<4 ; i++){ |
72 |
|
trkAlarm->BID[3+i] = (subData[7]&(0x03<<i*2)) >> i*2; |
73 |
|
}; |
74 |
|
|
75 |
|
trkAlarm->ALARM[0] = (subData[7]&0x02) >> 1; |
76 |
|
trkAlarm->ALARM[1] = (subData[7]&0x01); |
77 |
|
|
78 |
|
trkAlarm->Aswr = (subData[8]&0xff) << 8; |
79 |
|
trkAlarm->Aswr = trkAlarm->Aswr | (subData[9]&0xff); |
80 |
} |
} |
81 |
|
|