Select to view content in your preferred language

High cpu using NmeaLocationDataSource

435
2
06-02-2022 12:03 AM
Moer
by
New Contributor

UWP, Esri.ArcGISRuntime 100.14.0

Having problem with high cpu usage when using NmeaLocationDataSource with FromStreamCreator on UWP. Can't use FromSerialPort because it's a virtual com port and UWP won't allow that.

When getting gps data from com port it's using 20-50% cpu.

Any ideas?

Ping @dotMorten_esri 

0 Kudos
2 Replies
dotMorten_esri
Esri Notable Contributor

How did you implement the stream? I've seen issues where the read on the stream isn't blocking and could cause this

0 Kudos
Moer
by
New Contributor

I used the pattern in the api reference:

https://developers.arcgis.com/net/api-reference/api/uwp/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Locati...

var port = new System.IO.Ports.SerialPort("COM7", 9600);
NmeaLocationDataSource serialPortDatasource = NmeaLocationDataSource.FromStreamCreator(
    onStart: (ds) =>
    {
        port.Open();
        return Task.FromResult(port.BaseStream);
    },
    onStop: (ds) =>
    {
        port.Close();
        return Task.CompletedTask;
    }
);
0 Kudos