From 8ae0f4472e4365edf01d1dc1f5bda666be5e3ce7 Mon Sep 17 00:00:00 2001 From: jdomnitz <380352+jdomnitz@users.noreply.github.com> Date: Tue, 12 Nov 2024 21:35:11 -0500 Subject: [PATCH] Documentation --- .../CommandClasses/ApplicationCapability.cs | 3 ++ .../CommandClasses/ApplicationStatus.cs | 4 ++ ZWaveDotNet/CommandClasses/Association.cs | 34 +++++++++++++++ ZWaveDotNet/CommandClasses/BarrierOperator.cs | 35 ++++++++++++++++ ZWaveDotNet/CommandClasses/Basic.cs | 15 +++++++ ZWaveDotNet/CommandClasses/CRC16.cs | 4 +- .../CommandClasses/DeviceResetLocally.cs | 9 ++-- ZWaveDotNet/CommandClasses/MultiChannel.cs | 4 +- ZWaveDotNet/CommandClasses/MultiCommand.cs | 4 +- ZWaveDotNet/CommandClasses/SceneActivation.cs | 11 ++++- .../CommandClasses/SceneActuatorConf.cs | 20 +++++++++ .../CommandClasses/SceneControllerConf.cs | 20 +++++++++ ZWaveDotNet/CommandClasses/Security0.cs | 16 ++++++-- ZWaveDotNet/CommandClasses/Security2.cs | 20 ++++++--- ZWaveDotNet/CommandClasses/SilenceAlarm.cs | 10 +++++ ZWaveDotNet/CommandClasses/Supervision.cs | 4 +- .../CommandClasses/SwitchMultiLevel.cs | 41 +++++++++++++++++++ ZWaveDotNet/CommandClasses/ZWavePlus.cs | 9 ++++ ZWaveDotNet/ZWaveDotNet.csproj | 2 +- 19 files changed, 242 insertions(+), 23 deletions(-) diff --git a/ZWaveDotNet/CommandClasses/ApplicationCapability.cs b/ZWaveDotNet/CommandClasses/ApplicationCapability.cs index 12b314e..cf3000b 100644 --- a/ZWaveDotNet/CommandClasses/ApplicationCapability.cs +++ b/ZWaveDotNet/CommandClasses/ApplicationCapability.cs @@ -20,6 +20,9 @@ namespace ZWaveDotNet.CommandClasses { + /// + /// The Application Capability Command Class comprises commands for handling issues related to dynamic support for command classes. + /// [CCVersion(CommandClass.ApplicationCapability)] public class ApplicationCapability : CommandClassBase { diff --git a/ZWaveDotNet/CommandClasses/ApplicationStatus.cs b/ZWaveDotNet/CommandClasses/ApplicationStatus.cs index 9a42259..dbf2a49 100644 --- a/ZWaveDotNet/CommandClasses/ApplicationStatus.cs +++ b/ZWaveDotNet/CommandClasses/ApplicationStatus.cs @@ -18,6 +18,10 @@ namespace ZWaveDotNet.CommandClasses { + /// + /// This command class contains commands that are not directly related to a specific functionality in the application, + /// but are useful for maintaining an optimal Z-Wave system. + /// [CCVersion(CommandClass.ApplicationStatus)] public class ApplicationStatus : CommandClassBase { diff --git a/ZWaveDotNet/CommandClasses/Association.cs b/ZWaveDotNet/CommandClasses/Association.cs index ad01ab6..36b5f14 100644 --- a/ZWaveDotNet/CommandClasses/Association.cs +++ b/ZWaveDotNet/CommandClasses/Association.cs @@ -19,6 +19,10 @@ namespace ZWaveDotNet.CommandClasses { + /// + /// The Association Command Class is used to manage associations to NodeID destinations. + /// A NodeID destination may be a simple device or the Root Device of a Multi Channel device. + /// [CCVersion(CommandClass.Association, 1, 3)] public class Association : CommandClassBase { @@ -36,28 +40,58 @@ enum AssociationCommand } public Association(Node node, byte endpoint) : base(node, endpoint, CommandClass.Association) { } + /// + /// Version 1: Request the current destinations of a given association group + /// + /// + /// + /// public async Task Get(byte groupID, CancellationToken cancellationToken = default) { ReportMessage response = await SendReceive(AssociationCommand.Get, AssociationCommand.Report, cancellationToken, groupID); return new AssociationReport(response.Payload.Span); } + /// + /// Version 2: This command allows a portable controller to interactively create associations from a multi-button device to a destination that is out of direct range. + /// + /// + /// public async Task GetSpecific(CancellationToken cancellationToken = default) { var response = await SendReceive(AssociationCommand.SpecificGroupGet, AssociationCommand.SpecificGroupReport, cancellationToken); return response.Payload.Span[0]; } + /// + /// Version 1: Add destinations to a given association group + /// + /// + /// + /// + /// public async Task Add(byte groupID, CancellationToken cancellationToken, params byte[] nodeIDs) { await SendCommand(AssociationCommand.Set, cancellationToken, nodeIDs.Prepend(groupID).ToArray()); } + /// + /// Version 1: Remove destinations from a given association group + /// + /// + /// + /// + /// public async Task Remove(byte groupID, CancellationToken cancellationToken, params byte[] nodeIDs) { await SendCommand(AssociationCommand.Remove, cancellationToken, nodeIDs.Prepend(groupID).ToArray()); } + /// + /// Version 1: Request the number of association groups that this node supports + /// + /// + /// public async Task GetGroups(CancellationToken cancellationToken = default) { ReportMessage response = await SendReceive(AssociationCommand.GroupingsGet, AssociationCommand.GroupingsReport, cancellationToken); diff --git a/ZWaveDotNet/CommandClasses/BarrierOperator.cs b/ZWaveDotNet/CommandClasses/BarrierOperator.cs index 2c81896..a3280d0 100644 --- a/ZWaveDotNet/CommandClasses/BarrierOperator.cs +++ b/ZWaveDotNet/CommandClasses/BarrierOperator.cs @@ -22,6 +22,9 @@ namespace ZWaveDotNet.CommandClasses { + /// + /// The Barrier Operator Command Class is used to control and query the status of motorized barriers. + /// [CCVersion(CommandClass.BarrierOperator, 1)] public class BarrierOperator : CommandClassBase { @@ -41,6 +44,12 @@ enum BarrierOperatorCommand : byte public BarrierOperator(Node node, byte endpoint) : base(node, endpoint, CommandClass.BarrierOperator) { } + /// + /// Request the current state of a barrier operator device + /// + /// + /// + /// public async Task Get(CancellationToken cancellationToken = default) { if (node.ID == Node.BROADCAST_ID) @@ -49,11 +58,22 @@ public async Task Get(CancellationToken cancellationToken = defau return new BarrierReport(response.Payload.Span); } + /// + /// Initiate an unattended change in state of the barrier + /// + /// + /// + /// public async Task Set(bool open, CancellationToken cancellationToken = default) { await SendCommand(BarrierOperatorCommand.Set, cancellationToken, open ? (byte)0xFF : (byte)0x00); } + /// + /// Query a device for available subsystems which may be controlled via Z-Wave + /// + /// + /// public async Task GetSupportedSignals(CancellationToken cancellationToken = default) { ReportMessage response = await SendReceive(BarrierOperatorCommand.SupportedGet, BarrierOperatorCommand.SupportedReport, cancellationToken); @@ -67,11 +87,26 @@ public async Task GetSupportedSignals(CancellationToken cancell return supportedTypes.ToArray(); } + /// + /// Turn on or off an event signaling subsystem that is supported by the device + /// + /// + /// + /// + /// public async Task SignalSet(BarrierSignal signal, bool active, CancellationToken cancellationToken = default) { await SendCommand(BarrierOperatorCommand.Set, cancellationToken, (byte)signal, active ? (byte)0xFF : (byte)0x00); } + /// + /// Request the state of a signaling subsystem to a supporting node + /// + /// + /// + /// + /// + /// public async Task> SignalGet(BarrierSignal signal, CancellationToken cancellationToken = default) { if (node.ID == Node.BROADCAST_ID) diff --git a/ZWaveDotNet/CommandClasses/Basic.cs b/ZWaveDotNet/CommandClasses/Basic.cs index 85c24c8..34237b2 100644 --- a/ZWaveDotNet/CommandClasses/Basic.cs +++ b/ZWaveDotNet/CommandClasses/Basic.cs @@ -19,6 +19,9 @@ namespace ZWaveDotNet.CommandClasses { + /// + /// The Basic Command Class allows a controlling device to operate the primary functionality of a supporting device without any further knowledge. + /// [CCVersion(CommandClass.Basic, 2)] public class Basic : CommandClassBase { @@ -33,6 +36,12 @@ enum BasicCommand : byte public Basic(Node node, byte endpoint) : base(node, endpoint, CommandClass.Basic) { } + /// + /// Version 1: Request the status of a supporting device + /// + /// + /// + /// public async Task Get(CancellationToken cancellationToken = default) { if (node.ID == Node.BROADCAST_ID) @@ -41,6 +50,12 @@ public async Task Get(CancellationToken cancellationToken = default return new BasicReport(response.Payload.Span); } + /// + /// Version 1: Set a value in a supporting device + /// + /// + /// + /// public async Task Set(byte value, CancellationToken cancellationToken = default) { await SendCommand(BasicCommand.Set, cancellationToken, value); diff --git a/ZWaveDotNet/CommandClasses/CRC16.cs b/ZWaveDotNet/CommandClasses/CRC16.cs index a33d62c..2d0f6f2 100644 --- a/ZWaveDotNet/CommandClasses/CRC16.cs +++ b/ZWaveDotNet/CommandClasses/CRC16.cs @@ -30,12 +30,12 @@ public enum CRC16Command public CRC16(Node node, byte endpoint) : base(node, endpoint, CommandClass.CRC16) { } - public static bool IsEncapsulated(ReportMessage msg) + internal static bool IsEncapsulated(ReportMessage msg) { return msg.CommandClass == CommandClass.CRC16 && msg.Command == (byte)CRC16Command.Encap; } - public static void Encapsulate (List payload) + internal static void Encapsulate (List payload) { byte[] header = new byte[] { diff --git a/ZWaveDotNet/CommandClasses/DeviceResetLocally.cs b/ZWaveDotNet/CommandClasses/DeviceResetLocally.cs index 0897763..2ebb415 100644 --- a/ZWaveDotNet/CommandClasses/DeviceResetLocally.cs +++ b/ZWaveDotNet/CommandClasses/DeviceResetLocally.cs @@ -10,14 +10,17 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -using ZWaveDotNet.Entities; -using ZWaveDotNet.SerialAPI; -using ZWaveDotNet.Enums; using Serilog; using ZWaveDotNet.CommandClassReports.Enums; +using ZWaveDotNet.Entities; +using ZWaveDotNet.Enums; +using ZWaveDotNet.SerialAPI; namespace ZWaveDotNet.CommandClasses { + /// + /// This Command Class is used to notify central controllers that a Z-Wave device is resetting its network specific parameters. + /// [CCVersion(CommandClass.DeviceResetLocally)] public class DeviceResetLocally : CommandClassBase { diff --git a/ZWaveDotNet/CommandClasses/MultiChannel.cs b/ZWaveDotNet/CommandClasses/MultiChannel.cs index f50f0e4..3e2d5ef 100644 --- a/ZWaveDotNet/CommandClasses/MultiChannel.cs +++ b/ZWaveDotNet/CommandClasses/MultiChannel.cs @@ -78,12 +78,12 @@ public async Task> GetAggregatedMembers(byte endpointId, Cancellation return ret; } - public static bool IsEncapsulated(ReportMessage msg) + internal static bool IsEncapsulated(ReportMessage msg) { return msg.CommandClass == CommandClass.MultiChannel && msg.Command == (byte)MultiChannelCommand.Encap; } - public static void Encapsulate (List payload, byte destinationEndpoint) + internal static void Encapsulate (List payload, byte destinationEndpoint) { byte[] header = new byte[] { diff --git a/ZWaveDotNet/CommandClasses/MultiCommand.cs b/ZWaveDotNet/CommandClasses/MultiCommand.cs index d34f4cf..0917911 100644 --- a/ZWaveDotNet/CommandClasses/MultiCommand.cs +++ b/ZWaveDotNet/CommandClasses/MultiCommand.cs @@ -26,12 +26,12 @@ public enum MultiCommandCommand } public MultiCommand(Node node, byte endpoint) : base(node, endpoint, CommandClass.MultiCommand) { } - public static bool IsEncapsulated(ReportMessage msg) + internal static bool IsEncapsulated(ReportMessage msg) { return msg.CommandClass == CommandClass.MultiCommand && msg.Command == (byte)MultiCommandCommand.Encap; } - public static void Encapsulate (List payload, List commands) + internal static void Encapsulate (List payload, List commands) { payload.Clear(); payload.Add((byte)CommandClass.MultiCommand); diff --git a/ZWaveDotNet/CommandClasses/SceneActivation.cs b/ZWaveDotNet/CommandClasses/SceneActivation.cs index 7781095..839020d 100644 --- a/ZWaveDotNet/CommandClasses/SceneActivation.cs +++ b/ZWaveDotNet/CommandClasses/SceneActivation.cs @@ -18,6 +18,9 @@ namespace ZWaveDotNet.CommandClasses { + /// + /// This Command Class is used for launching scenes in a number of actuator nodes e.g. another scene-controlling unit, a multilevel switch, a binary switch etc. + /// [CCVersion(CommandClass.SceneActivation)] public class SceneActivation : CommandClassBase { @@ -28,9 +31,15 @@ enum SceneActivationCommand : byte public SceneActivation(Node node, byte endpoint) : base(node, endpoint, CommandClass.SceneActivation) { } + /// + /// Activate the scene associated to the scene ID + /// + /// + /// + /// + /// public async Task Set(byte sceneId, TimeSpan duration, CancellationToken cancellationToken = default) { - await SendCommand(SceneActivationCommand.Set, cancellationToken, sceneId, PayloadConverter.GetByte(duration)); } diff --git a/ZWaveDotNet/CommandClasses/SceneActuatorConf.cs b/ZWaveDotNet/CommandClasses/SceneActuatorConf.cs index 86f4412..205ff94 100644 --- a/ZWaveDotNet/CommandClasses/SceneActuatorConf.cs +++ b/ZWaveDotNet/CommandClasses/SceneActuatorConf.cs @@ -19,6 +19,9 @@ namespace ZWaveDotNet.CommandClasses { + /// + /// This Command Class is used to configure scenes settings for a node supporting an actuator Command Class, e.g.a multilevel switch, binary switch etc. + /// [CCVersion(CommandClass.SceneActuatorConf)] public class SceneActuatorConf : CommandClassBase { @@ -31,6 +34,14 @@ enum SceneActuatorConfCommand : byte public SceneActuatorConf(Node node, byte endpoint) : base(node, endpoint, CommandClass.SceneActuatorConf) { } + /// + /// Request the settings for a given scene identifier or for the scene currently active + /// + /// + /// + /// + /// + /// public async Task Get(byte sceneId, CancellationToken cancellationToken = default) { if (node.ID == Node.BROADCAST_ID) @@ -42,6 +53,15 @@ public async Task Get(byte sceneId, Cancellati return new SceneActuatorConfigurationReport(response.Payload.Span); } + /// + /// Associate the specified scene ID to the defined actuator settings + /// + /// + /// + /// + /// + /// + /// public async Task Set(byte sceneId, TimeSpan duration, byte? level = null, CancellationToken cancellationToken = default) { if (sceneId == 0) diff --git a/ZWaveDotNet/CommandClasses/SceneControllerConf.cs b/ZWaveDotNet/CommandClasses/SceneControllerConf.cs index 9d90bba..2c37def 100644 --- a/ZWaveDotNet/CommandClasses/SceneControllerConf.cs +++ b/ZWaveDotNet/CommandClasses/SceneControllerConf.cs @@ -19,6 +19,9 @@ namespace ZWaveDotNet.CommandClasses { + /// + /// This Command Class is used to configure nodes launching scenes using their association groups + /// [CCVersion(CommandClass.SceneControllerConf)] public class SceneControllerConf : CommandClassBase { @@ -31,6 +34,14 @@ enum SceneActuatorConfCommand : byte public SceneControllerConf(Node node, byte endpoint) : base(node, endpoint, CommandClass.SceneControllerConf) { } + /// + /// Request the settings for a given association grouping identifier or the active settings + /// + /// + /// + /// + /// + /// public async Task Get(byte groupId, CancellationToken cancellationToken = default) { if (node.ID == Node.BROADCAST_ID) @@ -42,6 +53,15 @@ public async Task Get(byte groupId, Cancella return new SceneControllerConfigurationReport(response.Payload.Span); } + /// + /// Configure settings for a given physical item on the device + /// + /// + /// + /// + /// + /// + /// public async Task Set(byte groupId, byte sceneId, TimeSpan duration, CancellationToken cancellationToken = default) { if (groupId == 0) diff --git a/ZWaveDotNet/CommandClasses/Security0.cs b/ZWaveDotNet/CommandClasses/Security0.cs index a2ed897..6505ca8 100644 --- a/ZWaveDotNet/CommandClasses/Security0.cs +++ b/ZWaveDotNet/CommandClasses/Security0.cs @@ -22,6 +22,9 @@ namespace ZWaveDotNet.CommandClasses { + /// + /// The Security Command Class defines a number of commands used to facilitate handling of encrypted frames in a Z-Wave Network + /// [CCVersion(CommandClass.Security0)] public class Security0 : CommandClassBase { @@ -43,6 +46,11 @@ public enum Security0Command public Security0(Node node, byte endpoint) : base(node, endpoint, CommandClass.Security0) { } + /// + /// Query the commands supported by the device when using secure communication + /// + /// + /// public async Task CommandsSupportedGet(CancellationToken cancellationToken = default) { ReportMessage msg = await SendReceive(Security0Command.CommandsSupportedGet, Security0Command.CommandsSupportedReport, cancellationToken); @@ -68,12 +76,12 @@ protected async Task GetNonce(CancellationToken cancellationToken return await SendReceive(Security0Command.NonceGet, Security0Command.NonceReport, cancellationToken); } - public static bool IsEncapsulated(ReportMessage msg) + internal static bool IsEncapsulated(ReportMessage msg) { return msg.CommandClass == CommandClass.Security0 && (msg.Command == (byte)Security0Command.MessageEncap || msg.Command == (byte)Security0Command.MessageEncapNonceGet); } - public async Task TransmitTemp(List payload, CancellationToken cancellationToken = default) + internal async Task TransmitTemp(List payload, CancellationToken cancellationToken = default) { ReportMessage report; using (CancellationTokenSource timeout = new CancellationTokenSource(10000)) @@ -101,7 +109,7 @@ public async Task TransmitTemp(List payload, CancellationToken cancellatio await SendCommand(Security0Command.MessageEncap, cancellationToken, securePayload).ConfigureAwait(false); } - public async Task Encapsulate(List payload, CancellationToken cancellationToken) + internal async Task Encapsulate(List payload, CancellationToken cancellationToken) { ReportMessage report = await GetNonce(cancellationToken).ConfigureAwait(false); if (report.IsMulticastMethod) @@ -221,7 +229,7 @@ private static byte[] EncryptDecryptPayload(Memory plaintext, byte[] sende return output; } - public async Task WaitForKeyVerified(CancellationToken cancellationToken) + internal async Task WaitForKeyVerified(CancellationToken cancellationToken) { keyVerified = new TaskCompletionSource(); cancellationToken.Register(() => keyVerified.TrySetCanceled()); diff --git a/ZWaveDotNet/CommandClasses/Security2.cs b/ZWaveDotNet/CommandClasses/Security2.cs index 5cdb33e..61fb427 100644 --- a/ZWaveDotNet/CommandClasses/Security2.cs +++ b/ZWaveDotNet/CommandClasses/Security2.cs @@ -24,6 +24,9 @@ namespace ZWaveDotNet.CommandClasses { + /// + /// The Security 2 Command Class is a framework for allowing nodes to communicate securely in a Z-Wave network + /// [CCVersion(CommandClass.Security2, 1, 1, false)] public class Security2 : CommandClassBase { @@ -53,6 +56,11 @@ internal enum Security2Command public Security2(Node node, byte endpoint) : base(node, endpoint, CommandClass.Security2) { } + /// + /// Query the commands supported by the device when using secure communication + /// + /// + /// public async Task> GetSupportedCommands(CancellationToken cancellationToken = default) { ReportMessage msg = await SendReceive(Security2Command.CommandsSupportedGet, Security2Command.CommandsSupportedReport, cancellationToken); @@ -128,12 +136,12 @@ internal async Task KexFail(KexFailType type, CancellationToken cancellationToke bootstrapComplete.TrySetException(new SecurityException(type.ToString())); } - public static bool IsEncapsulated(ReportMessage msg) + internal static bool IsEncapsulated(ReportMessage msg) { return msg.CommandClass == CommandClass.Security2 && msg.Command == (byte)Security2Command.MessageEncap; } - public async Task Transmit(List payload, SecurityManager.RecordType? type, CancellationToken cancellationToken = default) + internal async Task Transmit(List payload, SecurityManager.RecordType? type, CancellationToken cancellationToken = default) { await Encapsulate(payload, type, cancellationToken); if (payload.Count > 2) @@ -142,7 +150,7 @@ public async Task Transmit(List payload, SecurityManager.RecordType? type, Log.Verbose("Transmit Complete"); } - public async Task Encapsulate(List payload, SecurityManager.RecordType? type, CancellationToken cancellationToken = default) + internal async Task Encapsulate(List payload, SecurityManager.RecordType? type, CancellationToken cancellationToken = default) { List extensionData = new List(); Log.Verbose("Encrypting Payload for " + node.ID.ToString()); @@ -545,14 +553,14 @@ protected override bool IsSecure(byte command) return false; } - public async Task WaitForBootstrap(CancellationToken cancellationToken) + internal async Task WaitForBootstrap(CancellationToken cancellationToken) { bootstrapComplete = new TaskCompletionSource(); cancellationToken.Register(() => bootstrapComplete.TrySetCanceled()); await bootstrapComplete.Task; } - public static Memory EncryptCCM(Memory plaintext, Memory nonce, Memory key, AdditionalAuthData ad) + protected static Memory EncryptCCM(Memory plaintext, Memory nonce, Memory key, AdditionalAuthData ad) { Memory ret = new byte[plaintext.Length + 8]; using (AesCcm aes = new AesCcm(key.Span)) @@ -560,7 +568,7 @@ public static Memory EncryptCCM(Memory plaintext, Memory nonce return ret; } - public static Memory DecryptCCM(Memory cipherText, Memory nonce, Memory key, AdditionalAuthData ad) + protected static Memory DecryptCCM(Memory cipherText, Memory nonce, Memory key, AdditionalAuthData ad) { Memory ret = new byte[cipherText.Length - 8]; using (AesCcm aes = new AesCcm(key.Span)) diff --git a/ZWaveDotNet/CommandClasses/SilenceAlarm.cs b/ZWaveDotNet/CommandClasses/SilenceAlarm.cs index ca0a3ca..5da11e9 100644 --- a/ZWaveDotNet/CommandClasses/SilenceAlarm.cs +++ b/ZWaveDotNet/CommandClasses/SilenceAlarm.cs @@ -19,6 +19,9 @@ namespace ZWaveDotNet.CommandClasses { + /// + /// The Alarm Silence Command Class may be used to temporarily disable the sounding of the alarm but still keep the alarm operating. + /// [CCVersion(CommandClass.SilenceAlarm)] public class SilenceAlarm : CommandClassBase { @@ -29,6 +32,13 @@ enum AlarmSilenceCommand public SilenceAlarm(Node node, byte endpoint) : base(node, endpoint, CommandClass.SilenceAlarm) { } + /// + /// Remotely silence the sensor alarm + /// + /// + /// + /// + /// public async Task Set(List types, TimeSpan duration, CancellationToken cancellationToken = default) { byte[] payload = new byte[5]; diff --git a/ZWaveDotNet/CommandClasses/Supervision.cs b/ZWaveDotNet/CommandClasses/Supervision.cs index f6c6501..8e2517e 100644 --- a/ZWaveDotNet/CommandClasses/Supervision.cs +++ b/ZWaveDotNet/CommandClasses/Supervision.cs @@ -40,12 +40,12 @@ public async Task Report(byte sessionId, SupervisionStatus status, CancellationT await SendCommand(SupervisionCommand.Report, cancellationToken, sessionId, (byte)status, 0x0); } - public static bool IsEncapsulated(ReportMessage msg) + internal static bool IsEncapsulated(ReportMessage msg) { return msg.CommandClass == CommandClass.Supervision && msg.Command == (byte)SupervisionCommand.Get; } - public static void Encapsulate (List payload, bool withProgress) + internal static void Encapsulate (List payload, bool withProgress) { sessionId = Math.Max((byte)(sessionId++ % 64), (byte)1); byte flags = sessionId; diff --git a/ZWaveDotNet/CommandClasses/SwitchMultiLevel.cs b/ZWaveDotNet/CommandClasses/SwitchMultiLevel.cs index ef3b9bf..f4a84e7 100644 --- a/ZWaveDotNet/CommandClasses/SwitchMultiLevel.cs +++ b/ZWaveDotNet/CommandClasses/SwitchMultiLevel.cs @@ -20,6 +20,9 @@ namespace ZWaveDotNet.CommandClasses { + /// + /// This Command Class is used to control devices with multilevel capability + /// [CCVersion(CommandClass.SwitchMultiLevel, 1, 4)] public class SwitchMultiLevel : CommandClassBase { @@ -37,17 +40,35 @@ enum MultiLevelCommand : byte public SwitchMultiLevel(Node node, byte endpoint) : base(node, endpoint, CommandClass.SwitchMultiLevel) { } + /// + /// Version 1: Request the status of a multilevel device. + /// + /// + /// public async Task Get(CancellationToken cancellationToken = default) { ReportMessage response = await SendReceive(MultiLevelCommand.Get, MultiLevelCommand.Report, cancellationToken); return new SwitchMultiLevelReport(response.Payload.Span); } + /// + /// Version 1: Set a multilevel value in a supporting device. + /// + /// + /// + /// public async Task Set(byte value, CancellationToken cancellationToken = default) { await SendCommand(MultiLevelCommand.Set, cancellationToken, value); } + /// + /// Version 2: Set a multilevel value in a supporting device (When used on a V1 device, duration is ignored) + /// + /// + /// + /// + /// public async Task Set(byte value, TimeSpan duration, CancellationToken cancellationToken = default) { byte time = 0; @@ -56,6 +77,16 @@ public async Task Set(byte value, TimeSpan duration, CancellationToken cancellat await SendCommand(MultiLevelCommand.Set, cancellationToken, value, time); } + /// + /// Version 1: Initiate a transition to a new level (Only V2 supports duration, only V3 supports secondary) + /// + /// + /// + /// + /// + /// + /// + /// public async Task StartLevelChange(bool? primaryDown, int startLevel, byte duration, bool? secondaryDecrement = null, byte secondaryStepSize = 0, CancellationToken cancellationToken = default) { byte flags = 0x0; @@ -72,11 +103,21 @@ public async Task StartLevelChange(bool? primaryDown, int startLevel, byte durat await SendCommand(MultiLevelCommand.StartLevelChange, cancellationToken, flags, (byte)Math.Max(0, startLevel), duration, secondaryStepSize); } + /// + /// Version 1: Stop an ongoing transition + /// + /// + /// public async Task StopLevelChange(CancellationToken cancellationToken = default) { await SendCommand(MultiLevelCommand.StopLevelChange, cancellationToken); } + /// + /// Version 3: This command is used to request the supported Switch Types of a supporting device. + /// + /// + /// public async Task GetSupported(CancellationToken cancellationToken = default) { ReportMessage response = await SendReceive(MultiLevelCommand.SupportedGet, MultiLevelCommand.SupportedReport, cancellationToken); diff --git a/ZWaveDotNet/CommandClasses/ZWavePlus.cs b/ZWaveDotNet/CommandClasses/ZWavePlus.cs index ecccdf4..823c6f2 100644 --- a/ZWaveDotNet/CommandClasses/ZWavePlus.cs +++ b/ZWaveDotNet/CommandClasses/ZWavePlus.cs @@ -18,6 +18,10 @@ namespace ZWaveDotNet.CommandClasses { + /// + /// The Z-Wave Plus Info Command Class is used to differentiate between Z-Wave Plus, Z-Wave for IP and Z-Wave devices. + /// Furthermore this command class provides additional information about the Z-Wave Plus device in question. + /// [CCVersion(CommandClass.ZWavePlusInfo, 2,2)] public class ZWavePlus : CommandClassBase { @@ -29,6 +33,11 @@ public enum ZwavePlusCommand public ZWavePlus(Node node, byte endpoint) : base(node, endpoint, CommandClass.ZWavePlusInfo) { } + /// + /// Version 1/2: Get additional information of the Z-Wave Plus device in question + /// + /// + /// public async Task GetInfo(CancellationToken cancellationToken = default) { ReportMessage resp = await SendReceive(ZwavePlusCommand.InfoGet, ZwavePlusCommand.InfoReport, cancellationToken); diff --git a/ZWaveDotNet/ZWaveDotNet.csproj b/ZWaveDotNet/ZWaveDotNet.csproj index 1bb8db7..cc901b7 100644 --- a/ZWaveDotNet/ZWaveDotNet.csproj +++ b/ZWaveDotNet/ZWaveDotNet.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 0.7.0 + 0.8.0 jdomnitz SmartHomeOS and Contributors AGPL-3.0-or-later