Re: [FSO] QT Dbus connection to Gypsy

2008-10-28 Thread Michael Tansella
 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;

}



___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: [FSO] QT Dbus connection to Gypsy

2008-10-28 Thread Nicola Mfb
2008/10/28 Michael Tansella [EMAIL PROTECTED]

  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:


Here my snippet to read Phonebooks from sim:

struct PhonebookEntry
{
int index;
QString name;
QString number;
};

Q_DECLARE_METATYPE ( PhonebookEntry );
Q_DECLARE_METATYPE ( QListPhonebookEntry );

const QDBusArgument operator(const QDBusArgument argument,
PhonebookEntry pe) {
argument.beginStructure();
argument  pe.index  pe.name  pe.number;
argument.endStructure();
return argument;
}

const QDBusArgument operator(QDBusArgument argument, const
PhonebookEntry pe) {
argument.beginStructure();
argument  pe.index  pe.name  pe.number;
argument.endStructure();
return argument;
}

qDBusRegisterMetaTypePhonebookEntry();  //somewhere in the code

QDBusMessage m=gsm_sim-call ( RetrievePhonebook,received );
QListPhonebookEntry lpe=qdbus_castQListPhonebookEntry
(m.arguments()[0]);
qDebug() lpe;

You may be interested to the following too:

const QDebug operator(QDebug debug, const PhonebookEntry pe) {
debug  pe.index pe.number pe.name;
return debug;
}

const QDebug operator(QDebug debug, const QListPhonebookEntry lpe) {
foreach(PhonebookEntry pe, lpe) debug  pe;
return debug;
}

Where to put this? fso/wiki? om/wiki?

Regards

Nicola
___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: [FSO] QT Dbus connection to Gypsy

2008-10-24 Thread Michael Tansella
On Wednesday 22 October 2008 22:36:51 Michael 'Mickey' Lauer wrote:
 How exactly does it not work? Are you extracting the data out of the
 struct with the  operators as described in
 http://doc.trolltech.com/4.2/qdbusargument.html ?

Thank you very much,

I didn't notice the Class qdbusargument and got it working the following way:

QDBusMessage PositionReply;
PositionReply = GPSPositionInterface-call(GetPosition);
QListQVariant ReplyData;

But now I want to read the Satellite information and there I have to use  
qdbusargument, so thank you for that hint.

By the way I'm writing a complete class to read all GPS Infos and I will make 
it public on the wiki when it's done.

All the best
Michael   

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: [FSO] QT Dbus connection to Gypsy

2008-10-22 Thread Michael 'Mickey' Lauer
How exactly does it not work? Are you extracting the data out of the
struct with the  operators as described in
http://doc.trolltech.com/4.2/qdbusargument.html ?

:M:


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: [FSO] QT Dbus connection to Gypsy

2008-10-21 Thread Michael Tansella
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.41309354), dbus.Double(172.148))

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

QDBusReplyTYPE 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() 
{
QDBusReplyint reply = GPSDeviceInterface-call(GetFixStatus);
FixStatus=reply.value();
qDebug()GetFixStatus Reply: FixStatus\n;
return FixStatus;
}


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


[FSO] QT Dbus connection to Gypsy

2008-10-17 Thread Michael Tansella
Hi,
I'm new to QT and Dbus and I want to establish a simple connection to Gypsy. I 
looked at the Code of Kbluetooth 
http://kdebluetooth.sourcearchive.com/documentation/1:0.1-0ubuntu1/obexsession_8cpp-source.html
and tried to port it to my intensions. But unfortunately it didnt't work. 
MokoNav::isConnected() always returns FALSE.
Can you tell me if I'm on the right way or what I'm doing wrong??

Thanks
Michael Tansella 

void MokoNav::ConnectGPS()
{
QDBusConnection* dbus = new QDBusConnection(dbus);
QDBusConnection dbusconn = 
dbus-connectToBus(QDBusConnection::SessionBus, dbus);
Service = org.freedesktop;
sessionPath = /org/freedesktop/Gypsy;
sessionIface = org.freedesktop.Gypsy;
session = new QDBusInterface(Service,sessionPath,sessionIface,dbusconn);
session-call(Connect);
std::cerr  check GPS...;
bool test = isConnected(); 
std::cerr  test;
}

bool MokoNav::isConnected()
{
QDBusReplybool reply = session-call(IsConnected);
if (reply.isValid())
return reply.value();
else
return false;
}

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: [FSO] QT Dbus connection to Gypsy

2008-10-17 Thread Michael Tansella
On Friday 17 October 2008 14:27:51 Michael Tansella wrote:
 QDBusConnection dbusconn =
 dbus-connectToBus(QDBusConnection::SessionBus, dbus);
 Service = org.freedesktop;

I found 1 error, it must be SystemBus instead of SessionBus. But unfortunately 
I still cannot establish a connection.

As soon as I get it working I will add a sample Code in C++ to the Wiki.

All the best
Michael

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community