![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /****************************************************************************** 00002 * WIFIMAC * 00003 * __________________________________________________________________________ * 00004 * * 00005 * Copyright (C) 1999-2007 * 00006 * Chair of Communication Networks (ComNets) * 00007 * Kopernikusstr. 16, D-52074 Aachen, Germany * 00008 * phone: ++49-241-80-27910 (phone), fax: ++49-241-80-22242 * 00009 * email: rise@comnets.rwth-aachen.de * 00010 * www: http://rise.comnets.rwth-aachen.de * 00011 ******************************************************************************/ 00012 00013 #ifndef WIFIMAC_CONVERGENCE_ICHANNELSTATE_HPP 00014 #define WIFIMAC_CONVERGENCE_ICHANNELSTATE_HPP 00015 00016 #include <WNS/Subject.hpp> 00017 00018 namespace wifimac { namespace convergence { 00019 00020 // The indicator for the channel state 00021 enum CS { 00022 idle, 00023 busy 00024 }; 00025 00027 class IChannelState 00028 { 00029 public: 00030 virtual ~IChannelState(){}; 00031 00032 virtual void onChannelBusy() = 0; 00033 virtual void onChannelIdle() = 0; 00034 }; 00035 00036 class ChannelStateNotification : 00037 virtual public wns::Subject<IChannelState> 00038 { 00039 public: 00040 // @brief functor for IChannelState::onChangedCS calls 00041 struct OnChangedCS 00042 { 00043 OnChangedCS(const CS _newCS): 00044 newCS(_newCS) 00045 {} 00046 00047 void operator()(IChannelState* cs) 00048 { 00049 // The functor calls the onChannelBusy/onChannelIdle implemented by the 00050 // Observer 00051 if (newCS == idle) 00052 cs->onChannelIdle(); 00053 else 00054 cs->onChannelBusy(); 00055 } 00056 private: 00057 CS newCS; 00058 }; 00059 00060 }; 00061 00062 00063 } 00064 } 00065 00066 #endif // not defined WIFIMAC_CONVERGENCE_ICHANNELSTATE_HPP
1.5.5