/[PAMELA software]/yoda/event/PscuHeader.h
ViewVC logotype

Annotation of /yoda/event/PscuHeader.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6.1 - (hide annotations) (download)
Fri Sep 29 10:19:13 2006 UTC (18 years, 2 months ago) by mocchiut
Branch: MAIN
CVS Tags: YODA6_3/13, YODA6_3/12, YODA6_3/11, YODA6_3/17, YODA6_3/16, YODA6_3/15, YODA6_3/14
Changes since 6.0: +5 -4 lines
File MIME type: text/plain
Last event bug fixed, compilation warnings/errors fixed

1 kusanagi 1.1 /** @file
2 mocchiut 6.1 * $Source: /afs/ba.infn.it/user/pamela/src/CVS/yoda/event/PscuHeader.h,v $
3     * $Id: PscuHeader.h,v 6.0 2006/02/07 17:11:07 kusanagi Exp $
4 kusanagi 6.0 * $Author: kusanagi $
5 kusanagi 1.1 *
6     * Header file for the PscuHeader class.
7     */
8     #ifndef PSCU_HEADER_H
9     #define PSCU_HEADER_H
10    
11 kusanagi 2.1 #include "Exception.h"
12 kusanagi 1.1 #include "SubPacket.h"
13    
14     namespace pamela {
15     /**
16     * Class containing the PSCU header and trailer information.
17     */
18     class PscuHeader: public pamela::SubPacket {
19 mocchiut 6.1
20 kusanagi 1.1 private:
21 kusanagi 2.1
22     public:
23 kusanagi 1.1 unsigned int Header; /**< Packet type header (must be 0xFAFEDE) */
24     UINT8 PacketId1; /**< Packet type first byte */
25     UINT8 PacketId2; /**< Packet type second byte */
26     UINT32 Counter; /**< PSCU event counter */
27     UINT32 OrbitalTime; /**< Raw Orbital time */
28     UINT32 PacketLenght;
29 kusanagi 2.1 UINT8 CRC; /**< PSCU Header Checksum */ //!
30 kusanagi 1.2
31     /* This parameter represent the offset of the header relative to the begin
32     * of the file it has been extracted. It's purpose is to
33     * check whenever the CPU (for error) store the same packet more than one time.
34     * It's not clear if it will be mantained or not in the definitive release.
35     */
36     UINT32 FileOffset;
37 kusanagi 2.1
38 kusanagi 1.1 PscuHeader();
39 mocchiut 6.1 virtual ~PscuHeader(){};
40 kusanagi 2.1 const pamela::PacketType* GetPacketType(void) const throw(UnidentifiedPacketException);
41 kusanagi 1.1 /** Get the Header. */
42     int GetHeader(void) const { return Header; }
43     /** Get packet id 1. */
44     unsigned char GetPacketId1(void) const { return PacketId1; }
45     /** Get packet id 2. */
46     unsigned char GetPacketId2(void) const { return PacketId2; }
47     /** Get the PSCU event counter. */
48     int GetCounter(void) const { return Counter; }
49     /** Get the orbital time. */
50     int GetOrbitalTime(void) const { return OrbitalTime; }
51     /** Get the header CRC. */
52     unsigned char GetCRC(void) const { return CRC; }
53     /** Get the packet length for this packet. */
54     int GetPacketLenght(void) const { return PacketLenght; }
55 kusanagi 1.2 /** Get the offset of the packet relative to the begin of the raw file. */
56     int GetFileOffset(void) const { return FileOffset; }
57 kusanagi 1.1
58     /** Set the orbital time. Intended to use by the raw reader. */
59     void SetHeader(int var) { Header = var; }
60     /** Set the packet id. Intended to use by the raw reader. */
61     void SetPacketId(short var1, short var2) { PacketId1 = var1; PacketId2 = var2; }
62     /** Set the counter. Intended to use by the raw reader. */
63     void SetCounter(int var) { Counter = var; }
64     /** Set the orbital time. Intended to use by the raw reader. */
65     void SetOrbitalTime(int var) { OrbitalTime = var; }
66     /** Set the packet length. Intended to use by the raw reader. */
67     void SetPacketLenght(int var) { PacketLenght = var; }
68     /** Set the packet length. Intended to use by the raw reader. */
69     void SetCRC(short var) { CRC = var; }
70 kusanagi 1.2 /** Get the offset of the packet relative to the begin of the raw file. */
71 mocchiut 6.1 int SetFileOffset(int var) { FileOffset = var; return(0); }
72 kusanagi 2.1
73     const char* Print(){
74     oss.str("");
75     oss << "\n Packet Counter : " << hex << Counter
76     << "\n Id1 - Id2 : " << hex << (UINT16)PacketId1 << " - " << hex << (UINT16)PacketId2
77     << "\n Orbital Time : " << hex << OrbitalTime
78     << "\n Lenght : " << hex << PacketLenght
79     << "\n CRC : " << hex << (UINT16)CRC
80     << "\n Header Start Position : " << hex << FileOffset;
81     return oss.str().c_str();
82     }
83    
84 kusanagi 2.2 static const char* Print(char* buff){
85     static stringstream out;
86     out.str("");
87     out << "\n Packet Counter : " << hex << (((UINT32)buff[5]<<16)&0x00FF0000) + (((UINT32)buff[6]<<8)&0x0000FF00) + (((UINT32)buff[7])&0x000000FF)
88     << "\n Id1 - Id2 : " << hex << (UINT16)buff[3] << " - " << hex << (UINT16)buff[4]
89     << "\n Orbital Time : " << hex << (((UINT32)buff[8]<<24)&0xFF000000) + (((UINT32)buff[9]<<16)&0x00FF0000) + (((UINT32)buff[10]<<8)&0x0000FF00) + (((UINT32)buff[11])&0x000000FF)
90     << "\n Lenght : " << hex << (((UINT32)buff[12]<<16)&0x00FF0000) + (((UINT32)buff[13]<<8)&0x0000FF00) + (((UINT32)buff[14])&0x000000FF)
91     << "\n CRC : " << hex << (UINT16)buff[15];
92     return out.str().c_str();
93     }
94    
95 kusanagi 1.1 ClassDef(PscuHeader, 1)
96     };
97     }
98    
99     #endif /* PSCU_HEADER_H */

  ViewVC Help
Powered by ViewVC 1.1.23