| 1 | /** @file | 
| 2 | * $Source: /home/cvsmanager/yoda/event/PscuHeader.h,v $ | 
| 3 | * $Id: PscuHeader.h,v 1.2 2004/08/25 10:14:22 kusanagi Exp $ | 
| 4 | * $Author: kusanagi $ | 
| 5 | * | 
| 6 | * Header file for the PscuHeader class. | 
| 7 | */ | 
| 8 | #ifndef PSCU_HEADER_H | 
| 9 | #define PSCU_HEADER_H | 
| 10 | #define UINT32 unsigned int | 
| 11 | #define UINT16 unsigned short | 
| 12 | #define UINT8  unsigned char | 
| 13 | #include <exception> | 
| 14 |  | 
| 15 | #include "PacketType.h" | 
| 16 | #include "SubPacket.h" | 
| 17 |  | 
| 18 | namespace pamela { | 
| 19 | /** | 
| 20 | * Class containing the PSCU header and trailer information. | 
| 21 | */ | 
| 22 | class PscuHeader: public pamela::SubPacket { | 
| 23 | private: | 
| 24 | unsigned int Header;  /**< Packet type header (must be 0xFAFEDE) */ | 
| 25 | UINT8  PacketId1; /**< Packet type first  byte */ | 
| 26 | UINT8  PacketId2; /**< Packet type second byte */ | 
| 27 | UINT32 Counter; /**< PSCU event counter */ | 
| 28 | UINT32 OrbitalTime; /**< Raw Orbital time */ | 
| 29 | UINT32 PacketLenght; | 
| 30 | UINT8  CRC; /**< PSCU Header Checksum  */ | 
| 31 |  | 
| 32 | /* This parameter represent the offset of the header relative to the begin | 
| 33 | * of the file it has been extracted. It's purpose is to | 
| 34 | * check whenever the CPU (for error) store the same packet more than one time. | 
| 35 | * It's not clear if it will be mantained or not in the definitive release. | 
| 36 | */ | 
| 37 | UINT32 FileOffset; | 
| 38 | public: | 
| 39 | PscuHeader(); | 
| 40 | virtual ~PscuHeader(); | 
| 41 | const pamela::PacketType* GetPacketType(void) const throw (std::exception); | 
| 42 | /** Get the Header. */ | 
| 43 | int GetHeader(void) const { return Header; } | 
| 44 | /** Get packet id 1. */ | 
| 45 | unsigned char GetPacketId1(void) const { return PacketId1; } | 
| 46 | /** Get packet id 2. */ | 
| 47 | unsigned char GetPacketId2(void) const { return PacketId2; } | 
| 48 | /** Get the PSCU event counter. */ | 
| 49 | int GetCounter(void) const { return Counter; } | 
| 50 | /** Get the orbital time. */ | 
| 51 | int GetOrbitalTime(void) const { return OrbitalTime; } | 
| 52 | /** Get the header CRC. */ | 
| 53 | unsigned char GetCRC(void) const { return CRC; } | 
| 54 | /** Get the packet length for this packet. */ | 
| 55 | int GetPacketLenght(void) const { return PacketLenght; } | 
| 56 | /** Get the offset of the packet relative to the begin of the raw file. */ | 
| 57 | int GetFileOffset(void) const { return FileOffset; } | 
| 58 |  | 
| 59 | /** Set the orbital time. Intended to use by the raw reader. */ | 
| 60 | void SetHeader(int var) { Header  = var; } | 
| 61 | /** Set the packet id. Intended to use by the raw reader. */ | 
| 62 | void SetPacketId(short var1, short var2) { PacketId1 = var1; PacketId2 = var2; } | 
| 63 | /** Set the counter. Intended to use by the raw reader. */ | 
| 64 | void SetCounter(int var) { Counter = var; } | 
| 65 | /** Set the orbital time. Intended to use by the raw reader. */ | 
| 66 | void SetOrbitalTime(int var) { OrbitalTime = var; } | 
| 67 | /** Set the packet length. Intended to use by the raw reader. */ | 
| 68 | void SetPacketLenght(int var) { PacketLenght = var; } | 
| 69 | /** Set the packet length. Intended to use by the raw reader. */ | 
| 70 | void SetCRC(short var) { CRC = var; } | 
| 71 | /** Get the offset of the packet relative to the begin of the raw file. */ | 
| 72 | int SetFileOffset(int var) { FileOffset = var; } | 
| 73 | ClassDef(PscuHeader, 1) | 
| 74 |  | 
| 75 | }; | 
| 76 | } | 
| 77 |  | 
| 78 | #endif /* PSCU_HEADER_H */ |