#include <RadioBase.h>
Inheritance diagram for RadioBase:
This module keeps track of the noise level of the channel.
When receiving a packet this module updates the noise level of the channel. Based on the receive power of the packet it is processed and handed to upper layers or just treated as noise.
After the packet is completely received the snir information is attached and it is handed to the decider module.
The snir information is a SnrList that lists all different snr levels together with the point of time (simTime()) when they started.
On top of that this module manages the RadioState, and posts notifications on NotificationBoard whenever it changes. The radio state gives information about whether this module is sending a packet, receiving a packet or idle. This information can be accessed via the NotificationBoard by other modules, e.g. a CSMAMacLayer.
Public Member Functions | |
RadioBase () | |
void | changeChannel (int channel) |
change transmitter and receiver to a new channel. This method throws an error if the radio state is transmit. Messages that are already sent to the new channel and would reach us in the future - thus they are on the air - will be received correctly. | |
void | setBitrate (double bitrate) |
change the bitrate to the given value. This method throws an error if the radio state is transmit. | |
Protected Types | |
typedef std::map< AirFrame *, double > | RecvBuff |
Typedef used to store received messages together with receive power. | |
Protected Member Functions | |
virtual void | initialize (int) |
Initialize variables and publish the radio status. | |
virtual void | finish () |
virtual | ~RadioBase () |
void | handleMessage (cMessage *msg) |
virtual void | handleUpperMsg (AirFrame *) |
virtual void | handleSelfMsg (cMessage *) |
virtual void | handleCommand (int msgkind, cPolymorphic *ctrl) |
virtual void | handleLowerMsgStart (AirFrame *airframe) |
Buffer the frame and update noise levels and snr information. | |
virtual void | handleLowerMsgEnd (AirFrame *airframe) |
Unbuffer the frame and update noise levels and snr information. | |
void | bufferMsg (AirFrame *airframe) |
Buffers message for 'transmission time'. | |
AirFrame * | unbufferMsg (cMessage *msg) |
Unbuffers a message after 'transmission time'. | |
void | sendUp (AirFrame *airframe) |
Sends a message to the upper layer. | |
void | sendDown (AirFrame *airframe) |
Sends a message to the channel. | |
virtual AirFrame * | encapsMsg (cMessage *msg) |
Encapsulates a MAC frame into an Air Frame. | |
virtual int | channelNumber () const |
void | addNewSnr () |
updates the snr information of the relevant AirFrames | |
virtual AirFrame * | createCapsulePkt () |
Create a new AirFrame. | |
virtual IRadioModel * | createRadioModel ()=0 |
virtual IReceptionModel * | createReceptionModel ()=0 |
Protected Attributes | |
IRadioModel * | radioModel |
IReceptionModel * | receptionModel |
double | transmitterPower |
power used to transmit messages | |
SnrStruct | snrInfo |
State: SnrInfo stores the snrList and the the recvdPower for the message currently being received, together with a pointer to the message. | |
RecvBuff | recvBuff |
State: A buffer to store a pointer to a message and the related receive power. | |
RadioState | rs |
State: the current RadioState of the NIC; includes channel number. | |
int | newChannel |
State: if not -1, we have to switch to that channel once we finished transmitting. | |
double | newBitrate |
State: if not -1, we have to switch to that bitrate once we finished transmitting. | |
double | noiseLevel |
State: the current noise level of the channel. | |
double | carrierFrequency |
Configuration: The carrier frequency used. It is read from the ChannelControl module. | |
double | thermalNoise |
Configuration: Thermal noise on the channel. Can be specified in omnetpp.ini. Default: -100 dBm. | |
double | sensitivity |
Configuration: Defines up to what Power level (in dBm) a message can be understood. If the level of a received packet is lower, it is only treated as noise. Can be specified in omnetpp.ini. Default: -85 dBm. | |
int | uppergateOut |
gate id | |
int | uppergateIn |
Classes | |
struct | SnrStruct |
Struct to store a pointer to the message, rcvdPower AND a SnrList, needed in RadioBase::addNewSnr. More... |
|
Typedef used to store received messages together with receive power.
|
|
00034 : rs(this->id()) 00035 { 00036 radioModel = NULL; 00037 receptionModel = NULL; 00038 }
|
|
00109 { 00110 delete radioModel; 00111 delete receptionModel; 00112 00113 // delete messages being received 00114 for (RecvBuff::iterator it = recvBuff.begin(); it!=recvBuff.end(); ++it) 00115 delete it->first; 00116 }
|
|
updates the snr information of the relevant AirFrames The Snr information of the buffered message is updated. 00556 { 00557 SnrListEntry listEntry; // create a new entry 00558 listEntry.time = simTime(); 00559 listEntry.snr = snrInfo.rcvdPower / noiseLevel; 00560 snrInfo.sList.push_back(listEntry); 00561 }
|
|
Buffers message for 'transmission time'. The packet is put in a buffer for the time the transmission would last in reality. A timer indicates when the transmission is complete. So, look at unbufferMsg to see what happens when the transmission is complete.. 00185 : add explicit simtime_t atTime arg? 00186 { 00187 // set timer to indicate transmission is complete 00188 cMessage *endRxTimer = new cMessage("endRx", MK_RECEPTION_COMPLETE); 00189 endRxTimer->setContextPointer(airframe); 00190 airframe->setContextPointer(endRxTimer); 00191 00192 // NOTE: use arrivalTime instead of simTime, because we might be calling this 00193 // function during a channel change, when we're picking up ongoing transmissions 00194 // on the channel -- and then the message's arrival time is in the past! 00195 scheduleAt(airframe->arrivalTime() + airframe->getDuration(), endRxTimer); 00196 }
|
|
change transmitter and receiver to a new channel. This method throws an error if the radio state is transmit. Messages that are already sent to the new channel and would reach us in the future - thus they are on the air - will be received correctly.
00564 { 00565 if (channel == rs.getChannel()) 00566 return; 00567 if (channel < 0 || channel >= cc->getNumChannels()) 00568 error("changeChannel(): channel number %d is out of range (hint: numChannels is a parameter of ChannelControl)", channel); 00569 if (rs.getState() == RadioState::TRANSMIT) 00570 error("changing channel while transmitting is not allowed"); 00571 00572 // if we are currently receiving, must clean that up before moving to different channel 00573 if (rs.getState() == RadioState::RECV) 00574 { 00575 // delete messages being received, and cancel associated self-messages 00576 for (RecvBuff::iterator it = recvBuff.begin(); it!=recvBuff.end(); ++it) 00577 { 00578 AirFrame *airframe = it->first; 00579 cMessage *endRxTimer = (cMessage *)airframe->contextPointer(); 00580 delete airframe; 00581 delete cancelEvent(endRxTimer); 00582 } 00583 recvBuff.clear(); 00584 } 00585 00586 // clear snr info 00587 snrInfo.ptr = NULL; 00588 snrInfo.sList.clear(); 00589 00590 // do channel switch 00591 EV << "Changing to channel #" << channel << "\n"; 00592 00593 rs.setChannel(channel); 00594 cc->updateHostChannel(myHostRef, channel); 00595 ChannelControl::TransmissionList tl = cc->getOngoingTransmissions(channel); 00596 00597 // pick up ongoing transmissions on the new channel 00598 EV << "Picking up ongoing transmissions on new channel:\n"; 00599 for (ChannelControl::TransmissionList::const_iterator it = tl.begin(); it != tl.end(); ++it) 00600 { 00601 AirFrame *airframe = *it; 00602 // time for the message to reach us 00603 double distance = myHostRef->pos.distance(airframe->getSenderPos()); 00604 double propagationDelay = distance / LIGHT_SPEED; 00605 00606 // if this transmission is on our new channel and it would reach us in the future, then schedule it 00607 if (channel == airframe->getChannelNumber()) 00608 { 00609 EV << " - (" << airframe->className() << ")" << airframe->name() << ": "; 00610 00611 // if there is a message on the air which will reach us in the future 00612 if (airframe->timestamp() + propagationDelay >= simTime()) 00613 { 00614 EV << "will arrive in the future, scheduling it\n"; 00615 00616 // we need to send to each radioIn[] gate 00617 cGate *radioGate = gate("radioIn"); 00618 for (int i = 0; i < radioGate->size(); i++) 00619 sendDirect((cMessage*)airframe->dup(), airframe->timestamp() + propagationDelay - simTime(), this, radioGate->id() + i); 00620 } 00621 // if we hear some part of the message 00622 else if (airframe->timestamp() + airframe->getDuration() + propagationDelay > simTime()) 00623 { 00624 EV << "missed beginning of frame, processing it as noise\n"; 00625 00626 AirFrame *frameDup = (AirFrame*)airframe->dup(); 00627 frameDup->setArrivalTime(airframe->timestamp() + propagationDelay); 00628 handleLowerMsgStart(frameDup); 00629 bufferMsg(frameDup); 00630 } 00631 else 00632 { 00633 EV << "in the past\n"; 00634 } 00635 } 00636 } 00637 00638 // notify other modules about the channel switch; and actually, radio state has changed too 00639 nb->fireChangeNotification(NF_RADIO_CHANNEL_CHANGED, &rs); 00640 nb->fireChangeNotification(NF_RADIOSTATE_CHANGED, &rs); 00641 }
|
|
Redefined from BasicRadio 00116 {return rs.getChannel();}
|
|
Create a new AirFrame.
00122 {return new AirFrame();};
|
|
Implemented in Ieee80211Radio2. |
|
Implemented in Ieee80211Radio2. |
|
Encapsulates a MAC frame into an Air Frame. This function encapsulates messages from the upper layer into an AirFrame. 00203 { 00204 PhyControlInfo *ctrl = dynamic_cast<PhyControlInfo *>(frame->removeControlInfo()); 00205 ASSERT(!ctrl || ctrl->channelNumber()==-1); // per-packet channel switching not supported 00206 00207 // Note: we don't set length() of the AirFrame, because duration will be used everywhere instead 00208 AirFrame *airframe = createCapsulePkt(); 00209 airframe->setName(frame->name()); 00210 airframe->setPSend(transmitterPower); 00211 airframe->setChannelNumber(channelNumber()); 00212 airframe->encapsulate(frame); 00213 airframe->setBitrate(ctrl ? ctrl->bitrate() : rs.getBitrate()); 00214 airframe->setDuration(radioModel->calcDuration(airframe)); 00215 airframe->setSenderPos(myPosition()); 00216 delete ctrl; 00217 00218 EV << "Frame (" << frame->className() << ")" << frame->name() 00219 << " will be transmitted at " << (airframe->getBitrate()/1e6) << "Mbps\n"; 00220 return airframe; 00221 }
|
|
00105 { 00106 }
|
|
00301 { 00302 if (msgkind==PHY_C_CONFIGURERADIO) 00303 { 00304 // extract new channel number 00305 PhyControlInfo *phyCtrl = check_and_cast<PhyControlInfo *>(ctrl); 00306 int newChannel = phyCtrl->channelNumber(); 00307 double newBitrate = phyCtrl->bitrate(); 00308 delete ctrl; 00309 00310 if (newChannel!=-1) 00311 { 00312 EV << "Command received: change to channel #" << newChannel << "\n"; 00313 00314 // do it 00315 if (rs.getChannel()==newChannel) 00316 EV << "Right on that channel, nothing to do\n"; // fine, nothing to do 00317 else if (rs.getState()==RadioState::TRANSMIT) { 00318 EV << "We're transmitting right now, remembering to change after it's completed\n"; 00319 this->newChannel = newChannel; 00320 } else 00321 changeChannel(newChannel); // change channel right now 00322 } 00323 if (newBitrate!=-1) 00324 { 00325 EV << "Command received: change bitrate to " << (newBitrate/1e6) << "Mbps\n"; 00326 00327 // do it 00328 if (rs.getBitrate()==newBitrate) 00329 EV << "Right at that bitrate, nothing to do\n"; // fine, nothing to do 00330 else if (rs.getState()==RadioState::TRANSMIT) { 00331 EV << "We're transmitting right now, remembering to change after it's completed\n"; 00332 this->newBitrate = newBitrate; 00333 } else 00334 setBitrate(newBitrate); // change bitrate right now 00335 } 00336 } 00337 else 00338 { 00339 error("unknown command (msgkind=%d)", msgkind); 00340 } 00341 }
|
|
Unbuffer the frame and update noise levels and snr information. This function is called right after the transmission is over, i.e. right after unbuffering. The noise level of the channel and the snr information of the buffered messages have to be updated. Additionally the RadioState has to be updated. If the corresponding AirFrame was not only noise the corresponding SnrList and the AirFrame are sent to the decider. 00488 { 00489 // check if message has to be send to the decider 00490 if (snrInfo.ptr == airframe) 00491 { 00492 EV << "reception of frame over, preparing to send packet to upper layer\n"; 00493 // get Packet and list out of the receive buffer: 00494 SnrList list; 00495 list = snrInfo.sList; 00496 00497 // delete the pointer to indicate that no message is currently 00498 // being received and clear the list 00499 snrInfo.ptr = NULL; 00500 snrInfo.sList.clear(); 00501 00502 // delete the frame from the recvBuff 00503 recvBuff.erase(airframe); 00504 00505 //XXX send up the frame: 00506 //if (radioModel->isReceivedCorrectly(airframe, list)) 00507 // sendUp(airframe); 00508 //else 00509 // delete airframe; 00510 if (!radioModel->isReceivedCorrectly(airframe, list)) 00511 { 00512 airframe->encapsulatedMsg()->setKind(list.size()>1 ? COLLISION : BITERROR); 00513 airframe->setName(list.size()>1 ? "COLLISION" : "BITERROR"); 00514 } 00515 sendUp(airframe); 00516 } 00517 // all other messages are noise 00518 else 00519 { 00520 EV << "reception of noise message over, removing recvdPower from noiseLevel....\n"; 00521 // get the rcvdPower and subtract it from the noiseLevel 00522 noiseLevel -= recvBuff[airframe]; 00523 00524 // delete message from the recvBuff 00525 recvBuff.erase(airframe); 00526 00527 // update snr info for message currently being received if any 00528 if (snrInfo.ptr != NULL) 00529 { 00530 addNewSnr(); 00531 } 00532 00533 // message should be deleted 00534 delete airframe; 00535 EV << "message deleted\n"; 00536 } 00537 00538 // check the RadioState and update if necessary 00539 // change to idle if noiseLevel smaller than threshold and state was 00540 // not idle before 00541 // do not change state if currently sending or receiving a message!!! 00542 if (noiseLevel < sensitivity && rs.getState() == RadioState::RECV && snrInfo.ptr == NULL) 00543 { 00544 // publish the new RadioState: 00545 EV << "new RadioState is IDLE\n"; 00546 rs.setState(RadioState::IDLE); 00547 nb->fireChangeNotification(NF_RADIOSTATE_CHANGED, &rs); 00548 } 00549 }
|
|
Buffer the frame and update noise levels and snr information. This function is called right after a packet arrived, i.e. right before it is buffered for 'transmission time'. First the receive power of the packet has to be calculated and is stored in the recvBuff. Afterwards it has to be decided whether the packet is just noise or a "real" packet that needs to be received. The message is not treated as noise if all of the following conditions apply:
If all conditions apply a new SnrList is created and the RadioState is changed to RECV. If the packet is just noise the receive power is added to the noise Level of the channel. Additionally the snr information of the currently being received message (if any) has to be updated as well as the RadioState. 00409 { 00410 // Calculate the receive power of the message 00411 00412 // calculate distance 00413 const Coord& myPos = myPosition(); 00414 const Coord& framePos = airframe->getSenderPos(); 00415 double distance = myPos.distance(framePos); 00416 00417 // calculate receive power 00418 double rcvdPower = receptionModel->calculateReceivedPower(airframe->getPSend(), carrierFrequency, distance); 00419 00420 // store the receive power in the recvBuff 00421 recvBuff[airframe] = rcvdPower; 00422 00423 // if receive power is bigger than sensitivity and if not sending 00424 // and currently not receiving another message and the message has 00425 // arrived in time 00426 // NOTE: a message may have arrival time in the past here when we are 00427 // processing ongoing transmissions during a channel change 00428 if (airframe->arrivalTime() == simTime() && rcvdPower >= sensitivity && rs.getState() != RadioState::TRANSMIT && snrInfo.ptr == NULL) 00429 { 00430 EV << "receiving frame " << airframe->name() << endl; 00431 00432 // Put frame and related SnrList in receive buffer 00433 SnrList snrList; //defined in SnrList.h!! 00434 snrInfo.ptr = airframe; 00435 snrInfo.rcvdPower = rcvdPower; 00436 snrInfo.sList = snrList; 00437 00438 // add initial snr value 00439 addNewSnr(); 00440 00441 if (rs.getState() != RadioState::RECV) 00442 { 00443 // publish new RadioState 00444 rs.setState(RadioState::RECV); 00445 EV << "publish new RadioState:RECV\n"; 00446 nb->fireChangeNotification(NF_RADIOSTATE_CHANGED, &rs); 00447 } 00448 } 00449 // receive power is too low or another message is being sent or received 00450 else 00451 { 00452 EV << "frame " << airframe->name() << " is just noise\n"; 00453 //add receive power to the noise level 00454 noiseLevel += rcvdPower; 00455 00456 // if a message is being received add a new snr value 00457 if (snrInfo.ptr != NULL) 00458 { 00459 // update snr info for currently being received message 00460 EV << "add new snr value to snr list of message being received\n"; 00461 addNewSnr(); 00462 } 00463 00464 // update the RadioState if the noiseLevel exceeded the threshold 00465 // and the radio is currently not in receive or in send mode 00466 if (noiseLevel >= sensitivity && rs.getState() == RadioState::IDLE) 00467 { 00468 // publish new RadioState 00469 rs.setState(RadioState::RECV); 00470 EV << "publish new RadioState:RECV\n"; 00471 nb->fireChangeNotification(NF_RADIOSTATE_CHANGED, &rs); 00472 } 00473 } 00474 }
|
|
The basic handle message function. Depending on the gate a message arrives handleMessage just calls different handle*Msg functions to further process the message. Messages from the channel are also buffered here in order to simulate a transmission delay You should not make any changes in this function but implement all your functionality into the handle*Msg functions called from here.
00134 { 00135 // handle commands 00136 if (msg->arrivalGateId()==uppergateIn && msg->length()==0) 00137 { 00138 cPolymorphic *ctrl = msg->removeControlInfo(); 00139 if (msg->kind()==0) 00140 error("Message '%s' with length==0 is supposed to be a command, but msg kind is also zero", msg->name()); 00141 handleCommand(msg->kind(), ctrl); 00142 delete msg; 00143 return; 00144 } 00145 00146 if (msg->arrivalGateId() == uppergateIn) 00147 { 00148 AirFrame *airframe = encapsMsg(msg); 00149 handleUpperMsg(airframe); 00150 } 00151 else if (msg->isSelfMessage()) 00152 { 00153 if (msg->kind()==MK_RECEPTION_COMPLETE) 00154 { 00155 EV << "frame is completely received now\n"; 00156 00157 // unbuffer the message 00158 AirFrame *airframe = unbufferMsg(msg); 00159 00160 handleLowerMsgEnd(airframe); 00161 } 00162 else 00163 handleSelfMsg(msg); 00164 } 00165 else if (check_and_cast<AirFrame *>(msg)->getChannelNumber() == channelNumber()) 00166 { 00167 // must be an AirFrame 00168 AirFrame *airframe = (AirFrame *) msg; 00169 handleLowerMsgStart(airframe); 00170 bufferMsg(airframe); 00171 } 00172 else 00173 { 00174 EV << "listening to different channel when receiving message -- dropping it\n"; 00175 delete msg; 00176 } 00177 }
|
|
The only self message that can arrive is a timer to indicate that sending of a message is completed. The RadioState has to be changed based on the noise level on the channel. If the noise level is bigger than the sensitivity switch to receive mode odtherwise to idle mode. 00352 { 00353 if (msg->kind() == MK_TRANSMISSION_OVER) 00354 { 00355 if (noiseLevel < sensitivity) 00356 { 00357 // set the RadioState to IDLE 00358 rs.setState(RadioState::IDLE); 00359 EV << "transmission over, switch to idle mode (state:IDLE)\n"; 00360 nb->fireChangeNotification(NF_RADIOSTATE_CHANGED, &rs); 00361 } 00362 else 00363 { 00364 // set the RadioState to RECV 00365 rs.setState(RadioState::RECV); 00366 EV << "transmission over but noise level too high, switch to recv mode (state:RECV)\n"; 00367 nb->fireChangeNotification(NF_RADIOSTATE_CHANGED, &rs); 00368 } 00369 00370 // delete the timer 00371 delete msg; 00372 00373 // switch channel if it needs be 00374 if (newChannel!=-1) 00375 { 00376 changeChannel(newChannel); 00377 newChannel = -1; 00378 } 00379 } 00380 else 00381 error("Internal error: unknown self-message `%s'", msg->name()); 00382 }
|
|
If a message is already being transmitted, an error is raised. Otherwise the RadioState is set to TRANSMIT and a timer is started. When this timer expires the RadioState will be set back to RECV (or IDLE respectively) again. If the host is receiving a packet this packet is from now on only considered as noise. 00265 { 00266 if (rs.getState() == RadioState::TRANSMIT) 00267 error("Trying to send a message while already transmitting -- MAC should " 00268 "take care this does not happen"); 00269 00270 // if a packet was being received, it is corrupted now as should be treated as noise 00271 if (snrInfo.ptr != NULL) 00272 { 00273 EV << "Sending a message while receiving another. The received one is now corrupted.\n"; 00274 00275 // remove the snr information stored for the message currently being 00276 // received. This message is treated as noise now and the 00277 // receive power has to be added to the noiseLevel 00278 00279 // delete the pointer to indicate that no message is being received 00280 snrInfo.ptr = NULL; 00281 // clear the snr list 00282 snrInfo.sList.clear(); 00283 // add the receive power to the noise level 00284 noiseLevel += snrInfo.rcvdPower; 00285 } 00286 00287 // now we are done with all the exception handling and can take care 00288 // about the "real" stuff 00289 00290 // change radio status 00291 rs.setState(RadioState::TRANSMIT); 00292 EV << "sending, changing RadioState to TRANSMIT\n"; 00293 nb->fireChangeNotification(NF_RADIOSTATE_CHANGED, &rs); 00294 00295 cMessage *timer = new cMessage(NULL, MK_TRANSMISSION_OVER); 00296 scheduleAt(simTime() + airframe->getDuration(), timer); 00297 sendDown(airframe); 00298 }
|
|
Initialize variables and publish the radio status.
Reimplemented from ChannelAccess. 00041 { 00042 ChannelAccess::initialize(stage); 00043 00044 EV << "Initializing RadioBase, stage=" << stage << endl; 00045 00046 if (stage == 0) 00047 { 00048 uppergateIn = findGate("uppergateIn"); 00049 uppergateOut = findGate("uppergateOut"); 00050 00051 // read parameters 00052 transmitterPower = par("transmitterPower"); 00053 if (transmitterPower > (double) (cc->par("pMax"))) 00054 error("transmitterPower cannot be bigger than pMax in ChannelControl!"); 00055 rs.setBitrate(par("bitrate")); 00056 rs.setChannel(par("channelNumber")); 00057 thermalNoise = FWMath::dBm2mW(par("thermalNoise")); 00058 carrierFrequency = cc->par("carrierFrequency"); // taken from ChannelControl 00059 sensitivity = FWMath::dBm2mW(par("sensitivity")); 00060 00061 // initialize noiseLevel 00062 noiseLevel = thermalNoise; 00063 00064 EV << "Initialized channel with noise: " << noiseLevel << " sensitivity: " << sensitivity << 00065 endl; 00066 00067 // initialize the pointer of the snrInfo with NULL to indicate 00068 // that currently no message is received 00069 snrInfo.ptr = NULL; 00070 00071 // no channel switch pending 00072 newChannel = -1; 00073 00074 // Initialize radio state. If thermal noise is already to high, radio 00075 // state has to be initialized as RECV 00076 rs.setState(RadioState::IDLE); 00077 if (noiseLevel >= sensitivity) 00078 rs.setState(RadioState::RECV); 00079 00080 WATCH(noiseLevel); 00081 WATCH(rs); 00082 00083 receptionModel = createReceptionModel(); 00084 receptionModel->initializeFrom(this); 00085 00086 radioModel = createRadioModel(); 00087 radioModel->initializeFrom(this); 00088 } 00089 else if (stage == 1) 00090 { 00091 // tell initial value to MAC; must be done in stage 1, because they 00092 // subscribe in stage 0 00093 nb->fireChangeNotification(NF_RADIOSTATE_CHANGED, &rs); 00094 nb->fireChangeNotification(NF_RADIO_CHANNEL_CHANGED, &rs); 00095 } 00096 else if (stage == 2) 00097 { 00098 // tell initial channel number to ChannelControl; should be done in 00099 // stage==2 or later, because base class initializes myHostRef in that stage 00100 cc->updateHostChannel(myHostRef, rs.getChannel()); 00101 } 00102 }
|
|
Sends a message to the channel.
00237 { 00238 sendToChannel(airframe); 00239 }
|
|
Sends a message to the upper layer.
00224 { 00225 cMessage *frame = airframe->decapsulate(); 00226 delete airframe; 00227 EV << "sending up frame " << frame->name() << endl; 00228 send(frame, uppergateOut); 00229 }
|
|
change the bitrate to the given value. This method throws an error if the radio state is transmit.
00644 { 00645 if (rs.getBitrate() == bitrate) 00646 return; 00647 if (bitrate < 0) 00648 error("setBitrate(): bitrate cannot be negative (%g)", bitrate); 00649 if (rs.getState() == RadioState::TRANSMIT) 00650 error("changing the bitrate while transmitting is not allowed"); 00651 00652 EV << "Setting bitrate to " << (bitrate/1e6) << "Mbps\n"; 00653 rs.setBitrate(bitrate); 00654 00655 //XXX fire some notification? 00656 }
|
|
Unbuffers a message after 'transmission time'. Get the context pointer to the now completely received AirFrame and delete the self message 00246 { 00247 AirFrame *airframe = (AirFrame *) msg->contextPointer(); 00248 //delete the self message 00249 delete msg; 00250 00251 return airframe; 00252 }
|
|
Configuration: The carrier frequency used. It is read from the ChannelControl module.
|
|
State: if not -1, we have to switch to that bitrate once we finished transmitting.
|
|
State: if not -1, we have to switch to that channel once we finished transmitting.
|
|
State: the current noise level of the channel.
|
|
|
|
|
|
State: A buffer to store a pointer to a message and the related receive power.
|
|
State: the current RadioState of the NIC; includes channel number.
|
|
Configuration: Defines up to what Power level (in dBm) a message can be understood. If the level of a received packet is lower, it is only treated as noise. Can be specified in omnetpp.ini. Default: -85 dBm.
|
|
State: SnrInfo stores the snrList and the the recvdPower for the message currently being received, together with a pointer to the message.
|
|
Configuration: Thermal noise on the channel. Can be specified in omnetpp.ini. Default: -100 dBm.
|
|
power used to transmit messages
|
|
|
|
gate id
|