I'm trying to get GPS position information on a Windows 10 laptop using a Bluetooth GPS. I'm using the following QML:
MapView {
id: mapView
anchors.fill: parent
// set focus to enable keyboard navigation
focus: true
Map {
BasemapTopographic {}
}
locationDisplay {
positionSource: PositionSource {
id: positionSource
name: "SerialPortNmea"
preferredPositioningMethods: PositionSource.SatellitePositioningMethods
updateInterval: 1000 // 1 second
active: true
onPositionChanged: {
var coord = positionSource.position.coordinate;
console.log("Coordinate:", coord.longitude, coord.latitude);
}
}
// compass: Compass {
// id: compass
// }
}
}
After pairing the GPS with the laptop, when I run the program in Qt Creator I see the following Application Output:
class QGeoPositionInfoSource *__cdecl PositionInfoSourceFactory::positionInfoSource(class QObject *) QDeclarativePositionSource(0x17768f05b20)
portName "COM4"
description "Standard Serial over Bluetooth link"
manufacturer "Microsoft"
systemLocation "\\\\.\\COM4"
portName "COM5"
description "Standard Serial over Bluetooth link"
manufacturer "Microsoft"
systemLocation "\\\\.\\COM5"
QNetworkReplyHttpImplPrivate::_q_startOperation was called more than once QUrl("https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer?f=json")
void __cdecl SerialPortNmeaPositionInfoSource::startUpdates(void) false "" "The system cannot find the path specified."
int __cdecl main(int,char *[]) QQuickApplicationWindow_QML_99(0x177687fcfc0)
void __cdecl SerialPortNmeaPositionInfoSource::startUpdates(void) false "" "The system cannot find the path specified."
It seems as though the COM ports are showing up (when the GPS wasn't paired those messages weren't appearing in the log), but I'm not sure what path it cannot find, nor how to give it a path so it can use the NMEA stream from the GPS.
Can someone help me set up my app to get locations from this device?
I'm using Qt 5.12.1, Visual Studio 2017, ArcGIS Runtime for Windows (x86_64) Version 100.4
As a follow-up, now whenever I run the application from within Qt Creator I get a different error:
void __cdecl SerialPortNmeaPositionInfoSource::startUpdates(void) "COM4" 4800
int __cdecl main(int,char *[]) QQuickApplicationWindow_WML_99(0x20d78a6ca80)
void __cdecl SerialPortNmeaPositionInfoSource::startUpdates(void) false "COM4" "Device is already open"
This message persists even after disconnecting the Bluetooth GPS and restarting Qt Creator and the app.
Sorry to keep replying to my own post. The initial run showed two COM ports (4 and 5) and after that it continues to choose COM4, which doesn't work because it says the device is already open. When I attempt to read the COM data using a terminal emulator (Tera Term), I get nothing from COM4, but a NMEA stream from COM5. So it may be that all I need to know is how to tell the plugin to use COM5. How do I specify a COM port with the SerialPortNmea plugin?
For future reference in case no one replies on how to set a COM port via software, one "fix" is to use the Windows 10 device manager to reconfigure the COM ports on your computer such that the proper device and port happens to be at COM4 (or whatever port Qt/ArcGIS is trying to talk to). I don't know how stable this is, but I managed to get both a Bluetooth GPS and a USB GPS device working by doing this and it has persisted through at least one system reboot.