/[PAMELA software]/yoda/techmodel/McmdReader.cpp
ViewVC logotype

Diff of /yoda/techmodel/McmdReader.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by kusanagi, Tue Sep 21 20:24:33 2004 UTC revision 6.2 by kusanagi, Tue May 30 19:10:03 2006 UTC
# Line 1  Line 1 
1  /** @file  /** @file
2   * $Source: /home/cvsmanager/yoda/techmodel/McmdReader.cpp,v $   * $Source: /home/cvsmanager/yoda/techmodel/McmdReader.cpp,v $
3   * $Id: McmdReader.cpp,v 1.4 2004/08/26 08:21:31 kusanagi Exp $   * $Id: McmdReader.cpp,v 6.1 2006/05/30 19:10:02 kusanagi Exp $
4   * $Author: kusanagi $   * $Author: kusanagi $
5   *   *
6   * Implementation of the McmdReader class.   * Implementation of the McmdReader class.
7   */   */
8    
 #define BYTE unsigned char  
 #include <string>  
 #include <log4cxx/logger.h>  
9  extern "C" {  extern "C" {
10  #include <sys/time.h>          #include "CRC.h"
 #include "CRC.h"  
11  }  }
   
 #include <fstream>  
 #include "stdio.h"  
12  #include "ReaderAlgorithms.h"  #include "ReaderAlgorithms.h"
   
 #include "event/mcmd/McmdRecord.h"  
   
 using namespace pamela;  
13  using namespace pamela::techmodel;  using namespace pamela::techmodel;
14    
15  static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.McmdReader"));  static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.McmdReader"));
# Line 39  McmdReader::McmdReader(void): Line 28  McmdReader::McmdReader(void):
28   */   */
29  std::string McmdReader::GetVersionInfo(void) const {  std::string McmdReader::GetVersionInfo(void) const {
30    return    return
31      "$Header: /home/cvsmanager/yoda/techmodel/McmdReader.cpp,v 1.4 2004/08/26 08:21:31 kusanagi Exp $\n";      "$Header: /home/cvsmanager/yoda/techmodel/McmdReader.cpp,v 6.1 2006/05/30 19:10:02 kusanagi Exp $\n";
32  }  }
33    
34  /**  /**
# Line 75  void McmdReader::Init(PamelaRun *run) { Line 64  void McmdReader::Init(PamelaRun *run) {
64   * @Event Number   * @Event Number
65   * @length is the size in bytes of the event (or packet)   * @length is the size in bytes of the event (or packet)
66   */   */
67  void McmdReader::RunEvent(int EventNumber, long int length) {  void McmdReader::RunEvent(int EventNumber, long int length) throw (WrongCRCException){
68        
69    int i = 0;    int i = 0;
70    char OBT[4];    char OBT[4];
# Line 166  void McmdReader::RunEvent(int EventNumbe Line 155  void McmdReader::RunEvent(int EventNumbe
155          rec->endID           = (BYTE)subTrailer[1];          rec->endID           = (BYTE)subTrailer[1];
156    
157          rec->McmdData        = new TArrayC(dataLength, subData);          rec->McmdData        = new TArrayC(dataLength, subData);
         //memcpy(rec->McmdData, (BYTE*)subData, sizeof(rec->McmdData));  
         //rec->setMcmdData((BYTE*)&subData);  
158          delete [] subData;          delete [] subData;
159      } else {      } else {
160              oss.flush();              oss.str("");
161              oss << "Wrong CRC on Subpacket internal to TMTC Packet starting at position"              oss << "Wrong CRC on Subpacket internal to TMTC Packet starting at position"
162                  << start;                  << start;
163              logger->warn(oss.str().c_str());              logger->warn(oss.str().c_str());
# Line 180  void McmdReader::RunEvent(int EventNumbe Line 167  void McmdReader::RunEvent(int EventNumbe
167      InputFile->read(eventCRC, sizeof(eventCRC));      InputFile->read(eventCRC, sizeof(eventCRC));
168      readCRC = (((UINT16)(eventCRC[0]<<8))&0xFF00) + (((UINT16)eventCRC[1])&0x00FF);      readCRC = (((UINT16)(eventCRC[0]<<8))&0xFF00) + (((UINT16)eventCRC[1])&0x00FF);
169            
170      if(!(partialCRC == readCRC)) {      if(partialCRC != readCRC) throw WrongCRCException(" Wrong Global CRC for MCMD Packet ");
171          logger->warn(_T("The test of calculated CRC with one wrote on file FAILED!!"));      /*if(!(partialCRC == readCRC)) {
172      }          throw WrongCRCException();
173        }*/
174  }  }
175    
176    

Legend:
Removed from v.1.5  
changed lines
  Added in v.6.2

  ViewVC Help
Powered by ViewVC 1.1.23