Advertisement
Guest User

gr-ctrlport client

a guest
Apr 3rd, 2013
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement