![]() |
User Manual, Developers Guide and API Documentation |
![]() |
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 #include <WIMEMAC/Component.hpp> 00030 #include <WIMEMAC/convergence/PhyUser.hpp> 00031 #include <WIMEMAC/helper/contextprovider/CommandInformation.hpp> 00032 #include <WNS/service/dll/Handler.hpp> 00033 #include <WNS/ldk/fun/Main.hpp> 00034 #include <WNS/ldk/utils.hpp> 00035 #include <WNS/pyconfig/Parser.hpp> 00036 #include <WNS/Exception.hpp> 00037 #include <sstream> 00038 00039 using namespace wimemac; 00040 00041 STATIC_FACTORY_REGISTER_WITH_CREATOR( 00042 Component, 00043 wns::node::component::Interface, 00044 "wimemac.Component", 00045 wns::node::component::ConfigCreator 00046 ); 00047 00048 Component::Component( 00049 wns::node::Interface* _node, 00050 const wns::pyconfig::View& _config) : 00051 dll::Layer2(_node, _config, NULL), 00052 lowerConvergence(NULL) 00053 { 00054 } // Component 00055 00056 void 00057 Component::doStartup() 00058 { 00059 dll::Layer2::doStartup(); 00060 } 00061 00062 Component::~Component() 00063 { 00064 } // ~Component 00065 00066 void 00067 Component::onNodeCreated() 00068 { 00069 // Initialize management and control services 00070 getMSR()->onMSRCreated(); 00071 getCSR()->onCSRCreated(); 00072 00073 fun->onFUNCreated(); 00074 00075 MESSAGE_BEGIN(NORMAL, logger, m, fun->getName()); 00076 m << ": onNodeCreated(), setting physical layer"; 00077 MESSAGE_END(); 00078 00079 // set services in lower convergence to communicate with lower layer 00080 lowerConvergence = getFUN()->findFriend<convergence::IPhyServices*>( 00081 getConfig().get<std::string>("phyuser.functionalUnitName")); 00082 assure(lowerConvergence, "No lowerConvergence available"); 00083 00084 lowerConvergence->setDataTransmissionService( 00085 getService<wns::service::Service*>( 00086 getConfig().get<std::string>("phyDataTransmission"))); 00087 00088 lowerConvergence->setNotificationService( 00089 getService<wns::service::Service*>( 00090 getConfig().get<std::string>("phyNotification"))); 00091 00092 00093 // Add compound-based context providers 00094 // TODO: Reading names from configuration 00095 getNode()->getContextProviderCollection().addProvider( 00096 wimemac::helper::contextprovider::SourceAddress(fun, "upperConvergence")); 00097 getNode()->getContextProviderCollection().addProvider( 00098 wimemac::helper::contextprovider::TargetAddress(fun, "upperConvergence")); 00099 getNode()->getContextProviderCollection().addProvider( 00100 wimemac::helper::contextprovider::IsUnicast(fun, "upperConvergence")); 00101 getNode()->getContextProviderCollection().addProvider( 00102 wimemac::helper::contextprovider::DataBitsPerSymbol(fun, "ManagerCommand")); 00103 getNode()->getContextProviderCollection().addProvider( 00104 wimemac::helper::contextprovider::SpatialStreams(fun, "ManagerCommand")); 00105 //getNode()->getContextProviderCollection().addProvider( 00106 // wimemac::helper::contextprovider::IsForMe(fun, "upperConvergence")); 00107 00108 } // onNodeCreated 00109 00110 void 00111 Component::onWorldCreated() 00112 { 00113 } // onWorldCreated 00114 00115 void 00116 Component::onShutdown() 00117 { 00118 } // onShutdown 00119 00120
1.5.5