![]() |
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 * email: info@openwns.org 00009 * www: http://www.openwns.org 00010 * _____________________________________________________________________________ 00011 * 00012 * openWNS is free software; you can redistribute it and/or modify it under the 00013 * terms of the GNU Lesser General Public License version 2 as published by the 00014 * Free Software Foundation; 00015 * 00016 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00017 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00018 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00019 * details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public License 00022 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00023 * 00024 ******************************************************************************/ 00025 00026 #ifndef WIMAC_FRAME_TIMINGCONTROL_H 00027 #define WIMAC_FRAME_TIMINGCONTROL_H 00028 00029 #include <WNS/ldk/ldk.hpp> 00030 #include <WNS/ldk/fcf/TimingControl.hpp> 00031 #include <WNS/events/CanTimeout.hpp> 00032 00033 00034 namespace wns { 00035 namespace pyconfig { 00036 class View; 00037 } 00038 00039 namespace ldk { 00040 namespace fcf { 00041 class FrameBuilder; 00042 class CompoundCollectorInterface; 00043 } 00044 } 00045 } 00046 00047 namespace wimac { 00048 namespace frame { 00049 00059 class TimingControl : 00060 public virtual wns::ldk::fcf::TimingControlInterface, 00061 public wns::events::PeriodicTimeout, 00062 public wns::events::CanTimeout 00063 { 00064 public: 00065 00066 enum Activation { 00067 Start, 00068 StartCollection, 00069 FinishCollection, 00070 Pause 00071 }; 00072 00073 TimingControl( wns::ldk::fcf::FrameBuilder* fb, const wns::pyconfig::View& config ); 00074 00075 void configure(); 00076 void start(); 00077 void pause(); 00078 void stop(); 00079 void getRole(); 00080 void finishedPhase( wns::ldk::fcf::CompoundCollectorInterface* collector ); 00081 wns::ldk::fcf::FrameBuilder* getFrameBuilder() const 00082 { 00083 return frameBuilder_; 00084 } 00085 00086 void periodically(); 00087 00088 void onTimeout(); 00089 00090 void onFUNCreated(); 00091 00092 int getOffset(); 00093 00094 private: 00095 struct ActivationEntry 00096 { 00097 wns::ldk::fcf::CompoundCollectorInterface* compoundCollector; 00098 int mode; 00099 int action; 00100 double duration; 00101 }; 00102 typedef std::list<ActivationEntry> Activations; 00103 00104 void startProcessingActivations(); 00105 void processOneActivation(); 00106 00115 Activations activations_; 00116 00120 Activations::const_iterator activeCC_; 00121 00122 // iterator is used for validation only ( assure(timeoutIsForMe == activeCC_, ...) ) 00123 //Activations::const_iterator timeoutIsForMe; 00124 00125 wns::ldk::fcf::FrameBuilder* frameBuilder_; 00126 00127 bool running_; 00128 wns::pyconfig::View config_; 00129 00130 wns::simulator::Time frameStartupDelay_; 00131 wns::simulator::Time frameStartTime_; 00132 00133 friend class TriggerActivationStart; 00134 }; 00135 } 00136 } 00137 00138 #endif 00139
1.5.5