rfid_reader_phy.hpp

00001 
00002 #ifndef RFID_READER_PHY_H
00003 #define RFID_READER_PHY_H
00004 
00005 #include <boost/shared_ptr.hpp>
00006 #include <boost/weak_ptr.hpp>
00007 
00008 #include "physical_layer.hpp"
00009 #include "simulator.hpp"
00010 
00014 class RfidReaderPhy : public PhysicalLayer {
00015 public:
00017    typedef boost::shared_ptr<RfidReaderPhy> RfidReaderPhyPtr;
00018 
00023    static inline RfidReaderPhyPtr create(
00024       NodePtr node, WirelessChannelManagerPtr wirelessChannelManager);
00025    
00029    virtual ~RfidReaderPhy();
00030 
00037    inline RfidReaderPhyPtr thisRfidReaderPhy();
00038 
00045    inline PhysicalLayerPtr thisPhysicalLayer();
00046 
00053    inline SimulationEndListenerPtr thisSimulationEndListener();
00054 
00058    virtual void simulationEndHandler();
00059 
00073    bool setRegularChannel(t_uint channelId);
00074 
00082    void resetRegularChannel();
00083 
00097    bool setAllSendersChannel(t_uint channelId);
00098 
00106    void resetAllSendersChannel();
00107 
00108 protected:
00109 
00111    RfidReaderPhy(NodePtr node,
00112       WirelessChannelManagerPtr wirelessChannelManager);
00113 
00114 private:
00115 
00118    boost::weak_ptr<RfidReaderPhy> m_weakThis;
00119 
00121    static const double m_DEFAULT_READER_RX_THRESHOLD;
00122 
00124    static const double m_DEFAULT_READER_CS_THRESHOLD;
00125 
00129    bool m_regularChannelIsValid;
00130 
00134    t_uint m_regularChannel;
00135 
00139    bool m_allSendersChannelIsValid;
00140 
00144    t_uint m_allSendersChannel;
00145 
00146 };
00147 typedef boost::shared_ptr<RfidReaderPhy> RfidReaderPhyPtr;
00148 
00150 // Inline Functions
00152 
00153 inline RfidReaderPhyPtr RfidReaderPhy::create(
00154    NodePtr node, WirelessChannelManagerPtr wirelessChannelManager)
00155 {
00156    RfidReaderPhyPtr p(new RfidReaderPhy(node, wirelessChannelManager));
00157    p->m_weakThis = p;
00158    // weakThis *must* be set before this* functions are called.
00159    Simulator::instance()->addSimulationEndListener(
00160       p->thisSimulationEndListener());
00161    return p;
00162 }
00163 
00164 inline RfidReaderPhyPtr RfidReaderPhy::thisRfidReaderPhy()
00165 {
00166    RfidReaderPhyPtr p(m_weakThis);
00167    return p;
00168 }
00169 
00170 inline PhysicalLayerPtr RfidReaderPhy::thisPhysicalLayer()
00171 {
00172    PhysicalLayerPtr p(m_weakThis);
00173    return p;
00174 }
00175 
00176 inline SimulationEndListenerPtr RfidReaderPhy::thisSimulationEndListener()
00177 {
00178    SimulationEndListenerPtr p(m_weakThis);
00179    return p;
00180 }
00181 
00183 // Overloaded Operators
00185 
00186 #endif // RFID_READER_PHY_H
00187 

Generated on Tue Dec 12 17:04:38 2006 for rfidsim by  doxygen 1.4.7