Skip to content

Smdn.Devices.BP35XX version 2.1.0

Latest
Compare
Choose a tag to compare
@smdn smdn released this 14 Nov 14:40
· 7 commits to main since this release
3688416

Released package

Release notes

The full release notes are available at gist.

Change log

Change log in this release:

API changes

API changes in this release:
diff --git a/doc/api-list/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX-net6.0.apilist.cs b/doc/api-list/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX-net6.0.apilist.cs
index 804d164..d8acbb6 100644
--- a/doc/api-list/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX-net6.0.apilist.cs
+++ b/doc/api-list/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX-net6.0.apilist.cs
@@ -1,103 +1,109 @@
-// Smdn.Devices.BP35XX.dll (Smdn.Devices.BP35XX-2.0.0)
+// Smdn.Devices.BP35XX.dll (Smdn.Devices.BP35XX-2.1.0)
 //   Name: Smdn.Devices.BP35XX
-//   AssemblyVersion: 2.0.0.0
-//   InformationalVersion: 2.0.0+ef185af5c73268aab02d6909202fffce4560122b
+//   AssemblyVersion: 2.1.0.0
+//   InformationalVersion: 2.1.0+fc01bab8c6330c41db1ce6309f8f5f79b42b2785
 //   TargetFramework: .NETCoreApp,Version=v6.0
 //   Configuration: Release
 //   Referenced assemblies:
 //     Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
 //     Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
 //     Smdn.Fundamental.PrintableEncoding.Hexadecimal, Version=3.0.0.0, Culture=neutral
 //     Smdn.Net.SkStackIP, Version=1.0.0.0, Culture=neutral
 //     System.ComponentModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 //     System.IO.Ports, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
 //     System.Memory, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
 //     System.Net.NetworkInformation, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 //     System.Net.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 //     System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 #nullable enable annotations
 
 using System;
 using System.IO;
 using System.Net;
 using System.Net.NetworkInformation;
 using System.Threading;
 using System.Threading.Tasks;
 using Smdn.Devices.BP35XX;
 using Smdn.Net.SkStackIP;
 
 namespace Smdn.Devices.BP35XX {
   public interface IBP35SerialPortStreamFactory : IDisposable {
     Stream CreateSerialPortStream(string? serialPortName);
   }
 
   public enum BP35UartBaudRate : byte {
     Baud115200 = 0,
     Baud19200 = 4,
     Baud2400 = 1,
     Baud38400 = 5,
     Baud4800 = 2,
     Baud57600 = 6,
     Baud9600 = 3,
   }
 
   public enum BP35UartCharacterInterval : byte {
     Microseconds100 = 16,
     Microseconds200 = 32,
     Microseconds300 = 48,
     Microseconds400 = 64,
     Microseconds50 = 80,
     None = 0,
   }
 
   public enum BP35UartFlowControl : byte {
     Disabled = 0,
     Enabled = 128,
   }
 
   public enum BP35UdpReceiveDataFormat : byte {
     Binary = 0,
     HexAscii = 1,
   }
 
   public class BP35A1 : BP35Base {
     public static ValueTask<BP35A1> CreateAsync(BP35A1Configurations configurations, IServiceProvider? serviceProvider = null, CancellationToken cancellationToken = default) {}
     public static ValueTask<BP35A1> CreateAsync(string? serialPortName, IServiceProvider? serviceProvider = null, CancellationToken cancellationToken = default) {}
   }
 
   public sealed class BP35A1Configurations {
     public BP35A1Configurations() {}
 
     public BP35UartBaudRate BaudRate { get; set; }
     public string? SerialPortName { get; set; }
     public bool TryLoadFlashMemory { get; set; }
     public bool UseFlowControl { get; set; }
   }
 
   public abstract class BP35Base : SkStackClient {
     public IPAddress LinkLocalAddress { get; }
     public PhysicalAddress MacAddress { get; }
     public string RohmPassword { get; }
     public string RohmUserId { get; }
     public string SkStackAppVersion { get; }
     public Version SkStackVersion { get; }
 
     public async ValueTask<BP35UartConfigurations> GetUartOptionsAsync(CancellationToken cancellationToken = default) {}
     public async ValueTask<BP35UdpReceiveDataFormat> GetUdpDataFormatAsync(CancellationToken cancellationToken = default) {}
     public ValueTask SetUartOptionsAsync(BP35UartBaudRate baudRate, BP35UartCharacterInterval characterInterval = BP35UartCharacterInterval.None, BP35UartFlowControl flowControl = BP35UartFlowControl.Disabled, CancellationToken cancellationToken = default) {}
     public ValueTask SetUartOptionsAsync(BP35UartConfigurations uartConfigurations, CancellationToken cancellationToken = default) {}
     public ValueTask SetUdpDataFormatAsync(BP35UdpReceiveDataFormat format, CancellationToken cancellationToken = default) {}
   }
 
+  public class BP35SerialPortException : IOException {
+    public BP35SerialPortException() {}
+    public BP35SerialPortException(string message) {}
+    public BP35SerialPortException(string message, Exception? innerException = null) {}
+  }
+
   public readonly struct BP35UartConfigurations {
     public BP35UartConfigurations(BP35UartBaudRate baudRate, BP35UartCharacterInterval characterInterval, BP35UartFlowControl flowControl) {}
 
     public BP35UartBaudRate BaudRate { get; }
     public BP35UartCharacterInterval CharacterInterval { get; }
     public BP35UartFlowControl FlowControl { get; }
 
     public void Deconstruct(out BP35UartBaudRate baudRate, out BP35UartCharacterInterval characterInterval, out BP35UartFlowControl flowControl) {}
   }
 }
 // API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.4.1.0.
 // Smdn.Reflection.ReverseGenerating.ListApi.Core v1.3.1.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX-net8.0.apilist.cs b/doc/api-list/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX-net8.0.apilist.cs
index f383021..5031fcc 100644
--- a/doc/api-list/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX-net8.0.apilist.cs
+++ b/doc/api-list/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX-net8.0.apilist.cs
@@ -1,103 +1,109 @@
-// Smdn.Devices.BP35XX.dll (Smdn.Devices.BP35XX-2.0.0)
+// Smdn.Devices.BP35XX.dll (Smdn.Devices.BP35XX-2.1.0)
 //   Name: Smdn.Devices.BP35XX
-//   AssemblyVersion: 2.0.0.0
-//   InformationalVersion: 2.0.0+ef185af5c73268aab02d6909202fffce4560122b
+//   AssemblyVersion: 2.1.0.0
+//   InformationalVersion: 2.1.0+fc01bab8c6330c41db1ce6309f8f5f79b42b2785
 //   TargetFramework: .NETCoreApp,Version=v8.0
 //   Configuration: Release
 //   Referenced assemblies:
 //     Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
 //     Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
 //     Smdn.Fundamental.PrintableEncoding.Hexadecimal, Version=3.0.0.0, Culture=neutral
 //     Smdn.Net.SkStackIP, Version=1.0.0.0, Culture=neutral
 //     System.ComponentModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 //     System.IO.Ports, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
 //     System.Memory, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
 //     System.Net.NetworkInformation, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 //     System.Net.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 //     System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 #nullable enable annotations
 
 using System;
 using System.IO;
 using System.Net;
 using System.Net.NetworkInformation;
 using System.Threading;
 using System.Threading.Tasks;
 using Smdn.Devices.BP35XX;
 using Smdn.Net.SkStackIP;
 
 namespace Smdn.Devices.BP35XX {
   public interface IBP35SerialPortStreamFactory : IDisposable {
     Stream CreateSerialPortStream(string? serialPortName);
   }
 
   public enum BP35UartBaudRate : byte {
     Baud115200 = 0,
     Baud19200 = 4,
     Baud2400 = 1,
     Baud38400 = 5,
     Baud4800 = 2,
     Baud57600 = 6,
     Baud9600 = 3,
   }
 
   public enum BP35UartCharacterInterval : byte {
     Microseconds100 = 16,
     Microseconds200 = 32,
     Microseconds300 = 48,
     Microseconds400 = 64,
     Microseconds50 = 80,
     None = 0,
   }
 
   public enum BP35UartFlowControl : byte {
     Disabled = 0,
     Enabled = 128,
   }
 
   public enum BP35UdpReceiveDataFormat : byte {
     Binary = 0,
     HexAscii = 1,
   }
 
   public class BP35A1 : BP35Base {
     public static ValueTask<BP35A1> CreateAsync(BP35A1Configurations configurations, IServiceProvider? serviceProvider = null, CancellationToken cancellationToken = default) {}
     public static ValueTask<BP35A1> CreateAsync(string? serialPortName, IServiceProvider? serviceProvider = null, CancellationToken cancellationToken = default) {}
   }
 
   public sealed class BP35A1Configurations {
     public BP35A1Configurations() {}
 
     public BP35UartBaudRate BaudRate { get; set; }
     public string? SerialPortName { get; set; }
     public bool TryLoadFlashMemory { get; set; }
     public bool UseFlowControl { get; set; }
   }
 
   public abstract class BP35Base : SkStackClient {
     public IPAddress LinkLocalAddress { get; }
     public PhysicalAddress MacAddress { get; }
     public string RohmPassword { get; }
     public string RohmUserId { get; }
     public string SkStackAppVersion { get; }
     public Version SkStackVersion { get; }
 
     public async ValueTask<BP35UartConfigurations> GetUartOptionsAsync(CancellationToken cancellationToken = default) {}
     public async ValueTask<BP35UdpReceiveDataFormat> GetUdpDataFormatAsync(CancellationToken cancellationToken = default) {}
     public ValueTask SetUartOptionsAsync(BP35UartBaudRate baudRate, BP35UartCharacterInterval characterInterval = BP35UartCharacterInterval.None, BP35UartFlowControl flowControl = BP35UartFlowControl.Disabled, CancellationToken cancellationToken = default) {}
     public ValueTask SetUartOptionsAsync(BP35UartConfigurations uartConfigurations, CancellationToken cancellationToken = default) {}
     public ValueTask SetUdpDataFormatAsync(BP35UdpReceiveDataFormat format, CancellationToken cancellationToken = default) {}
   }
 
+  public class BP35SerialPortException : IOException {
+    public BP35SerialPortException() {}
+    public BP35SerialPortException(string message) {}
+    public BP35SerialPortException(string message, Exception? innerException = null) {}
+  }
+
   public readonly struct BP35UartConfigurations {
     public BP35UartConfigurations(BP35UartBaudRate baudRate, BP35UartCharacterInterval characterInterval, BP35UartFlowControl flowControl) {}
 
     public BP35UartBaudRate BaudRate { get; }
     public BP35UartCharacterInterval CharacterInterval { get; }
     public BP35UartFlowControl FlowControl { get; }
 
     public void Deconstruct(out BP35UartBaudRate baudRate, out BP35UartCharacterInterval characterInterval, out BP35UartFlowControl flowControl) {}
   }
 }
 // API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.4.1.0.
 // Smdn.Reflection.ReverseGenerating.ListApi.Core v1.3.1.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX-netstandard2.1.apilist.cs b/doc/api-list/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX-netstandard2.1.apilist.cs
index 1b92fd5..ef662f2 100644
--- a/doc/api-list/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX-netstandard2.1.apilist.cs
+++ b/doc/api-list/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX-netstandard2.1.apilist.cs
@@ -1,99 +1,105 @@
-// Smdn.Devices.BP35XX.dll (Smdn.Devices.BP35XX-2.0.0)
+// Smdn.Devices.BP35XX.dll (Smdn.Devices.BP35XX-2.1.0)
 //   Name: Smdn.Devices.BP35XX
-//   AssemblyVersion: 2.0.0.0
-//   InformationalVersion: 2.0.0+ef185af5c73268aab02d6909202fffce4560122b
+//   AssemblyVersion: 2.1.0.0
+//   InformationalVersion: 2.1.0+fc01bab8c6330c41db1ce6309f8f5f79b42b2785
 //   TargetFramework: .NETStandard,Version=v2.1
 //   Configuration: Release
 //   Referenced assemblies:
 //     Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
 //     Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
 //     Smdn.Fundamental.PrintableEncoding.Hexadecimal, Version=3.0.0.0, Culture=neutral
 //     Smdn.Net.SkStackIP, Version=1.0.0.0, Culture=neutral
 //     System.IO.Ports, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
 //     netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
 #nullable enable annotations
 
 using System;
 using System.IO;
 using System.Net;
 using System.Net.NetworkInformation;
 using System.Threading;
 using System.Threading.Tasks;
 using Smdn.Devices.BP35XX;
 using Smdn.Net.SkStackIP;
 
 namespace Smdn.Devices.BP35XX {
   public interface IBP35SerialPortStreamFactory : IDisposable {
     Stream CreateSerialPortStream(string? serialPortName);
   }
 
   public enum BP35UartBaudRate : byte {
     Baud115200 = 0,
     Baud19200 = 4,
     Baud2400 = 1,
     Baud38400 = 5,
     Baud4800 = 2,
     Baud57600 = 6,
     Baud9600 = 3,
   }
 
   public enum BP35UartCharacterInterval : byte {
     Microseconds100 = 16,
     Microseconds200 = 32,
     Microseconds300 = 48,
     Microseconds400 = 64,
     Microseconds50 = 80,
     None = 0,
   }
 
   public enum BP35UartFlowControl : byte {
     Disabled = 0,
     Enabled = 128,
   }
 
   public enum BP35UdpReceiveDataFormat : byte {
     Binary = 0,
     HexAscii = 1,
   }
 
   public class BP35A1 : BP35Base {
     public static ValueTask<BP35A1> CreateAsync(BP35A1Configurations configurations, IServiceProvider? serviceProvider = null, CancellationToken cancellationToken = default) {}
     public static ValueTask<BP35A1> CreateAsync(string? serialPortName, IServiceProvider? serviceProvider = null, CancellationToken cancellationToken = default) {}
   }
 
   public sealed class BP35A1Configurations {
     public BP35A1Configurations() {}
 
     public BP35UartBaudRate BaudRate { get; set; }
     public string? SerialPortName { get; set; }
     public bool TryLoadFlashMemory { get; set; }
     public bool UseFlowControl { get; set; }
   }
 
   public abstract class BP35Base : SkStackClient {
     public IPAddress LinkLocalAddress { get; }
     public PhysicalAddress MacAddress { get; }
     public string RohmPassword { get; }
     public string RohmUserId { get; }
     public string SkStackAppVersion { get; }
     public Version SkStackVersion { get; }
 
     public async ValueTask<BP35UartConfigurations> GetUartOptionsAsync(CancellationToken cancellationToken = default) {}
     public async ValueTask<BP35UdpReceiveDataFormat> GetUdpDataFormatAsync(CancellationToken cancellationToken = default) {}
     public ValueTask SetUartOptionsAsync(BP35UartBaudRate baudRate, BP35UartCharacterInterval characterInterval = BP35UartCharacterInterval.None, BP35UartFlowControl flowControl = BP35UartFlowControl.Disabled, CancellationToken cancellationToken = default) {}
     public ValueTask SetUartOptionsAsync(BP35UartConfigurations uartConfigurations, CancellationToken cancellationToken = default) {}
     public ValueTask SetUdpDataFormatAsync(BP35UdpReceiveDataFormat format, CancellationToken cancellationToken = default) {}
   }
 
+  public class BP35SerialPortException : IOException {
+    public BP35SerialPortException() {}
+    public BP35SerialPortException(string message) {}
+    public BP35SerialPortException(string message, Exception? innerException = null) {}
+  }
+
   public readonly struct BP35UartConfigurations {
     public BP35UartConfigurations(BP35UartBaudRate baudRate, BP35UartCharacterInterval characterInterval, BP35UartFlowControl flowControl) {}
 
     public BP35UartBaudRate BaudRate { get; }
     public BP35UartCharacterInterval CharacterInterval { get; }
     public BP35UartFlowControl FlowControl { get; }
 
     public void Deconstruct(out BP35UartBaudRate baudRate, out BP35UartCharacterInterval characterInterval, out BP35UartFlowControl flowControl) {}
   }
 }
 // API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.4.1.0.
 // Smdn.Reflection.ReverseGenerating.ListApi.Core v1.3.1.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)

Full changes

Full changes in this release:
diff --git a/src/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX.csproj b/src/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX.csproj
index 484e112..663d18a 100644
--- a/src/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX.csproj
+++ b/src/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX.csproj
@@ -5,9 +5,9 @@ SPDX-License-Identifier: MIT
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFrameworks>net8.0;net6.0;netstandard2.1</TargetFrameworks>
-    <VersionPrefix>2.0.0</VersionPrefix>
+    <VersionPrefix>2.1.0</VersionPrefix>
     <VersionSuffix></VersionSuffix>
-    <!-- <PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion> -->
+    <PackageValidationBaselineVersion>2.0.0</PackageValidationBaselineVersion>
     <Nullable>enable</Nullable>
     <RootNamespace/> <!-- empty the root namespace so that the namespace is determined only by the directory name, for code style rule IDE0030 -->
     <NoWarn>CS1591;$(NoWarn)</NoWarn> <!-- CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' -->
diff --git a/src/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX/BP35Base.cs b/src/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX/BP35Base.cs
index 3ffaf8c..0e6638c 100644
--- a/src/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX/BP35Base.cs
+++ b/src/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX/BP35Base.cs
@@ -9,6 +9,7 @@ using System.Diagnostics.CodeAnalysis;
 #if !SYSTEM_CONVERT_TOHEXSTRING
 using System.Buffers; // ArrayPool
 #endif
+using System.IO;
 using System.Net;
 using System.Net.NetworkInformation;
 using System.Threading;
@@ -55,6 +56,22 @@ public abstract partial class BP35Base : SkStackClient {
   private protected static InvalidOperationException CreateNotInitializedException()
     => new(message: "not initialized");
 
+  private static Stream CreateSerialPortStream(
+    IBP35SerialPortStreamFactory factory,
+    string? serialPortName
+  )
+  {
+    try {
+      return factory.CreateSerialPortStream(serialPortName);
+    }
+    catch (Exception ex) {
+      throw new BP35SerialPortException(
+        message: $"could not create serial port stream with the specified name '{serialPortName ?? "(null)"}'.",
+        innerException: ex
+      );
+    }
+  }
+
   /*
    * instance members
    */
@@ -111,12 +128,17 @@ public abstract partial class BP35Base : SkStackClient {
     ILogger? logger
   )
 #pragma warning restore IDE0290
+#pragma warning disable CA2000
     : base(
-      stream: (serialPortStreamFactory ?? throw new ArgumentNullException(nameof(serialPortStreamFactory))).CreateSerialPortStream(serialPortName),
+      stream: CreateSerialPortStream(
+        serialPortStreamFactory ?? throw new ArgumentNullException(nameof(serialPortStreamFactory)),
+        serialPortName
+      ),
       leaveStreamOpen: false, // should close the opened stream
       erxudpDataFormat: erxudpDataFormat,
       logger: logger
     )
+#pragma warning restore CA2000
   {
   }
 
diff --git a/src/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX/BP35SerialPortException.cs b/src/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX/BP35SerialPortException.cs
new file mode 100644
index 0000000..b1a6744
--- /dev/null
+++ b/src/Smdn.Devices.BP35XX/Smdn.Devices.BP35XX/BP35SerialPortException.cs
@@ -0,0 +1,27 @@
+// SPDX-FileCopyrightText: 2024 smdn <[email protected]>
+// SPDX-License-Identifier: MIT
+using System;
+using System.IO;
+
+namespace Smdn.Devices.BP35XX;
+
+/// <summary>
+/// The exception that is thrown when an unexpected exception thrown in a call
+/// to <see cref="IBP35SerialPortStreamFactory.CreateSerialPortStream"/>.
+/// </summary>
+public class BP35SerialPortException : IOException {
+  public BP35SerialPortException()
+    : base()
+  {
+  }
+
+  public BP35SerialPortException(string message)
+    : base(message: message)
+  {
+  }
+
+  public BP35SerialPortException(string message, Exception? innerException = null)
+    : base(message: message, innerException: innerException)
+  {
+  }
+}

Notes

Full Changelog: releases/Smdn.Devices.BP35XX-2.0.0...releases/Smdn.Devices.BP35XX-2.1.0