1 |
/** @file |
/** @file |
2 |
* $Source: /home/cvspamela/yoda/event/PscuHeader.h,v $ |
* $Source: /home/cvsmanager/yoda/event/PscuHeader.h,v $ |
3 |
* $Id: PscuHeader.h,v 1.7 2004/04/28 09:01:27 nagni Exp $ |
* $Id: PscuHeader.h,v 2.0 2004/09/21 20:49:57 kusanagi Exp $ |
4 |
* $Author: nagni $ |
* $Author: kusanagi $ |
5 |
* |
* |
6 |
* Header file for the PscuHeader class. |
* Header file for the PscuHeader class. |
7 |
*/ |
*/ |
8 |
#ifndef PSCU_HEADER_H |
#ifndef PSCU_HEADER_H |
9 |
#define PSCU_HEADER_H |
#define PSCU_HEADER_H |
|
#define UINT32 unsigned int |
|
|
#define UINT16 unsigned short |
|
|
#define UINT8 unsigned char |
|
|
#include <exception> |
|
10 |
|
|
11 |
#include "PacketType.h" |
#include "Exception.h" |
12 |
#include "SubPacket.h" |
#include "SubPacket.h" |
13 |
|
|
14 |
namespace pamela { |
namespace pamela { |
17 |
*/ |
*/ |
18 |
class PscuHeader: public pamela::SubPacket { |
class PscuHeader: public pamela::SubPacket { |
19 |
private: |
private: |
20 |
|
|
21 |
|
public: |
22 |
unsigned int Header; /**< Packet type header (must be 0xFAFEDE) */ |
unsigned int Header; /**< Packet type header (must be 0xFAFEDE) */ |
23 |
UINT8 PacketId1; /**< Packet type first byte */ |
UINT8 PacketId1; /**< Packet type first byte */ |
24 |
UINT8 PacketId2; /**< Packet type second byte */ |
UINT8 PacketId2; /**< Packet type second byte */ |
25 |
UINT32 Counter; /**< PSCU event counter */ |
UINT32 Counter; /**< PSCU event counter */ |
26 |
UINT32 OrbitalTime; /**< Raw Orbital time */ |
UINT32 OrbitalTime; /**< Raw Orbital time */ |
27 |
UINT32 PacketLenght; |
UINT32 PacketLenght; |
28 |
UINT8 CRC; /**< PSCU Header Checksum */ |
UINT8 CRC; /**< PSCU Header Checksum */ //! |
29 |
public: |
|
30 |
|
/* This parameter represent the offset of the header relative to the begin |
31 |
|
* of the file it has been extracted. It's purpose is to |
32 |
|
* check whenever the CPU (for error) store the same packet more than one time. |
33 |
|
* It's not clear if it will be mantained or not in the definitive release. |
34 |
|
*/ |
35 |
|
UINT32 FileOffset; |
36 |
|
|
37 |
PscuHeader(); |
PscuHeader(); |
38 |
virtual ~PscuHeader(); |
virtual ~PscuHeader(); |
39 |
const pamela::PacketType* GetPacketType(void) const throw (std::exception); |
const pamela::PacketType* GetPacketType(void) const throw(UnidentifiedPacketException); |
40 |
/** Get the Header. */ |
/** Get the Header. */ |
41 |
int GetHeader(void) const { return Header; } |
int GetHeader(void) const { return Header; } |
42 |
/** Get packet id 1. */ |
/** Get packet id 1. */ |
51 |
unsigned char GetCRC(void) const { return CRC; } |
unsigned char GetCRC(void) const { return CRC; } |
52 |
/** Get the packet length for this packet. */ |
/** Get the packet length for this packet. */ |
53 |
int GetPacketLenght(void) const { return PacketLenght; } |
int GetPacketLenght(void) const { return PacketLenght; } |
54 |
|
/** Get the offset of the packet relative to the begin of the raw file. */ |
55 |
|
int GetFileOffset(void) const { return FileOffset; } |
56 |
|
|
57 |
/** Set the orbital time. Intended to use by the raw reader. */ |
/** Set the orbital time. Intended to use by the raw reader. */ |
58 |
void SetHeader(int var) { Header = var; } |
void SetHeader(int var) { Header = var; } |
66 |
void SetPacketLenght(int var) { PacketLenght = var; } |
void SetPacketLenght(int var) { PacketLenght = var; } |
67 |
/** Set the packet length. Intended to use by the raw reader. */ |
/** Set the packet length. Intended to use by the raw reader. */ |
68 |
void SetCRC(short var) { CRC = var; } |
void SetCRC(short var) { CRC = var; } |
69 |
|
/** Get the offset of the packet relative to the begin of the raw file. */ |
70 |
|
int SetFileOffset(int var) { FileOffset = var; } |
71 |
|
|
72 |
|
const char* Print(){ |
73 |
|
oss.str(""); |
74 |
|
oss << "\n Packet Counter : " << hex << Counter |
75 |
|
<< "\n Id1 - Id2 : " << hex << (UINT16)PacketId1 << " - " << hex << (UINT16)PacketId2 |
76 |
|
<< "\n Orbital Time : " << hex << OrbitalTime |
77 |
|
<< "\n Lenght : " << hex << PacketLenght |
78 |
|
<< "\n CRC : " << hex << (UINT16)CRC |
79 |
|
<< "\n Header Start Position : " << hex << FileOffset; |
80 |
|
return oss.str().c_str(); |
81 |
|
} |
82 |
|
|
83 |
ClassDef(PscuHeader, 1) |
ClassDef(PscuHeader, 1) |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
}; |
}; |
88 |
} |
} |
89 |
|
|