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

DC_TestPUSTelecommand.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // DC_TestPUSTelecommand.cpp 00005 // 00006 // Version 1.0 00007 // Date 4.01.04 00008 // Author A. Pasetti (P&P Software) 00009 00010 #include "../GeneralInclude/CompilerSwitches.h" 00011 #include "../GeneralInclude/DebugSupport.h" 00012 #include "../GeneralInclude/ClassId.h" 00013 #include "../GeneralInclude/Constants.h" 00014 #include "../GeneralInclude/BasicTypes.h" 00015 #include "PUSTelecommand.h" 00016 #include "DC_TestPUSTelecommand.h" 00017 00018 DC_TestPUSTelecommand::DC_TestPUSTelecommand(void) { 00019 setClassId(ID_TESTPUSTELECOMMAND); 00020 setType(PUS_TYPE_TEST); 00021 setSubType(PUS_ST_TC_TEST); 00022 executionSuccess = 0; 00023 executionCounter = 0; 00024 executionCheckValue = TC_CAN_EXECUTE; 00025 validityCheckValue = VALID; 00026 executionCheckCode = 0; 00027 validityCheckCode = 0; 00028 lasti = 0; 00029 } 00030 00031 unsigned int DC_TestPUSTelecommand::getExecutionCounter(void) { 00032 return executionCounter; 00033 } 00034 00035 TD_ActionOutcome DC_TestPUSTelecommand::doAction(void) { 00036 if (executionCounter<255) 00037 executionCounter++; 00038 else 00039 executionCounter=0; 00040 if (executionSuccess) 00041 return ACTION_SUCCESS; 00042 else 00043 return ACTION_FAILURE; 00044 } 00045 00046 bool DC_TestPUSTelecommand::canExecute(void) { 00047 return executionCheckValue; 00048 } 00049 00050 bool DC_TestPUSTelecommand::isValid(void) { 00051 return validityCheckValue; 00052 } 00053 00054 void DC_TestPUSTelecommand::setExecutionCheckValue(bool executionCheckValue) { 00055 this->executionCheckValue = executionCheckValue; 00056 } 00057 00058 void DC_TestPUSTelecommand::setValidityCheckValue(bool validityCheckValue) { 00059 this->validityCheckValue = validityCheckValue; 00060 } 00061 00062 TD_CheckCode DC_TestPUSTelecommand::getValidityCheckCode(void) const { 00063 return validityCheckCode; 00064 } 00065 00066 TD_CheckCode DC_TestPUSTelecommand::getExecutionCheckCode(void) const { 00067 return executionCheckCode; 00068 } 00069 00070 void DC_TestPUSTelecommand::setValidityCheckCode(TD_CheckCode validityCheckCode) { 00071 this->validityCheckCode = validityCheckCode; 00072 } 00073 00074 void DC_TestPUSTelecommand::setExecutionCheckCode(TD_CheckCode executionCheckCode) { 00075 this->executionCheckCode = executionCheckCode; 00076 } 00077 00078 void DC_TestPUSTelecommand::setActionOutcome(bool executionSuccess) { 00079 this->executionSuccess = executionSuccess; 00080 } 00081 00082 bool DC_TestPUSTelecommand::getActionOutcome() { 00083 return executionSuccess; 00084 } 00085 00086 void DC_TestPUSTelecommand::setRawData(unsigned int i, unsigned char d) { 00087 assert( i<6 ); 00088 assert( (i==0) || (i==(lasti+1)) ); // check that i argument increments by 1 in each call 00089 00090 lasti = i; 00091 switch (i) { 00092 case 0: 00093 executionCounter = d; 00094 return; 00095 case 1: 00096 if (d>0) 00097 executionCheckValue = true; 00098 else 00099 executionCheckValue = false; 00100 return; 00101 case 2: 00102 if (d>0) 00103 validityCheckValue = true; 00104 else 00105 validityCheckValue = false; 00106 return; 00107 case 3: 00108 executionCheckCode = d; 00109 return; 00110 case 4: 00111 validityCheckCode = d; 00112 return; 00113 case 5: 00114 if (d>0) 00115 executionSuccess = true; 00116 else 00117 executionSuccess = false; 00118 return; 00119 00120 } 00121 } 00122 00123 unsigned int DC_TestPUSTelecommand::getNumberOfRawData(void) const { 00124 return 6; 00125 } 00126
Copyright 2003 P&P Software GmbH - All Rights Reserved