1 |
|
2 |
// Implementation of the TrkAlarmReader class. |
3 |
|
4 |
#include "ReaderAlgorithms.h" |
5 |
using namespace pamela::techmodel; |
6 |
|
7 |
|
8 |
/** |
9 |
* Constructor. |
10 |
*/ |
11 |
TrkAlarmReader::TrkAlarmReader(void): |
12 |
TechmodelAlgorithm(PacketType::TrkAlarm, "TechmodelTrkAlarmReader") { |
13 |
trkAlarm = new TrkAlarmEvent(); |
14 |
} |
15 |
|
16 |
/** |
17 |
* Get a string with the version info of the algorithm. |
18 |
*/ |
19 |
std::string TrkAlarmReader::GetVersionInfo(void) const { |
20 |
return |
21 |
"$Trailer: /home/cvsmanager/yoda/techmodel/TrkAlarmReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 Maurizio Nagni Exp $\n"; |
22 |
} |
23 |
|
24 |
/** |
25 |
* Initialize the algorithm with a special run. This will initialize the |
26 |
* event reader routines for all packet types. |
27 |
*/ |
28 |
void TrkAlarmReader::Init(PamelaRun *run) { |
29 |
//SetInputStream(run); |
30 |
run->WriteSubPacket(this, &trkAlarm, trkAlarm->Class()); |
31 |
// logger->debug(_T("Initialize")); |
32 |
} |
33 |
|
34 |
/** |
35 |
* Unpack the TrkAlarm event |
36 |
*/ |
37 |
void TrkAlarmReader::PKT_RunEvent(char* subData, long int length) throw (WrongCRCException){ |
38 |
|
39 |
trkAlarm->TrigMask = (subData[0]&0xc0) >> 6; |
40 |
trkAlarm->DSPMask = (subData[0]&0x3f); |
41 |
|
42 |
trkAlarm->FlashShutdown = (subData[1]&0x80) >> 7; |
43 |
trkAlarm->FlashOn = (subData[1]&0x40) >> 6; |
44 |
trkAlarm->DSPBusy = (subData[1]&0x3f); |
45 |
|
46 |
trkAlarm->FlashUpset = (subData[2]&0x80) >> 7; |
47 |
trkAlarm->FlashData = (subData[2]&0x40) >> 6; |
48 |
trkAlarm->DSPSoft = (subData[2]&0x3f); |
49 |
|
50 |
trkAlarm->InterCheck = (subData[3]&0x80) >> 7; |
51 |
trkAlarm->FinalCheck = (subData[3]&0x40) >> 6; |
52 |
trkAlarm->CmdIDMA = (subData[3]&0x3f); |
53 |
|
54 |
trkAlarm->UnknownCmd = (subData[4]&0x80) >> 7; |
55 |
trkAlarm->CmdDuringTrig = (subData[4]&0x40) >> 6; |
56 |
trkAlarm->TrigIDMA = (subData[4]&0x3f); |
57 |
|
58 |
trkAlarm->PNum = (subData[5]&0xf0) >> 4; |
59 |
trkAlarm->CmdNum = (subData[5]&0x0f); |
60 |
|
61 |
for(int i=0 ; i<4 ; i++){ |
62 |
trkAlarm->BID[i] = (subData[6]&(0x03<<i*2)) >> i*2; |
63 |
}; |
64 |
|
65 |
for(int i=1 ; i<4 ; i++){ |
66 |
trkAlarm->BID[3+i] = (subData[7]&(0x03<<i*2)) >> i*2; |
67 |
}; |
68 |
|
69 |
trkAlarm->ALARM[0] = (subData[7]&0x02) >> 1; |
70 |
trkAlarm->ALARM[1] = (subData[7]&0x01); |
71 |
|
72 |
trkAlarm->Aswr = (subData[8]&0xff) << 8; |
73 |
trkAlarm->Aswr = trkAlarm->Aswr | (subData[9]&0xff); |
74 |
} |