![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /******************************************************************************* 00002 * This file is part of openWNS (open Wireless Network Simulator) 00003 * _____________________________________________________________________________ 00004 * 00005 * Copyright (C) 2004-2009 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 #include <COPPER/Transceiver.hpp> 00029 #include <COPPER/Wire.hpp> 00030 #include <COPPER/Transmission.hpp> 00031 #include <COPPER/Transmitter.hpp> 00032 #include <COPPER/Receiver.hpp> 00033 00034 #include <WNS/node/Node.hpp> 00035 00036 00037 using namespace copper; 00038 00039 STATIC_FACTORY_REGISTER_WITH_CREATOR( 00040 Transceiver, 00041 wns::node::component::Interface, 00042 "copper.Transceiver", 00043 wns::node::component::ConfigCreator 00044 ); 00045 00046 00047 Transceiver::Transceiver( 00048 wns::node::Interface* node, 00049 const wns::pyconfig::View& pyco) : 00050 00051 wns::node::component::Component(node, pyco), 00052 transmitter(NULL), 00053 receiver(NULL), 00054 logger(pyco.get<wns::pyconfig::View>("logger")) 00055 { 00056 } 00057 00058 void 00059 Transceiver::doStartup() 00060 { 00061 wns::pyconfig::View pyco = this->getConfig(); 00062 // No need to store this here, the Broker keeps the instances ... 00063 WireInterface* wire = Transceiver::getWireBroker().procure(pyco.get("wire")); 00064 00065 this->transmitter = new Transmitter(pyco.get("transmitter"), wire); 00066 00067 this->receiver = new Receiver(pyco.get("receiver"), wire); 00068 this->addService(pyco.get<std::string>("dataTransmission"), transmitter); 00069 this->addService(pyco.get<std::string>("dataTransmissionFeedback"), transmitter); 00070 this->addService(pyco.get<std::string>("notification"), receiver); 00071 } 00072 00073 Transceiver::~Transceiver() 00074 { 00075 if (this->transmitter != NULL) 00076 { 00077 delete this->transmitter; 00078 } 00079 if (this->receiver != NULL) 00080 { 00081 delete this->receiver; 00082 } 00083 } 00084 00085 00086 void 00087 Transceiver::onNodeCreated() 00088 { 00089 } 00090 00091 00092 void 00093 Transceiver::onWorldCreated() 00094 { 00095 } 00096 00097 00098 void 00099 Transceiver::onShutdown() 00100 { 00101 } 00102 00103 00104 copper::WireBroker& 00105 Transceiver::getWireBroker() 00106 { 00107 static WireBroker b; 00108 return b; 00109 } 00110 00111
1.5.5