[GnssDevice] Adjusting for full .NET code compatibility (#1122)
This commit is contained in:
Родитель
1b55034537
Коммит
4b55e77316
|
@ -41,7 +41,9 @@ namespace Iot.Device.Common.GnssDevice
|
|||
_serialPort = new SerialPort(portName, baudRate, parity, dataBits, stopBits);
|
||||
_serialPort.ReadBufferSize = 2048;
|
||||
_serialPort.ReadTimeout = 2000;
|
||||
#if NANOFRAMEWORK_1_0
|
||||
_serialPort.WatchChar = '\n';
|
||||
#endif
|
||||
_shouldDispose = true;
|
||||
}
|
||||
|
||||
|
@ -125,7 +127,11 @@ namespace Iot.Device.Common.GnssDevice
|
|||
var buffer = new byte[serialDevice.BytesToRead];
|
||||
var bytesRead = serialDevice.Read(buffer, 0, buffer.Length);
|
||||
var stringBuffer = Encoding.UTF8.GetString(buffer, 0, bytesRead);
|
||||
#if NANOFRAMEWORK_1_0
|
||||
var commands = stringBuffer.Split(serialDevice.WatchChar);
|
||||
#else
|
||||
var commands = stringBuffer.Split('\n');
|
||||
#endif
|
||||
foreach (var command in commands)
|
||||
{
|
||||
if (command.Length > 4)
|
||||
|
|
Загрузка…
Ссылка в новой задаче