On Wednesday 02 September 2009 15:58:05 Vas...@so... wrote:
> Hi, I am trying to use dbus-cxx 0.4.2 with a project and I have run into
> some trouble. I'm using the code from the calculator example, modified for
> what I am doing:
>
> DBus::init();
>
> int ret;
>
> DBus::Dispatcher dispatcher;
>
> DBus::Connection::pointer conn =
> dispatcher.create_connection(DBus::BUS_SESSION); std::cout << "Requesting
> name" << endl;
> // request a name on the bus
> ret = conn->request_name( "pa.agent.controller",
> DBUS_NAME_FLAG_REPLACE_EXISTING ); if
> (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
> cout << "Shit happened" << endl;
> }
> std::cout << "Declaring adapter" << endl;
>
> Controller controller;
> std::cout << "Creating adapter" << controller.startnode()<< endl;
>
>
> DBus::ControllerAdapter::pointer adapter =
> DBus::ControllerAdapter::create(&controller);
>
>
> The program gets stuck at
> DBus::ControllerAdapter::pointer adapter =
> DBus::ControllerAdapter::create(&controller);
>
> With this output:
>
> Requesting name
> Declaring adapter
> Creating adapter0
> terminate called after throwing an instance of 'DBus::Error'
> what(): Did not receive a reply. Possible causes include: the remote
> application did not send a reply, the message bus security policy blocked
> the reply, the reply timeout expired, or the network connection was
> broken.
>
> Thanks,
> Vasile
>
Sorry about replying to my own post but maybe someone may use this. The problem was in the constructor of the Controller
class, I had this code in place which I assumed messed with the copy constructor creation in the code generated by XML:
Controller::Controller() {
//initialize logger
//TODO move outside the constructor
logger = log4cxx::Logger::getLogger("Controller");
BasicConfigurator::configure();
logger->setLevel(log4cxx::Level::getTrace());
}
Vasile
|