![]() |
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 #ifndef WIMEMAC_FRAME_DATACOLLECTOR_H 00030 #define WIMEMAC_FRAME_DATACOLLECTOR_H 00031 00032 #include <WNS/ldk/fcf/CompoundCollector.hpp> 00033 #include <WNS/ldk/FunctionalUnit.hpp> 00034 #include <WNS/events/CanTimeout.hpp> 00035 #include <WNS/logger/Logger.hpp> 00036 00037 namespace wimemac { namespace frame { 00038 00039 00040 00041 00042 /* 00043 * @brief The DataCollector is the second phase within the WiMedia superframe. 00044 * Its length in time depends on active devices and beacon period (BP) length. 00045 * It's mandatory to send a beacon inside the BP, hence the length of the BP is variable. 00046 * If the DataPhase starts, DataCollector sends a wakeup to the upper fu 00047 */ 00048 00049 00050 00051 00052 class DataCollector : 00053 public wns::ldk::fcf::CompoundCollector, 00054 public wns::ldk::CommandTypeSpecifier<wns::ldk::EmptyCommand>, 00055 public wns::ldk::HasConnector<>, 00056 public wns::ldk::HasReceptor<>, 00057 public wns::ldk::HasDeliverer<>, 00058 public wns::Cloneable<DataCollector>, 00059 public wns::events::CanTimeout 00060 00061 00062 { 00063 public: 00064 DataCollector(wns::ldk::fun::FUN* fun, const 00065 wns::pyconfig::View& config ); 00066 00067 00068 void doOnData(const wns::ldk::CompoundPtr& ); 00069 void doSendData(const wns::ldk::CompoundPtr& ); 00070 00071 bool doIsAccepting(const wns::ldk::CompoundPtr& compound) const; 00072 00073 void doWakeup(); 00074 00075 void doStart(int); 00076 00077 void doStartCollection(int){} 00078 void finishCollection(){} 00079 00080 wns::simulator::Time getCurrentDuration() const{return getMaximumDuration();} 00081 00082 protected: 00083 00084 virtual void onFUNCreated(); 00085 00086 private: 00087 00088 wns::logger::Logger logger; 00089 wns::simulator::Time duration; 00090 void onTimeout(); 00091 bool sending; 00092 wns::pyconfig::View _config; 00093 00094 00095 }; 00096 }//frame 00097 }//wimemac 00098 00099 #endif
1.5.5