From: Andreas V. <li...@br...> - 2009-10-07 06:15:34
|
Am Tue, 6 Oct 2009 23:19:38 -0400 schrieb asdfffdsa: Hello (what ever your name is), is the source from the fdo.org GIT repository or that from gitorious.org? I ask because the generator is different. Could you send me a minimal example with Makefile, XML and source that compiles? Then I try it on my system. To be honest I didn't work much with Variant in the past. So I don't see the problem from only looking on your source. I've to try it. regards Andreas > 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. |