ChannelState.h

00001 #ifndef _CHANNELSTATE_H_
00002 #define _CHANNELSTATE_H_
00003 
00004 #include <sstream>
00005 
00014 class ChannelState {
00015 protected:
00016 
00018   bool idle;
00019 
00021   double rssi;
00022 public:
00023 
00031   ChannelState(bool isIdle = false, double rssi = 0.0) :
00032     idle(isIdle), rssi(rssi) {}
00033 
00038   bool isIdle() const;
00039 
00043   double getRSSI() const;
00044 
00050   std::string info() const {
00051     std::stringstream os;
00052     if (idle) {
00053       os << "[idle with rssi of ";
00054     } else {
00055       os << "[busy with rssi of ";
00056     }
00057     os << rssi << "]";
00058     return os.str();
00059   }
00060 };
00061 
00062 #endif /*_CHANNELSTATE_H_*/