User Manual, Developers Guide and API Documentation

PhyUserCommand.hpp

Go to the documentation of this file.
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  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 
00028 #ifndef WIMAC_PHYUSERCOMMAND_HPP
00029 #define WIMAC_PHYUSERCOMMAND_HPP
00030 
00031 #include <functional>
00032 
00033 #include <WNS/ldk/Command.hpp>
00034 #include <WNS/service/phy/phymode/PhyModeInterface.hpp>
00035 #include <WNS/service/phy/power/PowerMeasurement.hpp>
00036 #include <WIMAC/CIRProvider.hpp>
00037 #include <WIMAC/PhyAccessFunc.hpp>
00038 #include <WIMAC/PhyModeProviderCommand.hpp>
00039 #include <WNS/service/phy/phymode/PhyModeInterface.hpp>
00040 #include <WNS/scheduler/SchedulerTypes.hpp>
00041 #include <WNS/scheduler/SchedulingMap.hpp>
00042 
00043 namespace wimac {
00044     class PhyUser;
00045     class Component;
00046 
00047 
00051     class PhyUserCommand :
00052             public wns::ldk::Command,
00053             public wimac::PhyModeProviderCommand,
00054             public wimac::CIRProviderCommand
00055     {
00056     public:
00057         struct {
00058             wns::Power rxPower_;
00059             wns::Power interference_;
00060 
00061             std::auto_ptr<PhyAccessFunc> pAFunc_;
00062 
00063         } local;
00064 
00065         struct {
00066             wns::node::Interface* source_;
00067             wns::node::Interface* destination_;
00068             int cellID_;
00069             wns::SmartPtr<const wns::service::phy::phymode::PhyModeInterface> phyModePtr;
00070             bool measureInterference_;
00071             wns::scheduler::ChannelQualityOnOneSubChannel estimatedCQI;
00072         } peer;
00073 
00074         struct {
00075             wimac::Component* sourceComponent_;
00076             bool contentionAccess_;
00077             bool frameHead_;
00078             wns::service::phy::power::PowerMeasurementPtr rxMeasurement;
00079             wns::scheduler::SchedulingTimeSlotPtr schedulingTimeSlot;
00080         } magic;
00081 
00082 
00083         PhyUserCommand()
00084         {
00085             peer.measureInterference_ = false;
00086             peer.source_ = 0;
00087             peer.destination_ = 0;
00088             peer.cellID_ = 0;
00089             peer.estimatedCQI = wns::scheduler::ChannelQualityOnOneSubChannel();
00090             magic.sourceComponent_ = 0;
00091             magic.contentionAccess_ = false;
00092             magic.frameHead_ = false;
00093         }
00094 
00095         PhyUserCommand(const PhyUserCommand& other) :
00096             wns::ldk::Command(),
00097             wimac::PhyModeProviderCommand(),
00098             wimac::CIRProviderCommand()
00099         {
00100             local.rxPower_            = other.local.rxPower_;
00101             local.interference_       = other.local.interference_;
00102             if (other.local.pAFunc_.get())
00103                 local.pAFunc_.reset(dynamic_cast<wimac::PhyAccessFunc*>(other.local.pAFunc_->clone()));
00104             peer.measureInterference_ = other.peer.measureInterference_;
00105             peer.source_              = other.peer.source_;
00106             peer.destination_         = other.peer.destination_;
00107             peer.cellID_              = other.peer.cellID_;
00108             peer.phyModePtr           = other.peer.phyModePtr;
00109             peer.estimatedCQI      = other.peer.estimatedCQI;
00110 
00111             magic.sourceComponent_       = other.magic.sourceComponent_;
00112             magic.contentionAccess_   = other.magic.contentionAccess_;
00113             magic.frameHead_          = other.magic.frameHead_;
00114         }
00115 
00116         const wns::service::phy::phymode::PhyModeInterface& getPhyMode() const { return *(peer.phyModePtr); }
00117         const wns::service::phy::phymode::PhyModeInterface* getPhyModePtr() const { return peer.phyModePtr.getPtr(); }
00118 
00119         void setPhyMode( const wns::service::phy::phymode::PhyModeInterface& _phyMode )
00120         {
00121             peer.phyModePtr = wns::SmartPtr<const wns::service::phy::phymode::PhyModeInterface>
00122                 (dynamic_cast<const wns::service::phy::phymode::PhyModeInterface*>(_phyMode.clone()));
00123         }
00124 
00125         wns::Ratio getCIR() const
00126         {
00127             return magic.rxMeasurement->getSINR();
00128         }
00129 
00130         wns::Power getEstimatedIintra() const { return peer.estimatedCQI.sdma.iIntra; }
00131 
00132     };
00133 }
00134 #endif

Generated on Sun May 27 03:32:13 2012 for openWNS by  doxygen 1.5.5