int main()
{
  DBus::init();

  DBus::Dispatcher::pointer dispatcher;
  dispatcher = DBus::Dispatcher::create();

  DBus::Connection::pointer connection;
  connection = dispatcher->create_connection( DBus::BUS_SESSION );

  //create an object proxy, which stands in for a real object.
  //a proxy exists over the dbus
  DBus::ObjectProxy::pointer object;
  object = connection->create_object_proxy("dbuscxx.quickstart_0.server", "/dbuscxx/quickstart_0");

  //a method proxy acts like a real method, but will go over the dbus
  //to do its work.
  DBus::MethodProxy<double,double,double>& add_proxy
    = *(object->create_method<double,double,double>("dbuscxx.Quickstart","add"));

  double answer;
  answer = add_proxy( 1.1, 2.2 );

  std::cout << "1.1 + 2.2 = " << answer << std::endl;

  return 0;
}
Exemple #2
0
InBasket::InBasket() {

  //Connect to DBus
  DBus::init();
  m_dispatcher = DBus::Dispatcher::create();
  DBus::Connection::pointer connection = m_dispatcher->create_connection( DBus::BUS_SESSION );
  m_object = connection->create_object_proxy("org.lingtd", "/");
}