#include <RadioState.h>
Public Types | |
enum | State { IDLE, RECV, TRANSMIT, SLEEP } |
Public Member Functions | |
RadioState (int radioModuleId) | |
int | getRadioId () const |
State | getState () const |
void | setState (State s) |
int | getChannelNumber () const |
void | setChannelNumber (int chan) |
double | getBitrate () const |
void | setBitrate (double d) |
std::string | info () const |
Static Public Member Functions | |
static const char * | stateName (State state) |
Private Attributes | |
int | radioId |
State | state |
int | channelNumber |
double | bitrate |
|
Possible states of the radio
|
|
Constructor 00070 : cPolymorphic() { 00071 radioId = radioModuleId; state = IDLE; channelNumber = -1; bitrate = -1; 00072 }
|
|
function to get the bitrate 00090 { return bitrate; }
|
|
function to get the channel number (frequency) 00084 { return channelNumber; }
|
|
id of the radio/snrEval module -- identifies the radio in case there're more than one in the host 00075 { return radioId; }
|
|
Returns radio state 00078 { return state; }
|
|
Enables inspection 00107 { 00108 std::stringstream out; 00109 out << stateName(state) << ", channel #" << channelNumber << ", " << (bitrate/1e6) << "Mbps "; 00110 return out.str(); 00111 }
|
|
set the bitrate 00093 { bitrate = d; }
|
|
set the channel number (frequency) 00087 { channelNumber = chan; }
|
|
Sets the radio state 00081 { state = s; }
|
|
Returns the name of the radio state in a readable form 00096 { 00097 switch(state) { 00098 case IDLE: return "IDLE"; 00099 case RECV: return "RECV"; 00100 case TRANSMIT: return "TRANSMIT"; 00101 case SLEEP: return "SLEEP"; 00102 default: return "???"; 00103 } 00104 }
|
|
|
|
|
|
|
|
|