src/devices/wifi/wifi-phy.h
changeset 5820 1c02054740eb
parent 5189 8fcdf87a790a
child 6273 8d70de29d514
--- a/src/devices/wifi/wifi-phy.h	Mon Nov 30 18:20:30 2009 +0100
+++ b/src/devices/wifi/wifi-phy.h	Mon Nov 30 18:40:35 2009 +0100
@@ -120,39 +120,39 @@
    */
   enum State {
     /**
-     * The PHY layer is synchronized upon a packet.
+     * The PHY layer is IDLE.
      */
-    SYNC,
+    IDLE,
+    /**
+     * The PHY layer has sense the medium busy through the CCA mechanism
+     */
+    CCA_BUSY,
     /**
      * The PHY layer is sending a packet.
      */
     TX,
     /**
-     * The PHY layer has sense the medium busy through
-     * the CCA mechanism
+     * The PHY layer is receiving a packet.
      */
-    CCA_BUSY,
-    /**
-     * The PHY layer is IDLE.
-     */
-    IDLE,
+    RX,
     /**
      * The PHY layer is switching to other channel.
      */
     SWITCHING
   };
+
   /**
    * arg1: packet received successfully
    * arg2: snr of packet
    * arg3: mode of packet
    * arg4: type of preamble used for packet.
    */
-  typedef Callback<void,Ptr<Packet>, double, WifiMode, enum WifiPreamble> SyncOkCallback;
+  typedef Callback<void,Ptr<Packet>, double, WifiMode, enum WifiPreamble> RxOkCallback;
   /**
    * arg1: packet received unsuccessfully
    * arg2: snr of packet
    */
-  typedef Callback<void,Ptr<const Packet>, double> SyncErrorCallback;
+  typedef Callback<void,Ptr<const Packet>, double> RxErrorCallback;
 
   static TypeId GetTypeId (void);
 
@@ -170,12 +170,12 @@
    * \param callback the callback to invoke
    *        upon successful packet reception.
    */
-  virtual void SetReceiveOkCallback (SyncOkCallback callback) = 0;
+  virtual void SetReceiveOkCallback (RxOkCallback callback) = 0;
   /**
    * \param callback the callback to invoke
    *        upon erronous packet reception.
    */
-  virtual void SetReceiveErrorCallback (SyncErrorCallback callback) = 0;
+  virtual void SetReceiveErrorCallback (RxErrorCallback callback) = 0;
 
   /**
    * \param packet the packet to send
@@ -195,26 +195,30 @@
   virtual void RegisterListener (WifiPhyListener *listener) = 0;
 
   /**
+   * \returns true of the current state of the PHY layer is WifiPhy::IDLE, false otherwise.
+   */
+  virtual bool IsStateIdle (void) = 0;
+  /**
    * \returns true of the current state of the PHY layer is WifiPhy::CCA_BUSY, false otherwise.
    */
   virtual bool IsStateCcaBusy (void) = 0;
   /**
-   * \returns true of the current state of the PHY layer is WifiPhy::IDLE, false otherwise.
-   */
-  virtual bool IsStateIdle (void) = 0;
-  /**
    * \returns true of the current state of the PHY layer is not WifiPhy::IDLE, false otherwise.
    */
   virtual bool IsStateBusy (void) = 0;
   /**
-   * \returns true of the current state of the PHY layer is WifiPhy::SYNC, false otherwise.
+   * \returns true of the current state of the PHY layer is WifiPhy::RX, false otherwise.
    */
-  virtual bool IsStateSync (void) = 0;
+  virtual bool IsStateRx (void) = 0;
   /**
    * \returns true of the current state of the PHY layer is WifiPhy::TX, false otherwise.
    */
   virtual bool IsStateTx (void) = 0;
   /**
+   * \returns true of the current state of the PHY layer is WifiPhy::SWITCHING, false otherwise.
+   */
+  virtual bool IsStateSwitching (void) = 0;
+  /**
    * \returns the amount of time since the current state has started.
    */
   virtual Time GetStateDuration (void) = 0;
@@ -253,7 +257,7 @@
    *          the requested ber for the specified transmission mode. (W/W)
    */
   virtual double CalculateSnr (WifiMode txMode, double ber) const = 0;
-  
+
   /** 
    * \brief Set channel number. 
    * 
@@ -449,7 +453,12 @@
 
 };
 
+/**
+ * \param os          output stream
+ * \param state       wifi state to stringify
+ */
+std::ostream& operator<< (std::ostream& os, enum WifiPhy::State state);
+
 } // namespace ns3
 
-
 #endif /* WIFI_PHY_H */