User Manual, Developers Guide and API Documentation

BCHService.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-2007
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 LTE_CONTROLPLANE_BCH_BCHSERVICE_HPP
00029 #define LTE_CONTROLPLANE_BCH_BCHSERVICE_HPP
00030 
00031 #include <WNS/events/PeriodicTimeout.hpp>
00032 #include <WNS/pyconfig/View.hpp>
00033 #include <WNS/ldk/ControlServiceInterface.hpp>
00034 
00035 #include <LTE/controlplane/bch/BCHStorage.hpp>
00036 #include <LTE/helper/HasModeName.hpp>
00037 #include <LTE/macr/PhyCommand.hpp>
00038 
00039 namespace lte {
00040     namespace macr {
00041         class PhyUser;
00042     }
00043     namespace controlplane {
00044         namespace associationHandler {
00045             class AssociationHandlerUT;
00046         }
00047 
00048     namespace bch {
00049 
00050     struct Best {
00051         BCHRecordPtr entry;
00052         double value;
00053     };
00054 
00055     class BCHService
00056         : public wns::ldk::ControlService,
00057           public wns::events::PeriodicTimeout,
00058           public lte::helper::HasModeName
00059     {
00060         BCHStorage<wns::service::dll::UnicastAddress> bchStorage;
00061 
00062         struct Criterion {
00063             Criterion(const wns::pyconfig::View& config):
00064                 name(config.get<std::string>("name"))
00065             {
00066                 if(name == "SINR" || name == "Pathloss")
00067                     ratioMargin = config.get<wns::Ratio>("margin");
00068                 else if(name == "RxPower")
00069                     powerMargin = config.get<wns::Power>("margin");
00070                 else if(name == "Distance")
00071                     distanceMargin == config.get<double>("margin");
00072                 else if(name == "MAC_ID")
00073                 {
00074                     assure(!config.isNone("address"), "MAC_ID criterion needs address of serving station");
00075                     address = wns::service::dll::UnicastAddress(config.get<int>("address"));              
00076                 }                
00077                 else
00078                     throw wns::Exception("Unsupported BCH Storage criterion");  
00079             }
00080 
00081             std::string name;
00082             wns::Power powerMargin;
00083             wns::Ratio ratioMargin;
00084             double distanceMargin;
00085             wns::service::dll::UnicastAddress address;
00086         };
00087 
00088         Criterion criterion;
00089 
00090         double upperThreshold;
00091         double lowerThreshold;
00092         dll::ILayer2* layer2;
00093         lte::controlplane::associationHandler::AssociationHandlerUT* associationHandler;
00094         wns::logger::Logger logger;
00095 
00096         simTimeType timeout;
00097         bool triggersAssociation;
00098         bool triggersReAssociation;
00099 
00100     public:
00101         BCHService(wns::ldk::ControlServiceRegistry* csr,
00102                    const wns::pyconfig::View& config);
00103         virtual
00104         ~BCHService(){}
00105 
00106         virtual void
00107         onCSRCreated(){}
00108 
00110         virtual void
00111         periodically();
00113         void
00114         storeMeasurement(const wns::service::dll::UnicastAddress& source,
00115                          const wns::service::phy::power::PowerMeasurementPtr&  phyMeasurementPtr,
00116                          int subband);
00117         void
00118         storeMeasurement(const wns::service::dll::UnicastAddress& source,
00119                          const lte::macr::PhyCommand& phyCommand);
00120 
00121         uint32_t
00122         getSubBand(const wns::service::dll::UnicastAddress& source) const;
00123 
00124         Best
00125         getBest() const;
00126 
00127     };
00128 
00129 }}}
00130 
00131 #endif // NOT defined LTE_CONTROLPLANE_BCH_BCHSERVICE_HPP
00132 
00133 

Generated on Mon May 21 03:32:02 2012 for openWNS by  doxygen 1.5.5