Created
February 25, 2012 12:12
-
-
Save ymirpl/1908137 to your computer and use it in GitHub Desktop.
pppGAL.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// This program is free software: you can redistribute it and/or modify | |
// it under the terms of the GNU Lesser General Public License as published by | |
// the Free Software Foundation, either version 3 of the License, or | |
// (at your option) any later version. | |
// | |
// This program is distributed in the hope that it will be useful, | |
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
// GNU Lesser General Public License for more details. | |
// | |
// You should have received a copy of the GNU Lesser General Public License | |
// along with this program. If not, see http://www.gnu.org/licenses/. | |
// | |
#include "PppGAL.h" | |
#include "XMLUtils.h" | |
/** DEPRECATED **/ | |
Define_Module(PppGAL); | |
void PppGAL::initialize(int stage) | |
{ | |
if(stage == 1) { // wait for ppp to initlize in stage 0 | |
readStatesFromXML(par("states").xmlValue()); | |
// WATCH_VECTOR(states); // TODO what is this for? Nevertheless solution: http://groups.google.com/group/omnetpp/browse_thread/thread/d4f55519728701ab/a39d5532aafa96a5 | |
EV << "HI MY NAME IS " << simulation.getContextModule()->getFullName() << std::endl; | |
EV << "HI MY PATH IS " << simulation.getContextModule()->getFullPath() << std::endl; | |
} | |
} | |
void PppGAL::handleMessage(cMessage *msg) | |
{ | |
EV << "GAL does not handle messages, it's accessed via direct API calls for now. " << std::endl; | |
ASSERT(false); | |
} | |
// Returns datarate form states table for given EAS | |
long PppGAL::getDatarateInEAS(int eas) { | |
return 25000; | |
// TODO Here we can implement LCS -- if it gets high thruput from thruputMeter it can return different datarate than this shown in EAS table | |
// TODO zrobic | |
} | |
void PppGAL::readStatesFromXML(const cXMLElement *states) | |
{ | |
ASSERT(states); | |
ASSERT(!strcmp(states->getTagName(), "states")); | |
checkTags(states, "eas"); | |
cXMLElementList list = states->getChildrenByTagName("eas"); | |
for (cXMLElementList::iterator it=list.begin(); it != list.end(); it++) | |
readEASFromXML(*it); | |
} | |
void PppGAL::readEASFromXML(const cXMLElement *eas) | |
{ | |
ASSERT(eas); | |
ASSERT(!strcmp(eas->getTagName(), "eas")); | |
int easid = getParameterIntValue(eas, "id"); | |
double power = getParameterDoubleValue(eas, "power"); | |
long int datarate = getParameterIntValue(eas, "datarate"); | |
EASEntry newEAS; | |
newEAS.id = easid; | |
newEAS.power = power; | |
newEAS.datarate = datarate; | |
states.push_back(newEAS); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment