Smdn.Net.EchonetLite version 2.0.0-preview2
Pre-release
Pre-release
smdn
released this
11 Dec 13:45
·
159 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-10-16 update package version
- 2024-10-16 simplify event args
- 2024-10-16 define default value explicitly
- 2024-10-16 use IReadOnlyList to express the processing target properties, instead of IReadOnlyCollection
- 2024-10-16 expose ESVExtensions.ToSymbolString
- 2024-10-16 move MeasurementValue to Smdn.Net.EchonetLite.RouteB
- 2024-10-15 fix xml document comment
- 2024-10-15 improve log output
- 2024-10-15 fix trimming null terminator
- 2024-10-15 modify EchonetClient.RequestNotifyInstanceListAsync to be able to specify the destination node address
- 2024-10-15 fix to use non-generic TaskCompletionSource
- 2024-10-15 add support for acquiring extra properties along with property maps
- 2024-10-15 fix to keep property states after applying acquired property maps
- 2024-10-15 reduce duplicate codes
- 2024-10-15 import DeviceSuperClass
- 2024-10-15 import IEchonetPropertyAccessor and its derived ifaces, and impls
- 2024-10-15 import MeasurementValue<TValue>
- 2024-10-14 add extension methods for requesting ESVs from EchonetObject
- 2024-10-14 add EchonetProperty.HasModified to describe whether the value has been changed or accepted as a result of requesting set
- 2024-10-14 introduce EchonetServiceResponse to describe response of ESV requests
- 2024-10-14 simplify operation method namings
- 2024-10-14 simplify ESV method namings
- 2024-10-14 changed the API for each ESV request to be able to use with only primitive types
- 2024-10-14 fix to refer only the requested size range for the buffer rent from ArrayPool
- 2024-10-14 reorganize impls and files of EchonetClient
- 2024-10-14 add PropertyValue.Create
- 2024-10-14 extract and methodize EchonetClient.GetOrAddOtherNode
- 2024-10-14 narrow the accessibilities to internal
- 2024-10-12 change acquring property map to be called manually, instead of when receiving instance list
- 2024-10-12 introduce IEchonetDeviceFactory
- 2024-10-12 introduce API for applying property map
- 2024-10-11 implement EchonetProperty.ToString
- 2024-10-08 implement EchonetObject.ToString
- 2024-10-07 fix logging
- 2024-10-06 simplify new operator
- 2024-10-06 add comment
- 2024-10-06 expose EchonetProfileObjectDetail.NodeProfile
- 2024-10-06 add IEchonetObjectSpecification implementation for the controller class
- 2024-10-06 add overload of EchonetNode.CreateSelfNode that can specify a node profile
- 2024-10-06 expose EchonetObject.CreateNodeProfile
- 2024-10-06 fix static field initialization
- 2024-10-06 fix warning
- 2024-10-06 change HandleFormat1Message to ignore self-started requests
- 2024-10-06 fix value for concurrencyLevel
- 2024-10-06 implement transaction management
- 2024-10-06 fix response handler to handle only responses of the requesting transaction
- 2024-10-06 modify to increment TID using with Interlocked.Increment
- 2024-10-05 fix accessibility modifiers
- 2024-10-05 reverse if and else to simplify conditions
- 2024-10-05 remove abstract members with no usage
- 2024-10-05 expose IReadOnlyDictionary<byte, EchonetProperty> instead of IReadOnlyCollection<EchonetProperty> to be able to simplify property lookups from EPC
- 2024-10-05 correct processing and response for Get/GetSet service operation
- 2024-10-05 add EchonetObject.StorePropertyValue to commonize codes for storing property values
- 2024-10-05 add missing namespace declaration
- 2024-10-05 improve naming and clarify intentions
- 2024-10-04 improve to log exception occured while writing new property value
- 2024-10-04 fix specifying wrong property accessibilities
- 2024-10-04 make sure to log exception occured while handling format 1 messages
- 2024-10-04 fix xml comment docs
- 2024-10-04 fix naming of async method
- 2024-10-03 fix not to reference property objects before acquiring property maps
- 2024-10-03 add overload of PerformPropertyValueReadRequestAsync that can accept IEnumerable<byte> for the list of property
- 2024-10-03 fix log format
- 2024-10-03 reduce dependency to concrete types
- 2024-10-03 fix to be sure to set OwnerNode for node profiles
- 2024-10-03 fix not to pass array rented from ArrayPool directly to event arguments
- 2024-10-03 add EchonetClient.ServiceHandlerTaskFactory to enable customizing TaskFactory for creating handlers for ESVs
- 2024-10-03 improve naming
- 2024-10-03 split file into separate files for the codes of service requests and service handlings
- 2024-10-03 remove unnecessary warning suppression
- 2024-10-03 introduce IEchonetClientService to provide references to the service interfaces
- 2024-10-03 change to use ILogger and TimeProvider provided by EchonetClient
- 2024-10-03 add method overload for logging
- 2024-10-03 implement EchonetProperty.LastUpdatedTime
- 2024-10-02 introduce IEventInvoker to enable raising events using with ISynchronizeInvoke
- 2024-10-02 define object relationships to enable to refer the node which they belong
- 2024-10-02 use the unabbreviated term 'detail' instead of the abbreviated term 'spec'
- 2024-10-02 rename EchonetClient.Nodes to EchonetClient.OtherNodes
- 2024-10-02 simplify and minor improvements
- 2024-10-01 add package Smdn.Net.EchonetLite.Primitives and merge package Smdn.Net.EchonetLite.Transport
- 2024-10-01 introduce IEchonetObjectSpecification and IEchonetPropertySpecification to invert dependency to the appendix
- 2024-10-01 introduce DetailedEchonetObject and UnspecifiedEchonetObject to reduce dependency to the appendix
- 2024-10-01 introduce DetailedEchonetProperty and UnspecifiedEchonetProperty to reduce dependency to the appendix
- 2024-10-01 remove duplicate self-node address specification from EchonetClient constructor
- 2024-10-01 add constructor overload that can set preconfigured EchonetNode as the self node
- 2024-10-01 introduce EchonetSelfNode and EchonetOtherNode to classify self and other nodes by type
- 2024-10-01 improve log level and formatting
- 2024-10-01 reduce duplicate codes for conversion to hexadecimal representation
- 2024-09-30 fix to allow multicast
- 2024-09-30 add overload of PerformPropertyValueNotificationRequestAsync that can accept IEnumerable<byte> for the list of property
- 2024-09-30 reduce complexity of processing received property maps
- 2024-09-30 remove dead codes
- 2024-09-29 improve logging
- 2024-09-29 use concurrent collection to manage ECHONET objects
- 2024-09-29 use concurrent collection to manage other nodes
- 2024-09-29 fix EOJ comparison not to consider the instance code for comparing the profile class group objects
- 2024-09-29 fix handling notification from node profiles
- 2024-09-29 remove implementations relevant to serialization to reduce dependencies of System.Text.Json
- 2024-09-28 use Format1Message.ToString() for logging, instead of JsonSerializer.Serialize()
- 2024-09-28 implement ToString()
- 2024-09-28 reduce duplicate codes
- 2024-09-28 rename PropertyRequest to PropertyValue
- 2024-09-28 improve FrameSerializer.SerializeEchonetLiteFrameFormat1
- 2024-09-28 fix public API namings with the terminology defined in the specification
- 2024-09-28 fix namings for the processsing target properties with the terminology defined in the specification
- 2024-09-28 improve xml comment docs
- 2024-09-28 reduce allocation size for OPC list
- 2024-09-27 reimplement and improve logging for sending/receiving messages
- 2024-09-27 rename EData1 to Format1Message
- 2024-09-27 deprecate unnecessary polymorphic implementation for frames
- 2024-09-27 unify some namings with the terminology defined in the specification
- 2024-09-27 split implementations into individual files
- 2024-09-27 rename events and handlers for handling received messages
- 2024-09-27 make the internal frame handler more message-format specific
- 2024-09-27 improve xml doc comments
- 2024-09-21 temporarily assign 0x00 to the instance code for the profile object of the newly identified node
- 2024-09-21 add NodeObject.CreateNodeProfile() and its variants
- 2024-09-20 simplify DEOJ for instance list notification and instance list notification request to use node profile
- 2024-04-06 add TODO comment
- 2024-04-06 add ISynchronizeInvoke EchonetClient.SynchronizingObject and raise events via ISynchronizeInvoke.BeginInvoke if set
- 2024-04-06 modify to raise NodeJoined event via the overridable trigger method
- 2024-04-05 improve to define reference project/package versions in single .targets file
- 2024-04-05 improve to define reference package versions in single .targets file
- 2024-04-05 fix order of property declaration
- 2024-04-05 add placeholder for PackageValidationBaselineVersion
- 2024-04-05 remove duplicate property declarations
- 2024-04-05 split the property settings for the project inherited from the original repository into individual prop file
API changes
API changes in this release:
diff --git a/doc/api-list/Smdn.Net.EchonetLite/Smdn.Net.EchonetLite-net6.0.apilist.cs b/doc/api-list/Smdn.Net.EchonetLite/Smdn.Net.EchonetLite-net6.0.apilist.cs
index 43a384f..49d29b7 100644
--- a/doc/api-list/Smdn.Net.EchonetLite/Smdn.Net.EchonetLite-net6.0.apilist.cs
+++ b/doc/api-list/Smdn.Net.EchonetLite/Smdn.Net.EchonetLite-net6.0.apilist.cs
@@ -1,256 +1,376 @@
-// Smdn.Net.EchonetLite.dll (Smdn.Net.EchonetLite-2.0.0-preview1)
+// Smdn.Net.EchonetLite.dll (Smdn.Net.EchonetLite-2.0.0-preview2)
// Name: Smdn.Net.EchonetLite
// AssemblyVersion: 2.0.0.0
-// InformationalVersion: 2.0.0-preview1+2afe0aa023b391033e8606759aaf401afa325ddb
+// InformationalVersion: 2.0.0-preview2+60a8ce3520b765b1bcab669a662cfb615f41a1f5
// TargetFramework: .NETCoreApp,Version=v6.0
// Configuration: Release
// Referenced assemblies:
// Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
-// Smdn.Net.EchonetLite.Appendix, Version=2.0.0.0, Culture=neutral
-// Smdn.Net.EchonetLite.Transport, Version=2.0.0.0, Culture=neutral
+// Smdn.Net.EchonetLite.Primitives, Version=2.0.0.0, Culture=neutral
// System.Collections, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+// System.Collections.Concurrent, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.ComponentModel.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Linq, 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.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-// System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
// System.Threading, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
#nullable enable annotations
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Smdn.Net.EchonetLite;
-using Smdn.Net.EchonetLite.Appendix;
+using Smdn.Net.EchonetLite.ComponentModel;
+using Smdn.Net.EchonetLite.ObjectModel;
using Smdn.Net.EchonetLite.Protocol;
using Smdn.Net.EchonetLite.Transport;
namespace Smdn.Net.EchonetLite {
+ public interface IEchonetDeviceFactory {
+ EchonetDevice? Create(byte classGroupCode, byte classCode, byte instanceCode);
+ }
+
+ public enum EchonetServicePropertyResult : int {
+ Accepted = 1,
+ NotAccepted = 2,
+ Unavailable = 0,
+ }
+
public class EchonetClient :
IAsyncDisposable,
IDisposable
{
- public event EventHandler<(EchonetNode, IReadOnlyList<EchonetObject>)>? InstanceListPropertyMapAcquiring;
- public event EventHandler<(EchonetNode, IReadOnlyList<EchonetObject>)>? InstanceListUpdated;
+ public event EventHandler<EchonetNode>? InstanceListUpdated;
public event EventHandler<EchonetNode>? InstanceListUpdating;
public event EventHandler<EchonetNode>? NodeJoined;
- public event EventHandler<(EchonetNode, EchonetObject)>? PropertyMapAcquired;
- public event EventHandler<(EchonetNode, EchonetObject)>? PropertyMapAcquiring;
+ public event EventHandler<EchonetObject>? PropertyMapAcquired;
+ public event EventHandler<EchonetObject>? PropertyMapAcquiring;
- public EchonetClient(IPAddress nodeAddress, IEchonetLiteHandler echonetLiteHandler, ILogger<EchonetClient>? logger = null) {}
- public EchonetClient(IPAddress nodeAddress, IEchonetLiteHandler echonetLiteHandler, bool shouldDisposeEchonetLiteHandler, ILogger<EchonetClient>? logger) {}
+ public EchonetClient(EchonetNode selfNode, IEchonetLiteHandler echonetLiteHandler, bool shouldDisposeEchonetLiteHandler, IEchonetDeviceFactory? deviceFactory, ILogger<EchonetClient>? logger) {}
+ public EchonetClient(IEchonetLiteHandler echonetLiteHandler, ILogger<EchonetClient>? logger = null) {}
+ public EchonetClient(IEchonetLiteHandler echonetLiteHandler, bool shouldDisposeEchonetLiteHandler, ILogger<EchonetClient>? logger) {}
- public ICollection<EchonetNode> Nodes { get; }
+ public IReadOnlyCollection<EchonetNode> OtherNodes { get; }
public EchonetNode SelfNode { get; }
+ public TaskFactory? ServiceHandlerTaskFactory { get; set; }
+ public ISynchronizeInvoke? SynchronizingObject { get; set; }
+ public async ValueTask<bool> AcquirePropertyMapsAsync(EchonetObject device, IEnumerable<byte>? extraPropertyCodes = null, CancellationToken cancellationToken = default) {}
protected virtual void Dispose(bool disposing) {}
public void Dispose() {}
public async ValueTask DisposeAsync() {}
protected virtual async ValueTask DisposeAsyncCore() {}
- protected virtual void OnInstanceListPropertyMapAcquiring(EchonetNode node, IReadOnlyList<EchonetObject> instances) {}
- protected virtual void OnInstanceListUpdated(EchonetNode node, IReadOnlyList<EchonetObject> instances) {}
+ internal protected IPAddress? GetSelfNodeAddress() {}
+ protected void InvokeEvent<TEventArgs>(object? sender, EventHandler<TEventArgs>? eventHandler, TEventArgs e) {}
+ public async ValueTask<EchonetServiceResponse> NotifyAsync(EOJ sourceObject, IEnumerable<PropertyValue> properties, IPAddress destinationNodeAddress, EOJ destinationObject, CancellationToken cancellationToken = default) {}
+ public async ValueTask NotifyInstanceListAsync(CancellationToken cancellationToken = default) {}
+ public ValueTask NotifyOneWayAsync(EOJ sourceObject, IEnumerable<PropertyValue> properties, IPAddress? destinationNodeAddress, EOJ destinationObject, CancellationToken cancellationToken = default) {}
+ protected virtual void OnInstanceListUpdated(EchonetNode node) {}
protected virtual void OnInstanceListUpdating(EchonetNode node) {}
- protected virtual void OnPropertyMapAcquired(EchonetNode node, EchonetObject device) {}
- protected virtual void OnPropertyMapAcquiring(EchonetNode node, EchonetObject device) {}
- public async ValueTask PerformInstanceListNotificationAsync(CancellationToken cancellationToken = default) {}
- public async Task PerformInstanceListNotificationRequestAsync<TState>(Func<EchonetClient, EchonetNode, TState, bool>? onInstanceListPropertyMapAcquiring, Func<EchonetClient, EchonetNode, TState, bool>? onInstanceListUpdated, Func<EchonetClient, EchonetNode, EchonetObject, TState, bool>? onPropertyMapAcquired, TState state, CancellationToken cancellationToken = default) {}
- public async ValueTask PerformInstanceListNotificationRequestAsync(CancellationToken cancellationToken = default) {}
- public ValueTask PerformPropertyValueNotificationAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public ValueTask PerformPropertyValueNotificationRequestAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public async Task<IReadOnlyCollection<PropertyRequest>> PerformPropertyValueNotificationResponseRequiredAsync(EchonetObject sourceObject, EchonetNode destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public async Task<(bool Result, IReadOnlyCollection<PropertyRequest> Properties)> PerformPropertyValueReadRequestAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public async Task<(bool Result, IReadOnlyCollection<PropertyRequest> PropertiesSet, IReadOnlyCollection<PropertyRequest> PropertiesGet)> PerformPropertyValueWriteReadRequestAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> propertiesSet, IEnumerable<EchonetProperty> propertiesGet, CancellationToken cancellationToken = default) {}
- public async Task<IReadOnlyCollection<PropertyRequest>> PerformPropertyValueWriteRequestAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public async Task<(bool Result, IReadOnlyCollection<PropertyRequest> Properties)> PerformPropertyValueWriteRequestResponseRequiredAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
+ protected virtual void OnNodeJoined(EchonetNode node) {}
+ protected virtual void OnPropertyMapAcquired(EchonetObject device) {}
+ protected virtual void OnPropertyMapAcquiring(EchonetObject device) {}
+ public ValueTask RequestNotifyInstanceListAsync(IPAddress? destinationNodeAddress = null, CancellationToken cancellationToken = default) {}
+ public async Task RequestNotifyInstanceListAsync<TState>(IPAddress? destinationNodeAddress, Func<EchonetNode, TState, bool> onInstanceListUpdated, TState state, CancellationToken cancellationToken = default) {}
+ public ValueTask RequestNotifyOneWayAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<byte> propertyCodes, CancellationToken cancellationToken = default) {}
+ public async ValueTask<EchonetServiceResponse> RequestReadAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<byte> propertyCodes, CancellationToken cancellationToken = default) {}
+ public async ValueTask<EchonetServiceResponse> RequestWriteAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<PropertyValue> properties, CancellationToken cancellationToken = default) {}
+ public async ValueTask RequestWriteOneWayAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<PropertyValue> properties, CancellationToken cancellationToken = default) {}
+ public async ValueTask<(EchonetServiceResponse SetResponse, EchonetServiceResponse GetResponse)> RequestWriteReadAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<PropertyValue> propertiesToSet, IEnumerable<byte> propertyCodesToGet, CancellationToken cancellationToken = default) {}
+ void IEventInvoker.InvokeEvent<TEventArgs>(object? sender, EventHandler<TEventArgs>? eventHandler, TEventArgs e) {}
protected void ThrowIfDisposed() {}
}
- public sealed class EchonetNode {
- public event NotifyCollectionChangedEventHandler? DevicesChanged;
+ public class EchonetDevice : EchonetObject {
+ public EchonetDevice(byte classGroupCode, byte classCode, byte instanceCode) {}
+
+ public override byte ClassCode { get; }
+ public override byte ClassGroupCode { get; }
+ public override bool HasPropertyMapAcquired { get; }
+ public override byte InstanceCode { get; }
+ public override IReadOnlyDictionary<byte, EchonetProperty> Properties { get; }
+
+ protected virtual EchonetProperty CreateProperty(byte propertyCode) {}
+ protected virtual EchonetProperty CreateProperty(byte propertyCode, bool canSet, bool canGet, bool canAnnounceStatusChange) {}
+ }
+
+ public abstract class EchonetNode {
+ public static EchonetNode CreateSelfNode(EchonetObject nodeProfile, IEnumerable<EchonetObject> devices) {}
+ public static EchonetNode CreateSelfNode(IEnumerable<EchonetObject> devices) {}
- public EchonetNode(IPAddress address, EchonetObject nodeProfile) {}
+ public event EventHandler<NotifyCollectionChangedEventArgs>? DevicesChanged;
- public IPAddress Address { get; }
- public ICollection<EchonetObject> Devices { get; }
+ public abstract IPAddress Address { get; }
+ public abstract IReadOnlyCollection<EchonetObject> Devices { get; }
public EchonetObject NodeProfile { get; }
}
- public sealed class EchonetObject {
- public event NotifyCollectionChangedEventHandler? PropertiesChanged;
+ public abstract class EchonetObject {
+ public static EchonetObject Create(IEchonetObjectSpecification objectDetail, byte instanceCode) {}
+ public static EchonetObject CreateNodeProfile(bool transmissionOnly = false) {}
- public EchonetObject(EOJ eoj) {}
- public EchonetObject(EchonetObjectSpecification classObject, byte instanceCode) {}
+ public event EventHandler<NotifyCollectionChangedEventArgs>? PropertiesChanged;
- public IEnumerable<EchonetProperty> AnnoProperties { get; }
- public IEnumerable<EchonetProperty> GetProperties { get; }
- public bool HasPropertyMapAcquired { get; }
- public byte InstanceCode { get; }
- public IReadOnlyCollection<EchonetProperty> Properties { get; }
- public IEnumerable<EchonetProperty> SetProperties { get; }
- public EchonetObjectSpecification Spec { get; }
+ public abstract byte ClassCode { get; }
+ public abstract byte ClassGroupCode { get; }
+ protected virtual IEventInvoker EventInvoker { get; }
+ public abstract bool HasPropertyMapAcquired { get; }
+ public abstract byte InstanceCode { get; }
+ public EchonetNode Node { get; }
+ public abstract IReadOnlyDictionary<byte, EchonetProperty> Properties { get; }
+
+ public override string ToString() {}
+ }
+
+ public static class EchonetObjectExtensions {
+ public static ValueTask NotifyPropertiesOneWayMulticastAsync(this EchonetObject sourceObject, IEnumerable<byte> notifyPropertyCodes, EOJ destinationObject, CancellationToken cancellationToken = default) {}
+ public static async ValueTask<EchonetServiceResponse> ReadPropertiesAsync(this EchonetObject destinationObject, IEnumerable<byte> readPropertyCodes, EchonetObject sourceObject, CancellationToken cancellationToken = default) {}
+ public static ValueTask RequestNotifyPropertiesOneWayAsync(this EchonetObject sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<byte> requestNotifyPropertyCodes, CancellationToken cancellationToken = default) {}
+ public static async ValueTask<EchonetServiceResponse> WritePropertiesAsync(this EchonetObject destinationObject, IEnumerable<byte> writePropertyCodes, EchonetObject sourceObject, CancellationToken cancellationToken = default) {}
+ public static async ValueTask WritePropertiesOneWayAsync(this EchonetObject destinationObject, IEnumerable<byte> writePropertyCodes, EchonetObject sourceObject, CancellationToken cancellationToken = default) {}
+ public static async ValueTask<(EchonetServiceResponse SetResponse, EchonetServiceResponse GetResponse)> WriteReadPropertiesAsync(this EchonetObject destinationObject, IEnumerable<byte> writePropertyCodes, IEnumerable<byte> readPropertyCodes, EchonetObject sourceObject, CancellationToken cancellationToken = default) {}
}
- public sealed class EchonetProperty {
+ public abstract class EchonetProperty {
public event EventHandler<(ReadOnlyMemory<byte> OldValue, ReadOnlyMemory<byte> NewValue)>? ValueChanged;
- public EchonetProperty(EchonetPropertySpecification spec) {}
- public EchonetProperty(EchonetPropertySpecification spec, bool canAnnounceStatusChange, bool canSet, bool canGet) {}
- public EchonetProperty(byte classGroupCode, byte classCode, byte epc) {}
- public EchonetProperty(byte classGroupCode, byte classCode, byte epc, bool canAnnounceStatusChange, bool canSet, bool canGet) {}
+ protected EchonetProperty() {}
- public bool CanAnnounceStatusChange { get; }
- public bool CanGet { get; }
- public bool CanSet { get; }
- public EchonetPropertySpecification Spec { get; }
+ public abstract bool CanAnnounceStatusChange { get; }
+ public abstract bool CanGet { get; }
+ public abstract bool CanSet { get; }
+ public abstract byte Code { get; }
+ public abstract EchonetObject Device { get; }
+ protected virtual IEventInvoker EventInvoker { get; }
+ public bool HasModified { get; }
+ public DateTimeOffset LastUpdatedTime { get; }
public ReadOnlyMemory<byte> ValueMemory { get; }
public ReadOnlySpan<byte> ValueSpan { get; }
- public void SetValue(ReadOnlyMemory<byte> newValue) {}
- public void WriteValue(Action<IBufferWriter<byte>> write) {}
+ internal protected virtual bool IsAcceptableValue(ReadOnlySpan<byte> edt) {}
+ public void SetValue(ReadOnlyMemory<byte> newValue, bool raiseValueChangedEvent = false, bool setLastUpdatedTime = false) {}
+ public override string ToString() {}
+ public void WriteValue(Action<IBufferWriter<byte>> write, bool raiseValueChangedEvent = false, bool setLastUpdatedTime = false) {}
+ }
+
+ public readonly struct EchonetServiceResponse {
+ public bool IsSuccess { get; init; }
+ public IReadOnlyDictionary<EchonetProperty, EchonetServicePropertyResult> Properties { get; init; }
}
}
-namespace Smdn.Net.EchonetLite.Protocol {
- public interface IEData {
+namespace Smdn.Net.EchonetLite.ComponentModel {
+ public interface IEventInvoker {
+ ISynchronizeInvoke? SynchronizingObject { get; set; }
+
+ void InvokeEvent<TEventArgs>(object? sender, EventHandler<TEventArgs>? eventHandler, TEventArgs e);
+ }
+}
+
+namespace Smdn.Net.EchonetLite.ObjectModel {
+ public delegate void EchonetPropertyValueFormatter<in TValue>(IBufferWriter<byte> writer, TValue @value) where TValue : notnull;
+ public delegate bool EchonetPropertyValueParser<TValue>(ReadOnlySpan<byte> data, out TValue @value) where TValue : notnull;
+
+ public interface IEchonetPropertyAccessor {
+ EchonetProperty BaseProperty { get; }
+ bool IsAvailable { get; }
+ byte PropertyCode { get; }
+ }
+
+ public interface IEchonetPropertyGetAccessor<TValue> : IEchonetPropertyAccessor {
+ TValue Value { get; }
+
+ bool TryGetValue(out TValue @value);
+ }
+
+ public interface IEchonetPropertySetGetAccessor<TValue> : IEchonetPropertyGetAccessor<TValue> {
+ new TValue Value { get; set; }
+ }
+
+ public abstract class DeviceSuperClass : EchonetDevice {
+ protected DeviceSuperClass(byte classGroupCode, byte classCode, byte instanceCode) {}
+
+ public IEchonetPropertyGetAccessor<DateTime> CurrentDateAndTime { get; }
+ public IEchonetPropertyGetAccessor<TimeSpan> CurrentTimeSetting { get; }
+ public IEchonetPropertyGetAccessor<bool> FaultStatus { get; }
+ public IEchonetPropertyGetAccessor<byte> InstallationLocation { get; }
+ public IEchonetPropertyGetAccessor<int> Manufacturer { get; }
+ public IEchonetPropertyGetAccessor<bool> OperationStatus { get; }
+ public IEchonetPropertyGetAccessor<(string Release, int Revision)> Protocol { get; }
+ public IEchonetPropertyGetAccessor<string> SerialNumber { get; }
+
+ protected IEchonetPropertyGetAccessor<TValue> CreateAccessor<TValue>(byte propertyCode, EchonetPropertyValueParser<TValue> tryParseValue) where TValue : notnull {}
+ protected IEchonetPropertySetGetAccessor<TValue> CreateAccessor<TValue>(byte propertyCode, EchonetPropertyValueParser<TValue> tryParseValue, EchonetPropertyValueFormatter<TValue> formatValue) where TValue : notnull {}
+ }
+
+ public class EchonetPropertyInvalidValueException : InvalidOperationException {
+ public EchonetPropertyInvalidValueException() {}
+ public EchonetPropertyInvalidValueException(EchonetObject deviceObject, EchonetProperty property) {}
+ public EchonetPropertyInvalidValueException(string? message) {}
+ public EchonetPropertyInvalidValueException(string? message, Exception? innerException) {}
+
+ public EchonetObject? DeviceObject { get; }
+ public EchonetProperty? Property { get; }
+ }
+
+ public class EchonetPropertyNotAvailableException : InvalidOperationException {
+ public EchonetPropertyNotAvailableException() {}
+ public EchonetPropertyNotAvailableException(EchonetObject deviceObject, byte propertyCode) {}
+ public EchonetPropertyNotAvailableException(string? message) {}
+ public EchonetPropertyNotAvailableException(string? message, Exception? innerException) {}
+
+ public EchonetObject? DeviceObject { get; }
+ public byte? PropertyCode { get; }
}
+}
+namespace Smdn.Net.EchonetLite.Protocol {
public enum EHD1 : byte {
EchonetLite = 16,
MaskEchonet = 128,
None = 0,
}
public enum EHD2 : byte {
- Type1 = 129,
- Type2 = 130,
+ Format1 = 129,
+ Format2 = 130,
}
public enum ESV : byte {
Get = 98,
GetResponse = 114,
GetServiceNotAvailable = 82,
Inf = 115,
InfC = 116,
InfCResponse = 122,
InfRequest = 99,
InfServiceNotAvailable = 83,
Invalid = 0,
SetC = 97,
SetCServiceNotAvailable = 81,
SetGet = 110,
SetGetResponse = 126,
SetGetServiceNotAvailable = 94,
SetI = 96,
SetIServiceNotAvailable = 80,
SetResponse = 113,
}
- public sealed class EData1 : IEData {
- public EData1(EOJ seoj, EOJ deoj, ESV esv, IReadOnlyCollection<PropertyRequest> opcList) {}
- public EData1(EOJ seoj, EOJ deoj, ESV esv, IReadOnlyCollection<PropertyRequest> opcSetList, IReadOnlyCollection<PropertyRequest> opcGetList) {}
-
- public EOJ DEOJ { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
- public ESV ESV { get; }
- [MemberNotNullWhen(false, "OPCList")]
- [MemberNotNullWhen(true, "OPCGetList")]
- [MemberNotNullWhen(true, "OPCSetList")]
- [JsonIgnore]
- public bool IsWriteOrReadService { [MemberNotNullWhen(false, "OPCList"), MemberNotNullWhen(true, "OPCGetList"), MemberNotNullWhen(true, "OPCSetList")] get; }
- public IReadOnlyCollection<PropertyRequest>? OPCGetList { get; }
- public IReadOnlyCollection<PropertyRequest>? OPCList { get; }
- public IReadOnlyCollection<PropertyRequest>? OPCSetList { get; }
- public EOJ SEOJ { get; }
-
- public (IReadOnlyCollection<PropertyRequest> OPCSetList, IReadOnlyCollection<PropertyRequest> OPCGetList) GetOPCSetGetList() {}
- }
-
- public sealed class EData2 : IEData {
- public EData2(ReadOnlyMemory<byte> message) {}
-
- public ReadOnlyMemory<byte> Message { get; }
+ public static class ESVExtensions {
+ public static string ToSymbolString(this ESV esv) {}
}
public static class FrameSerializer {
- public static void Serialize(Frame frame, IBufferWriter<byte> buffer) {}
- public static void SerializeEchonetLiteFrameFormat1(IBufferWriter<byte> buffer, ushort tid, EOJ sourceObject, EOJ destinationObject, ESV esv, IEnumerable<PropertyRequest> opcListOrOpcSetList, IEnumerable<PropertyRequest>? opcGetList = null) {}
+ public static void SerializeEchonetLiteFrameFormat1(IBufferWriter<byte> buffer, int tid, EOJ sourceObject, EOJ destinationObject, ESV esv, IEnumerable<PropertyValue> properties) {}
+ public static void SerializeEchonetLiteFrameFormat1(IBufferWriter<byte> buffer, int tid, EOJ sourceObject, EOJ destinationObject, ESV esv, IEnumerable<PropertyValue> propertiesForSet, IEnumerable<PropertyValue> propertiesForGet) {}
public static void SerializeEchonetLiteFrameFormat2(IBufferWriter<byte> buffer, ushort tid, ReadOnlySpan<byte> edata) {}
- public static bool TryDeserialize(ReadOnlySpan<byte> bytes, out Frame frame) {}
+ public static bool TryDeserialize(ReadOnlyMemory<byte> bytes, out EHD1 ehd1, out EHD2 ehd2, out int tid, out ReadOnlyMemory<byte> edata) {}
+ public static bool TryDeserialize(ReadOnlySpan<byte> bytes, out EHD1 ehd1, out EHD2 ehd2, out int tid, out ReadOnlySpan<byte> edata) {}
+ public static bool TryParseEDataAsFormat1Message(ReadOnlySpan<byte> bytes, out Format1Message message) {}
}
public static class PropertyContentSerializer {
public static bool TryDeserializeInstanceListNotification(ReadOnlySpan<byte> content, [NotNullWhen(true)] out IReadOnlyList<EOJ>? instanceList) {}
public static bool TryDeserializePropertyMap(ReadOnlySpan<byte> content, [NotNullWhen(true)] out IReadOnlyList<byte>? propertyMap) {}
public static bool TrySerializeInstanceListNotification(IEnumerable<EOJ> instanceList, Span<byte> destination, out int bytesWritten) {}
}
public readonly struct EOJ : IEquatable<EOJ> {
+ public static readonly EOJ NodeProfile; // = "0E.F0 00"
+
+ public static bool AreSame(EOJ x, EOJ y) {}
public static bool operator == (EOJ c1, EOJ c2) {}
public static bool operator != (EOJ c1, EOJ c2) {}
public EOJ(byte classGroupCode, byte classCode, byte instanceCode) {}
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte ClassCode { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte ClassGroupCode { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte InstanceCode { get; }
public bool Equals(EOJ other) {}
public override bool Equals(object? obj) {}
public override int GetHashCode() {}
+ public override string ToString() {}
}
- public readonly struct Frame {
- public Frame(EHD1 ehd1, EHD2 ehd2, ushort tid, IEData edata) {}
+ public readonly struct Format1Message {
+ public Format1Message(EOJ seoj, EOJ deoj, ESV esv, IReadOnlyList<PropertyValue> properties) {}
+ public Format1Message(EOJ seoj, EOJ deoj, ESV esv, IReadOnlyList<PropertyValue> propertiesForSet, IReadOnlyList<PropertyValue> propertiesForGet) {}
- public IEData? EData { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
- public EHD1 EHD1 { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
- public EHD2 EHD2 { get; }
- [JsonConverter(typeof(SingleUInt16JsonConverter))]
- public ushort TID { get; }
+ public EOJ DEOJ { get; }
+ public ESV ESV { get; }
+ public EOJ SEOJ { get; }
+
+ public IReadOnlyList<PropertyValue> GetProperties() {}
+ public (IReadOnlyList<PropertyValue> PropertiesForSet, IReadOnlyList<PropertyValue> PropertiesForGet) GetPropertiesForSetAndGet() {}
+ public override string ToString() {}
}
- public readonly struct PropertyRequest {
- public PropertyRequest(byte epc) {}
- public PropertyRequest(byte epc, ReadOnlyMemory<byte> edt) {}
+ public readonly struct PropertyValue {
+ public PropertyValue(byte epc) {}
+ public PropertyValue(byte epc, ReadOnlyMemory<byte> edt) {}
- [JsonConverter(typeof(ByteSequenceJsonConverter))]
public ReadOnlyMemory<byte> EDT { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte EPC { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte PDC { get; }
}
}
+namespace Smdn.Net.EchonetLite.Specifications {
+ public abstract class EchonetDeviceObjectDetail : IEchonetObjectSpecification {
+ protected static class PropertyDetails {
+ public static IReadOnlyList<IEchonetPropertySpecification> Properties { get; }
+ }
+
+ public static IEchonetObjectSpecification Controller { get; }
+
+ protected EchonetDeviceObjectDetail() {}
+
+ public abstract byte ClassCode { get; }
+ public abstract byte ClassGroupCode { get; }
+ public abstract IEnumerable<IEchonetPropertySpecification> Properties { get; }
+ }
+
+ public abstract class EchonetProfileObjectDetail : IEchonetObjectSpecification {
+ protected static class PropertyDetails {
+ public static IReadOnlyList<IEchonetPropertySpecification> Properties { get; }
+ }
+
+ public static IEchonetObjectSpecification NodeProfile { get; }
+
+ protected EchonetProfileObjectDetail() {}
+
+ public abstract byte ClassCode { get; }
+ public byte ClassGroupCode { get; }
+ public abstract IEnumerable<IEchonetPropertySpecification> Properties { get; }
+ }
+}
+
namespace Smdn.Net.EchonetLite.Transport {
public class UdpEchonetLiteHandler : EchonetLiteHandler {
public UdpEchonetLiteHandler(ILogger<UdpEchonetLiteHandler> logger) {}
public override IPAddress? LocalAddress { get; }
public override ISynchronizeInvoke? SynchronizingObject { get; set; }
protected override void Dispose(bool disposing) {}
protected override ValueTask DisposeAsyncCore() {}
protected override async ValueTask<IPAddress> ReceiveAsyncCore(IBufferWriter<byte> buffer, CancellationToken cancellationToken) {}
protected override async ValueTask SendAsyncCore(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken) {}
protected override async ValueTask SendToAsyncCore(IPAddress remoteAddress, ReadOnlyMemory<byte> buffer, 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/Smdn.Net.EchonetLite-net8.0.apilist.cs b/doc/api-list/Smdn.Net.EchonetLite/Smdn.Net.EchonetLite-net8.0.apilist.cs
index 2376f2c..d597d46 100644
--- a/doc/api-list/Smdn.Net.EchonetLite/Smdn.Net.EchonetLite-net8.0.apilist.cs
+++ b/doc/api-list/Smdn.Net.EchonetLite/Smdn.Net.EchonetLite-net8.0.apilist.cs
@@ -1,256 +1,377 @@
-// Smdn.Net.EchonetLite.dll (Smdn.Net.EchonetLite-2.0.0-preview1)
+// Smdn.Net.EchonetLite.dll (Smdn.Net.EchonetLite-2.0.0-preview2)
// Name: Smdn.Net.EchonetLite
// AssemblyVersion: 2.0.0.0
-// InformationalVersion: 2.0.0-preview1+2afe0aa023b391033e8606759aaf401afa325ddb
+// InformationalVersion: 2.0.0-preview2+60a8ce3520b765b1bcab669a662cfb615f41a1f5
// TargetFramework: .NETCoreApp,Version=v8.0
// Configuration: Release
// Referenced assemblies:
// Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
-// Smdn.Net.EchonetLite.Appendix, Version=2.0.0.0, Culture=neutral
-// Smdn.Net.EchonetLite.Transport, Version=2.0.0.0, Culture=neutral
+// Smdn.Net.EchonetLite.Primitives, Version=2.0.0.0, Culture=neutral
// System.Collections, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+// System.Collections.Concurrent, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.ComponentModel.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Linq, 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.ObjectModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-// System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
// System.Threading, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
#nullable enable annotations
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Smdn.Net.EchonetLite;
-using Smdn.Net.EchonetLite.Appendix;
+using Smdn.Net.EchonetLite.ComponentModel;
+using Smdn.Net.EchonetLite.ObjectModel;
using Smdn.Net.EchonetLite.Protocol;
using Smdn.Net.EchonetLite.Transport;
namespace Smdn.Net.EchonetLite {
+ public interface IEchonetDeviceFactory {
+ EchonetDevice? Create(byte classGroupCode, byte classCode, byte instanceCode);
+ }
+
+ public enum EchonetServicePropertyResult : int {
+ Accepted = 1,
+ NotAccepted = 2,
+ Unavailable = 0,
+ }
+
public class EchonetClient :
IAsyncDisposable,
IDisposable
{
- public event EventHandler<(EchonetNode, IReadOnlyList<EchonetObject>)>? InstanceListPropertyMapAcquiring;
- public event EventHandler<(EchonetNode, IReadOnlyList<EchonetObject>)>? InstanceListUpdated;
+ public event EventHandler<EchonetNode>? InstanceListUpdated;
public event EventHandler<EchonetNode>? InstanceListUpdating;
public event EventHandler<EchonetNode>? NodeJoined;
- public event EventHandler<(EchonetNode, EchonetObject)>? PropertyMapAcquired;
- public event EventHandler<(EchonetNode, EchonetObject)>? PropertyMapAcquiring;
+ public event EventHandler<EchonetObject>? PropertyMapAcquired;
+ public event EventHandler<EchonetObject>? PropertyMapAcquiring;
- public EchonetClient(IPAddress nodeAddress, IEchonetLiteHandler echonetLiteHandler, ILogger<EchonetClient>? logger = null) {}
- public EchonetClient(IPAddress nodeAddress, IEchonetLiteHandler echonetLiteHandler, bool shouldDisposeEchonetLiteHandler, ILogger<EchonetClient>? logger) {}
+ public EchonetClient(EchonetNode selfNode, IEchonetLiteHandler echonetLiteHandler, bool shouldDisposeEchonetLiteHandler, IEchonetDeviceFactory? deviceFactory, ILogger<EchonetClient>? logger) {}
+ public EchonetClient(IEchonetLiteHandler echonetLiteHandler, ILogger<EchonetClient>? logger = null) {}
+ public EchonetClient(IEchonetLiteHandler echonetLiteHandler, bool shouldDisposeEchonetLiteHandler, ILogger<EchonetClient>? logger) {}
- public ICollection<EchonetNode> Nodes { get; }
+ public IReadOnlyCollection<EchonetNode> OtherNodes { get; }
public EchonetNode SelfNode { get; }
+ public TaskFactory? ServiceHandlerTaskFactory { get; set; }
+ public ISynchronizeInvoke? SynchronizingObject { get; set; }
+ public async ValueTask<bool> AcquirePropertyMapsAsync(EchonetObject device, IEnumerable<byte>? extraPropertyCodes = null, CancellationToken cancellationToken = default) {}
protected virtual void Dispose(bool disposing) {}
public void Dispose() {}
public async ValueTask DisposeAsync() {}
protected virtual async ValueTask DisposeAsyncCore() {}
- protected virtual void OnInstanceListPropertyMapAcquiring(EchonetNode node, IReadOnlyList<EchonetObject> instances) {}
- protected virtual void OnInstanceListUpdated(EchonetNode node, IReadOnlyList<EchonetObject> instances) {}
+ internal protected IPAddress? GetSelfNodeAddress() {}
+ protected void InvokeEvent<TEventArgs>(object? sender, EventHandler<TEventArgs>? eventHandler, TEventArgs e) {}
+ public async ValueTask<EchonetServiceResponse> NotifyAsync(EOJ sourceObject, IEnumerable<PropertyValue> properties, IPAddress destinationNodeAddress, EOJ destinationObject, CancellationToken cancellationToken = default) {}
+ public async ValueTask NotifyInstanceListAsync(CancellationToken cancellationToken = default) {}
+ public ValueTask NotifyOneWayAsync(EOJ sourceObject, IEnumerable<PropertyValue> properties, IPAddress? destinationNodeAddress, EOJ destinationObject, CancellationToken cancellationToken = default) {}
+ protected virtual void OnInstanceListUpdated(EchonetNode node) {}
protected virtual void OnInstanceListUpdating(EchonetNode node) {}
- protected virtual void OnPropertyMapAcquired(EchonetNode node, EchonetObject device) {}
- protected virtual void OnPropertyMapAcquiring(EchonetNode node, EchonetObject device) {}
- public async ValueTask PerformInstanceListNotificationAsync(CancellationToken cancellationToken = default) {}
- public async Task PerformInstanceListNotificationRequestAsync<TState>(Func<EchonetClient, EchonetNode, TState, bool>? onInstanceListPropertyMapAcquiring, Func<EchonetClient, EchonetNode, TState, bool>? onInstanceListUpdated, Func<EchonetClient, EchonetNode, EchonetObject, TState, bool>? onPropertyMapAcquired, TState state, CancellationToken cancellationToken = default) {}
- public async ValueTask PerformInstanceListNotificationRequestAsync(CancellationToken cancellationToken = default) {}
- public ValueTask PerformPropertyValueNotificationAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public ValueTask PerformPropertyValueNotificationRequestAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public async Task<IReadOnlyCollection<PropertyRequest>> PerformPropertyValueNotificationResponseRequiredAsync(EchonetObject sourceObject, EchonetNode destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public async Task<(bool Result, IReadOnlyCollection<PropertyRequest> Properties)> PerformPropertyValueReadRequestAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public async Task<(bool Result, IReadOnlyCollection<PropertyRequest> PropertiesSet, IReadOnlyCollection<PropertyRequest> PropertiesGet)> PerformPropertyValueWriteReadRequestAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> propertiesSet, IEnumerable<EchonetProperty> propertiesGet, CancellationToken cancellationToken = default) {}
- public async Task<IReadOnlyCollection<PropertyRequest>> PerformPropertyValueWriteRequestAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public async Task<(bool Result, IReadOnlyCollection<PropertyRequest> Properties)> PerformPropertyValueWriteRequestResponseRequiredAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
+ protected virtual void OnNodeJoined(EchonetNode node) {}
+ protected virtual void OnPropertyMapAcquired(EchonetObject device) {}
+ protected virtual void OnPropertyMapAcquiring(EchonetObject device) {}
+ public ValueTask RequestNotifyInstanceListAsync(IPAddress? destinationNodeAddress = null, CancellationToken cancellationToken = default) {}
+ public async Task RequestNotifyInstanceListAsync<TState>(IPAddress? destinationNodeAddress, Func<EchonetNode, TState, bool> onInstanceListUpdated, TState state, CancellationToken cancellationToken = default) {}
+ public ValueTask RequestNotifyOneWayAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<byte> propertyCodes, CancellationToken cancellationToken = default) {}
+ public async ValueTask<EchonetServiceResponse> RequestReadAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<byte> propertyCodes, CancellationToken cancellationToken = default) {}
+ public async ValueTask<EchonetServiceResponse> RequestWriteAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<PropertyValue> properties, CancellationToken cancellationToken = default) {}
+ public async ValueTask RequestWriteOneWayAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<PropertyValue> properties, CancellationToken cancellationToken = default) {}
+ public async ValueTask<(EchonetServiceResponse SetResponse, EchonetServiceResponse GetResponse)> RequestWriteReadAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<PropertyValue> propertiesToSet, IEnumerable<byte> propertyCodesToGet, CancellationToken cancellationToken = default) {}
+ void IEventInvoker.InvokeEvent<TEventArgs>(object? sender, EventHandler<TEventArgs>? eventHandler, TEventArgs e) {}
protected void ThrowIfDisposed() {}
}
- public sealed class EchonetNode {
- public event NotifyCollectionChangedEventHandler? DevicesChanged;
+ public class EchonetDevice : EchonetObject {
+ public EchonetDevice(byte classGroupCode, byte classCode, byte instanceCode) {}
+
+ public override byte ClassCode { get; }
+ public override byte ClassGroupCode { get; }
+ public override bool HasPropertyMapAcquired { get; }
+ public override byte InstanceCode { get; }
+ public override IReadOnlyDictionary<byte, EchonetProperty> Properties { get; }
+
+ protected virtual EchonetProperty CreateProperty(byte propertyCode) {}
+ protected virtual EchonetProperty CreateProperty(byte propertyCode, bool canSet, bool canGet, bool canAnnounceStatusChange) {}
+ }
+
+ public abstract class EchonetNode {
+ public static EchonetNode CreateSelfNode(EchonetObject nodeProfile, IEnumerable<EchonetObject> devices) {}
+ public static EchonetNode CreateSelfNode(IEnumerable<EchonetObject> devices) {}
- public EchonetNode(IPAddress address, EchonetObject nodeProfile) {}
+ public event EventHandler<NotifyCollectionChangedEventArgs>? DevicesChanged;
- public IPAddress Address { get; }
- public ICollection<EchonetObject> Devices { get; }
+ public abstract IPAddress Address { get; }
+ public abstract IReadOnlyCollection<EchonetObject> Devices { get; }
public EchonetObject NodeProfile { get; }
}
- public sealed class EchonetObject {
- public event NotifyCollectionChangedEventHandler? PropertiesChanged;
+ public abstract class EchonetObject {
+ public static EchonetObject Create(IEchonetObjectSpecification objectDetail, byte instanceCode) {}
+ public static EchonetObject CreateNodeProfile(bool transmissionOnly = false) {}
- public EchonetObject(EOJ eoj) {}
- public EchonetObject(EchonetObjectSpecification classObject, byte instanceCode) {}
+ public event EventHandler<NotifyCollectionChangedEventArgs>? PropertiesChanged;
- public IEnumerable<EchonetProperty> AnnoProperties { get; }
- public IEnumerable<EchonetProperty> GetProperties { get; }
- public bool HasPropertyMapAcquired { get; }
- public byte InstanceCode { get; }
- public IReadOnlyCollection<EchonetProperty> Properties { get; }
- public IEnumerable<EchonetProperty> SetProperties { get; }
- public EchonetObjectSpecification Spec { get; }
+ public abstract byte ClassCode { get; }
+ public abstract byte ClassGroupCode { get; }
+ protected virtual IEventInvoker EventInvoker { get; }
+ public abstract bool HasPropertyMapAcquired { get; }
+ public abstract byte InstanceCode { get; }
+ public EchonetNode Node { get; }
+ public abstract IReadOnlyDictionary<byte, EchonetProperty> Properties { get; }
+
+ public override string ToString() {}
}
- public sealed class EchonetProperty {
- public event EventHandler<(ReadOnlyMemory<byte> OldValue, ReadOnlyMemory<byte> NewValue)>? ValueChanged;
+ public static class EchonetObjectExtensions {
+ public static ValueTask NotifyPropertiesOneWayMulticastAsync(this EchonetObject sourceObject, IEnumerable<byte> notifyPropertyCodes, EOJ destinationObject, CancellationToken cancellationToken = default) {}
+ public static async ValueTask<EchonetServiceResponse> ReadPropertiesAsync(this EchonetObject destinationObject, IEnumerable<byte> readPropertyCodes, EchonetObject sourceObject, CancellationToken cancellationToken = default) {}
+ public static ValueTask RequestNotifyPropertiesOneWayAsync(this EchonetObject sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<byte> requestNotifyPropertyCodes, CancellationToken cancellationToken = default) {}
+ public static async ValueTask<EchonetServiceResponse> WritePropertiesAsync(this EchonetObject destinationObject, IEnumerable<byte> writePropertyCodes, EchonetObject sourceObject, CancellationToken cancellationToken = default) {}
+ public static async ValueTask WritePropertiesOneWayAsync(this EchonetObject destinationObject, IEnumerable<byte> writePropertyCodes, EchonetObject sourceObject, CancellationToken cancellationToken = default) {}
+ public static async ValueTask<(EchonetServiceResponse SetResponse, EchonetServiceResponse GetResponse)> WriteReadPropertiesAsync(this EchonetObject destinationObject, IEnumerable<byte> writePropertyCodes, IEnumerable<byte> readPropertyCodes, EchonetObject sourceObject, CancellationToken cancellationToken = default) {}
+ }
- public EchonetProperty(EchonetPropertySpecification spec) {}
- public EchonetProperty(EchonetPropertySpecification spec, bool canAnnounceStatusChange, bool canSet, bool canGet) {}
- public EchonetProperty(byte classGroupCode, byte classCode, byte epc) {}
- public EchonetProperty(byte classGroupCode, byte classCode, byte epc, bool canAnnounceStatusChange, bool canSet, bool canGet) {}
+ public abstract class EchonetProperty {
+ public event EventHandler<(ReadOnlyMemory<byte> OldValue, ReadOnlyMemory<byte> NewValue)>? ValueChanged;
- public bool CanAnnounceStatusChange { get; }
- public bool CanGet { get; }
- public bool CanSet { get; }
- public EchonetPropertySpecification Spec { get; }
+ protected EchonetProperty() {}
+
+ public abstract bool CanAnnounceStatusChange { get; }
+ public abstract bool CanGet { get; }
+ public abstract bool CanSet { get; }
+ public abstract byte Code { get; }
+ public abstract EchonetObject Device { get; }
+ protected virtual IEventInvoker EventInvoker { get; }
+ public bool HasModified { get; }
+ public DateTimeOffset LastUpdatedTime { get; }
+ protected virtual TimeProvider TimeProvider { get; }
public ReadOnlyMemory<byte> ValueMemory { get; }
public ReadOnlySpan<byte> ValueSpan { get; }
- public void SetValue(ReadOnlyMemory<byte> newValue) {}
- public void WriteValue(Action<IBufferWriter<byte>> write) {}
+ internal protected virtual bool IsAcceptableValue(ReadOnlySpan<byte> edt) {}
+ public void SetValue(ReadOnlyMemory<byte> newValue, bool raiseValueChangedEvent = false, bool setLastUpdatedTime = false) {}
+ public override string ToString() {}
+ public void WriteValue(Action<IBufferWriter<byte>> write, bool raiseValueChangedEvent = false, bool setLastUpdatedTime = false) {}
+ }
+
+ public readonly struct EchonetServiceResponse {
+ public bool IsSuccess { get; init; }
+ public IReadOnlyDictionary<EchonetProperty, EchonetServicePropertyResult> Properties { get; init; }
}
}
-namespace Smdn.Net.EchonetLite.Protocol {
- public interface IEData {
+namespace Smdn.Net.EchonetLite.ComponentModel {
+ public interface IEventInvoker {
+ ISynchronizeInvoke? SynchronizingObject { get; set; }
+
+ void InvokeEvent<TEventArgs>(object? sender, EventHandler<TEventArgs>? eventHandler, TEventArgs e);
+ }
+}
+
+namespace Smdn.Net.EchonetLite.ObjectModel {
+ public delegate void EchonetPropertyValueFormatter<in TValue>(IBufferWriter<byte> writer, TValue @value) where TValue : notnull;
+ public delegate bool EchonetPropertyValueParser<TValue>(ReadOnlySpan<byte> data, out TValue @value) where TValue : notnull;
+
+ public interface IEchonetPropertyAccessor {
+ EchonetProperty BaseProperty { get; }
+ bool IsAvailable { get; }
+ byte PropertyCode { get; }
+ }
+
+ public interface IEchonetPropertyGetAccessor<TValue> : IEchonetPropertyAccessor {
+ TValue Value { get; }
+
+ bool TryGetValue(out TValue @value);
}
+ public interface IEchonetPropertySetGetAccessor<TValue> : IEchonetPropertyGetAccessor<TValue> {
+ new TValue Value { get; set; }
+ }
+
+ public abstract class DeviceSuperClass : EchonetDevice {
+ protected DeviceSuperClass(byte classGroupCode, byte classCode, byte instanceCode) {}
+
+ public IEchonetPropertyGetAccessor<DateTime> CurrentDateAndTime { get; }
+ public IEchonetPropertyGetAccessor<TimeSpan> CurrentTimeSetting { get; }
+ public IEchonetPropertyGetAccessor<bool> FaultStatus { get; }
+ public IEchonetPropertyGetAccessor<byte> InstallationLocation { get; }
+ public IEchonetPropertyGetAccessor<int> Manufacturer { get; }
+ public IEchonetPropertyGetAccessor<bool> OperationStatus { get; }
+ public IEchonetPropertyGetAccessor<(string Release, int Revision)> Protocol { get; }
+ public IEchonetPropertyGetAccessor<string> SerialNumber { get; }
+
+ protected IEchonetPropertyGetAccessor<TValue> CreateAccessor<TValue>(byte propertyCode, EchonetPropertyValueParser<TValue> tryParseValue) where TValue : notnull {}
+ protected IEchonetPropertySetGetAccessor<TValue> CreateAccessor<TValue>(byte propertyCode, EchonetPropertyValueParser<TValue> tryParseValue, EchonetPropertyValueFormatter<TValue> formatValue) where TValue : notnull {}
+ }
+
+ public class EchonetPropertyInvalidValueException : InvalidOperationException {
+ public EchonetPropertyInvalidValueException() {}
+ public EchonetPropertyInvalidValueException(EchonetObject deviceObject, EchonetProperty property) {}
+ public EchonetPropertyInvalidValueException(string? message) {}
+ public EchonetPropertyInvalidValueException(string? message, Exception? innerException) {}
+
+ public EchonetObject? DeviceObject { get; }
+ public EchonetProperty? Property { get; }
+ }
+
+ public class EchonetPropertyNotAvailableException : InvalidOperationException {
+ public EchonetPropertyNotAvailableException() {}
+ public EchonetPropertyNotAvailableException(EchonetObject deviceObject, byte propertyCode) {}
+ public EchonetPropertyNotAvailableException(string? message) {}
+ public EchonetPropertyNotAvailableException(string? message, Exception? innerException) {}
+
+ public EchonetObject? DeviceObject { get; }
+ public byte? PropertyCode { get; }
+ }
+}
+
+namespace Smdn.Net.EchonetLite.Protocol {
public enum EHD1 : byte {
EchonetLite = 16,
MaskEchonet = 128,
None = 0,
}
public enum EHD2 : byte {
- Type1 = 129,
- Type2 = 130,
+ Format1 = 129,
+ Format2 = 130,
}
public enum ESV : byte {
Get = 98,
GetResponse = 114,
GetServiceNotAvailable = 82,
Inf = 115,
InfC = 116,
InfCResponse = 122,
InfRequest = 99,
InfServiceNotAvailable = 83,
Invalid = 0,
SetC = 97,
SetCServiceNotAvailable = 81,
SetGet = 110,
SetGetResponse = 126,
SetGetServiceNotAvailable = 94,
SetI = 96,
SetIServiceNotAvailable = 80,
SetResponse = 113,
}
- public sealed class EData1 : IEData {
- public EData1(EOJ seoj, EOJ deoj, ESV esv, IReadOnlyCollection<PropertyRequest> opcList) {}
- public EData1(EOJ seoj, EOJ deoj, ESV esv, IReadOnlyCollection<PropertyRequest> opcSetList, IReadOnlyCollection<PropertyRequest> opcGetList) {}
-
- public EOJ DEOJ { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
- public ESV ESV { get; }
- [MemberNotNullWhen(false, "OPCList")]
- [MemberNotNullWhen(true, "OPCGetList")]
- [MemberNotNullWhen(true, "OPCSetList")]
- [JsonIgnore]
- public bool IsWriteOrReadService { [MemberNotNullWhen(false, "OPCList"), MemberNotNullWhen(true, "OPCGetList"), MemberNotNullWhen(true, "OPCSetList")] get; }
- public IReadOnlyCollection<PropertyRequest>? OPCGetList { get; }
- public IReadOnlyCollection<PropertyRequest>? OPCList { get; }
- public IReadOnlyCollection<PropertyRequest>? OPCSetList { get; }
- public EOJ SEOJ { get; }
-
- public (IReadOnlyCollection<PropertyRequest> OPCSetList, IReadOnlyCollection<PropertyRequest> OPCGetList) GetOPCSetGetList() {}
- }
-
- public sealed class EData2 : IEData {
- public EData2(ReadOnlyMemory<byte> message) {}
-
- public ReadOnlyMemory<byte> Message { get; }
+ public static class ESVExtensions {
+ public static string ToSymbolString(this ESV esv) {}
}
public static class FrameSerializer {
- public static void Serialize(Frame frame, IBufferWriter<byte> buffer) {}
- public static void SerializeEchonetLiteFrameFormat1(IBufferWriter<byte> buffer, ushort tid, EOJ sourceObject, EOJ destinationObject, ESV esv, IEnumerable<PropertyRequest> opcListOrOpcSetList, IEnumerable<PropertyRequest>? opcGetList = null) {}
+ public static void SerializeEchonetLiteFrameFormat1(IBufferWriter<byte> buffer, int tid, EOJ sourceObject, EOJ destinationObject, ESV esv, IEnumerable<PropertyValue> properties) {}
+ public static void SerializeEchonetLiteFrameFormat1(IBufferWriter<byte> buffer, int tid, EOJ sourceObject, EOJ destinationObject, ESV esv, IEnumerable<PropertyValue> propertiesForSet, IEnumerable<PropertyValue> propertiesForGet) {}
public static void SerializeEchonetLiteFrameFormat2(IBufferWriter<byte> buffer, ushort tid, ReadOnlySpan<byte> edata) {}
- public static bool TryDeserialize(ReadOnlySpan<byte> bytes, out Frame frame) {}
+ public static bool TryDeserialize(ReadOnlyMemory<byte> bytes, out EHD1 ehd1, out EHD2 ehd2, out int tid, out ReadOnlyMemory<byte> edata) {}
+ public static bool TryDeserialize(ReadOnlySpan<byte> bytes, out EHD1 ehd1, out EHD2 ehd2, out int tid, out ReadOnlySpan<byte> edata) {}
+ public static bool TryParseEDataAsFormat1Message(ReadOnlySpan<byte> bytes, out Format1Message message) {}
}
public static class PropertyContentSerializer {
public static bool TryDeserializeInstanceListNotification(ReadOnlySpan<byte> content, [NotNullWhen(true)] out IReadOnlyList<EOJ>? instanceList) {}
public static bool TryDeserializePropertyMap(ReadOnlySpan<byte> content, [NotNullWhen(true)] out IReadOnlyList<byte>? propertyMap) {}
public static bool TrySerializeInstanceListNotification(IEnumerable<EOJ> instanceList, Span<byte> destination, out int bytesWritten) {}
}
public readonly struct EOJ : IEquatable<EOJ> {
+ public static readonly EOJ NodeProfile; // = "0E.F0 00"
+
+ public static bool AreSame(EOJ x, EOJ y) {}
public static bool operator == (EOJ c1, EOJ c2) {}
public static bool operator != (EOJ c1, EOJ c2) {}
public EOJ(byte classGroupCode, byte classCode, byte instanceCode) {}
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte ClassCode { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte ClassGroupCode { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte InstanceCode { get; }
public bool Equals(EOJ other) {}
public override bool Equals(object? obj) {}
public override int GetHashCode() {}
+ public override string ToString() {}
}
- public readonly struct Frame {
- public Frame(EHD1 ehd1, EHD2 ehd2, ushort tid, IEData edata) {}
+ public readonly struct Format1Message {
+ public Format1Message(EOJ seoj, EOJ deoj, ESV esv, IReadOnlyList<PropertyValue> properties) {}
+ public Format1Message(EOJ seoj, EOJ deoj, ESV esv, IReadOnlyList<PropertyValue> propertiesForSet, IReadOnlyList<PropertyValue> propertiesForGet) {}
- public IEData? EData { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
- public EHD1 EHD1 { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
- public EHD2 EHD2 { get; }
- [JsonConverter(typeof(SingleUInt16JsonConverter))]
- public ushort TID { get; }
+ public EOJ DEOJ { get; }
+ public ESV ESV { get; }
+ public EOJ SEOJ { get; }
+
+ public IReadOnlyList<PropertyValue> GetProperties() {}
+ public (IReadOnlyList<PropertyValue> PropertiesForSet, IReadOnlyList<PropertyValue> PropertiesForGet) GetPropertiesForSetAndGet() {}
+ public override string ToString() {}
}
- public readonly struct PropertyRequest {
- public PropertyRequest(byte epc) {}
- public PropertyRequest(byte epc, ReadOnlyMemory<byte> edt) {}
+ public readonly struct PropertyValue {
+ public PropertyValue(byte epc) {}
+ public PropertyValue(byte epc, ReadOnlyMemory<byte> edt) {}
- [JsonConverter(typeof(ByteSequenceJsonConverter))]
public ReadOnlyMemory<byte> EDT { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte EPC { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte PDC { get; }
}
}
+namespace Smdn.Net.EchonetLite.Specifications {
+ public abstract class EchonetDeviceObjectDetail : IEchonetObjectSpecification {
+ protected static class PropertyDetails {
+ public static IReadOnlyList<IEchonetPropertySpecification> Properties { get; }
+ }
+
+ public static IEchonetObjectSpecification Controller { get; }
+
+ protected EchonetDeviceObjectDetail() {}
+
+ public abstract byte ClassCode { get; }
+ public abstract byte ClassGroupCode { get; }
+ public abstract IEnumerable<IEchonetPropertySpecification> Properties { get; }
+ }
+
+ public abstract class EchonetProfileObjectDetail : IEchonetObjectSpecification {
+ protected static class PropertyDetails {
+ public static IReadOnlyList<IEchonetPropertySpecification> Properties { get; }
+ }
+
+ public static IEchonetObjectSpecification NodeProfile { get; }
+
+ protected EchonetProfileObjectDetail() {}
+
+ public abstract byte ClassCode { get; }
+ public byte ClassGroupCode { get; }
+ public abstract IEnumerable<IEchonetPropertySpecification> Properties { get; }
+ }
+}
+
namespace Smdn.Net.EchonetLite.Transport {
public class UdpEchonetLiteHandler : EchonetLiteHandler {
public UdpEchonetLiteHandler(ILogger<UdpEchonetLiteHandler> logger) {}
public override IPAddress? LocalAddress { get; }
public override ISynchronizeInvoke? SynchronizingObject { get; set; }
protected override void Dispose(bool disposing) {}
protected override ValueTask DisposeAsyncCore() {}
protected override async ValueTask<IPAddress> ReceiveAsyncCore(IBufferWriter<byte> buffer, CancellationToken cancellationToken) {}
protected override async ValueTask SendAsyncCore(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken) {}
protected override async ValueTask SendToAsyncCore(IPAddress remoteAddress, ReadOnlyMemory<byte> buffer, 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/Smdn.Net.EchonetLite-netstandard2.1.apilist.cs b/doc/api-list/Smdn.Net.EchonetLite/Smdn.Net.EchonetLite-netstandard2.1.apilist.cs
index bbab1c6..5671a9a 100644
--- a/doc/api-list/Smdn.Net.EchonetLite/Smdn.Net.EchonetLite-netstandard2.1.apilist.cs
+++ b/doc/api-list/Smdn.Net.EchonetLite/Smdn.Net.EchonetLite-netstandard2.1.apilist.cs
@@ -1,244 +1,366 @@
-// Smdn.Net.EchonetLite.dll (Smdn.Net.EchonetLite-2.0.0-preview1)
+// Smdn.Net.EchonetLite.dll (Smdn.Net.EchonetLite-2.0.0-preview2)
// Name: Smdn.Net.EchonetLite
// AssemblyVersion: 2.0.0.0
-// InformationalVersion: 2.0.0-preview1+2afe0aa023b391033e8606759aaf401afa325ddb
+// InformationalVersion: 2.0.0-preview2+60a8ce3520b765b1bcab669a662cfb615f41a1f5
// TargetFramework: .NETStandard,Version=v2.1
// Configuration: Release
// Referenced assemblies:
// Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
-// Smdn.Net.EchonetLite.Appendix, Version=2.0.0.0, Culture=neutral
-// Smdn.Net.EchonetLite.Transport, Version=2.0.0.0, Culture=neutral
-// System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
+// 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.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Smdn.Net.EchonetLite;
-using Smdn.Net.EchonetLite.Appendix;
+using Smdn.Net.EchonetLite.ComponentModel;
+using Smdn.Net.EchonetLite.ObjectModel;
using Smdn.Net.EchonetLite.Protocol;
using Smdn.Net.EchonetLite.Transport;
namespace Smdn.Net.EchonetLite {
+ public interface IEchonetDeviceFactory {
+ EchonetDevice? Create(byte classGroupCode, byte classCode, byte instanceCode);
+ }
+
+ public enum EchonetServicePropertyResult : int {
+ Accepted = 1,
+ NotAccepted = 2,
+ Unavailable = 0,
+ }
+
public class EchonetClient :
IAsyncDisposable,
IDisposable
{
- public event EventHandler<(EchonetNode, IReadOnlyList<EchonetObject>)>? InstanceListPropertyMapAcquiring;
- public event EventHandler<(EchonetNode, IReadOnlyList<EchonetObject>)>? InstanceListUpdated;
+ public event EventHandler<EchonetNode>? InstanceListUpdated;
public event EventHandler<EchonetNode>? InstanceListUpdating;
public event EventHandler<EchonetNode>? NodeJoined;
- public event EventHandler<(EchonetNode, EchonetObject)>? PropertyMapAcquired;
- public event EventHandler<(EchonetNode, EchonetObject)>? PropertyMapAcquiring;
+ public event EventHandler<EchonetObject>? PropertyMapAcquired;
+ public event EventHandler<EchonetObject>? PropertyMapAcquiring;
- public EchonetClient(IPAddress nodeAddress, IEchonetLiteHandler echonetLiteHandler, ILogger<EchonetClient>? logger = null) {}
- public EchonetClient(IPAddress nodeAddress, IEchonetLiteHandler echonetLiteHandler, bool shouldDisposeEchonetLiteHandler, ILogger<EchonetClient>? logger) {}
+ public EchonetClient(EchonetNode selfNode, IEchonetLiteHandler echonetLiteHandler, bool shouldDisposeEchonetLiteHandler, IEchonetDeviceFactory? deviceFactory, ILogger<EchonetClient>? logger) {}
+ public EchonetClient(IEchonetLiteHandler echonetLiteHandler, ILogger<EchonetClient>? logger = null) {}
+ public EchonetClient(IEchonetLiteHandler echonetLiteHandler, bool shouldDisposeEchonetLiteHandler, ILogger<EchonetClient>? logger) {}
- public ICollection<EchonetNode> Nodes { get; }
+ public IReadOnlyCollection<EchonetNode> OtherNodes { get; }
public EchonetNode SelfNode { get; }
+ public TaskFactory? ServiceHandlerTaskFactory { get; set; }
+ public ISynchronizeInvoke? SynchronizingObject { get; set; }
+ public async ValueTask<bool> AcquirePropertyMapsAsync(EchonetObject device, IEnumerable<byte>? extraPropertyCodes = null, CancellationToken cancellationToken = default) {}
protected virtual void Dispose(bool disposing) {}
public void Dispose() {}
public async ValueTask DisposeAsync() {}
protected virtual async ValueTask DisposeAsyncCore() {}
- protected virtual void OnInstanceListPropertyMapAcquiring(EchonetNode node, IReadOnlyList<EchonetObject> instances) {}
- protected virtual void OnInstanceListUpdated(EchonetNode node, IReadOnlyList<EchonetObject> instances) {}
+ internal protected IPAddress? GetSelfNodeAddress() {}
+ protected void InvokeEvent<TEventArgs>(object? sender, EventHandler<TEventArgs>? eventHandler, TEventArgs e) {}
+ public async ValueTask<EchonetServiceResponse> NotifyAsync(EOJ sourceObject, IEnumerable<PropertyValue> properties, IPAddress destinationNodeAddress, EOJ destinationObject, CancellationToken cancellationToken = default) {}
+ public async ValueTask NotifyInstanceListAsync(CancellationToken cancellationToken = default) {}
+ public ValueTask NotifyOneWayAsync(EOJ sourceObject, IEnumerable<PropertyValue> properties, IPAddress? destinationNodeAddress, EOJ destinationObject, CancellationToken cancellationToken = default) {}
+ protected virtual void OnInstanceListUpdated(EchonetNode node) {}
protected virtual void OnInstanceListUpdating(EchonetNode node) {}
- protected virtual void OnPropertyMapAcquired(EchonetNode node, EchonetObject device) {}
- protected virtual void OnPropertyMapAcquiring(EchonetNode node, EchonetObject device) {}
- public async ValueTask PerformInstanceListNotificationAsync(CancellationToken cancellationToken = default) {}
- public async Task PerformInstanceListNotificationRequestAsync<TState>(Func<EchonetClient, EchonetNode, TState, bool>? onInstanceListPropertyMapAcquiring, Func<EchonetClient, EchonetNode, TState, bool>? onInstanceListUpdated, Func<EchonetClient, EchonetNode, EchonetObject, TState, bool>? onPropertyMapAcquired, TState state, CancellationToken cancellationToken = default) {}
- public async ValueTask PerformInstanceListNotificationRequestAsync(CancellationToken cancellationToken = default) {}
- public ValueTask PerformPropertyValueNotificationAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public ValueTask PerformPropertyValueNotificationRequestAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public async Task<IReadOnlyCollection<PropertyRequest>> PerformPropertyValueNotificationResponseRequiredAsync(EchonetObject sourceObject, EchonetNode destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public async Task<(bool Result, IReadOnlyCollection<PropertyRequest> Properties)> PerformPropertyValueReadRequestAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public async Task<(bool Result, IReadOnlyCollection<PropertyRequest> PropertiesSet, IReadOnlyCollection<PropertyRequest> PropertiesGet)> PerformPropertyValueWriteReadRequestAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> propertiesSet, IEnumerable<EchonetProperty> propertiesGet, CancellationToken cancellationToken = default) {}
- public async Task<IReadOnlyCollection<PropertyRequest>> PerformPropertyValueWriteRequestAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
- public async Task<(bool Result, IReadOnlyCollection<PropertyRequest> Properties)> PerformPropertyValueWriteRequestResponseRequiredAsync(EchonetObject sourceObject, EchonetNode? destinationNode, EchonetObject destinationObject, IEnumerable<EchonetProperty> properties, CancellationToken cancellationToken = default) {}
+ protected virtual void OnNodeJoined(EchonetNode node) {}
+ protected virtual void OnPropertyMapAcquired(EchonetObject device) {}
+ protected virtual void OnPropertyMapAcquiring(EchonetObject device) {}
+ public ValueTask RequestNotifyInstanceListAsync(IPAddress? destinationNodeAddress = null, CancellationToken cancellationToken = default) {}
+ public async Task RequestNotifyInstanceListAsync<TState>(IPAddress? destinationNodeAddress, Func<EchonetNode, TState, bool> onInstanceListUpdated, TState state, CancellationToken cancellationToken = default) {}
+ public ValueTask RequestNotifyOneWayAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<byte> propertyCodes, CancellationToken cancellationToken = default) {}
+ public async ValueTask<EchonetServiceResponse> RequestReadAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<byte> propertyCodes, CancellationToken cancellationToken = default) {}
+ public async ValueTask<EchonetServiceResponse> RequestWriteAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<PropertyValue> properties, CancellationToken cancellationToken = default) {}
+ public async ValueTask RequestWriteOneWayAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<PropertyValue> properties, CancellationToken cancellationToken = default) {}
+ public async ValueTask<(EchonetServiceResponse SetResponse, EchonetServiceResponse GetResponse)> RequestWriteReadAsync(EOJ sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<PropertyValue> propertiesToSet, IEnumerable<byte> propertyCodesToGet, CancellationToken cancellationToken = default) {}
+ void IEventInvoker.InvokeEvent<TEventArgs>(object? sender, EventHandler<TEventArgs>? eventHandler, TEventArgs e) {}
protected void ThrowIfDisposed() {}
}
- public sealed class EchonetNode {
- public event NotifyCollectionChangedEventHandler? DevicesChanged;
+ public class EchonetDevice : EchonetObject {
+ public EchonetDevice(byte classGroupCode, byte classCode, byte instanceCode) {}
+
+ public override byte ClassCode { get; }
+ public override byte ClassGroupCode { get; }
+ public override bool HasPropertyMapAcquired { get; }
+ public override byte InstanceCode { get; }
+ public override IReadOnlyDictionary<byte, EchonetProperty> Properties { get; }
+
+ protected virtual EchonetProperty CreateProperty(byte propertyCode) {}
+ protected virtual EchonetProperty CreateProperty(byte propertyCode, bool canSet, bool canGet, bool canAnnounceStatusChange) {}
+ }
+
+ public abstract class EchonetNode {
+ public static EchonetNode CreateSelfNode(EchonetObject nodeProfile, IEnumerable<EchonetObject> devices) {}
+ public static EchonetNode CreateSelfNode(IEnumerable<EchonetObject> devices) {}
- public EchonetNode(IPAddress address, EchonetObject nodeProfile) {}
+ public event EventHandler<NotifyCollectionChangedEventArgs>? DevicesChanged;
- public IPAddress Address { get; }
- public ICollection<EchonetObject> Devices { get; }
+ public abstract IPAddress Address { get; }
+ public abstract IReadOnlyCollection<EchonetObject> Devices { get; }
public EchonetObject NodeProfile { get; }
}
- public sealed class EchonetObject {
- public event NotifyCollectionChangedEventHandler? PropertiesChanged;
+ public abstract class EchonetObject {
+ public static EchonetObject Create(IEchonetObjectSpecification objectDetail, byte instanceCode) {}
+ public static EchonetObject CreateNodeProfile(bool transmissionOnly = false) {}
- public EchonetObject(EOJ eoj) {}
- public EchonetObject(EchonetObjectSpecification classObject, byte instanceCode) {}
+ public event EventHandler<NotifyCollectionChangedEventArgs>? PropertiesChanged;
- public IEnumerable<EchonetProperty> AnnoProperties { get; }
- public IEnumerable<EchonetProperty> GetProperties { get; }
- public bool HasPropertyMapAcquired { get; }
- public byte InstanceCode { get; }
- public IReadOnlyCollection<EchonetProperty> Properties { get; }
- public IEnumerable<EchonetProperty> SetProperties { get; }
- public EchonetObjectSpecification Spec { get; }
+ public abstract byte ClassCode { get; }
+ public abstract byte ClassGroupCode { get; }
+ protected virtual IEventInvoker EventInvoker { get; }
+ public abstract bool HasPropertyMapAcquired { get; }
+ public abstract byte InstanceCode { get; }
+ public EchonetNode Node { get; }
+ public abstract IReadOnlyDictionary<byte, EchonetProperty> Properties { get; }
+
+ public override string ToString() {}
+ }
+
+ public static class EchonetObjectExtensions {
+ public static ValueTask NotifyPropertiesOneWayMulticastAsync(this EchonetObject sourceObject, IEnumerable<byte> notifyPropertyCodes, EOJ destinationObject, CancellationToken cancellationToken = default) {}
+ public static async ValueTask<EchonetServiceResponse> ReadPropertiesAsync(this EchonetObject destinationObject, IEnumerable<byte> readPropertyCodes, EchonetObject sourceObject, CancellationToken cancellationToken = default) {}
+ public static ValueTask RequestNotifyPropertiesOneWayAsync(this EchonetObject sourceObject, IPAddress? destinationNodeAddress, EOJ destinationObject, IEnumerable<byte> requestNotifyPropertyCodes, CancellationToken cancellationToken = default) {}
+ public static async ValueTask<EchonetServiceResponse> WritePropertiesAsync(this EchonetObject destinationObject, IEnumerable<byte> writePropertyCodes, EchonetObject sourceObject, CancellationToken cancellationToken = default) {}
+ public static async ValueTask WritePropertiesOneWayAsync(this EchonetObject destinationObject, IEnumerable<byte> writePropertyCodes, EchonetObject sourceObject, CancellationToken cancellationToken = default) {}
+ public static async ValueTask<(EchonetServiceResponse SetResponse, EchonetServiceResponse GetResponse)> WriteReadPropertiesAsync(this EchonetObject destinationObject, IEnumerable<byte> writePropertyCodes, IEnumerable<byte> readPropertyCodes, EchonetObject sourceObject, CancellationToken cancellationToken = default) {}
}
- public sealed class EchonetProperty {
+ public abstract class EchonetProperty {
public event EventHandler<(ReadOnlyMemory<byte> OldValue, ReadOnlyMemory<byte> NewValue)>? ValueChanged;
- public EchonetProperty(EchonetPropertySpecification spec) {}
- public EchonetProperty(EchonetPropertySpecification spec, bool canAnnounceStatusChange, bool canSet, bool canGet) {}
- public EchonetProperty(byte classGroupCode, byte classCode, byte epc) {}
- public EchonetProperty(byte classGroupCode, byte classCode, byte epc, bool canAnnounceStatusChange, bool canSet, bool canGet) {}
+ protected EchonetProperty() {}
- public bool CanAnnounceStatusChange { get; }
- public bool CanGet { get; }
- public bool CanSet { get; }
- public EchonetPropertySpecification Spec { get; }
+ public abstract bool CanAnnounceStatusChange { get; }
+ public abstract bool CanGet { get; }
+ public abstract bool CanSet { get; }
+ public abstract byte Code { get; }
+ public abstract EchonetObject Device { get; }
+ protected virtual IEventInvoker EventInvoker { get; }
+ public bool HasModified { get; }
+ public DateTimeOffset LastUpdatedTime { get; }
public ReadOnlyMemory<byte> ValueMemory { get; }
public ReadOnlySpan<byte> ValueSpan { get; }
- public void SetValue(ReadOnlyMemory<byte> newValue) {}
- public void WriteValue(Action<IBufferWriter<byte>> write) {}
+ internal protected virtual bool IsAcceptableValue(ReadOnlySpan<byte> edt) {}
+ public void SetValue(ReadOnlyMemory<byte> newValue, bool raiseValueChangedEvent = false, bool setLastUpdatedTime = false) {}
+ public override string ToString() {}
+ public void WriteValue(Action<IBufferWriter<byte>> write, bool raiseValueChangedEvent = false, bool setLastUpdatedTime = false) {}
+ }
+
+ public readonly struct EchonetServiceResponse {
+ public bool IsSuccess { get; init; }
+ public IReadOnlyDictionary<EchonetProperty, EchonetServicePropertyResult> Properties { get; init; }
}
}
-namespace Smdn.Net.EchonetLite.Protocol {
- public interface IEData {
+namespace Smdn.Net.EchonetLite.ComponentModel {
+ public interface IEventInvoker {
+ ISynchronizeInvoke? SynchronizingObject { get; set; }
+
+ void InvokeEvent<TEventArgs>(object? sender, EventHandler<TEventArgs>? eventHandler, TEventArgs e);
+ }
+}
+
+namespace Smdn.Net.EchonetLite.ObjectModel {
+ public delegate void EchonetPropertyValueFormatter<in TValue>(IBufferWriter<byte> writer, TValue @value) where TValue : notnull;
+ public delegate bool EchonetPropertyValueParser<TValue>(ReadOnlySpan<byte> data, out TValue @value) where TValue : notnull;
+
+ public interface IEchonetPropertyAccessor {
+ EchonetProperty BaseProperty { get; }
+ bool IsAvailable { get; }
+ byte PropertyCode { get; }
+ }
+
+ public interface IEchonetPropertyGetAccessor<TValue> : IEchonetPropertyAccessor {
+ TValue Value { get; }
+
+ bool TryGetValue(out TValue @value);
+ }
+
+ public interface IEchonetPropertySetGetAccessor<TValue> : IEchonetPropertyGetAccessor<TValue> {
+ new TValue Value { get; set; }
+ }
+
+ public abstract class DeviceSuperClass : EchonetDevice {
+ protected DeviceSuperClass(byte classGroupCode, byte classCode, byte instanceCode) {}
+
+ public IEchonetPropertyGetAccessor<DateTime> CurrentDateAndTime { get; }
+ public IEchonetPropertyGetAccessor<TimeSpan> CurrentTimeSetting { get; }
+ public IEchonetPropertyGetAccessor<bool> FaultStatus { get; }
+ public IEchonetPropertyGetAccessor<byte> InstallationLocation { get; }
+ public IEchonetPropertyGetAccessor<int> Manufacturer { get; }
+ public IEchonetPropertyGetAccessor<bool> OperationStatus { get; }
+ public IEchonetPropertyGetAccessor<(string Release, int Revision)> Protocol { get; }
+ public IEchonetPropertyGetAccessor<string> SerialNumber { get; }
+
+ protected IEchonetPropertyGetAccessor<TValue> CreateAccessor<TValue>(byte propertyCode, EchonetPropertyValueParser<TValue> tryParseValue) where TValue : notnull {}
+ protected IEchonetPropertySetGetAccessor<TValue> CreateAccessor<TValue>(byte propertyCode, EchonetPropertyValueParser<TValue> tryParseValue, EchonetPropertyValueFormatter<TValue> formatValue) where TValue : notnull {}
+ }
+
+ public class EchonetPropertyInvalidValueException : InvalidOperationException {
+ public EchonetPropertyInvalidValueException() {}
+ public EchonetPropertyInvalidValueException(EchonetObject deviceObject, EchonetProperty property) {}
+ public EchonetPropertyInvalidValueException(string? message) {}
+ public EchonetPropertyInvalidValueException(string? message, Exception? innerException) {}
+
+ public EchonetObject? DeviceObject { get; }
+ public EchonetProperty? Property { get; }
+ }
+
+ public class EchonetPropertyNotAvailableException : InvalidOperationException {
+ public EchonetPropertyNotAvailableException() {}
+ public EchonetPropertyNotAvailableException(EchonetObject deviceObject, byte propertyCode) {}
+ public EchonetPropertyNotAvailableException(string? message) {}
+ public EchonetPropertyNotAvailableException(string? message, Exception? innerException) {}
+
+ public EchonetObject? DeviceObject { get; }
+ public byte? PropertyCode { get; }
}
+}
+namespace Smdn.Net.EchonetLite.Protocol {
public enum EHD1 : byte {
EchonetLite = 16,
MaskEchonet = 128,
None = 0,
}
public enum EHD2 : byte {
- Type1 = 129,
- Type2 = 130,
+ Format1 = 129,
+ Format2 = 130,
}
public enum ESV : byte {
Get = 98,
GetResponse = 114,
GetServiceNotAvailable = 82,
Inf = 115,
InfC = 116,
InfCResponse = 122,
InfRequest = 99,
InfServiceNotAvailable = 83,
Invalid = 0,
SetC = 97,
SetCServiceNotAvailable = 81,
SetGet = 110,
SetGetResponse = 126,
SetGetServiceNotAvailable = 94,
SetI = 96,
SetIServiceNotAvailable = 80,
SetResponse = 113,
}
- public sealed class EData1 : IEData {
- public EData1(EOJ seoj, EOJ deoj, ESV esv, IReadOnlyCollection<PropertyRequest> opcList) {}
- public EData1(EOJ seoj, EOJ deoj, ESV esv, IReadOnlyCollection<PropertyRequest> opcSetList, IReadOnlyCollection<PropertyRequest> opcGetList) {}
-
- public EOJ DEOJ { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
- public ESV ESV { get; }
- [JsonIgnore]
- public bool IsWriteOrReadService { get; }
- public IReadOnlyCollection<PropertyRequest>? OPCGetList { get; }
- public IReadOnlyCollection<PropertyRequest>? OPCList { get; }
- public IReadOnlyCollection<PropertyRequest>? OPCSetList { get; }
- public EOJ SEOJ { get; }
-
- public (IReadOnlyCollection<PropertyRequest> OPCSetList, IReadOnlyCollection<PropertyRequest> OPCGetList) GetOPCSetGetList() {}
- }
-
- public sealed class EData2 : IEData {
- public EData2(ReadOnlyMemory<byte> message) {}
-
- public ReadOnlyMemory<byte> Message { get; }
+ public static class ESVExtensions {
+ public static string ToSymbolString(this ESV esv) {}
}
public static class FrameSerializer {
- public static void Serialize(Frame frame, IBufferWriter<byte> buffer) {}
- public static void SerializeEchonetLiteFrameFormat1(IBufferWriter<byte> buffer, ushort tid, EOJ sourceObject, EOJ destinationObject, ESV esv, IEnumerable<PropertyRequest> opcListOrOpcSetList, IEnumerable<PropertyRequest>? opcGetList = null) {}
+ public static void SerializeEchonetLiteFrameFormat1(IBufferWriter<byte> buffer, int tid, EOJ sourceObject, EOJ destinationObject, ESV esv, IEnumerable<PropertyValue> properties) {}
+ public static void SerializeEchonetLiteFrameFormat1(IBufferWriter<byte> buffer, int tid, EOJ sourceObject, EOJ destinationObject, ESV esv, IEnumerable<PropertyValue> propertiesForSet, IEnumerable<PropertyValue> propertiesForGet) {}
public static void SerializeEchonetLiteFrameFormat2(IBufferWriter<byte> buffer, ushort tid, ReadOnlySpan<byte> edata) {}
- public static bool TryDeserialize(ReadOnlySpan<byte> bytes, out Frame frame) {}
+ public static bool TryDeserialize(ReadOnlyMemory<byte> bytes, out EHD1 ehd1, out EHD2 ehd2, out int tid, out ReadOnlyMemory<byte> edata) {}
+ public static bool TryDeserialize(ReadOnlySpan<byte> bytes, out EHD1 ehd1, out EHD2 ehd2, out int tid, out ReadOnlySpan<byte> edata) {}
+ public static bool TryParseEDataAsFormat1Message(ReadOnlySpan<byte> bytes, out Format1Message message) {}
}
public static class PropertyContentSerializer {
public static bool TryDeserializeInstanceListNotification(ReadOnlySpan<byte> content, [NotNullWhen(true)] out IReadOnlyList<EOJ>? instanceList) {}
public static bool TryDeserializePropertyMap(ReadOnlySpan<byte> content, [NotNullWhen(true)] out IReadOnlyList<byte>? propertyMap) {}
public static bool TrySerializeInstanceListNotification(IEnumerable<EOJ> instanceList, Span<byte> destination, out int bytesWritten) {}
}
public readonly struct EOJ : IEquatable<EOJ> {
+ public static readonly EOJ NodeProfile; // = "0E.F0 00"
+
+ public static bool AreSame(EOJ x, EOJ y) {}
public static bool operator == (EOJ c1, EOJ c2) {}
public static bool operator != (EOJ c1, EOJ c2) {}
public EOJ(byte classGroupCode, byte classCode, byte instanceCode) {}
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte ClassCode { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte ClassGroupCode { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte InstanceCode { get; }
public bool Equals(EOJ other) {}
public override bool Equals(object? obj) {}
public override int GetHashCode() {}
+ public override string ToString() {}
}
- public readonly struct Frame {
- public Frame(EHD1 ehd1, EHD2 ehd2, ushort tid, IEData edata) {}
+ public readonly struct Format1Message {
+ public Format1Message(EOJ seoj, EOJ deoj, ESV esv, IReadOnlyList<PropertyValue> properties) {}
+ public Format1Message(EOJ seoj, EOJ deoj, ESV esv, IReadOnlyList<PropertyValue> propertiesForSet, IReadOnlyList<PropertyValue> propertiesForGet) {}
- public IEData? EData { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
- public EHD1 EHD1 { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
- public EHD2 EHD2 { get; }
- [JsonConverter(typeof(SingleUInt16JsonConverter))]
- public ushort TID { get; }
+ public EOJ DEOJ { get; }
+ public ESV ESV { get; }
+ public EOJ SEOJ { get; }
+
+ public IReadOnlyList<PropertyValue> GetProperties() {}
+ public (IReadOnlyList<PropertyValue> PropertiesForSet, IReadOnlyList<PropertyValue> PropertiesForGet) GetPropertiesForSetAndGet() {}
+ public override string ToString() {}
}
- public readonly struct PropertyRequest {
- public PropertyRequest(byte epc) {}
- public PropertyRequest(byte epc, ReadOnlyMemory<byte> edt) {}
+ public readonly struct PropertyValue {
+ public PropertyValue(byte epc) {}
+ public PropertyValue(byte epc, ReadOnlyMemory<byte> edt) {}
- [JsonConverter(typeof(ByteSequenceJsonConverter))]
public ReadOnlyMemory<byte> EDT { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte EPC { get; }
- [JsonConverter(typeof(SingleByteJsonConverterFactory))]
public byte PDC { get; }
}
}
+namespace Smdn.Net.EchonetLite.Specifications {
+ public abstract class EchonetDeviceObjectDetail : IEchonetObjectSpecification {
+ protected static class PropertyDetails {
+ public static IReadOnlyList<IEchonetPropertySpecification> Properties { get; }
+ }
+
+ public static IEchonetObjectSpecification Controller { get; }
+
+ protected EchonetDeviceObjectDetail() {}
+
+ public abstract byte ClassCode { get; }
+ public abstract byte ClassGroupCode { get; }
+ public abstract IEnumerable<IEchonetPropertySpecification> Properties { get; }
+ }
+
+ public abstract class EchonetProfileObjectDetail : IEchonetObjectSpecification {
+ protected static class PropertyDetails {
+ public static IReadOnlyList<IEchonetPropertySpecification> Properties { get; }
+ }
+
+ public static IEchonetObjectSpecification NodeProfile { get; }
+
+ protected EchonetProfileObjectDetail() {}
+
+ public abstract byte ClassCode { get; }
+ public byte ClassGroupCode { get; }
+ public abstract IEnumerable<IEchonetPropertySpecification> Properties { get; }
+ }
+}
+
namespace Smdn.Net.EchonetLite.Transport {
public class UdpEchonetLiteHandler : EchonetLiteHandler {
public UdpEchonetLiteHandler(ILogger<UdpEchonetLiteHandler> logger) {}
public override IPAddress? LocalAddress { get; }
public override ISynchronizeInvoke? SynchronizingObject { get; set; }
protected override void Dispose(bool disposing) {}
protected override ValueTask DisposeAsyncCore() {}
protected override async ValueTask<IPAddress> ReceiveAsyncCore(IBufferWriter<byte> buffer, CancellationToken cancellationToken) {}
protected override async ValueTask SendAsyncCore(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken) {}
protected override async ValueTask SendToAsyncCore(IPAddress remoteAddress, ReadOnlyMemory<byte> buffer, 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)
Notes
Full Changelog: releases/Smdn.Net.EchonetLite-2.0.0-preview1...releases/Smdn.Net.EchonetLite-2.0.0-preview2