Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

DC_PUSTcVerificationPacket.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // DC_DummyPUSTelemetryPacket.cpp 00005 // 00006 // Version 1.0 00007 // Date 04.04.03 00008 // Author A. Pasetti (P&P Software) 00009 00010 #include "../GeneralInclude/CompilerSwitches.h" 00011 #include "../GeneralInclude/TestConstants.h" 00012 #include "../GeneralInclude/ClassId.h" 00013 #include "../GeneralInclude/Constants.h" 00014 #include "../Base/CC_RootObject.h" 00015 #include "../Telecommand/PUSTelecommand.h" 00016 #include "../Telemetry/PUSTelemetryPacket.h" 00017 #include "../Telemetry/DC_PUSTcVerificationPacket.h" 00018 00019 #include <string.h> 00020 00021 DC_PUSTcVerificationPacket::DC_PUSTcVerificationPacket(void) { 00022 setClassId(ID_PUSTCVERIFICATIONPACKET); 00023 packetLengthSuccess = sizeof(TD_PUSPacketId)+sizeof(TD_TelecommandId); 00024 packetLengthFailure = sizeof(TD_PUSPacketId)+sizeof(TD_TelecommandId)+sizeof(TD_CheckCode); 00025 tmByte = new unsigned char[packetLengthFailure]; 00026 setType(PUS_TYPE_TC_VER); 00027 00028 // The PUS packet identifier, the telecommand identifier and the error 00029 // code are stored in the tmByte array 00030 00031 // set the PUS packet identifier 00032 TD_PUSPacketId pidTemp = PUSTelecommand::getPacketId(); 00033 memcpy(tmByte,&pidTemp,sizeof(TD_PUSPacketId)); 00034 00035 // initialize the telecommand identifier 00036 TD_TelecommandId tcidTemp = 0; 00037 memcpy(tmByte+sizeof(TD_PUSPacketId),&tcidTemp,sizeof(TD_TelecommandId)); 00038 00039 // initialize the error code 00040 TD_CheckCode ccTemp = 0; 00041 memcpy(tmByte+sizeof(TD_PUSPacketId)+sizeof(TD_TelecommandId),&ccTemp,sizeof(TD_CheckCode)); 00042 } 00043 00044 unsigned int DC_PUSTcVerificationPacket::getNumberOfBytes(void) { 00045 assert( getSubType()!=0 ); 00046 00047 TD_TelecommandSubType tcSubType = getSubType(); 00048 if ( ( tcSubType == PUS_ST_TC_VER_ACC_SC) || 00049 ( tcSubType == PUS_ST_TC_EXE_STR_SC) || 00050 ( tcSubType == PUS_ST_TC_EXE_PRO_SC) || 00051 ( tcSubType == PUS_ST_TC_EXE_END_SC) ) 00052 return packetLengthSuccess; 00053 else 00054 return packetLengthFailure; 00055 } 00056 00057 TD_CheckCode DC_PUSTcVerificationPacket::getErrorCode() { 00058 TD_CheckCode temp; 00059 memcpy(&temp,tmByte+sizeof(TD_PUSPacketId)+sizeof(TD_TelecommandId),sizeof(TD_CheckCode)); 00060 return temp; 00061 } 00062 00063 void DC_PUSTcVerificationPacket::setErrorCode(TD_CheckCode errCode) { 00064 assert( errCode>0 ); 00065 memcpy(tmByte+sizeof(TD_PUSPacketId)+sizeof(TD_TelecommandId),&errCode,sizeof(TD_CheckCode)); 00066 } 00067 00068 TD_TelecommandId DC_PUSTcVerificationPacket::getTelecommandId() { 00069 TD_TelecommandId temp; 00070 memcpy(&temp,tmByte+sizeof(TD_PUSPacketId),sizeof(TD_TelecommandId)); 00071 return temp; 00072 } 00073 00074 void DC_PUSTcVerificationPacket::setTelecommandId(TD_TelecommandId tcId) { 00075 assert( tcId>0 ); 00076 memcpy(tmByte+sizeof(TD_PUSPacketId),&tcId,sizeof(TD_TelecommandId)); 00077 } 00078 00079 void DC_PUSTcVerificationPacket::update(void) { 00080 return; 00081 } 00082 00083 unsigned char DC_PUSTcVerificationPacket::getUnsignedByte(unsigned int n) { 00084 return tmByte[n]; 00085 }
Copyright 2003 P&P Software GmbH - All Rights Reserved