QDBus call return error

SoulEdge wakkas.m at gmail.com
Sat Jun 4 18:25:54 CEST 2011


	Hi all,

	I'm writing my first plasmoid and I'd like to make a plasmoid that show 
the Energy Rate using the lib org.freedesktop.upower.

My script is something like this:

QDBusInterface *battInterface	=	new QDBusInterface("org.freedesktop.UPower",
						"/org/freedesktop/UPower/devices/battery_BAT1",
						"org.freedesktop.UPower.Device", 
						QDBusConnection::systemBus(), this);
    
QDBusReply<double> wattUsage	=	battInterface->call( "EnergyRate" );
    
if ( wattUsage.isValid() )
{
	if( wattUsage.value() > 0 ) {
	wattString	=	QString::number( wattUsage.value() , 'd' , 2 ) + "W";
	}
	else 	{
	wattString	=	"AC";
	}
}
else
	wattString	=	wattUsage.error().message();

but I receive the error <Method "EnergyRate" with signature "" on interface 
"org.freedesktop.UPower.Device" Doesn't exist">

According to you, where is the problem?

Thank you :)

SoulEdge


More information about the Plasma-devel mailing list