Changeset 15 in flair-src for trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp
- Timestamp:
- Apr 8, 2016, 3:40:57 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp
r3 r15 28 28 using namespace flair::gui; 29 29 30 namespace flair 31 { 32 namespace sensor 33 { 30 namespace flair { 31 namespace sensor { 34 32 35 RadioReceiver::RadioReceiver(const FrameworkManager* parent,string name,unsigned int nb_channels) : IODevice(parent,name) 36 { 37 is_connected=false; 38 this->nb_channels=nb_channels; 33 RadioReceiver::RadioReceiver(const FrameworkManager *parent, string name, 34 unsigned int nb_channels) 35 : IODevice(parent, name) { 36 is_connected = false; 37 this->nb_channels = nb_channels; 39 38 40 //init matrix 41 cvmatrix_descriptor* desc=new cvmatrix_descriptor(nb_channels,1); 42 for(int i=0;i<nb_channels;i++) 43 { 44 ostringstream channel_name; 45 channel_name << "channel " << i; 46 desc->SetElementName(i,0,channel_name.str()); 47 } 48 output=new cvmatrix(this,desc,floatType,name); 39 // init matrix 40 cvmatrix_descriptor *desc = new cvmatrix_descriptor(nb_channels, 1); 41 for (int i = 0; i < nb_channels; i++) { 42 ostringstream channel_name; 43 channel_name << "channel " << i; 44 desc->SetElementName(i, 0, channel_name.str()); 45 } 46 output = new cvmatrix(this, desc, floatType, name); 49 47 50 //station sol51 main_tab=new Tab(parent->GetTabWidget(),name);52 tab=new TabWidget(main_tab->NewRow(),name);53 setup_tab=new Tab(tab,"Setup");48 // station sol 49 main_tab = new Tab(parent->GetTabWidget(), name); 50 tab = new TabWidget(main_tab->NewRow(), name); 51 setup_tab = new Tab(tab, "Setup"); 54 52 55 53 AddDataToLog(output); 56 54 } 57 55 58 RadioReceiver::~RadioReceiver() 59 { 60 delete main_tab; 56 RadioReceiver::~RadioReceiver() { delete main_tab; } 57 58 Layout *RadioReceiver::GetLayout(void) const { return setup_tab; } 59 60 float RadioReceiver::ChannelValue(unsigned int id) const { 61 if (id < nb_channels) { 62 return output->Value(id, 0); 63 } else { 64 Err("channel %i/%i is out of bound\n", id, nb_channels); 65 return -1; 66 } 61 67 } 62 68 63 Layout* RadioReceiver::GetLayout(void) const 64 { 65 return setup_tab; 66 } 67 68 float RadioReceiver::ChannelValue(unsigned int id) const 69 { 70 if(id<nb_channels) 71 { 72 return output->Value(id,0); 73 } 74 else 75 { 76 Err("channel %i/%i is out of bound\n",id,nb_channels); 77 return -1; 78 } 79 } 80 81 bool RadioReceiver::IsConnected(void) const 82 { 83 return is_connected; 84 } 69 bool RadioReceiver::IsConnected(void) const { return is_connected; } 85 70 86 71 } // end namespace sensor
Note:
See TracChangeset
for help on using the changeset viewer.