Is there a way to access the status and the XY-coordinates from a GPS-connection established by the GPS-widget in QGIS 3 via python? I want to establish the connection with the widget to have better control of the connection (like changing ports) and status checks, but need the coordinates inside a python plugin.
Thanks to the comment of Cary H I found a solution.
QGIS 2 uses
QGIS 3 now uses
So using the following code
connectionRegistry = QgsApplication.gpsConnectionRegistry() connectionList = connectionRegistry.connectionList() GPSInfo = connectionList.currentGPSInformation()
After that it is possible to access all information of the widget-gps-connection using for example
All available commands are listed at https://qgis.org/pyqgis/3.2/core/Gps/QgsGpsInformation.html