Want more features on Pastebin? Sign Up, it's FREE!
Guest

gr-ctrlport client

By: a guest on Apr 3rd, 2013  |  syntax: C++  |  size: 1.18 KB  |  views: 40  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <Ice/Ice.h>
  2. #include <gnuradio.h>
  3.  
  4. using namespace std;
  5.  
  6. int main(int argc, char* argv[])
  7. {
  8.     int status = 0;
  9.     Ice::CommunicatorPtr ic;
  10.  
  11.     GNURadio::KnobIDList   empty_list;  // vector<string>
  12.     GNURadio::KnobPropMap  knob_props;  // map<string, GNURadio::KnobProp>
  13.     GNURadio::KnobMap      knob_map;    // map<string, GNURadio::KnobPtr>
  14.  
  15.     try
  16.     {
  17.         // Get proxy object
  18.         ic = Ice::initialize(argc, argv);
  19.         Ice::ObjectPrx base = ic->stringToProxy("gnuradio:tcp -h localhost -p 43243");
  20.         GNURadio::ControlPortPrx ctrlport = GNURadio::ControlPortPrx::checkedCast(base);
  21.         if (!ctrlport)
  22.             throw "Invalid proxy";
  23.  
  24.         // Get list of knobs
  25.         knob_map = ctrlport->get(empty_list);
  26.  
  27.         GNURadio::KnobPtr knob = knob_map["strx_source_c0::Frequency"];
  28.         GNURadio::KnobDPtr knobd = static_cast<GNURadio::KnobDPtr>(knob);   // GCC error
  29.     }
  30.     catch (const Ice::Exception& ex)
  31.     {
  32.         cerr << ex << endl;
  33.         status = 1;
  34.     }
  35.     catch (const char* msg)
  36.     {
  37.         cerr << msg << endl;
  38.         status = 1;
  39.     }
  40.  
  41.     if (ic)
  42.         ic->destroy();
  43.  
  44.     return status;
  45. }
clone this paste RAW Paste Data