|
From: asdfffdsa <n8...@gm...> - 2009-10-07 03:20:29
|
Hello, I am new to dbus-c++. I am very enthusiastic about this project (and
the dbus and hal projects). I've installed dbus-c++ from the Archlinux User
Repository ( dbus-c++ 20090929-1 ). I will be downloading the source over
night to further inspect the problem (my ISP has a very strict usage
policy).
I seem to be having a problem with the DBus::MessageIter::operator>>(
DBus::MessageIter & iter, DBus::Variant & val ) function ( declaration is in
types.h ). I've used the "dbusxx-xml2cpp" binary to generate proxy pattern
classes.
*Here is my code:*
// halDeviceProxy is a variable of a dbusxx-xml2cpp-generated proxy class
for the "org.freedesktop.Hal.device" interface
::DBus::Variant variant = halDeviceProxy.GetProperty(
std::string(propertyName) );
*Here is the dbusxx-xml2cpp-generated proxy code:*
::DBus::Variant GetProperty(const std::string& key)
{
::DBus::CallMessage call;
::DBus::MessageIter wi = call.writer();
wi << key;
call.member("GetProperty");
::DBus::Message ret = invoke_method(call);
::DBus::MessageIter ri = ret.reader();
::DBus::Variant argout;
ri >> argout; *// this line causes an exception to be thrown*
return argout;
}
*The "ri >> argout" call is causing the following error/exception:*
terminate called after throwing an instance of 'DBus::ErrorInvalidArgs'
what(): variant type expected
Aborted
Naturally, "ri >> argout" is passing in a variant type, so I'm not sure what
the problem is. The odd thing about this is that functions such as
GetAllProperties() work fine (which returns a
std::map<std::string,DBus::Variant>).
I will be looking over the source when I get a chance, but if anyone has any
ideas in the mean time, it would be very helpful.
|