| 1 |
/** @file |
/** @file |
| 2 |
* $Source: /home/cvsmanager/yoda/techmodel/TmtcReader.cpp,v $ |
* $Source: /home/cvsmanager/yoda/techmodel/TmtcReader.cpp,v $ |
| 3 |
* $Id: TmtcReader.cpp,v 1.2 2004/07/17 20:03:38 kusanagi Exp $ |
* $Id: TmtcReader.cpp,v 1.3 2004/08/24 16:01:57 kusanagi Exp $ |
| 4 |
* $Author: kusanagi $ |
* $Author: kusanagi $ |
| 5 |
* |
* |
| 6 |
* Implementation of the TmtcReader class. |
* Implementation of the TmtcReader class. |
| 12 |
|
|
| 13 |
|
|
| 14 |
#include <string> |
#include <string> |
| 15 |
#include <log4cpp/Category.hh> |
#include <log4cxx/logger.h> |
| 16 |
extern "C" { |
extern "C" { |
| 17 |
#include <sys/time.h> |
#include <sys/time.h> |
| 18 |
#include "CRC.h" |
#include "CRC.h" |
| 27 |
using namespace pamela; |
using namespace pamela; |
| 28 |
using namespace pamela::techmodel; |
using namespace pamela::techmodel; |
| 29 |
|
|
| 30 |
static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.TmtcReader"); |
static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.TmtcReader")); |
| 31 |
|
|
| 32 |
/** |
/** |
| 33 |
* Constructor. |
* Constructor. |
| 34 |
*/ |
*/ |
| 35 |
TmtcReader::TmtcReader(void): |
TmtcReader::TmtcReader(void): |
| 36 |
TechmodelAlgorithm(PacketType::Tmtc, "TechmodelTmtcReader") { |
TechmodelAlgorithm(PacketType::Tmtc, "TechmodelTmtcReader") { |
| 37 |
cat << log4cpp::Priority::DEBUG |
logger->debug(_T("Constructor")); |
|
<< "Constructor " |
|
|
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
|
| 38 |
Tmtc = new TmtcEvent(); |
Tmtc = new TmtcEvent(); |
| 39 |
} |
} |
| 40 |
|
|
| 43 |
*/ |
*/ |
| 44 |
std::string TmtcReader::GetVersionInfo(void) const { |
std::string TmtcReader::GetVersionInfo(void) const { |
| 45 |
return |
return |
| 46 |
"$Header: /home/cvsmanager/yoda/techmodel/TmtcReader.cpp,v 1.2 2004/07/17 20:03:38 kusanagi Exp $\n"; |
"$Header: /home/cvsmanager/yoda/techmodel/TmtcReader.cpp,v 1.3 2004/08/24 16:01:57 kusanagi Exp $\n"; |
| 47 |
} |
} |
| 48 |
|
|
| 49 |
/** |
/** |
| 119 |
rec->TM_BIL_DIAG_ACQ = subData[53]; |
rec->TM_BIL_DIAG_ACQ = subData[53]; |
| 120 |
rec->TM_CC_DIAG_ACQ = (((UINT32)subData[54]<<24)&0xFF000000) + (((UINT32)subData[55]<<16)&0x00FF0000) + (((UINT32)subData[56]<<8)&0x0000FF00) + ((UINT32)subData[57])&0x000000FF; |
rec->TM_CC_DIAG_ACQ = (((UINT32)subData[54]<<24)&0xFF000000) + (((UINT32)subData[55]<<16)&0x00FF0000) + (((UINT32)subData[56]<<8)&0x0000FF00) + ((UINT32)subData[57])&0x000000FF; |
| 121 |
} else { |
} else { |
| 122 |
cat << log4cpp::Priority::ERROR |
stringstream oss; |
| 123 |
<< "Wrong CRC on Subpacket int TMTC Packet starting at position " << start |
oss.flush(); |
| 124 |
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
oss << "Wrong CRC on Subpacket int TMTC Packet starting at position" |
| 125 |
|
<< start; |
| 126 |
|
logger->warn(oss.str().c_str()); |
| 127 |
} |
} |
| 128 |
} |
} |
| 129 |
InputFile->read(eventCRC, sizeof(eventCRC)); |
InputFile->read(eventCRC, sizeof(eventCRC)); |
| 130 |
readCRC = (((UINT16)(eventCRC[0]<<8))&0xFF00) + (((UINT16)eventCRC[1])&0x00FF); |
readCRC = (((UINT16)(eventCRC[0]<<8))&0xFF00) + (((UINT16)eventCRC[1])&0x00FF); |
| 131 |
if(!(partialCRC == readCRC)) { |
if(!(partialCRC == readCRC)) { |
| 132 |
cat << log4cpp::Priority::ERROR |
logger->warn(_T("The test of calculated CRC with one wrote on file FAILED!!")); |
|
<< "The test of calculated CRC with one wrote on file FAILED!!" |
|
|
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
|
| 133 |
} |
} |
| 134 |
} |
} |
| 135 |
|
|