![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /******************************************************************************* 00002 * This file is part of openWNS (open Wireless Network Simulator) 00003 * _____________________________________________________________________________ 00004 * 00005 * Copyright (C) 2004-2009 00006 * Chair of Communication Networks (ComNets) 00007 * Kopernikusstr. 5, D-52074 Aachen, Germany 00008 * email: info@openwns.org 00009 * www: http://www.openwns.org 00010 * _____________________________________________________________________________ 00011 * 00012 * openWNS is free software; you can redistribute it and/or modify it under the 00013 * terms of the GNU Lesser General Public License version 2 as published by the 00014 * Free Software Foundation; 00015 * 00016 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00017 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00018 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00019 * details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public License 00022 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00023 * 00024 ******************************************************************************/ 00025 00026 #include <WIMAC/PhyAccessFunc.hpp> 00027 00028 #include <WIMAC/PhyUser.hpp> 00029 #include <WIMAC/Logger.hpp> 00030 00031 using namespace wimac; 00032 00033 void StopTransmission::operator()() 00034 { 00035 LOG_INFO(phyUser_->getFUN()->getName(), " stop transmission"); 00036 phyUser_->getNotificationService()->enableReception(); 00037 phyUser_->getDataTransmissionService()->stopTransmission( compound_, subBand_ ); 00038 } 00039 00040 void StartTransmission::operator()() 00041 { 00042 LOG_INFO(phyUser_->getFUN()->getName(), " start transmission to ", dstStation_->getName()); 00043 assure(phyMode_,"invalid PhyMode"); 00044 phyUser_->getNotificationService()->disableReception(); 00045 phyUser_->getDataTransmissionService()->startBroadcast( compound_, subBand_, requestedTxPower_, phyMode_ ); 00046 } 00047 00048 void StartBroadcastTransmission::operator()() 00049 { 00050 LOG_INFO(phyUser_->getFUN()->getName(), " start broadcast transmission"); 00051 wns::Power defaultTxPower = phyUser_->getDataTransmissionService()->getMaxPowerPerSubband(); 00052 assure(phyMode_,"invalid PhyMode"); 00053 phyUser_->getNotificationService()->disableReception(); 00054 phyUser_->getDataTransmissionService()->startBroadcast( compound_, subBand_, defaultTxPower, phyMode_ ); 00055 } 00056 00057 void StartBeamformingTransmission::operator()() 00058 { 00059 assure(dstStation_ != NULL, " destination is required for beamforming transmission "); 00060 assure(pattern_ != wns::service::phy::ofdma::PatternPtr(), " pattern is required for beamforming transmission"); 00061 assure(phyMode_,"invalid PhyMode"); 00062 LOG_INFO(phyUser_->getFUN()->getName(), ": starts beamforming transmission to: ", dstStation_->getName()); 00063 phyUser_->getNotificationService()->disableReception(); 00064 phyUser_->getDataTransmissionService()->startTransmission(compound_, dstStation_, subBand_, pattern_, requestedTxPower_, phyMode_ ); 00065 } 00066 00067 void SetPattern::operator()() 00068 { 00069 LOG_INFO(phyUser_->getFUN()->getName(), " set pattern to ", dstStation_->getName()); 00070 phyUser_->getDataTransmissionService()->insertReceivePattern( dstStation_, pattern_ ); 00071 } 00072 00073 void RemovePattern::operator()() 00074 { 00075 phyUser_->getDataTransmissionService()->removeReceivePattern(dstStation_); 00076 } 00077 00078 void 00079 BroadcastPhyAccessFunc::operator()(wimac::PhyUser* phyUser, const wns::ldk::CompoundPtr& compound ) 00080 { 00081 assureNotNull(phyMode_.getPtr()); 00082 StartBroadcastTransmission start ( phyUser, compound, phyMode_ ); 00083 wns::simulator::getEventScheduler()->schedule( start, transmissionStart_ ); 00084 00085 StopTransmission stop ( phyUser, compound ); 00086 wns::simulator::getEventScheduler()->schedule( stop, transmissionStop_); 00087 } 00088 00089 void OmniUnicastPhyAccessFunc::operator()( PhyUser* pu, const wns::ldk::CompoundPtr& compound ) 00090 { 00091 assureNotNull(phyMode_.getPtr()); 00092 StartTransmission start ( pu, compound, destination_, phyMode_, subBand_, requestedTxPower_); 00093 00094 wns::simulator::getEventScheduler() 00095 ->schedule( start, transmissionStart_ ); 00096 00097 00098 StopTransmission stop ( pu, compound ); 00099 00100 wns::simulator::getEventScheduler() 00101 ->schedule( stop, transmissionStop_ ); 00102 } 00103 00104 void BeamformingPhyAccessFunc::operator()( PhyUser* pu, const wns::ldk::CompoundPtr& compound ) 00105 { 00106 assure( destination_ != NULL, " destination is required for beamforming transmission "); 00107 assure(pattern_ != wns::service::phy::ofdma::PatternPtr(), " pattern is required for beamforming transmission"); 00108 assure(subBand_ >= 0," negative Subband is a not valid value"); 00109 assureNotNull(phyMode_.getPtr()); 00110 00111 StartBeamformingTransmission start ( pu, compound, destination_, 00112 pattern_, subBand_, 00113 requestedTxPower_, phyMode_ ); 00114 wns::simulator::getEventScheduler() 00115 ->schedule( start, transmissionStart_ ); 00116 00117 StopTransmission stop ( pu, compound ); 00118 wns::simulator::getEventScheduler() 00119 ->schedule( stop, transmissionStop_ ); 00120 } 00121 00122 void PatternSetterPhyAccessFunc::operator()( PhyUser* pu, const wns::ldk::CompoundPtr& ) 00123 { 00124 patternStart_ = transmissionStart_; 00125 patternEnd_ = transmissionStop_; 00126 SetPattern setter ( pu, destination_, pattern_); 00127 wns::simulator::getEventScheduler() 00128 ->schedule( setter, patternStart_ ); 00129 00130 //race condition: removing before reading by approximalty 1.6e-5 [s] 00131 /*RemovePattern remover (pu, destination_); 00132 wns::simulator::getEventScheduler() 00133 ->schedule( remover, patternEnd_);*/ 00134 }
1.5.5