Smdn.Net.EchonetLite.Primitives version 2.0.0-preview1
Pre-release
Pre-release
smdn
released this
11 Dec 13:44
·
161 commits
to main
since this release
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.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Primitives-net6.0.apilist.cs b/doc/api-list/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Primitives-net6.0.apilist.cs
new file mode 100644
index 0000000..b9ba083
--- /dev/null
+++ b/doc/api-list/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Primitives-net6.0.apilist.cs
@@ -0,0 +1,65 @@
+// Smdn.Net.EchonetLite.RouteB.Primitives.dll (Smdn.Net.EchonetLite.RouteB.Primitives-2.0.0-preview1)
+// Name: Smdn.Net.EchonetLite.RouteB.Primitives
+// AssemblyVersion: 2.0.0.0
+// InformationalVersion: 2.0.0-preview1+60a8ce3520b765b1bcab669a662cfb615f41a1f5
+// TargetFramework: .NETCoreApp,Version=v6.0
+// Configuration: Release
+// Referenced assemblies:
+// Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
+// Smdn.Net.EchonetLite.Primitives, Version=2.0.0.0, Culture=neutral
+// System.Memory, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
+// 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.Buffers;
+using System.Net;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Extensions.DependencyInjection;
+using Smdn.Net.EchonetLite.RouteB.Credentials;
+using Smdn.Net.EchonetLite.RouteB.Transport;
+using Smdn.Net.EchonetLite.Transport;
+
+namespace Smdn.Net.EchonetLite.RouteB.Credentials {
+ public interface IRouteBCredential : IDisposable {
+ void WriteIdTo(IBufferWriter<byte> buffer);
+ void WritePasswordTo(IBufferWriter<byte> buffer);
+ }
+
+ public interface IRouteBCredentialIdentity {
+ }
+
+ public interface IRouteBCredentialProvider {
+ IRouteBCredential GetCredential(IRouteBCredentialIdentity identity);
+ }
+
+ public static class RouteBCredentials {
+ public const int AuthenticationIdLength = 32;
+ public const int PasswordLength = 12;
+ }
+}
+
+namespace Smdn.Net.EchonetLite.RouteB.Transport {
+ public interface IRouteBEchonetLiteHandlerBuilder {
+ IServiceCollection Services { get; }
+ }
+
+ public interface IRouteBEchonetLiteHandlerFactory {
+ ValueTask<RouteBEchonetLiteHandler> CreateAsync(CancellationToken cancellationToken);
+ }
+
+ public abstract class RouteBEchonetLiteHandler : EchonetLiteHandler {
+ protected RouteBEchonetLiteHandler() {}
+
+ public abstract IPAddress? PeerAddress { get; }
+
+ public ValueTask ConnectAsync(IRouteBCredential credential, CancellationToken cancellationToken = default) {}
+ protected abstract ValueTask ConnectAsyncCore(IRouteBCredential credential, CancellationToken cancellationToken);
+ public ValueTask DisconnectAsync(CancellationToken cancellationToken = default) {}
+ protected abstract ValueTask DisconnectAsyncCore(CancellationToken cancellationToken);
+ }
+}
+// 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.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Primitives-net8.0.apilist.cs b/doc/api-list/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Primitives-net8.0.apilist.cs
new file mode 100644
index 0000000..6ad7338
--- /dev/null
+++ b/doc/api-list/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Primitives-net8.0.apilist.cs
@@ -0,0 +1,65 @@
+// Smdn.Net.EchonetLite.RouteB.Primitives.dll (Smdn.Net.EchonetLite.RouteB.Primitives-2.0.0-preview1)
+// Name: Smdn.Net.EchonetLite.RouteB.Primitives
+// AssemblyVersion: 2.0.0.0
+// InformationalVersion: 2.0.0-preview1+60a8ce3520b765b1bcab669a662cfb615f41a1f5
+// TargetFramework: .NETCoreApp,Version=v8.0
+// Configuration: Release
+// Referenced assemblies:
+// Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
+// Smdn.Net.EchonetLite.Primitives, Version=2.0.0.0, Culture=neutral
+// System.Memory, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
+// 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.Buffers;
+using System.Net;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Extensions.DependencyInjection;
+using Smdn.Net.EchonetLite.RouteB.Credentials;
+using Smdn.Net.EchonetLite.RouteB.Transport;
+using Smdn.Net.EchonetLite.Transport;
+
+namespace Smdn.Net.EchonetLite.RouteB.Credentials {
+ public interface IRouteBCredential : IDisposable {
+ void WriteIdTo(IBufferWriter<byte> buffer);
+ void WritePasswordTo(IBufferWriter<byte> buffer);
+ }
+
+ public interface IRouteBCredentialIdentity {
+ }
+
+ public interface IRouteBCredentialProvider {
+ IRouteBCredential GetCredential(IRouteBCredentialIdentity identity);
+ }
+
+ public static class RouteBCredentials {
+ public const int AuthenticationIdLength = 32;
+ public const int PasswordLength = 12;
+ }
+}
+
+namespace Smdn.Net.EchonetLite.RouteB.Transport {
+ public interface IRouteBEchonetLiteHandlerBuilder {
+ IServiceCollection Services { get; }
+ }
+
+ public interface IRouteBEchonetLiteHandlerFactory {
+ ValueTask<RouteBEchonetLiteHandler> CreateAsync(CancellationToken cancellationToken);
+ }
+
+ public abstract class RouteBEchonetLiteHandler : EchonetLiteHandler {
+ protected RouteBEchonetLiteHandler() {}
+
+ public abstract IPAddress? PeerAddress { get; }
+
+ public ValueTask ConnectAsync(IRouteBCredential credential, CancellationToken cancellationToken = default) {}
+ protected abstract ValueTask ConnectAsyncCore(IRouteBCredential credential, CancellationToken cancellationToken);
+ public ValueTask DisconnectAsync(CancellationToken cancellationToken = default) {}
+ protected abstract ValueTask DisconnectAsyncCore(CancellationToken cancellationToken);
+ }
+}
+// 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.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Primitives-netstandard2.1.apilist.cs b/doc/api-list/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Primitives-netstandard2.1.apilist.cs
new file mode 100644
index 0000000..23438af
--- /dev/null
+++ b/doc/api-list/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Primitives-netstandard2.1.apilist.cs
@@ -0,0 +1,63 @@
+// Smdn.Net.EchonetLite.RouteB.Primitives.dll (Smdn.Net.EchonetLite.RouteB.Primitives-2.0.0-preview1)
+// Name: Smdn.Net.EchonetLite.RouteB.Primitives
+// AssemblyVersion: 2.0.0.0
+// InformationalVersion: 2.0.0-preview1+60a8ce3520b765b1bcab669a662cfb615f41a1f5
+// TargetFramework: .NETStandard,Version=v2.1
+// Configuration: Release
+// Referenced assemblies:
+// Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
+// Smdn.Net.EchonetLite.Primitives, Version=2.0.0.0, Culture=neutral
+// netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
+#nullable enable annotations
+
+using System;
+using System.Buffers;
+using System.Net;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Extensions.DependencyInjection;
+using Smdn.Net.EchonetLite.RouteB.Credentials;
+using Smdn.Net.EchonetLite.RouteB.Transport;
+using Smdn.Net.EchonetLite.Transport;
+
+namespace Smdn.Net.EchonetLite.RouteB.Credentials {
+ public interface IRouteBCredential : IDisposable {
+ void WriteIdTo(IBufferWriter<byte> buffer);
+ void WritePasswordTo(IBufferWriter<byte> buffer);
+ }
+
+ public interface IRouteBCredentialIdentity {
+ }
+
+ public interface IRouteBCredentialProvider {
+ IRouteBCredential GetCredential(IRouteBCredentialIdentity identity);
+ }
+
+ public static class RouteBCredentials {
+ public const int AuthenticationIdLength = 32;
+ public const int PasswordLength = 12;
+ }
+}
+
+namespace Smdn.Net.EchonetLite.RouteB.Transport {
+ public interface IRouteBEchonetLiteHandlerBuilder {
+ IServiceCollection Services { get; }
+ }
+
+ public interface IRouteBEchonetLiteHandlerFactory {
+ ValueTask<RouteBEchonetLiteHandler> CreateAsync(CancellationToken cancellationToken);
+ }
+
+ public abstract class RouteBEchonetLiteHandler : EchonetLiteHandler {
+ protected RouteBEchonetLiteHandler() {}
+
+ public abstract IPAddress? PeerAddress { get; }
+
+ public ValueTask ConnectAsync(IRouteBCredential credential, CancellationToken cancellationToken = default) {}
+ protected abstract ValueTask ConnectAsyncCore(IRouteBCredential credential, CancellationToken cancellationToken);
+ public ValueTask DisconnectAsync(CancellationToken cancellationToken = default) {}
+ protected abstract ValueTask DisconnectAsyncCore(CancellationToken cancellationToken);
+ }
+}
+// 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.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Credentials/IRouteBCredential.cs b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Credentials/IRouteBCredential.cs
new file mode 100644
index 0000000..757503f
--- /dev/null
+++ b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Credentials/IRouteBCredential.cs
@@ -0,0 +1,14 @@
+// SPDX-FileCopyrightText: 2023 smdn <smdn@smdn.jp>
+// SPDX-License-Identifier: MIT
+using System;
+using System.Buffers;
+
+namespace Smdn.Net.EchonetLite.RouteB.Credentials;
+
+/// <summary>
+/// Provides a mechanism for abstracting credentials used for the route B authentication.
+/// </summary>
+public interface IRouteBCredential : IDisposable {
+ void WriteIdTo(IBufferWriter<byte> buffer);
+ void WritePasswordTo(IBufferWriter<byte> buffer);
+}
diff --git a/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Credentials/IRouteBCredentialIdentity.cs b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Credentials/IRouteBCredentialIdentity.cs
new file mode 100644
index 0000000..22acb97
--- /dev/null
+++ b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Credentials/IRouteBCredentialIdentity.cs
@@ -0,0 +1,8 @@
+// SPDX-FileCopyrightText: 2023 smdn <smdn@smdn.jp>
+// SPDX-License-Identifier: MIT
+namespace Smdn.Net.EchonetLite.RouteB.Credentials;
+
+/// <summary>
+/// Provides a mechanism for abstracting identities corresponding to credentials used for the route B authentication.
+/// </summary>
+public interface IRouteBCredentialIdentity { }
diff --git a/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Credentials/IRouteBCredentialProvider.cs b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Credentials/IRouteBCredentialProvider.cs
new file mode 100644
index 0000000..6ed9ab7
--- /dev/null
+++ b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Credentials/IRouteBCredentialProvider.cs
@@ -0,0 +1,11 @@
+// SPDX-FileCopyrightText: 2023 smdn <smdn@smdn.jp>
+// SPDX-License-Identifier: MIT
+namespace Smdn.Net.EchonetLite.RouteB.Credentials;
+
+/// <summary>
+/// Provides a mechanism to select the <see cref="IRouteBCredential"/> corresponding to the <see cref="IRouteBCredentialIdentity"/> and
+/// provide it to the route B authentication.
+/// </summary>
+public interface IRouteBCredentialProvider {
+ IRouteBCredential GetCredential(IRouteBCredentialIdentity identity);
+}
diff --git a/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Credentials/RouteBCredentials.cs b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Credentials/RouteBCredentials.cs
new file mode 100644
index 0000000..2c68280
--- /dev/null
+++ b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Credentials/RouteBCredentials.cs
@@ -0,0 +1,15 @@
+// SPDX-FileCopyrightText: 2023 smdn <smdn@smdn.jp>
+// SPDX-License-Identifier: MIT
+namespace Smdn.Net.EchonetLite.RouteB.Credentials;
+
+public static class RouteBCredentials {
+ /// <seealso href="https://www.meti.go.jp/committee/kenkyukai/shoujo/smart_house/pdf/009_s03_00.pdf">
+ /// HEMS-スマートメーターBルート(低圧電力メーター)運用ガイドライン[第4.0版]7.Bルート認証IDの定義
+ /// </seealso>
+ public const int AuthenticationIdLength = 32;
+
+ /// <seealso href="https://www.meti.go.jp/committee/kenkyukai/shoujo/smart_house/pdf/009_s03_00.pdf">
+ /// HEMS-スマートメーターBルート(低圧電力メーター)運用ガイドライン[第4.0版]7.Bルート認証IDの定義
+ /// </seealso>
+ public const int PasswordLength = 12;
+}
diff --git a/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Primitives.csproj b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Primitives.csproj
new file mode 100644
index 0000000..9b0ba2b
--- /dev/null
+++ b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Primitives.csproj
@@ -0,0 +1,53 @@
+<!--
+SPDX-FileCopyrightText: 2024 smdn <smdn@smdn.jp>
+SPDX-License-Identifier: MIT
+-->
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFrameworks>netstandard2.1;net6.0;net8.0</TargetFrameworks>
+ <VersionPrefix>2.0.0</VersionPrefix>
+ <VersionSuffix>preview1</VersionSuffix>
+ <!-- <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' -->
+ </PropertyGroup>
+
+ <PropertyGroup Label="assembly attributes">
+ <Description>
+<![CDATA[Provides common types and abstractions for `Smdn.Net.EchonetLite.RouteB.*`.
+
+Provides a transport layer abstraction class `RouteBEchonetLiteHandler` to handle ECHONET Lite communication via the **route-B**, the communication path for communicating information with smart electricity meters.
+Also provides an abstract interface `IRouteBCredential` to handle credentials used in B-route communication path.
+
+`Smdn.Net.EchonetLite.RouteB.*`で共通して使用される型と抽象化機能を提供します。
+
+スマート電力量メータとの情報伝達手段である「Bルート」を介してECHONET Lite規格の通信を扱うためのトランスポート層抽象クラス`RouteBEchonetLiteHandler`を提供します。
+また、その際に使用される認証情報を扱うための抽象インターフェイス`IRouteBCredential`を提供します。
+]]>
+ </Description>
+ <CopyrightYear>2024</CopyrightYear>
+ </PropertyGroup>
+
+ <PropertyGroup Label="package properties">
+ <PackageTags>abstraction;transport;Route-B;B-Route;smart-meter;smart-energy-meter;$(PackageTags)</PackageTags>
+ <GenerateNupkgReadmeFileDependsOnTargets>$(GenerateNupkgReadmeFileDependsOnTargets);GenerateReadmeFileContent</GenerateNupkgReadmeFileDependsOnTargets>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
+ <ProjectOrPackageReference Include="$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)..\Smdn.Net.EchonetLite.Primitives\Smdn.Net.EchonetLite.Primitives.csproj'))" />
+ </ItemGroup>
+
+ <Target Name="GenerateReadmeFileContent">
+ <PropertyGroup>
+ <PackageReadmeFileContent><![CDATA[# $(PackageId) $(PackageVersion)
+$(Description)
+
+## Contributing
+This project welcomes contributions, feedbacks and suggestions. You can contribute to this project by submitting [Issues]($(RepositoryUrl)/issues/new/choose) or [Pull Requests]($(RepositoryUrl)/pulls/) on the [GitHub repository]($(RepositoryUrl)).
+]]></PackageReadmeFileContent>
+ </PropertyGroup>
+ </Target>
+</Project>
diff --git a/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Transport/IRouteBEchonetLiteHandlerBuilder.cs b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Transport/IRouteBEchonetLiteHandlerBuilder.cs
new file mode 100644
index 0000000..c7860da
--- /dev/null
+++ b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Transport/IRouteBEchonetLiteHandlerBuilder.cs
@@ -0,0 +1,15 @@
+// SPDX-FileCopyrightText: 2023 smdn <smdn@smdn.jp>
+// SPDX-License-Identifier: MIT
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Smdn.Net.EchonetLite.RouteB.Transport;
+
+/// <summary>
+/// An interface for configuring <see cref="RouteBEchonetLiteHandler"/> providers.
+/// </summary>
+public interface IRouteBEchonetLiteHandlerBuilder {
+ /// <summary>
+ /// Gets the <see cref="IServiceCollection"/> where <see cref="RouteBEchonetLiteHandler"/> services are configured.
+ /// </summary>
+ IServiceCollection Services { get; }
+}
diff --git a/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Transport/IRouteBEchonetLiteHandlerFactory.cs b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Transport/IRouteBEchonetLiteHandlerFactory.cs
new file mode 100644
index 0000000..ca8b34d
--- /dev/null
+++ b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Transport/IRouteBEchonetLiteHandlerFactory.cs
@@ -0,0 +1,12 @@
+// SPDX-FileCopyrightText: 2023 smdn <smdn@smdn.jp>
+// SPDX-License-Identifier: MIT
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Smdn.Net.EchonetLite.RouteB.Transport;
+
+public interface IRouteBEchonetLiteHandlerFactory {
+ ValueTask<RouteBEchonetLiteHandler> CreateAsync(
+ CancellationToken cancellationToken
+ );
+}
diff --git a/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Transport/RouteBEchonetLiteHandler.cs b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Transport/RouteBEchonetLiteHandler.cs
new file mode 100644
index 0000000..ae5c5a2
--- /dev/null
+++ b/src/Smdn.Net.EchonetLite.RouteB.Primitives/Smdn.Net.EchonetLite.RouteB.Transport/RouteBEchonetLiteHandler.cs
@@ -0,0 +1,70 @@
+// SPDX-FileCopyrightText: 2023 smdn <smdn@smdn.jp>
+// SPDX-License-Identifier: MIT
+using System;
+using System.Net;
+using System.Threading;
+using System.Threading.Tasks;
+
+using Smdn.Net.EchonetLite.RouteB.Credentials;
+using Smdn.Net.EchonetLite.Transport;
+
+namespace Smdn.Net.EchonetLite.RouteB.Transport;
+
+public abstract class RouteBEchonetLiteHandler : EchonetLiteHandler {
+ /// <summary>
+ /// Gets the <see cref="IPAddress"/> represents the IP address of the peer device (i.e., smart electricity meter) to which this handler is currently connected.
+ /// </summary>
+ public abstract IPAddress? PeerAddress { get; }
+
+ public ValueTask ConnectAsync(
+ IRouteBCredential credential,
+ CancellationToken cancellationToken = default
+ )
+ {
+#pragma warning disable CA1510
+ if (credential is null)
+ throw new ArgumentNullException(nameof(credential));
+#pragma warning restore CA1510
+
+ ThrowIfDisposed();
+
+ return Core();
+
+ async ValueTask Core()
+ {
+ await ConnectAsyncCore(
+ credential: credential,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ StartReceiving();
+ }
+ }
+
+ protected abstract ValueTask ConnectAsyncCore(
+ IRouteBCredential credential,
+ CancellationToken cancellationToken
+ );
+
+ public ValueTask DisconnectAsync(
+ CancellationToken cancellationToken = default
+ )
+ {
+ ThrowIfDisposed();
+
+ return Core();
+
+ async ValueTask Core()
+ {
+ await DisconnectAsyncCore(
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ await StopReceivingAsync().ConfigureAwait(false);
+ }
+ }
+
+ protected abstract ValueTask DisconnectAsyncCore(
+ CancellationToken cancellationToken
+ );
+}
Notes
Full Changelog: releases/Smdn.Net.EchonetLite.RouteB.BP35XX-2.0.0-preview3...releases/Smdn.Net.EchonetLite.Primitives-2.0.0-preview1