Smdn.TPSmartHomeDevices.Kasa version 2.0.0-preview2
Pre-release
Pre-release
smdn
released this
16 Jan 16:09
·
49 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:
- 2024-01-17 add compatibility suppressions for net6.0 vs net8.0
- 2024-01-17 update package version
- 2024-01-17 bump Smdn.TPSmartHomeDevices.Primitives
- 2024-01-16 add ISmartDevice.GetDeviceInfoAsync
- 2024-01-16 implement ISmartDevice
- 2024-01-16 add IDeviceInfo
- 2024-01-16 add KasaDevice.GetDeviceInfoAsync
- 2024-01-13 delete ISmartPlug
API changes
API changes in this release:
diff --git a/doc/api-list/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa-net6.0.apilist.cs b/doc/api-list/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa-net6.0.apilist.cs
index 16144ee..a2ebbd2 100644
--- a/doc/api-list/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa-net6.0.apilist.cs
+++ b/doc/api-list/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa-net6.0.apilist.cs
@@ -1,234 +1,289 @@
-// Smdn.TPSmartHomeDevices.Kasa.dll (Smdn.TPSmartHomeDevices.Kasa-2.0.0-preview1)
+// Smdn.TPSmartHomeDevices.Kasa.dll (Smdn.TPSmartHomeDevices.Kasa-2.0.0-preview2)
// Name: Smdn.TPSmartHomeDevices.Kasa
// AssemblyVersion: 2.0.0.0
-// InformationalVersion: 2.0.0-preview1+79057c306c2fede642a92b623a95cbb150e83873
+// InformationalVersion: 2.0.0-preview2+d001e07a3ea43a47290d9e9d2f4d582e14caa297
// TargetFramework: .NETCoreApp,Version=v6.0
// Configuration: Release
// Referenced assemblies:
// Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
// Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
// Microsoft.Win32.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// Smdn.TPSmartHomeDevices.Primitives, Version=1.1.0.0, Culture=neutral
// System.Collections, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.ComponentModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// 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.Net.Sockets, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Text.Encodings.Web, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
// System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
#nullable enable annotations
using System;
using System.Buffers;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Net.NetworkInformation;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Smdn.TPSmartHomeDevices;
using Smdn.TPSmartHomeDevices.Kasa;
using Smdn.TPSmartHomeDevices.Kasa.Protocol;
namespace Smdn.TPSmartHomeDevices.Kasa {
public class HS105 :
KasaDevice,
- ISmartPlug
+ ISmartDevice
{
public static HS105 Create<TAddress>(TAddress deviceAddress, IServiceProvider serviceProvider) where TAddress : notnull {}
public HS105(IDeviceEndPoint deviceEndPoint, IServiceProvider? serviceProvider = null) {}
public HS105(IPAddress ipAddress, IServiceProvider? serviceProvider = null) {}
public HS105(PhysicalAddress macAddress, IServiceProvider serviceProvider) {}
public HS105(string host, IServiceProvider? serviceProvider = null) {}
public ValueTask<bool> GetOnOffStateAsync(CancellationToken cancellationToken = default) {}
public ValueTask SetOnOffStateAsync(bool newOnOffState, CancellationToken cancellationToken = default) {}
+ async ValueTask<IDeviceInfo> ISmartDevice.GetDeviceInfoAsync(CancellationToken cancellationToken) {}
public ValueTask TurnOffAsync(CancellationToken cancellationToken = default) {}
public ValueTask TurnOnAsync(CancellationToken cancellationToken = default) {}
}
public class KL130 :
KasaDevice,
IMulticolorSmartLight
{
public static KL130 Create<TAddress>(TAddress deviceAddress, IServiceProvider serviceProvider) where TAddress : notnull {}
public KL130(IDeviceEndPoint deviceEndPoint, IServiceProvider? serviceProvider = null) {}
public KL130(IPAddress ipAddress, IServiceProvider? serviceProvider = null) {}
public KL130(PhysicalAddress macAddress, IServiceProvider serviceProvider) {}
public KL130(string host, IServiceProvider? serviceProvider = null) {}
public ValueTask<KL130LightState> GetLightStateAsync(CancellationToken cancellationToken = default) {}
public ValueTask<bool> GetOnOffStateAsync(CancellationToken cancellationToken = default) {}
public ValueTask SetBrightnessAsync(int brightness, TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
public ValueTask SetColorAsync(int hue, int saturation, int? brightness = null, TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
public ValueTask SetColorTemperatureAsync(int colorTemperature, int? brightness = null, TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
public ValueTask SetOnOffStateAsync(bool newOnOffState, TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
+ async ValueTask<IDeviceInfo> ISmartDevice.GetDeviceInfoAsync(CancellationToken cancellationToken) {}
ValueTask ISmartDevice.SetOnOffStateAsync(bool newOnOffState, CancellationToken cancellationToken) {}
public ValueTask TurnOffAsync(TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
public ValueTask TurnOnAsync(TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
}
public class KasaDevice : IDisposable {
protected readonly struct NullParameter {
}
protected static readonly JsonEncodedText MethodTextGetSysInfo; // = "get_sysinfo"
protected static readonly JsonEncodedText ModuleTextSystem; // = "system"
public static KasaDevice Create(IDeviceEndPoint deviceEndPoint, IServiceProvider? serviceProvider = null) {}
public static KasaDevice Create(IPAddress ipAddress, IServiceProvider? serviceProvider = null) {}
public static KasaDevice Create(PhysicalAddress macAddress, IServiceProvider serviceProvider) {}
public static KasaDevice Create(string host, IServiceProvider? serviceProvider = null) {}
public static KasaDevice Create<TAddress>(TAddress deviceAddress, IServiceProvider serviceProvider) where TAddress : notnull {}
protected KasaDevice(IDeviceEndPoint deviceEndPoint, IServiceProvider? serviceProvider) {}
protected KasaDevice(IPAddress ipAddress, IServiceProvider? serviceProvider) {}
protected KasaDevice(PhysicalAddress macAddress, IServiceProvider serviceProvider) {}
protected KasaDevice(string host, IServiceProvider? serviceProvider) {}
public bool IsConnected { get; }
[MemberNotNullWhen(false, "deviceEndPoint")]
protected bool IsDisposed { [MemberNotNullWhen(false, "deviceEndPoint")] get; }
protected virtual void Dispose(bool disposing) {}
public void Dispose() {}
+ public ValueTask<KasaDeviceInfo?> GetDeviceInfoAsync(CancellationToken cancellationToken = default) {}
+ protected ValueTask<TSysInfo> GetSysInfoAsync<TSysInfo>(Func<JsonElement, TSysInfo> composeResult, CancellationToken cancellationToken = default) {}
public ValueTask<EndPoint> ResolveEndPointAsync(CancellationToken cancellationToken = default) {}
protected ValueTask SendRequestAsync<TMethodParameter>(JsonEncodedText module, JsonEncodedText method, TMethodParameter parameters, CancellationToken cancellationToken) {}
protected ValueTask<TMethodResult> SendRequestAsync<TMethodParameter, TMethodResult>(JsonEncodedText module, JsonEncodedText method, TMethodParameter parameters, Func<JsonElement, TMethodResult> composeResult, CancellationToken cancellationToken) {}
protected ValueTask<TMethodResult> SendRequestAsync<TMethodResult>(JsonEncodedText module, JsonEncodedText method, Func<JsonElement, TMethodResult> composeResult, CancellationToken cancellationToken) {}
public override string? ToString() {}
}
public abstract class KasaDeviceExceptionHandler {
internal protected static readonly KasaDeviceExceptionHandler Default; // = "Smdn.TPSmartHomeDevices.Kasa.KasaDeviceDefaultExceptionHandler"
protected KasaDeviceExceptionHandler() {}
public abstract KasaDeviceExceptionHandling DetermineHandling(KasaDevice device, Exception exception, int attempt, ILogger? logger);
}
public static class KasaDeviceExceptionHandlerServiceCollectionExtensions {
public static IServiceCollection AddKasaDeviceExceptionHandler(this IServiceCollection services, KasaDeviceExceptionHandler exceptionHandler) {}
}
+ public class KasaDeviceInfo : IDeviceInfo {
+ public KasaDeviceInfo() {}
+
+ public string? Description { get; }
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ [JsonPropertyName("fwId")]
+ public byte[]? FirmwareId { get; init; }
+ [JsonPropertyName("sw_ver")]
+ public string? FirmwareVersion { get; init; }
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ [JsonPropertyName("hwId")]
+ public byte[]? HardwareId { get; init; }
+ [JsonPropertyName("hw_ver")]
+ public string? HardwareVersion { get; init; }
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ [JsonPropertyName("deviceId")]
+ public byte[]? Id { get; init; }
+ [Obsolete("This property is intended to be used only for JSON deserialization. Refer 'Description' to get the value.")]
+ [JsonPropertyName("description")]
+ public string? JsonPropertyDescription { get; set; }
+ [Obsolete("This property is intended to be used only for JSON deserialization. Refer 'Description' to get the value.")]
+ [JsonPropertyName("dev_name")]
+ public string? JsonPropertyDevName { get; set; }
+ [Obsolete("This property is intended to be used only for JSON deserialization. Refer 'MacAddress' to get the value.")]
+ [JsonConverter(typeof(MacAddressJsonConverter))]
+ [JsonPropertyName("mac")]
+ public PhysicalAddress? JsonPropertyMac { get; init; }
+ [Obsolete("This property is intended to be used only for JSON deserialization. Refer 'MacAddress' to get the value.")]
+ [JsonConverter(typeof(MacAddressJsonConverter))]
+ [JsonPropertyName("mic_mac")]
+ public PhysicalAddress? JsonPropertyMicMac { get; init; }
+ [Obsolete("This property is intended to be used only for JSON deserialization. Refer 'TypeName' to get the value.")]
+ [JsonPropertyName("mic_type")]
+ public string? JsonPropertyMicType { get; set; }
+ [Obsolete("This property is intended to be used only for JSON deserialization. Refer 'TypeName' to get the value.")]
+ [JsonPropertyName("type")]
+ public string? JsonPropertyType { get; set; }
+ public PhysicalAddress? MacAddress { get; }
+ [JsonPropertyName("model")]
+ public string? ModelName { get; init; }
+ [JsonPropertyName("rssi")]
+ public decimal? NetworkRssi { get; init; }
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ [JsonPropertyName("oemId")]
+ public byte[]? OemId { get; init; }
+ ReadOnlySpan<byte> IDeviceInfo.Id { get; }
+ [JsonIgnore]
+ public DateTimeOffset TimeStamp { get; }
+ public string? TypeName { get; }
+ }
+
public class KasaDisconnectedException : KasaProtocolException {
public KasaDisconnectedException(string message, EndPoint deviceEndPoint, Exception? innerException) {}
}
public class KasaErrorResponseException : KasaUnexpectedResponseException {
public KasaErrorResponseException(EndPoint deviceEndPoint, string requestModule, string requestMethod, int rawErrorCode) {}
public int RawErrorCode { get; }
}
public class KasaIncompleteResponseException : KasaUnexpectedResponseException {
public KasaIncompleteResponseException(string message, EndPoint deviceEndPoint, string requestModule, string requestMethod, Exception? innerException) {}
}
public abstract class KasaProtocolException : InvalidOperationException {
protected KasaProtocolException(string message, EndPoint deviceEndPoint, Exception? innerException) {}
public EndPoint DeviceEndPoint { get; }
}
public class KasaUnexpectedResponseException : KasaProtocolException {
public KasaUnexpectedResponseException(string message, EndPoint deviceEndPoint, string requestModule, string requestMethod, Exception? innerException) {}
public string RequestMethod { get; }
public string RequestModule { get; }
}
public readonly struct KL130LightState {
[MemberNotNullWhen(true, "IsOn")]
[JsonPropertyName("brightness")]
public int? Brightness { [MemberNotNullWhen(true, "IsOn")] get; [MemberNotNullWhen(true, "IsOn")] init; }
[MemberNotNullWhen(true, "IsOn")]
[JsonPropertyName("color_temp")]
public int? ColorTemperature { [MemberNotNullWhen(true, "IsOn")] get; [MemberNotNullWhen(true, "IsOn")] init; }
[MemberNotNullWhen(true, "IsOn")]
[JsonPropertyName("hue")]
public int? Hue { [MemberNotNullWhen(true, "IsOn")] get; [MemberNotNullWhen(true, "IsOn")] init; }
[JsonConverter(typeof(KasaNumericalBooleanJsonConverter))]
[JsonPropertyName("on_off")]
public bool IsOn { get; init; }
[MemberNotNullWhen(true, "IsOn")]
[JsonPropertyName("mode")]
public string? Mode { [MemberNotNullWhen(true, "IsOn")] get; [MemberNotNullWhen(true, "IsOn")] init; }
[MemberNotNullWhen(true, "IsOn")]
[JsonPropertyName("saturation")]
public int? Saturation { [MemberNotNullWhen(true, "IsOn")] get; [MemberNotNullWhen(true, "IsOn")] init; }
}
public readonly struct KasaDeviceExceptionHandling {
public static readonly KasaDeviceExceptionHandling InvalidateEndPointAndRetry; // = "{ShouldRetry=True, RetryAfter=00:00:00, ShouldReconnect=False, ShouldInvalidateEndPoint=True}"
public static readonly KasaDeviceExceptionHandling InvalidateEndPointAndThrow; // = "{ShouldRetry=False, RetryAfter=00:00:00, ShouldReconnect=False, ShouldInvalidateEndPoint=True}"
public static readonly KasaDeviceExceptionHandling Retry; // = "{ShouldRetry=True, RetryAfter=00:00:00, ShouldReconnect=False, ShouldInvalidateEndPoint=False}"
public static readonly KasaDeviceExceptionHandling RetryAfterReconnect; // = "{ShouldRetry=True, RetryAfter=00:00:00, ShouldReconnect=True, ShouldInvalidateEndPoint=False}"
public static readonly KasaDeviceExceptionHandling Throw; // = "{ShouldRetry=False, RetryAfter=00:00:00, ShouldReconnect=False, ShouldInvalidateEndPoint=False}"
public static KasaDeviceExceptionHandling CreateRetry(TimeSpan retryAfter, bool shouldReconnect = false) {}
public TimeSpan RetryAfter { get; init; }
public bool ShouldInvalidateEndPoint { get; init; }
public bool ShouldReconnect { get; init; }
public bool ShouldRetry { get; init; }
public override string ToString() {}
}
}
namespace Smdn.TPSmartHomeDevices.Kasa.Json {
public sealed class KasaNumericalBooleanJsonConverter : JsonConverter<bool> {
public KasaNumericalBooleanJsonConverter() {}
public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {}
public override void Write(Utf8JsonWriter writer, bool @value, JsonSerializerOptions options) {}
}
}
namespace Smdn.TPSmartHomeDevices.Kasa.Protocol {
public sealed class KasaClient : IDisposable {
public const int DefaultPort = 9999;
public KasaClient(EndPoint endPoint, ILogger? logger = null) {}
public EndPoint EndPoint { get; }
public bool IsConnected { get; }
public void Dispose() {}
public ValueTask<TMethodResult> SendAsync<TMethodParameter, TMethodResult>(JsonEncodedText module, JsonEncodedText method, TMethodParameter parameter, Func<JsonElement, TMethodResult> composeResult, CancellationToken cancellationToken = default) {}
}
public static class KasaJsonSerializer {
public const byte InitialKey = 171;
public static void DecryptInPlace(Span<byte> body) {}
public static JsonElement Deserialize(ArrayBufferWriter<byte> buffer, JsonEncodedText module, JsonEncodedText method, ILogger? logger = null) {}
public static void EncryptInPlace(Span<byte> body) {}
public static void Serialize<TMethodParameter>(ArrayBufferWriter<byte> buffer, JsonEncodedText module, JsonEncodedText method, TMethodParameter parameter, ILogger? logger = null) {}
}
public class KasaMessageBodyTooShortException : KasaMessageException {
public KasaMessageBodyTooShortException(int indicatedLength, int actualLength) {}
public int ActualLength { get; }
public int IndicatedLength { get; }
}
public class KasaMessageException : SystemException {
public KasaMessageException(string message) {}
}
public class KasaMessageHeaderTooShortException : KasaMessageException {
public KasaMessageHeaderTooShortException(string message) {}
}
}
// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.2.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa-net8.0.apilist.cs b/doc/api-list/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa-net8.0.apilist.cs
index 12f39cb..57bd208 100644
--- a/doc/api-list/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa-net8.0.apilist.cs
+++ b/doc/api-list/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa-net8.0.apilist.cs
@@ -1,234 +1,269 @@
-// Smdn.TPSmartHomeDevices.Kasa.dll (Smdn.TPSmartHomeDevices.Kasa-2.0.0-preview1)
+// Smdn.TPSmartHomeDevices.Kasa.dll (Smdn.TPSmartHomeDevices.Kasa-2.0.0-preview2)
// Name: Smdn.TPSmartHomeDevices.Kasa
// AssemblyVersion: 2.0.0.0
-// InformationalVersion: 2.0.0-preview1+79057c306c2fede642a92b623a95cbb150e83873
+// InformationalVersion: 2.0.0-preview2+d001e07a3ea43a47290d9e9d2f4d582e14caa297
// TargetFramework: .NETCoreApp,Version=v8.0
// Configuration: Release
// Referenced assemblies:
// Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
// Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
// Microsoft.Win32.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// Smdn.TPSmartHomeDevices.Primitives, Version=1.1.0.0, Culture=neutral
// System.Collections, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.ComponentModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// 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.Net.Sockets, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
// System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
#nullable enable annotations
using System;
using System.Buffers;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Net.NetworkInformation;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Smdn.TPSmartHomeDevices;
using Smdn.TPSmartHomeDevices.Kasa;
using Smdn.TPSmartHomeDevices.Kasa.Protocol;
namespace Smdn.TPSmartHomeDevices.Kasa {
public class HS105 :
KasaDevice,
- ISmartPlug
+ ISmartDevice
{
public static HS105 Create<TAddress>(TAddress deviceAddress, IServiceProvider serviceProvider) where TAddress : notnull {}
public HS105(IDeviceEndPoint deviceEndPoint, IServiceProvider? serviceProvider = null) {}
public HS105(IPAddress ipAddress, IServiceProvider? serviceProvider = null) {}
public HS105(PhysicalAddress macAddress, IServiceProvider serviceProvider) {}
public HS105(string host, IServiceProvider? serviceProvider = null) {}
public ValueTask<bool> GetOnOffStateAsync(CancellationToken cancellationToken = default) {}
public ValueTask SetOnOffStateAsync(bool newOnOffState, CancellationToken cancellationToken = default) {}
+ async ValueTask<IDeviceInfo> ISmartDevice.GetDeviceInfoAsync(CancellationToken cancellationToken) {}
public ValueTask TurnOffAsync(CancellationToken cancellationToken = default) {}
public ValueTask TurnOnAsync(CancellationToken cancellationToken = default) {}
}
public class KL130 :
KasaDevice,
IMulticolorSmartLight
{
public static KL130 Create<TAddress>(TAddress deviceAddress, IServiceProvider serviceProvider) where TAddress : notnull {}
public KL130(IDeviceEndPoint deviceEndPoint, IServiceProvider? serviceProvider = null) {}
public KL130(IPAddress ipAddress, IServiceProvider? serviceProvider = null) {}
public KL130(PhysicalAddress macAddress, IServiceProvider serviceProvider) {}
public KL130(string host, IServiceProvider? serviceProvider = null) {}
public ValueTask<KL130LightState> GetLightStateAsync(CancellationToken cancellationToken = default) {}
public ValueTask<bool> GetOnOffStateAsync(CancellationToken cancellationToken = default) {}
public ValueTask SetBrightnessAsync(int brightness, TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
public ValueTask SetColorAsync(int hue, int saturation, int? brightness = null, TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
public ValueTask SetColorTemperatureAsync(int colorTemperature, int? brightness = null, TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
public ValueTask SetOnOffStateAsync(bool newOnOffState, TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
+ async ValueTask<IDeviceInfo> ISmartDevice.GetDeviceInfoAsync(CancellationToken cancellationToken) {}
ValueTask ISmartDevice.SetOnOffStateAsync(bool newOnOffState, CancellationToken cancellationToken) {}
public ValueTask TurnOffAsync(TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
public ValueTask TurnOnAsync(TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
}
public class KasaDevice : IDisposable {
protected readonly struct NullParameter {
}
protected static readonly JsonEncodedText MethodTextGetSysInfo; // = "get_sysinfo"
protected static readonly JsonEncodedText ModuleTextSystem; // = "system"
public static KasaDevice Create(IDeviceEndPoint deviceEndPoint, IServiceProvider? serviceProvider = null) {}
public static KasaDevice Create(IPAddress ipAddress, IServiceProvider? serviceProvider = null) {}
public static KasaDevice Create(PhysicalAddress macAddress, IServiceProvider serviceProvider) {}
public static KasaDevice Create(string host, IServiceProvider? serviceProvider = null) {}
public static KasaDevice Create<TAddress>(TAddress deviceAddress, IServiceProvider serviceProvider) where TAddress : notnull {}
protected KasaDevice(IDeviceEndPoint deviceEndPoint, IServiceProvider? serviceProvider) {}
protected KasaDevice(IPAddress ipAddress, IServiceProvider? serviceProvider) {}
protected KasaDevice(PhysicalAddress macAddress, IServiceProvider serviceProvider) {}
protected KasaDevice(string host, IServiceProvider? serviceProvider) {}
public bool IsConnected { get; }
[MemberNotNullWhen(false, "deviceEndPoint")]
protected bool IsDisposed { [MemberNotNullWhen(false, "deviceEndPoint")] get; }
protected virtual void Dispose(bool disposing) {}
public void Dispose() {}
+ public ValueTask<KasaDeviceInfo?> GetDeviceInfoAsync(CancellationToken cancellationToken = default) {}
+ protected ValueTask<TSysInfo> GetSysInfoAsync<TSysInfo>(Func<JsonElement, TSysInfo> composeResult, CancellationToken cancellationToken = default) {}
public ValueTask<EndPoint> ResolveEndPointAsync(CancellationToken cancellationToken = default) {}
protected ValueTask SendRequestAsync<TMethodParameter>(JsonEncodedText module, JsonEncodedText method, TMethodParameter parameters, CancellationToken cancellationToken) {}
protected ValueTask<TMethodResult> SendRequestAsync<TMethodParameter, TMethodResult>(JsonEncodedText module, JsonEncodedText method, TMethodParameter parameters, Func<JsonElement, TMethodResult> composeResult, CancellationToken cancellationToken) {}
protected ValueTask<TMethodResult> SendRequestAsync<TMethodResult>(JsonEncodedText module, JsonEncodedText method, Func<JsonElement, TMethodResult> composeResult, CancellationToken cancellationToken) {}
public override string? ToString() {}
}
public abstract class KasaDeviceExceptionHandler {
internal protected static readonly KasaDeviceExceptionHandler Default; // = "Smdn.TPSmartHomeDevices.Kasa.KasaDeviceDefaultExceptionHandler"
protected KasaDeviceExceptionHandler() {}
public abstract KasaDeviceExceptionHandling DetermineHandling(KasaDevice device, Exception exception, int attempt, ILogger? logger);
}
public static class KasaDeviceExceptionHandlerServiceCollectionExtensions {
public static IServiceCollection AddKasaDeviceExceptionHandler(this IServiceCollection services, KasaDeviceExceptionHandler exceptionHandler) {}
}
+ public class KasaDeviceInfo : IDeviceInfo {
+ public KasaDeviceInfo() {}
+
+ public string? Description { get; }
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ [JsonPropertyName("fwId")]
+ public byte[]? FirmwareId { get; init; }
+ [JsonPropertyName("sw_ver")]
+ public string? FirmwareVersion { get; init; }
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ [JsonPropertyName("hwId")]
+ public byte[]? HardwareId { get; init; }
+ [JsonPropertyName("hw_ver")]
+ public string? HardwareVersion { get; init; }
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ [JsonPropertyName("deviceId")]
+ public byte[]? Id { get; init; }
+ public PhysicalAddress? MacAddress { get; }
+ [JsonPropertyName("model")]
+ public string? ModelName { get; init; }
+ [JsonPropertyName("rssi")]
+ public decimal? NetworkRssi { get; init; }
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ [JsonPropertyName("oemId")]
+ public byte[]? OemId { get; init; }
+ ReadOnlySpan<byte> IDeviceInfo.Id { get; }
+ [JsonIgnore]
+ public DateTimeOffset TimeStamp { get; }
+ public string? TypeName { get; }
+ }
+
public class KasaDisconnectedException : KasaProtocolException {
public KasaDisconnectedException(string message, EndPoint deviceEndPoint, Exception? innerException) {}
}
public class KasaErrorResponseException : KasaUnexpectedResponseException {
public KasaErrorResponseException(EndPoint deviceEndPoint, string requestModule, string requestMethod, int rawErrorCode) {}
public int RawErrorCode { get; }
}
public class KasaIncompleteResponseException : KasaUnexpectedResponseException {
public KasaIncompleteResponseException(string message, EndPoint deviceEndPoint, string requestModule, string requestMethod, Exception? innerException) {}
}
public abstract class KasaProtocolException : InvalidOperationException {
protected KasaProtocolException(string message, EndPoint deviceEndPoint, Exception? innerException) {}
public EndPoint DeviceEndPoint { get; }
}
public class KasaUnexpectedResponseException : KasaProtocolException {
public KasaUnexpectedResponseException(string message, EndPoint deviceEndPoint, string requestModule, string requestMethod, Exception? innerException) {}
public string RequestMethod { get; }
public string RequestModule { get; }
}
public readonly struct KL130LightState {
[MemberNotNullWhen(true, "IsOn")]
[JsonPropertyName("brightness")]
public int? Brightness { [MemberNotNullWhen(true, "IsOn")] get; [MemberNotNullWhen(true, "IsOn")] init; }
[MemberNotNullWhen(true, "IsOn")]
[JsonPropertyName("color_temp")]
public int? ColorTemperature { [MemberNotNullWhen(true, "IsOn")] get; [MemberNotNullWhen(true, "IsOn")] init; }
[MemberNotNullWhen(true, "IsOn")]
[JsonPropertyName("hue")]
public int? Hue { [MemberNotNullWhen(true, "IsOn")] get; [MemberNotNullWhen(true, "IsOn")] init; }
[JsonConverter(typeof(KasaNumericalBooleanJsonConverter))]
[JsonPropertyName("on_off")]
public bool IsOn { get; init; }
[MemberNotNullWhen(true, "IsOn")]
[JsonPropertyName("mode")]
public string? Mode { [MemberNotNullWhen(true, "IsOn")] get; [MemberNotNullWhen(true, "IsOn")] init; }
[MemberNotNullWhen(true, "IsOn")]
[JsonPropertyName("saturation")]
public int? Saturation { [MemberNotNullWhen(true, "IsOn")] get; [MemberNotNullWhen(true, "IsOn")] init; }
}
public readonly struct KasaDeviceExceptionHandling {
public static readonly KasaDeviceExceptionHandling InvalidateEndPointAndRetry; // = "{ShouldRetry=True, RetryAfter=00:00:00, ShouldReconnect=False, ShouldInvalidateEndPoint=True}"
public static readonly KasaDeviceExceptionHandling InvalidateEndPointAndThrow; // = "{ShouldRetry=False, RetryAfter=00:00:00, ShouldReconnect=False, ShouldInvalidateEndPoint=True}"
public static readonly KasaDeviceExceptionHandling Retry; // = "{ShouldRetry=True, RetryAfter=00:00:00, ShouldReconnect=False, ShouldInvalidateEndPoint=False}"
public static readonly KasaDeviceExceptionHandling RetryAfterReconnect; // = "{ShouldRetry=True, RetryAfter=00:00:00, ShouldReconnect=True, ShouldInvalidateEndPoint=False}"
public static readonly KasaDeviceExceptionHandling Throw; // = "{ShouldRetry=False, RetryAfter=00:00:00, ShouldReconnect=False, ShouldInvalidateEndPoint=False}"
public static KasaDeviceExceptionHandling CreateRetry(TimeSpan retryAfter, bool shouldReconnect = false) {}
public TimeSpan RetryAfter { get; init; }
public bool ShouldInvalidateEndPoint { get; init; }
public bool ShouldReconnect { get; init; }
public bool ShouldRetry { get; init; }
public override string ToString() {}
}
}
namespace Smdn.TPSmartHomeDevices.Kasa.Json {
public sealed class KasaNumericalBooleanJsonConverter : JsonConverter<bool> {
public KasaNumericalBooleanJsonConverter() {}
public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {}
public override void Write(Utf8JsonWriter writer, bool @value, JsonSerializerOptions options) {}
}
}
namespace Smdn.TPSmartHomeDevices.Kasa.Protocol {
public sealed class KasaClient : IDisposable {
public const int DefaultPort = 9999;
public KasaClient(EndPoint endPoint, ILogger? logger = null) {}
public EndPoint EndPoint { get; }
public bool IsConnected { get; }
public void Dispose() {}
public ValueTask<TMethodResult> SendAsync<TMethodParameter, TMethodResult>(JsonEncodedText module, JsonEncodedText method, TMethodParameter parameter, Func<JsonElement, TMethodResult> composeResult, CancellationToken cancellationToken = default) {}
}
public static class KasaJsonSerializer {
public const byte InitialKey = 171;
public static void DecryptInPlace(Span<byte> body) {}
public static JsonElement Deserialize(ArrayBufferWriter<byte> buffer, JsonEncodedText module, JsonEncodedText method, ILogger? logger = null) {}
public static void EncryptInPlace(Span<byte> body) {}
public static void Serialize<TMethodParameter>(ArrayBufferWriter<byte> buffer, JsonEncodedText module, JsonEncodedText method, TMethodParameter parameter, ILogger? logger = null) {}
}
public class KasaMessageBodyTooShortException : KasaMessageException {
public KasaMessageBodyTooShortException(int indicatedLength, int actualLength) {}
public int ActualLength { get; }
public int IndicatedLength { get; }
}
public class KasaMessageException : SystemException {
public KasaMessageException(string message) {}
}
public class KasaMessageHeaderTooShortException : KasaMessageException {
public KasaMessageHeaderTooShortException(string message) {}
}
}
// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.2.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa-netstandard2.1.apilist.cs b/doc/api-list/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa-netstandard2.1.apilist.cs
index cdf118b..95addcf 100644
--- a/doc/api-list/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa-netstandard2.1.apilist.cs
+++ b/doc/api-list/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa-netstandard2.1.apilist.cs
@@ -1,220 +1,275 @@
-// Smdn.TPSmartHomeDevices.Kasa.dll (Smdn.TPSmartHomeDevices.Kasa-2.0.0-preview1)
+// Smdn.TPSmartHomeDevices.Kasa.dll (Smdn.TPSmartHomeDevices.Kasa-2.0.0-preview2)
// Name: Smdn.TPSmartHomeDevices.Kasa
// AssemblyVersion: 2.0.0.0
-// InformationalVersion: 2.0.0-preview1+79057c306c2fede642a92b623a95cbb150e83873
+// InformationalVersion: 2.0.0-preview2+d001e07a3ea43a47290d9e9d2f4d582e14caa297
// TargetFramework: .NETStandard,Version=v2.1
// Configuration: Release
// Referenced assemblies:
// Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
// Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
// Smdn.TPSmartHomeDevices.Primitives, Version=1.1.0.0, Culture=neutral
// System.Text.Encodings.Web, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
// System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
// netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
#nullable enable annotations
using System;
using System.Buffers;
using System.Net;
using System.Net.NetworkInformation;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Smdn.TPSmartHomeDevices;
using Smdn.TPSmartHomeDevices.Kasa;
using Smdn.TPSmartHomeDevices.Kasa.Protocol;
namespace Smdn.TPSmartHomeDevices.Kasa {
public class HS105 :
KasaDevice,
- ISmartPlug
+ ISmartDevice
{
public static HS105 Create<TAddress>(TAddress deviceAddress, IServiceProvider serviceProvider) where TAddress : notnull {}
public HS105(IDeviceEndPoint deviceEndPoint, IServiceProvider? serviceProvider = null) {}
public HS105(IPAddress ipAddress, IServiceProvider? serviceProvider = null) {}
public HS105(PhysicalAddress macAddress, IServiceProvider serviceProvider) {}
public HS105(string host, IServiceProvider? serviceProvider = null) {}
public ValueTask<bool> GetOnOffStateAsync(CancellationToken cancellationToken = default) {}
public ValueTask SetOnOffStateAsync(bool newOnOffState, CancellationToken cancellationToken = default) {}
+ async ValueTask<IDeviceInfo> ISmartDevice.GetDeviceInfoAsync(CancellationToken cancellationToken) {}
public ValueTask TurnOffAsync(CancellationToken cancellationToken = default) {}
public ValueTask TurnOnAsync(CancellationToken cancellationToken = default) {}
}
public class KL130 :
KasaDevice,
IMulticolorSmartLight
{
public static KL130 Create<TAddress>(TAddress deviceAddress, IServiceProvider serviceProvider) where TAddress : notnull {}
public KL130(IDeviceEndPoint deviceEndPoint, IServiceProvider? serviceProvider = null) {}
public KL130(IPAddress ipAddress, IServiceProvider? serviceProvider = null) {}
public KL130(PhysicalAddress macAddress, IServiceProvider serviceProvider) {}
public KL130(string host, IServiceProvider? serviceProvider = null) {}
public ValueTask<KL130LightState> GetLightStateAsync(CancellationToken cancellationToken = default) {}
public ValueTask<bool> GetOnOffStateAsync(CancellationToken cancellationToken = default) {}
public ValueTask SetBrightnessAsync(int brightness, TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
public ValueTask SetColorAsync(int hue, int saturation, int? brightness = null, TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
public ValueTask SetColorTemperatureAsync(int colorTemperature, int? brightness = null, TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
public ValueTask SetOnOffStateAsync(bool newOnOffState, TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
+ async ValueTask<IDeviceInfo> ISmartDevice.GetDeviceInfoAsync(CancellationToken cancellationToken) {}
ValueTask ISmartDevice.SetOnOffStateAsync(bool newOnOffState, CancellationToken cancellationToken) {}
public ValueTask TurnOffAsync(TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
public ValueTask TurnOnAsync(TimeSpan transitionPeriod = default, CancellationToken cancellationToken = default) {}
}
public class KasaDevice : IDisposable {
protected readonly struct NullParameter {
}
protected static readonly JsonEncodedText MethodTextGetSysInfo;
protected static readonly JsonEncodedText ModuleTextSystem;
public static KasaDevice Create(IDeviceEndPoint deviceEndPoint, IServiceProvider? serviceProvider = null) {}
public static KasaDevice Create(IPAddress ipAddress, IServiceProvider? serviceProvider = null) {}
public static KasaDevice Create(PhysicalAddress macAddress, IServiceProvider serviceProvider) {}
public static KasaDevice Create(string host, IServiceProvider? serviceProvider = null) {}
public static KasaDevice Create<TAddress>(TAddress deviceAddress, IServiceProvider serviceProvider) where TAddress : notnull {}
protected KasaDevice(IDeviceEndPoint deviceEndPoint, IServiceProvider? serviceProvider) {}
protected KasaDevice(IPAddress ipAddress, IServiceProvider? serviceProvider) {}
protected KasaDevice(PhysicalAddress macAddress, IServiceProvider serviceProvider) {}
protected KasaDevice(string host, IServiceProvider? serviceProvider) {}
public bool IsConnected { get; }
protected bool IsDisposed { get; }
protected virtual void Dispose(bool disposing) {}
public void Dispose() {}
+ public ValueTask<KasaDeviceInfo?> GetDeviceInfoAsync(CancellationToken cancellationToken = default) {}
+ protected ValueTask<TSysInfo> GetSysInfoAsync<TSysInfo>(Func<JsonElement, TSysInfo> composeResult, CancellationToken cancellationToken = default) {}
public ValueTask<EndPoint> ResolveEndPointAsync(CancellationToken cancellationToken = default) {}
protected ValueTask SendRequestAsync<TMethodParameter>(JsonEncodedText module, JsonEncodedText method, TMethodParameter parameters, CancellationToken cancellationToken) {}
protected ValueTask<TMethodResult> SendRequestAsync<TMethodParameter, TMethodResult>(JsonEncodedText module, JsonEncodedText method, TMethodParameter parameters, Func<JsonElement, TMethodResult> composeResult, CancellationToken cancellationToken) {}
protected ValueTask<TMethodResult> SendRequestAsync<TMethodResult>(JsonEncodedText module, JsonEncodedText method, Func<JsonElement, TMethodResult> composeResult, CancellationToken cancellationToken) {}
public override string? ToString() {}
}
public abstract class KasaDeviceExceptionHandler {
internal protected static readonly KasaDeviceExceptionHandler Default; // = "Smdn.TPSmartHomeDevices.Kasa.KasaDeviceDefaultExceptionHandler"
protected KasaDeviceExceptionHandler() {}
public abstract KasaDeviceExceptionHandling DetermineHandling(KasaDevice device, Exception exception, int attempt, ILogger? logger);
}
public static class KasaDeviceExceptionHandlerServiceCollectionExtensions {
public static IServiceCollection AddKasaDeviceExceptionHandler(this IServiceCollection services, KasaDeviceExceptionHandler exceptionHandler) {}
}
+ public class KasaDeviceInfo : IDeviceInfo {
+ public KasaDeviceInfo() {}
+
+ public string? Description { get; }
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ [JsonPropertyName("fwId")]
+ public byte[]? FirmwareId { get; init; }
+ [JsonPropertyName("sw_ver")]
+ public string? FirmwareVersion { get; init; }
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ [JsonPropertyName("hwId")]
+ public byte[]? HardwareId { get; init; }
+ [JsonPropertyName("hw_ver")]
+ public string? HardwareVersion { get; init; }
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ [JsonPropertyName("deviceId")]
+ public byte[]? Id { get; init; }
+ [Obsolete("This property is intended to be used only for JSON deserialization. Refer 'Description' to get the value.")]
+ [JsonPropertyName("description")]
+ public string? JsonPropertyDescription { get; set; }
+ [Obsolete("This property is intended to be used only for JSON deserialization. Refer 'Description' to get the value.")]
+ [JsonPropertyName("dev_name")]
+ public string? JsonPropertyDevName { get; set; }
+ [Obsolete("This property is intended to be used only for JSON deserialization. Refer 'MacAddress' to get the value.")]
+ [JsonConverter(typeof(MacAddressJsonConverter))]
+ [JsonPropertyName("mac")]
+ public PhysicalAddress? JsonPropertyMac { get; init; }
+ [Obsolete("This property is intended to be used only for JSON deserialization. Refer 'MacAddress' to get the value.")]
+ [JsonConverter(typeof(MacAddressJsonConverter))]
+ [JsonPropertyName("mic_mac")]
+ public PhysicalAddress? JsonPropertyMicMac { get; init; }
+ [Obsolete("This property is intended to be used only for JSON deserialization. Refer 'TypeName' to get the value.")]
+ [JsonPropertyName("mic_type")]
+ public string? JsonPropertyMicType { get; set; }
+ [Obsolete("This property is intended to be used only for JSON deserialization. Refer 'TypeName' to get the value.")]
+ [JsonPropertyName("type")]
+ public string? JsonPropertyType { get; set; }
+ public PhysicalAddress? MacAddress { get; }
+ [JsonPropertyName("model")]
+ public string? ModelName { get; init; }
+ [JsonPropertyName("rssi")]
+ public decimal? NetworkRssi { get; init; }
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ [JsonPropertyName("oemId")]
+ public byte[]? OemId { get; init; }
+ ReadOnlySpan<byte> IDeviceInfo.Id { get; }
+ [JsonIgnore]
+ public DateTimeOffset TimeStamp { get; }
+ public string? TypeName { get; }
+ }
+
public class KasaDisconnectedException : KasaProtocolException {
public KasaDisconnectedException(string message, EndPoint deviceEndPoint, Exception? innerException) {}
}
public class KasaErrorResponseException : KasaUnexpectedResponseException {
public KasaErrorResponseException(EndPoint deviceEndPoint, string requestModule, string requestMethod, int rawErrorCode) {}
public int RawErrorCode { get; }
}
public class KasaIncompleteResponseException : KasaUnexpectedResponseException {
public KasaIncompleteResponseException(string message, EndPoint deviceEndPoint, string requestModule, string requestMethod, Exception? innerException) {}
}
public abstract class KasaProtocolException : InvalidOperationException {
protected KasaProtocolException(string message, EndPoint deviceEndPoint, Exception? innerException) {}
public EndPoint DeviceEndPoint { get; }
}
public class KasaUnexpectedResponseException : KasaProtocolException {
public KasaUnexpectedResponseException(string message, EndPoint deviceEndPoint, string requestModule, string requestMethod, Exception? innerException) {}
public string RequestMethod { get; }
public string RequestModule { get; }
}
public readonly struct KL130LightState {
[JsonPropertyName("brightness")]
public int? Brightness { get; init; }
[JsonPropertyName("color_temp")]
public int? ColorTemperature { get; init; }
[JsonPropertyName("hue")]
public int? Hue { get; init; }
[JsonConverter(typeof(KasaNumericalBooleanJsonConverter))]
[JsonPropertyName("on_off")]
public bool IsOn { get; init; }
[JsonPropertyName("mode")]
public string? Mode { get; init; }
[JsonPropertyName("saturation")]
public int? Saturation { get; init; }
}
public readonly struct KasaDeviceExceptionHandling {
public static readonly KasaDeviceExceptionHandling InvalidateEndPointAndRetry; // = "{ShouldRetry=True, RetryAfter=00:00:00, ShouldReconnect=False, ShouldInvalidateEndPoint=True}"
public static readonly KasaDeviceExceptionHandling InvalidateEndPointAndThrow; // = "{ShouldRetry=False, RetryAfter=00:00:00, ShouldReconnect=False, ShouldInvalidateEndPoint=True}"
public static readonly KasaDeviceExceptionHandling Retry; // = "{ShouldRetry=True, RetryAfter=00:00:00, ShouldReconnect=False, ShouldInvalidateEndPoint=False}"
public static readonly KasaDeviceExceptionHandling RetryAfterReconnect; // = "{ShouldRetry=True, RetryAfter=00:00:00, ShouldReconnect=True, ShouldInvalidateEndPoint=False}"
public static readonly KasaDeviceExceptionHandling Throw; // = "{ShouldRetry=False, RetryAfter=00:00:00, ShouldReconnect=False, ShouldInvalidateEndPoint=False}"
public static KasaDeviceExceptionHandling CreateRetry(TimeSpan retryAfter, bool shouldReconnect = false) {}
public TimeSpan RetryAfter { get; init; }
public bool ShouldInvalidateEndPoint { get; init; }
public bool ShouldReconnect { get; init; }
public bool ShouldRetry { get; init; }
public override string ToString() {}
}
}
namespace Smdn.TPSmartHomeDevices.Kasa.Json {
public sealed class KasaNumericalBooleanJsonConverter : JsonConverter<bool> {
public KasaNumericalBooleanJsonConverter() {}
public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {}
[...] public override <unknown> Write(...) {}
}
}
namespace Smdn.TPSmartHomeDevices.Kasa.Protocol {
public sealed class KasaClient : IDisposable {
public const int DefaultPort = 9999;
public KasaClient(EndPoint endPoint, ILogger? logger = null) {}
public EndPoint EndPoint { get; }
public bool IsConnected { get; }
public void Dispose() {}
public ValueTask<TMethodResult> SendAsync<TMethodParameter, TMethodResult>(JsonEncodedText module, JsonEncodedText method, TMethodParameter parameter, Func<JsonElement, TMethodResult> composeResult, CancellationToken cancellationToken = default) {}
}
public static class KasaJsonSerializer {
public const byte InitialKey = 171;
public static void DecryptInPlace(Span<byte> body) {}
public static JsonElement Deserialize(ArrayBufferWriter<byte> buffer, JsonEncodedText module, JsonEncodedText method, ILogger? logger = null) {}
public static void EncryptInPlace(Span<byte> body) {}
public static void Serialize<TMethodParameter>(ArrayBufferWriter<byte> buffer, JsonEncodedText module, JsonEncodedText method, TMethodParameter parameter, ILogger? logger = null) {}
}
public class KasaMessageBodyTooShortException : KasaMessageException {
public KasaMessageBodyTooShortException(int indicatedLength, int actualLength) {}
public int ActualLength { get; }
public int IndicatedLength { get; }
}
public class KasaMessageException : SystemException {
public KasaMessageException(string message) {}
}
public class KasaMessageHeaderTooShortException : KasaMessageException {
public KasaMessageHeaderTooShortException(string message) {}
}
}
// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.2.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
Full changes
Full changes in this release:
diff --git a/src/Smdn.TPSmartHomeDevices.Kasa/CompatibilitySuppressions.xml b/src/Smdn.TPSmartHomeDevices.Kasa/CompatibilitySuppressions.xml
index 7f747e8..df4c540 100644
--- a/src/Smdn.TPSmartHomeDevices.Kasa/CompatibilitySuppressions.xml
+++ b/src/Smdn.TPSmartHomeDevices.Kasa/CompatibilitySuppressions.xml
@@ -36,6 +36,78 @@
<Right>lib/net6.0/Smdn.TPSmartHomeDevices.Kasa.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
+ <Suppression>
+ <DiagnosticId>CP0002</DiagnosticId>
+ <Target>M:Smdn.TPSmartHomeDevices.Kasa.KasaDeviceInfo.get_JsonPropertyDescription</Target>
+ <Left>lib/net6.0/Smdn.TPSmartHomeDevices.Kasa.dll</Left>
+ <Right>lib/net8.0/Smdn.TPSmartHomeDevices.Kasa.dll</Right>
+ </Suppression>
+ <Suppression>
+ <DiagnosticId>CP0002</DiagnosticId>
+ <Target>M:Smdn.TPSmartHomeDevices.Kasa.KasaDeviceInfo.get_JsonPropertyDevName</Target>
+ <Left>lib/net6.0/Smdn.TPSmartHomeDevices.Kasa.dll</Left>
+ <Right>lib/net8.0/Smdn.TPSmartHomeDevices.Kasa.dll</Right>
+ </Suppression>
+ <Suppression>
+ <DiagnosticId>CP0002</DiagnosticId>
+ <Target>M:Smdn.TPSmartHomeDevices.Kasa.KasaDeviceInfo.get_JsonPropertyMac</Target>
+ <Left>lib/net6.0/Smdn.TPSmartHomeDevices.Kasa.dll</Left>
+ <Right>lib/net8.0/Smdn.TPSmartHomeDevices.Kasa.dll</Right>
+ </Suppression>
+ <Suppression>
+ <DiagnosticId>CP0002</DiagnosticId>
+ <Target>M:Smdn.TPSmartHomeDevices.Kasa.KasaDeviceInfo.get_JsonPropertyMicMac</Target>
+ <Left>lib/net6.0/Smdn.TPSmartHomeDevices.Kasa.dll</Left>
+ <Right>lib/net8.0/Smdn.TPSmartHomeDevices.Kasa.dll</Right>
+ </Suppression>
+ <Suppression>
+ <DiagnosticId>CP0002</DiagnosticId>
+ <Target>M:Smdn.TPSmartHomeDevices.Kasa.KasaDeviceInfo.get_JsonPropertyMicType</Target>
+ <Left>lib/net6.0/Smdn.TPSmartHomeDevices.Kasa.dll</Left>
+ <Right>lib/net8.0/Smdn.TPSmartHomeDevices.Kasa.dll</Right>
+ </Suppression>
+ <Suppression>
+ <DiagnosticId>CP0002</DiagnosticId>
+ <Target>M:Smdn.TPSmartHomeDevices.Kasa.KasaDeviceInfo.get_JsonPropertyType</Target>
+ <Left>lib/net6.0/Smdn.TPSmartHomeDevices.Kasa.dll</Left>
+ <Right>lib/net8.0/Smdn.TPSmartHomeDevices.Kasa.dll</Right>
+ </Suppression>
+ <Suppression>
+ <DiagnosticId>CP0002</DiagnosticId>
+ <Target>M:Smdn.TPSmartHomeDevices.Kasa.KasaDeviceInfo.set_JsonPropertyDescription(System.String)</Target>
+ <Left>lib/net6.0/Smdn.TPSmartHomeDevices.Kasa.dll</Left>
+ <Right>lib/net8.0/Smdn.TPSmartHomeDevices.Kasa.dll</Right>
+ </Suppression>
+ <Suppression>
+ <DiagnosticId>CP0002</DiagnosticId>
+ <Target>M:Smdn.TPSmartHomeDevices.Kasa.KasaDeviceInfo.set_JsonPropertyDevName(System.String)</Target>
+ <Left>lib/net6.0/Smdn.TPSmartHomeDevices.Kasa.dll</Left>
+ <Right>lib/net8.0/Smdn.TPSmartHomeDevices.Kasa.dll</Right>
+ </Suppression>
+ <Suppression>
+ <DiagnosticId>CP0002</DiagnosticId>
+ <Target>M:Smdn.TPSmartHomeDevices.Kasa.KasaDeviceInfo.set_JsonPropertyMac(System.Net.NetworkInformation.PhysicalAddress)</Target>
+ <Left>lib/net6.0/Smdn.TPSmartHomeDevices.Kasa.dll</Left>
+ <Right>lib/net8.0/Smdn.TPSmartHomeDevices.Kasa.dll</Right>
+ </Suppression>
+ <Suppression>
+ <DiagnosticId>CP0002</DiagnosticId>
+ <Target>M:Smdn.TPSmartHomeDevices.Kasa.KasaDeviceInfo.set_JsonPropertyMicMac(System.Net.NetworkInformation.PhysicalAddress)</Target>
+ <Left>lib/net6.0/Smdn.TPSmartHomeDevices.Kasa.dll</Left>
+ <Right>lib/net8.0/Smdn.TPSmartHomeDevices.Kasa.dll</Right>
+ </Suppression>
+ <Suppression>
+ <DiagnosticId>CP0002</DiagnosticId>
+ <Target>M:Smdn.TPSmartHomeDevices.Kasa.KasaDeviceInfo.set_JsonPropertyMicType(System.String)</Target>
+ <Left>lib/net6.0/Smdn.TPSmartHomeDevices.Kasa.dll</Left>
+ <Right>lib/net8.0/Smdn.TPSmartHomeDevices.Kasa.dll</Right>
+ </Suppression>
+ <Suppression>
+ <DiagnosticId>CP0002</DiagnosticId>
+ <Target>M:Smdn.TPSmartHomeDevices.Kasa.KasaDeviceInfo.set_JsonPropertyType(System.String)</Target>
+ <Left>lib/net6.0/Smdn.TPSmartHomeDevices.Kasa.dll</Left>
+ <Right>lib/net8.0/Smdn.TPSmartHomeDevices.Kasa.dll</Right>
+ </Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Smdn.TPSmartHomeDevices.Kasa.KL130.SetColorAsync(System.Int32,System.Int32,System.Nullable{System.Int32},System.Nullable{System.TimeSpan},System.Threading.CancellationToken)</Target>
diff --git a/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa.csproj b/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa.csproj
index 51f638d..7b81cee 100644
--- a/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa.csproj
+++ b/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa.csproj
@@ -6,7 +6,7 @@ SPDX-License-Identifier: MIT
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0;netstandard2.1</TargetFrameworks>
<VersionPrefix>2.0.0</VersionPrefix>
- <VersionSuffix>preview1</VersionSuffix>
+ <VersionSuffix>preview2</VersionSuffix>
<PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion>
<RootNamespace/> <!-- empty the root namespace so that the namespace is determined only by the directory name, for code style rule IDE0030 -->
<Nullable>enable</Nullable>
@@ -38,7 +38,7 @@ SPDX-License-Identifier: MIT
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
- <ProjectOrPackageReference ReferencePackageVersion="1.1.0-preview1" Include="..\Smdn.TPSmartHomeDevices.Primitives\Smdn.TPSmartHomeDevices.Primitives.csproj" />
+ <ProjectOrPackageReference ReferencePackageVersion="1.1.0-preview2" Include="..\Smdn.TPSmartHomeDevices.Primitives\Smdn.TPSmartHomeDevices.Primitives.csproj" />
</ItemGroup>
<ItemGroup>
diff --git a/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/HS105.cs b/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/HS105.cs
index 09af0b7..b92d546 100644
--- a/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/HS105.cs
+++ b/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/HS105.cs
@@ -22,7 +22,7 @@ namespace Smdn.TPSmartHomeDevices.Kasa;
/// </remarks>
/// <seealso href="https://www.tp-link.com/jp/home-networking/smart-plug/hs105/">Kasa HS105 product information (ja)</seealso>
/// <seealso href="https://www.kasasmart.com/us/products/smart-plugs/kasa-smart-wifi-plug-mini">Kasa HS105 product information (en)</seealso>
-public class HS105 : KasaDevice, ISmartPlug {
+public class HS105 : KasaDevice, ISmartDevice {
#pragma warning disable SA1114
private static readonly JsonEncodedText MethodTextSetRelayState = JsonEncodedText.Encode(
#if LANG_VERSION_11_OR_GREATER
@@ -109,6 +109,9 @@ public class HS105 : KasaDevice, ISmartPlug {
serviceProvider: serviceProvider
);
+ async ValueTask<IDeviceInfo> ISmartDevice.GetDeviceInfoAsync(CancellationToken cancellationToken)
+ => await GetDeviceInfoAsync(cancellationToken).ConfigureAwait(false) ?? throw new InvalidOperationException("Could not retrieve device information since it was null.");
+
private readonly struct SetRelayStateParameter {
public static readonly SetRelayStateParameter SetOff = new(false);
public static readonly SetRelayStateParameter SetOn = new(true);
diff --git a/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/KL130.cs b/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/KL130.cs
index 0fa57ff..ee5724b 100644
--- a/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/KL130.cs
+++ b/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/KL130.cs
@@ -124,6 +124,9 @@ public class KL130 : KasaDevice, IMulticolorSmartLight {
return value;
}
+ async ValueTask<IDeviceInfo> ISmartDevice.GetDeviceInfoAsync(CancellationToken cancellationToken)
+ => await GetDeviceInfoAsync(cancellationToken).ConfigureAwait(false) ?? throw new InvalidOperationException("Could not retrieve device information since it was null.");
+
#pragma warning disable SA1313
private readonly record struct SetOnOffStateParameter(
[property: JsonPropertyName("on_off")]
diff --git a/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/KasaDevice.GetSysInfo.cs b/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/KasaDevice.GetSysInfo.cs
new file mode 100644
index 0000000..c81eb63
--- /dev/null
+++ b/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/KasaDevice.GetSysInfo.cs
@@ -0,0 +1,69 @@
+// SPDX-FileCopyrightText: 2024 smdn <smdn@smdn.jp>
+// SPDX-License-Identifier: MIT
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Smdn.TPSmartHomeDevices.Kasa;
+
+#pragma warning disable IDE0040
+partial class KasaDevice {
+#pragma warning disable SA1114
+ protected static readonly JsonEncodedText ModuleTextSystem = JsonEncodedText.Encode(
+#if LANG_VERSION_11_OR_GREATER
+ "system"u8
+#else
+ "system"
+#endif
+ );
+ protected static readonly JsonEncodedText MethodTextGetSysInfo = JsonEncodedText.Encode(
+#if LANG_VERSION_11_OR_GREATER
+ "get_sysinfo"u8
+#else
+ "get_sysinfo"
+#endif
+ );
+#pragma warning restore SA1114
+
+ /// <summary>
+ /// Gets the system info of the device.
+ /// </summary>
+ /// <param name="composeResult">
+ /// The <see cref="Func{JsonElement, TSysInfo}"/> delegate that composes or converts the JSON returned
+ /// as a result of the 'get_sysinfo' method into the type <typeparamref name="TSysInfo"/>.
+ /// </param>
+ /// <param name="cancellationToken">
+ /// The <see cref="CancellationToken" /> to monitor for cancellation requests.
+ /// The default value is <see langword="default" />.
+ /// </param>
+ protected ValueTask<TSysInfo> GetSysInfoAsync<TSysInfo>(
+ Func<JsonElement, TSysInfo> composeResult,
+ CancellationToken cancellationToken = default
+ )
+ => SendRequestAsync(
+ module: ModuleTextSystem,
+ method: MethodTextGetSysInfo,
+ composeResult: composeResult,
+ cancellationToken: cancellationToken
+ );
+
+ /// <summary>
+ /// Gets the Kasa device information.
+ /// </summary>
+ /// <param name="cancellationToken">
+ /// The <see cref="CancellationToken" /> to monitor for cancellation requests.
+ /// The default value is <see langword="default" />.
+ /// </param>
+ /// <returns>
+ /// A <see cref="ValueTask{KasaDeviceInfo}"/> representing the result of method.
+ /// </returns>
+ /// <seealso cref="KasaDeviceInfo"/>
+ public ValueTask<KasaDeviceInfo?> GetDeviceInfoAsync(
+ CancellationToken cancellationToken = default
+ )
+ => GetSysInfoAsync(
+ composeResult: static result => JsonSerializer.Deserialize<KasaDeviceInfo>(result),
+ cancellationToken: cancellationToken
+ );
+}
diff --git a/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/KasaDevice.cs b/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/KasaDevice.cs
index 6bdb20f..0bb2213 100644
--- a/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/KasaDevice.cs
+++ b/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/KasaDevice.cs
@@ -46,23 +46,6 @@ public partial class KasaDevice : IDisposable {
: $"{CurrentEndPoint} ({DeviceEndPoint})";
}
-#pragma warning disable SA1114
- protected static readonly JsonEncodedText ModuleTextSystem = JsonEncodedText.Encode(
-#if LANG_VERSION_11_OR_GREATER
- "system"u8
-#else
- "system"
-#endif
- );
- protected static readonly JsonEncodedText MethodTextGetSysInfo = JsonEncodedText.Encode(
-#if LANG_VERSION_11_OR_GREATER
- "get_sysinfo"u8
-#else
- "get_sysinfo"
-#endif
- );
-#pragma warning restore SA1114
-
protected readonly struct NullParameter { }
private IDeviceEndPoint deviceEndPoint; // if null, it indicates a 'disposed' state.
diff --git a/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/KasaDeviceInfo.cs b/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/KasaDeviceInfo.cs
new file mode 100644
index 0000000..e93a58a
--- /dev/null
+++ b/src/Smdn.TPSmartHomeDevices.Kasa/Smdn.TPSmartHomeDevices.Kasa/KasaDeviceInfo.cs
@@ -0,0 +1,170 @@
+// SPDX-FileCopyrightText: 2024 smdn <smdn@smdn.jp>
+// SPDX-License-Identifier: MIT
+#if NET8_0_OR_GREATER
+// https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/immutability#non-public-members-and-property-accessors
+#define SYSTEM_JSON_TEXT_SERIALIZE_NON_PUBLIC_ACCESSORS
+#endif
+
+using System;
+using System.Net.NetworkInformation;
+using System.Text.Json.Serialization;
+
+using Smdn.TPSmartHomeDevices.Json;
+
+namespace Smdn.TPSmartHomeDevices.Kasa;
+
+/// <summary>
+/// Represents Kasa device information, including current status.
+/// </summary>
+/// <seealso cref="KasaDevice.GetDeviceInfoAsync(System.Threading.CancellationToken)"/>
+public class KasaDeviceInfo : IDeviceInfo {
+ /// <summary>
+ /// Gets the <see cref="DateTimeOffset"/> that represents the time at which this instance was acquired.
+ /// </summary>
+ [JsonIgnore]
+ public DateTimeOffset TimeStamp { get; } = DateTimeOffset.Now;
+
+ /*
+ * properties for the informations common to the devices
+ */
+#pragma warning disable CA1819
+ /// <summary>Gets the Kasa device's ID.</summary>
+ /// <remarks>The value will be a <see cref="string"/> representing a HEX-encoded(Base16) byte array.</remarks>
+ [JsonPropertyName("deviceId")]
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ public byte[]? Id { get; init; }
+#pragma warning restore CA1819
+
+ ReadOnlySpan<byte> IDeviceInfo.Id => Id is null ? ReadOnlySpan<byte>.Empty : Id.AsSpan();
+
+ /// <summary>Gets the Kasa device's description.</summary>
+ public string? Description =>
+#if !SYSTEM_JSON_TEXT_SERIALIZE_NON_PUBLIC_ACCESSORS
+#pragma warning disable CS0618
+#endif
+ JsonPropertyDescription ?? JsonPropertyDevName;
+#pragma warning restore CS0618
+
+ [JsonPropertyName("description")]
+#if SYSTEM_JSON_TEXT_SERIALIZE_NON_PUBLIC_ACCESSORS
+ [JsonInclude]
+ private
+#else
+ [Obsolete($"This property is intended to be used only for JSON deserialization. Refer '{nameof(Description)}' to get the value.")]
+ public
+#endif
+ string? JsonPropertyDescription { get; set; }
+
+ [JsonPropertyName("dev_name")]
+#if SYSTEM_JSON_TEXT_SERIALIZE_NON_PUBLIC_ACCESSORS
+ [JsonInclude]
+ private
+#else
+ [Obsolete($"This property is intended to be used only for JSON deserialization. Refer '{nameof(Description)}' to get the value.")]
+ public
+#endif
+ string? JsonPropertyDevName { get; set; }
+
+ /// <summary>Gets the Kasa device's type name.</summary>
+ /// <remarks>The value would be like <c>IOT.SMARTBULB</c> for Kasa KL130, as an example.</remarks>
+ public string? TypeName =>
+#if !SYSTEM_JSON_TEXT_SERIALIZE_NON_PUBLIC_ACCESSORS
+#pragma warning disable CS0618
+#endif
+ JsonPropertyMicType ?? JsonPropertyType;
+#pragma warning restore CS0618
+
+ [JsonPropertyName("mic_type")]
+#if SYSTEM_JSON_TEXT_SERIALIZE_NON_PUBLIC_ACCESSORS
+ [JsonInclude]
+ private
+#else
+ [Obsolete($"This property is intended to be used only for JSON deserialization. Refer '{nameof(TypeName)}' to get the value.")]
+ public
+#endif
+ string? JsonPropertyMicType { get; set; }
+
+ [JsonPropertyName("type")]
+#if SYSTEM_JSON_TEXT_SERIALIZE_NON_PUBLIC_ACCESSORS
+ [JsonInclude]
+ private
+#else
+ [Obsolete($"This property is intended to be used only for JSON deserialization. Refer '{nameof(TypeName)}' to get the value.")]
+ public
+#endif
+ string? JsonPropertyType { get; set; }
+
+ /// <summary>Gets the Kasa device's model name.</summary>
+ /// <remarks>The value would be like <c>KL130(JP)</c> for Kasa KL130, as an example.</remarks>
+ [JsonPropertyName("model")]
+ public string? ModelName { get; init; }
+
+#pragma warning disable CA1819
+ /// <summary>Gets the Kasa device's current firmware ID.</summary>
+ /// <remarks>The value will be a <see cref="string"/> representing a HEX-encoded(Base16) byte array.</remarks>
+ [JsonPropertyName("fwId")]
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ public byte[]? FirmwareId { get; init; }
+#pragma warning restore CA1819
+
+ /// <summary>Gets the Kasa device's current firmware version string.</summary>
+ /// <remarks>The value would be like <c>x.y.z Build yyyyMMdd Rel. XXXXX</c>, as an example.</remarks>
+ [JsonPropertyName("sw_ver")]
+ public string? FirmwareVersion { get; init; }
+
+#pragma warning disable CA1819
+ /// <summary>Gets the Kasa device's hardware ID.</summary>
+ /// <remarks>The value will be a <see cref="string"/> representing a HEX-encoded(Base16) byte array.</remarks>
+ [JsonPropertyName("hwId")]
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ public byte[]? HardwareId { get; init; }
+#pragma warning restore CA1819
+
+ /// <summary>Gets the Kasa device's hardware version string.</summary>
+ /// <remarks>The value would be like <c>x.y</c>, as an example.</remarks>
+ [JsonPropertyName("hw_ver")]
+ public string? HardwareVersion { get; init; }
+
+#pragma warning disable CA1819
+ /// <summary>Gets the Kasa device's OEM ID.</summary>
+ /// <remarks>The value will be a <see cref="string"/> representing a HEX-encoded(Base16) byte array.</remarks>
+ [JsonPropertyName("oemId")]
+ [JsonConverter(typeof(Base16ByteArrayJsonConverter))]
+ public byte[]? OemId { get; init; }
+#pragma warning restore CA1819
+
+ /// <summary>Gets the <see cref="PhysicalAddress"/> that represents the Kasa device's MAC address.</summary>
+ public PhysicalAddress? MacAddress =>
+#if !SYSTEM_JSON_TEXT_SERIALIZE_NON_PUBLIC_ACCESSORS
+#pragma warning disable CS0618
+#endif
+ JsonPropertyMicMac ?? JsonPropertyMac;
+#pragma warning restore CS0618
+
+ [JsonPropertyName("mic_mac")]
+ [JsonConverter(typeof(MacAddressJsonConverter))]
+#if SYSTEM_JSON_TEXT_SERIALIZE_NON_PUBLIC_ACCESSORS
+ [JsonInclude]
+ private
+#else
+ [Obsolete($"This property is intended to be used only for JSON deserialization. Refer '{nameof(MacAddress)}' to get the value.")]
+ public
+#endif
+ PhysicalAddress? JsonPropertyMicMac { get; init; }
+
+ [JsonPropertyName("mac")]
+ [JsonConverter(typeof(MacAddressJsonConverter))]
+#if SYSTEM_JSON_TEXT_SERIALIZE_NON_PUBLIC_ACCESSORS
+ [JsonInclude]
+ private
+#else
+ [Obsolete($"This property is intended to be used only for JSON deserialization. Refer '{nameof(MacAddress)}' to get the value.")]
+ public
+#endif
+ PhysicalAddress? JsonPropertyMac { get; init; }
+
+ /// <summary>Gets the <see cref="decimal"/> that represents the RSSI (Received Signal Strength Indicator) of the network to which the Kasa device is currently connected, in dB.</summary>
+ /// <remarks>The value would be like <c>-30</c>, as an example.</remarks>
+ [JsonPropertyName("rssi")]
+ public decimal? NetworkRssi { get; init; }
+}
Notes
Full Changelog: releases/Smdn.TPSmartHomeDevices.Kasa-2.0.0-preview1...releases/Smdn.TPSmartHomeDevices.Kasa-2.0.0-preview2