From 4423c2883118e77c7f3a1042b375498c8712c3e2 Mon Sep 17 00:00:00 2001 From: Olivier Blaise <16148676+oblaise@users.noreply.github.com> Date: Mon, 24 Jan 2022 09:15:57 +0100 Subject: [PATCH 1/3] Cache SerialPort in SerialLoggerFactory --- .../SerialLoggerFactory.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/nanoFramework.Logging.Serial/SerialLoggerFactory.cs b/nanoFramework.Logging.Serial/SerialLoggerFactory.cs index ec0ce15..dad22ba 100644 --- a/nanoFramework.Logging.Serial/SerialLoggerFactory.cs +++ b/nanoFramework.Logging.Serial/SerialLoggerFactory.cs @@ -49,12 +49,15 @@ public SerialLoggerFactory( /// public ILogger CreateLogger(string categoryName) { - _serial = new SerialPort(_comPort); - _serial.BaudRate = _baudRate; - _serial.Parity = _parity; - _serial.StopBits = _stopBits; - _serial.Handshake = _handshake; - _serial.DataBits = _dataBits; + if (_serial is null) + { + _serial = new SerialPort(_comPort); + _serial.BaudRate = _baudRate; + _serial.Parity = _parity; + _serial.StopBits = _stopBits; + _serial.Handshake = _handshake; + _serial.DataBits = _dataBits; + } return new SerialLogger(ref _serial, categoryName); } From fb7ac9c8715f4c7a49c8dcdebea491971fb06d72 Mon Sep 17 00:00:00 2001 From: Olivier Blaise <16148676+oblaise@users.noreply.github.com> Date: Tue, 25 Jan 2022 11:37:19 +0100 Subject: [PATCH 2/3] SerialLogger[Factory] documentation update --- nanoFramework.Logging.Serial/SerialLogger.cs | 2 +- nanoFramework.Logging.Serial/SerialLoggerFactory.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nanoFramework.Logging.Serial/SerialLogger.cs b/nanoFramework.Logging.Serial/SerialLogger.cs index 36a4cca..044f43e 100644 --- a/nanoFramework.Logging.Serial/SerialLogger.cs +++ b/nanoFramework.Logging.Serial/SerialLogger.cs @@ -12,7 +12,7 @@ namespace nanoFramework.Logging.Serial { /// - /// A logger that outputs to a . + /// A logger that outputs to a . /// public class SerialLogger : ILogger { diff --git a/nanoFramework.Logging.Serial/SerialLoggerFactory.cs b/nanoFramework.Logging.Serial/SerialLoggerFactory.cs index dad22ba..2298820 100644 --- a/nanoFramework.Logging.Serial/SerialLoggerFactory.cs +++ b/nanoFramework.Logging.Serial/SerialLoggerFactory.cs @@ -22,7 +22,7 @@ public class SerialLoggerFactory : ILoggerFactory private readonly Handshake _handshake; /// - /// Create a new instance of from a . + /// Create a new instance of from a . /// /// /// From f9832db08b7d4ccd1ac67f8e0664ed6ccfa07bd2 Mon Sep 17 00:00:00 2001 From: Olivier Blaise <16148676+oblaise@users.noreply.github.com> Date: Tue, 25 Jan 2022 14:06:38 +0100 Subject: [PATCH 3/3] Add Signature to Serial and Stream packages --- .../nanoFramework.Logging.Serial.nfproj | 9 +++++++++ .../nanoFramework.Logging.Stream.nfproj | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/nanoFramework.Logging.Serial/nanoFramework.Logging.Serial.nfproj b/nanoFramework.Logging.Serial/nanoFramework.Logging.Serial.nfproj index 0c1870e..77248fb 100644 --- a/nanoFramework.Logging.Serial/nanoFramework.Logging.Serial.nfproj +++ b/nanoFramework.Logging.Serial/nanoFramework.Logging.Serial.nfproj @@ -17,6 +17,15 @@ v1.0 bin\$(Configuration)\nanoFramework.Logging.Serial.xml + + true + + + key.snk + + + false + diff --git a/nanoFramework.Logging.Stream/nanoFramework.Logging.Stream.nfproj b/nanoFramework.Logging.Stream/nanoFramework.Logging.Stream.nfproj index a865911..06521af 100644 --- a/nanoFramework.Logging.Stream/nanoFramework.Logging.Stream.nfproj +++ b/nanoFramework.Logging.Stream/nanoFramework.Logging.Stream.nfproj @@ -17,6 +17,15 @@ v1.0 bin\$(Configuration)\nanoFramework.Logging.Stream.xml + + true + + + key.snk + + + false +