User Manual, Developers Guide and API Documentation

DllBinding.cpp

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. 16, 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 #include <CONSTANZE/DllBinding.hpp>
00029 #include <CONSTANZE/Generator.hpp>
00030 
00031 #include <WNS/StaticFactory.hpp>
00032 #include <WNS/module/Base.hpp>
00033 #include <WNS/service/dll/Address.hpp>
00034 
00035 using namespace constanze;
00036 
00037 STATIC_FACTORY_REGISTER_WITH_CREATOR(
00038     constanze::DllBinding,
00039     constanze::Binding,
00040     "DllBinding",
00041     wns::PyConfigViewCreator);
00042 
00043 DllBinding::DllBinding(const wns::pyconfig::View& _pyco):
00044     pyco(_pyco),
00045     destinationDllAddress(pyco.get<long int>("destinationDllAddress")),
00046     log(pyco.get("logger"))
00047 {
00048     MESSAGE_BEGIN(NORMAL, log, m, "New DllBinding created. DestinationMACAddress="<<destinationDllAddress);
00049     MESSAGE_END();
00050 }
00051 
00052 DllBinding::~DllBinding()
00053 {
00054 }
00055 
00056 void DllBinding::registerComponent(wns::node::component::Component* _component)
00057 {
00058     component = _component;
00059     dllDataTransmission =
00060             component->getService<wns::service::dll::UnicastDataTransmission*>(
00061                 pyco.get<std::string>("dllDataTransmission"));
00062 
00063 }
00064 void DllBinding::sendData(const wns::osi::PDUPtr& _data){
00065     dllDataTransmission->sendData(destinationDllAddress, _data, wns::service::dll::CONSTANZE);
00066 }
00067 
00068 void DllBinding::registerListener(constanze::Listener*)
00069 {
00070     // intentionally left empty
00071 }
00072 
00073 void DllBinding::initBinding(constanze::StartTrigger* _startTrigger)
00074 {
00075     _startTrigger->bindingReady();
00076 }
00077 
00078 void DllBinding::releaseBinding(constanze::StopTrigger* _stopTrigger)
00079 {
00080     _stopTrigger->bindingReady();
00081 }
00082 
00083 std::string DllBinding::printAddress() const
00084 {
00085         std::ostringstream tmp;
00086         tmp << destinationDllAddress;
00087         return tmp.str();
00088 }

Generated on Wed May 23 03:32:13 2012 for openWNS by  doxygen 1.5.5