![]() |
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_CONVERGENCE_FRAMESYNCHRONIZATION_HPP 00030 #define WIMEMAC_CONVERGENCE_FRAMESYNCHRONIZATION_HPP 00031 00032 #include <WIMEMAC/convergence/IRxStartEnd.hpp> 00033 #include <WIMEMAC/lowerMAC/Manager.hpp> 00034 00035 #include <WNS/ldk/fu/Plain.hpp> 00036 #include <WNS/ldk/Dropper.hpp> 00037 #include <WNS/Birthmark.hpp> 00038 #include <WNS/events/CanTimeout.hpp> 00039 #include <WNS/PowerRatio.hpp> 00040 00041 #include <WNS/ldk/probe/Probe.hpp> 00042 #include <WNS/probe/bus/ContextCollector.hpp> 00043 00044 namespace wimemac { namespace convergence { 00045 00046 class FrameSynchronizationCommand: 00047 public wns::ldk::EmptyCommand 00048 { 00049 }; 00050 00051 enum SyncStateType { 00052 Idle, 00053 Synchronized, 00054 Garbled, 00055 waitForFinalDelivery 00056 }; 00057 00086 class FrameSynchronization: 00087 public wns::ldk::fu::Plain<FrameSynchronization, FrameSynchronizationCommand>, 00088 public wns::events::CanTimeout, 00089 public RxStartEndNotification, 00090 public wns::ldk::probe::Probe 00091 { 00092 public: 00093 FrameSynchronization(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config); 00094 virtual ~FrameSynchronization(); 00095 private: 00096 // CompoundHandlerInterface 00097 void doSendData(const wns::ldk::CompoundPtr& compound); 00098 void doOnData(const wns::ldk::CompoundPtr& compound); 00099 void onFUNCreated(); 00100 bool doIsAccepting(const wns::ldk::CompoundPtr& compound) const; 00101 void doWakeup(); 00102 00103 // CanTimeout Interface 00104 void onTimeout(); 00105 00106 void processPreamble(const wns::ldk::CompoundPtr& compound); 00107 void processPSDU(const wns::ldk::CompoundPtr& compound); 00108 void failedSyncToNewPreamble(wns::simulator::Time fExDur); 00109 void syncToNewPreamble(const wns::simulator::Time fExDur, const wns::service::dll::UnicastAddress transmitter); 00110 00111 00112 wns::logger::Logger logger; 00113 SyncStateType curState; 00114 wns::service::dll::UnicastAddress synchronizedToAddress; 00115 const wns::Ratio slcCapture; 00116 const wns::Ratio slgCapture; 00117 const wns::Ratio idleCapture; 00118 const wns::Ratio detectionThreshold; 00119 const bool signalRxErrorAlthoughNotSynchronized; 00120 wns::simulator::Time lastFrameEnd; 00121 00122 const std::string managerName; 00123 const std::string crcCommandName; 00124 00125 struct Friends 00126 { 00127 wimemac::lowerMAC::IManagerServices* manager; 00128 } friends; 00129 }; 00130 } // end namespace convergence 00131 } // end namespace wimemac 00132 00133 #endif // ifndef WIMEMAC_CONVERGENCE_FRAMESYNCHRONIZATION_HPP
1.5.5