1 |
/** @file |
/** @file |
2 |
* $Source: /repository/PamOffLineSW/techmodel/TmtcReader.cpp,v $ |
* $Source: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/PamOffLineSW/techmodel/TmtcReader.cpp,v $ |
3 |
* $Id: TmtcReader.cpp,v 1.7 2008-03-06 18:33:36 messineo Exp $ |
* $Id: TmtcReader.cpp,v 1.1.1.1 2008/09/23 07:20:28 mocchiut Exp $ |
4 |
* $Author: messineo $ |
* $Author: mocchiut $ |
5 |
* |
* |
6 |
* Implementation of the TmtcReader class. |
* Implementation of the TmtcReader class. |
7 |
* ToBeDone: |
* ToBeDone: |
28 |
*/ |
*/ |
29 |
std::string TmtcReader::GetVersionInfo(void) const { |
std::string TmtcReader::GetVersionInfo(void) const { |
30 |
return |
return |
31 |
"$Header: /repository/PamOffLineSW/techmodel/TmtcReader.cpp,v 1.7 2008-03-06 18:33:36 messineo Exp $\n"; |
"$Header: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/PamOffLineSW/techmodel/TmtcReader.cpp,v 1.1.1.1 2008/09/23 07:20:28 mocchiut Exp $\n"; |
32 |
} |
} |
33 |
|
|
34 |
/** |
/** |
70 |
{ |
{ |
71 |
start=(TMTC_SUB_LENGTH+TMTC_SUBCRC_LENGTH)*i; |
start=(TMTC_SUB_LENGTH+TMTC_SUBCRC_LENGTH)*i; |
72 |
for(int m=0; m<TMTC_SUB_LENGTH; m++){ |
for(int m=0; m<TMTC_SUB_LENGTH; m++){ |
73 |
subData[m]=mysubData[m + (TMTC_SUB_LENGTH+TMTC_SUBCRC_LENGTH)*i ]; |
subData[m]=mysubData[m + start]; |
74 |
} |
} |
75 |
|
|
76 |
CRCbuff[0]=mysubData[TMTC_SUB_LENGTH*i]; |
CRCbuff[0]=mysubData[start + TMTC_SUB_LENGTH]; |
77 |
|
|
78 |
partialCRC = CM_Compute_CRC16(partialCRC, (UINT8*)&subData, TMTC_SUB_LENGTH); |
partialCRC = CM_Compute_CRC16(partialCRC, (UINT8*)&subData, TMTC_SUB_LENGTH); |
79 |
partialCRC = CM_Compute_CRC16(partialCRC, (UINT8*)&CRCbuff, TMTC_SUBCRC_LENGTH); |
partialCRC = CM_Compute_CRC16(partialCRC, (UINT8*)&CRCbuff, TMTC_SUBCRC_LENGTH); |
80 |
|
if((UINT8)(CM_Compute_CRC16(0, (UINT8*)&subData, TMTC_SUB_LENGTH)) == (UINT8)CRCbuff[0]) |
81 |
|
{ |
82 |
|
|
83 |
//This == CRCBuff is not really parametric take care if have to change the static lengths |
//This == CRCBuff is not really parametric take care if have to change the static lengths |
|
if((UINT8)(CM_Compute_CRC16(0, (UINT8*)&subData, TMTC_SUB_LENGTH)) == (UINT8)CRCbuff[0]) |
|
|
{ |
|
84 |
rec = new(recs[k++]) TmtcRecord(); //add a new TmtcRecord |
rec = new(recs[k++]) TmtcRecord(); //add a new TmtcRecord |
85 |
rec->TM_RECORD_OBT = (((UINT32)subData[0]<<24)&0xFF000000) + (((UINT32)subData[1]<<16)&0x00FF0000) + (((UINT32)subData[2]<<8)&0x0000FF00) + (((UINT32)subData[3])&0x000000FF); |
rec->TM_RECORD_OBT = (((UINT32)subData[0]<<24)&0xFF000000) + (((UINT32)subData[1]<<16)&0x00FF0000) + (((UINT32)subData[2]<<8)&0x0000FF00) + (((UINT32)subData[3])&0x000000FF); |
86 |
rec->TM_DIAG_AND_BILEVEL_ACQ = (((UINT16)subData[4]<<8)&0x0000FF00) + (((UINT16)subData[5])&0x000000FF); |
rec->TM_DIAG_AND_BILEVEL_ACQ = (((UINT16)subData[4]<<8)&0x0000FF00) + (((UINT16)subData[5])&0x000000FF); |
103 |
} |
} |
104 |
// readCRC = (((UINT16)(eventCRC[0]<<8))&0xFF00) + (((UINT16)eventCRC[1])&0x00FF); |
// readCRC = (((UINT16)(eventCRC[0]<<8))&0xFF00) + (((UINT16)eventCRC[1])&0x00FF); |
105 |
readCRC = (((UINT16)(mysubData[length - 2]<<8))&0xFF00) + (((UINT16)mysubData[length - 1])&0x00FF); |
readCRC = (((UINT16)(mysubData[length - 2]<<8))&0xFF00) + (((UINT16)mysubData[length - 1])&0x00FF); |
106 |
|
// readCRC = (((UINT16)(mysubData[length - 1]<<8))&0xFF00) + (((UINT16)mysubData[length])&0x00FF); |
107 |
|
|
108 |
|
|
109 |
// if(partialCRC != readCRC) throw WrongCRCException(" Wrong Global CRC for TMTC Packet "); |
// if(partialCRC != readCRC) throw WrongCRCException(" Wrong Global CRC for TMTC Packet "); |