[Qgis-developer] FW: Connect to GPS device

Josua S josh-talk at hotmail.com
Sat Jun 29 08:45:07 PDT 2013


Thanks again for your answer.

(Sorry I forgot to send the last message to the mailing list)



From: josh-talk at hotmail.com
To: madmanwoo at gmail.com
Subject: RE: [Qgis-developer] Connect to GPS device
Date: Fri, 28 Jun 2013 03:33:00 +0200

Hello Nathan

Thank you very much! I saw that your Plugin is for QGIS 2.0. Have you always tested this code with QGIS 2.0 and not 1.8? I still have not succeded to get a GPS connection. With the QGIS (1.8) GPS Information Dialog it's possible to connect to the GPS device but not from the Python code. So my question is if there may be a problem with the Python bindings in QGIS? Well, if QGIS 2.0 is coming soon this is not such a big problem :-)

Josua



From: madmanwoo at gmail.com
Date: Fri, 28 Jun 2013 08:56:53 +1000
Subject: Re: [Qgis-developer] Connect to GPS device
To: josh-talk at hotmail.com
CC: qgis-developer at lists.osgeo.org

I have done it before.  https://github.com/NathanW2/qmap/blob/master/src/qmap/gps_action.py#L37

Although it's pretty much the same as what you have there.

- Nathan


On Fri, Jun 28, 2013 at 3:49 AM, Josua S <josh-talk at hotmail.com> wrote:
Or does anyone have other experiences with connecting to a GPS device in Python code?
I would be very grateful for any help.

Regards, Josua




From: josh-talk at hotmail.com
To: qgis-developer at lists.osgeo.org
Date: Wed, 26 Jun 2013 14:16:04 +0200
Subject: Re: [Qgis-developer] Connect to GPS device

Here's the code again, in case it is not displayed correctly: http://pastebin.com/sKfY2jDj




From: josh-talk at hotmail.com
To: qgis-developer at lists.osgeo.org
Date: Wed, 26 Jun 2013 14:12:20 +0200
Subject: [Qgis-developer] Connect to GPS device



Hello

I am working on a Python plugin for QGIS 1.8. My goal is to automatically connect to a gps device at
a COM port. I tried to clone some code of qgsgpsinformationwidget.cpp and looks like this:

---------------------------------------
from qgis.core import *
from qgis.utils import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *

devices_combo_box = qgis.utils.iface.mainWindow().findChild(QComboBox, 'mCboDevices')
com_port = devices_combo_box.itemData(devices_combo_box.currentIndex()).toString()
detector = QgsGPSDetector(com_port)
QObject.connect(detector, SIGNAL("detected( QgsGPSConnection )"), self.connection_detected)
QObject.connect(detector, SIGNAL("detectionFailed()"), self.connection_detection_failed)
detector.advance()

def connection_detected(self, gps_connection):
    QMessageBox.information(None, "Information", "Connection detected", QMessageBox.Ok)

def connection_detection_failed(self):
    QMessageBox.information(None, "Information", "Connection detection failed", QMessageBox.Ok)
---------------------------------------

So I first choose the correct port in the QGIS GPS Information Widget (mCboDevices) and then run this
code but nothing happens.

If I initialize detector with something like QgsGPSDetector('test') than connection_detection_failed is
called (as expected). With QgsGPSDetector('COM5') or QgsGPSDetector('\\\\.\\COM5')
connection_detection_failed is not called but connection_detected either. Do you have any idea what
I am doing wrong? Thank you very much.

Regards, Josua

_______________________________________________ Qgis-developer mailing list Qgis-developer at lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer

_______________________________________________ Qgis-developer mailing list Qgis-developer at lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
Qgis-developer mailing list
Qgis-developer at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer 		 	   		  


More information about the Qgis-developer mailing list