[FSO] QT Dbus connection to Gypsy
Michael Tansella
michael-tansella at gmx.de
Tue Oct 28 11:55:55 CET 2008
> Are you extracting the data out of the
> struct with the ">>" operators
Thank you again for that hint:
For interested the way I implemented it:
Greets Michael
struct GPSSatellite{
int ID;
bool InUse;
unsigned int Elevation;
unsigned int Azimuth;
unsigned int SNR;
};
GPSSatellite SatellitesArray[32];
GPSSatellite Satellite;
void
MokoGPS::GetSatellites()
{
QDBusMessage SatelliteReply;
SatelliteReply = GPSInterface->call("GetSatellites");
QList <QVariant> args = SatelliteReply.arguments();
QVariant attrs = args[0];
const QDBusArgument arg = args[0].value <QDBusArgument> ();
arg.beginArray ();
NumberOfSats = 0;
while ( !arg.atEnd ()) {
NumberOfSats +=1; /// SatellitesArray[] beginnt bei 1
arg.beginArray ();
arg >> SatellitesArray[NumberOfSats].ID >>
SatellitesArray[NumberOfSats].InUse >>
SatellitesArray[NumberOfSats].Elevation >>
SatellitesArray[NumberOfSats].Azimuth >> SatellitesArray[NumberOfSats].SNR;
arg.endArray ();
}
arg.endArray ();
qDebug() <<"Number of Satellites"<< NumberOfSats;
}
More information about the community
mailing list