[FSO] QT Dbus connection to Gypsy

Michael Tansella michael-tansella at gmx.de
Tue Oct 21 16:09:17 CEST 2008


Ok now I got it:
I can call simple methodes (see below)
But one problem I still have. i don't know what type 
Gypsy.Position.GetPosition returns.

When I call it with mdbus it returns:

#mdbus -s org.freedesktop.Gypsy /org/freedesktop/Gypsy 
org.freedesktop.Gypsy.Position.GetPosition

(dbus.Int32(0), dbus.Int32(0), dbus.Double(49.0120504), 
dbus.Double(8.4130935000000004), dbus.Double(172.148))

But when I call GetPosition I have to choose a TYPE and I don't know which!

QDBusReply<TYPE> reply = GPSDeviceInterface->call("GetPosition");

I tried to create one but it didn't work:

	typedef struct {
		long int  Fields;
		long int  TimeStamp;
		double Lat;
		double Lon;
		double Alt;
	} GypsyPosition;

any hints???

Greets
Michael
_______________________________________________________________-

For interested Some extractions of my current working Code:

#include <QtDBus>
#include <QDBusConnection>
#include <QDBusInterface>


// Connection to system bus
QDBusConnection GPSConnection = QDBusConnection::systemBus();

//check connection
if (GPSConnection.isConnected())
		qDebug() << "connected to system bus \n";
	else
		qFatal("Failed to connect to session bus");

// create a proxy object for method calls
GPSDeviceInterface = new 
QDBusInterface("org.freedesktop.Gypsy","/org/freedesktop/Gypsy","org.freedesktop.Gypsy.Device",QDBusConnection::systemBus());

//Call Method - returns 3 if Fix else returns 1
int
MokoGPS::GetFixStatus() 
{
	QDBusReply<int> reply = GPSDeviceInterface->call("GetFixStatus");
	FixStatus=reply.value();
	qDebug()<<"GetFixStatus Reply: "<<FixStatus<<"\n";
	return FixStatus;
}





More information about the community mailing list