User Manual, Developers Guide and API Documentation

BeaconBuilder.hpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  * WiMeMac                                                                    *
00003  * This file is part of openWNS (open Wireless Network Simulator)
00004  * _____________________________________________________________________________
00005  *
00006  * Copyright (C) 2004-2011
00007  * Chair of Communication Networks (ComNets)
00008  * Kopernikusstr. 5, D-52074 Aachen, Germany
00009  * phone: ++49-241-80-27910,
00010  * fax: ++49-241-80-22242
00011  * email: info@openwns.org
00012  * www: http://www.openwns.org
00013  * _____________________________________________________________________________
00014  *
00015  * openWNS is free software; you can redistribute it and/or modify it under the
00016  * terms of the GNU Lesser General Public License version 2 as published by the
00017  * Free Software Foundation;
00018  *
00019  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00020  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00021  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00022  * details.
00023  *
00024  * You should have received a copy of the GNU Lesser General Public License
00025  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00026  *
00027  ******************************************************************************/
00028  
00029 #ifndef WIMEMAC_MANAGEMENT_BEACONBUILDER_H
00030 #define WIMEMAC_MANAGEMENT_BEACONBUILDER_H
00031 
00032 #include <WNS/ldk/fu/Plain.hpp>
00033 #include <WNS/logger/Logger.hpp>
00034 #include <WNS/service/dll/Address.hpp>
00035 #include <WIMEMAC/lowerMAC/Manager.hpp>
00036 #include <WIMEMAC/management/BeaconCommand.hpp>
00037 #include <WIMEMAC/management/IBeaconBuilderServices.hpp>
00038 #include <WIMEMAC/management/BeaconEvaluator.hpp>
00039 #include <WNS/ldk/CommandTypeSpecifier.hpp>
00040 #include <WIMEMAC/helper/IDRPQueueInterface.hpp>
00041 #include <vector>
00042 #include <DLL/UpperConvergence.hpp>
00043 
00044 namespace wimemac {
00045 namespace management {
00046 
00054 typedef std::vector<bool> Vector;
00055 
00056     class BeaconBuilder :
00057 
00058         public wns::ldk::fu::Plain<BeaconBuilder, BeaconCommand>,
00059         public BeaconEvaluator,
00060         public IBeaconBuilderServices
00061         {
00062         public:
00063 
00064             BeaconBuilder(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config_ );
00065             ~BeaconBuilder();
00066             void doOnData(const wns::ldk::CompoundPtr& );
00067             void doSendData(const wns::ldk::CompoundPtr& );
00068 
00071             void BuildDTPmap();
00072             bool doIsAccepting(const wns::ldk::CompoundPtr& compound) const;
00073             void doWakeup();
00074 
00075             bool isBeacon(const wns::ldk::CommandPool* commandPool) const;
00076 
00077             void prepareDRPConnection(wns::service::dll::UnicastAddress rx, int CompoundspSF, int BitspSF, int MaxCompoundSize);
00078             void updateDRPConnection(wns::service::dll::UnicastAddress rx, int CompoundspSF, int BitspSF, int MaxCompoundSize);
00079             
00080             void SetBPDuration(wns::simulator::Time duration) {BeaconEvaluator::SetBPDuration(duration);};
00081 
00082 
00083         protected:
00084 
00085             virtual void onFUNCreated();
00086 
00087         private:
00088                     
00089             void calculateSizes(const wns::ldk::CommandPool* commandPool, Bit& commandPoolSize, Bit& dataSize) const;
00090             wns::ldk::CompoundPtr CreateBeacon();
00091             wns::ldk::CompoundPtr currentBeacon;
00092             wns::logger::Logger logger;
00093             wimemac::convergence::PhyMode beaconPhyMode;
00094             const std::string managerName;
00095 
00096             bool isDRPconnection;
00097             wns::service::dll::UnicastAddress tmpID; // For allocatedMAS probe in destructor
00098 
00099             wns::probe::bus::ContextCollectorPtr MASProbe;          // Number of allocated MAS
00100             wns::probe::bus::ContextCollectorPtr allocatedMASProbe; // Allocate MAS in text probe
00101 
00102             struct Friends
00103             {
00104                 dll::UpperConvergence * Upper;
00105                 wimemac::helper::IDRPQueueInterface* queueInterface;
00106                 wns::ldk::CommandReaderInterface* keyReader;
00107                 wimemac::lowerMAC::Manager* manager;
00108                 
00109             } friends;  
00110     };
00111 }
00112 }
00113 #endif

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