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

DC_PUSTelemetryModeManager.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // DC_PUSTelemetryModeManager.cpp 00005 // 00006 // Version 1.0 00007 // Date 24.01.04 00008 // Author A. Pasetti (P&P Software) 00009 00010 #include "../GeneralInclude/CompilerSwitches.h" 00011 #include "../GeneralInclude/ClassId.h" 00012 #include "../Telemetry/DC_PUSTelemetryModeManager.h" 00013 #include "../Telemetry/DC_PUSDataReportingPacket.h" 00014 #include "../Base/ModeManager.h" 00015 #include "../Event/DC_EventRepository.h" 00016 #include "../Base/CC_RootObject.h" 00017 00018 DC_PUSTelemetryModeManager::DC_PUSTelemetryModeManager(void) { 00019 setClassId(ID_PUSTELEMETRYMODEMANAGER); 00020 setNumberOfModes(1); 00021 setDefaultMode(0); 00022 00023 counter = 0; 00024 list = pNULL; 00025 listLength = 0; 00026 iterationCounter = 0; 00027 } 00028 00029 void DC_PUSTelemetryModeManager::allocateMemory(TD_Mode numberOfModes) { 00030 return; 00031 } 00032 00033 void DC_PUSTelemetryModeManager::update(void) { 00034 return; 00035 } 00036 00037 void DC_PUSTelemetryModeManager::setMaxNumberOfPackets(unsigned int n) { 00038 assert( listLength == 0 ); 00039 assert( n>0 ); 00040 00041 listLength = n; 00042 list = new DC_PUSDataReportingPacket*[listLength]; 00043 for (unsigned int i=0; i<listLength; i++) 00044 list[i] = pNULL; 00045 } 00046 00047 00048 void DC_PUSTelemetryModeManager::loadPacket(DC_PUSDataReportingPacket* pItem) { 00049 assert( list!=pNULL ); 00050 assert( pItem != pNULL ); 00051 00052 for (unsigned int i=0; i<listLength; i++) 00053 if ( list[i]==pNULL ) { 00054 list[i]=pItem; 00055 assert(counter<listLength); 00056 counter++; 00057 return; 00058 } 00059 00060 assert(counter==listLength); 00061 CC_RootObject::getEventRepository()->create(this,EVT_ILLEGAL_MM); 00062 return; 00063 } 00064 00065 bool DC_PUSTelemetryModeManager::isFull() const { 00066 return (counter==listLength); 00067 } 00068 00069 unsigned int DC_PUSTelemetryModeManager::getNumberOfPackets() const { 00070 return counter; 00071 } 00072 00073 unsigned int DC_PUSTelemetryModeManager::getMaxNumberOfPackets() const { 00074 return listLength; 00075 } 00076 00077 void DC_PUSTelemetryModeManager::unloadPacket(TD_SID sid) { 00078 assert( list!=pNULL ); 00079 00080 for (unsigned int i=0; i<listLength; i++) { 00081 if ( list[i]==pNULL ) 00082 continue; 00083 if ( list[i]->getSID()==sid ) { 00084 list[i]=pNULL; 00085 counter--; 00086 return; 00087 } 00088 } 00089 00090 CC_RootObject::getEventRepository()->create(this,EVT_SID_NOT_FOUND); 00091 return; 00092 } 00093 00094 bool DC_PUSTelemetryModeManager::isSIDLoaded(TD_SID sid) const { 00095 assert( list!=pNULL ); 00096 00097 for (unsigned int i=0; i<listLength; i++) { 00098 if ( list[i]==pNULL ) 00099 continue; 00100 if ( list[i]->getSID()==sid ) 00101 return true; 00102 } 00103 00104 return false; 00105 } 00106 00107 void DC_PUSTelemetryModeManager::first(void) { 00108 assert( isObjectConfigured() ); 00109 iterationCounter = 0; 00110 while ( (iterationCounter<listLength) && (list[iterationCounter]==pNULL) ) 00111 iterationCounter++; 00112 } 00113 00114 void DC_PUSTelemetryModeManager::next(void) { 00115 assert( isObjectConfigured() ); 00116 iterationCounter++; 00117 while ( (iterationCounter<listLength) && (list[iterationCounter]==pNULL) ) 00118 iterationCounter++; 00119 } 00120 00121 bool DC_PUSTelemetryModeManager::isIterationFinished(void) { 00122 assert( isObjectConfigured() ); 00123 assert( iterationCounter<=listLength ); 00124 return( iterationCounter == listLength ); 00125 } 00126 00127 TelemetryPacket* DC_PUSTelemetryModeManager::getIterationTelemetryPacket(void) { 00128 assert( isObjectConfigured() ); 00129 assert( iterationCounter<listLength ); 00130 return list[iterationCounter]; 00131 } 00132 00133 bool DC_PUSTelemetryModeManager::isObjectConfigured(void) { 00134 if (!TelemetryModeManager::isObjectConfigured() || list==pNULL ) 00135 return NOT_CONFIGURED; 00136 00137 return CONFIGURED; 00138 } 00139
Copyright 2003 P&P Software GmbH - All Rights Reserved