![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /****************************************************************************** 00002 * WiFiMac * 00003 * This file is part of openWNS (open Wireless Network Simulator) 00004 * _____________________________________________________________________________ 00005 * 00006 * Copyright (C) 2004-2007 00007 * Chair of Communication Networks (ComNets) 00008 * Kopernikusstr. 16, 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 WIFIMAC_CONVERGENCE_ERRORMODELLING 00030 #define WIFIMAC_CONVERGENCE_ERRORMODELLING 00031 00032 #include <WIFIMAC/convergence/PhyUser.hpp> 00033 #include <WIFIMAC/management/ProtocolCalculator.hpp> 00034 00035 #include <WNS/ldk/fu/Plain.hpp> 00036 #include <WNS/ldk/Processor.hpp> 00037 #include <WNS/ldk/ErrorRateProviderInterface.hpp> 00038 00039 #include <WNS/pyconfig/View.hpp> 00040 #include <WNS/logger/Logger.hpp> 00041 00042 namespace wifimac { namespace convergence { 00043 00047 class ErrorModellingCommand: 00048 public wns::ldk::Command, 00049 public wns::ldk::ErrorRateProviderInterface 00050 { 00051 public: 00052 ErrorModellingCommand() 00053 { 00054 local.per = 1; 00055 local.destructorCalled = NULL; 00056 local.cir.set_dB(0); 00057 } 00058 00059 ~ErrorModellingCommand() 00060 { 00061 if(local.destructorCalled != NULL) 00062 *local.destructorCalled = true; 00063 } 00064 virtual double getErrorRate() const 00065 { 00066 return local.per; 00067 } 00068 00069 struct { 00070 double per; 00071 long *destructorCalled; 00072 wns::Ratio cir; 00073 } local; 00074 struct {} peer; 00075 struct {} magic; 00076 }; 00077 00084 class ErrorModelling: 00085 public wns::ldk::fu::Plain<ErrorModelling, ErrorModellingCommand>, 00086 public wns::ldk::Processor<ErrorModelling> 00087 { 00088 public: 00089 // FUNConfigCreator interface realisation 00090 ErrorModelling(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config); 00091 00095 void processIncoming(const wns::ldk::CompoundPtr& compound); 00096 void processOutgoing(const wns::ldk::CompoundPtr& compound); 00097 00098 void onFUNCreated(); 00099 00100 private: 00101 wns::pyconfig::View config; 00102 wns::logger::Logger logger; 00103 const std::string phyUserCommandName; 00104 const std::string managerCommandName; 00105 const std::string protocolCalculatorName; 00106 00107 wifimac::management::ProtocolCalculator* pc; 00108 00109 }; // ErrorModelling 00110 } // convergence 00111 } // wifimac 00112 00113 #endif
1.5.5