Skip to content

Commit 9d7bf2b

Browse files
authored
Add xmldoc to existing code (#130)
1 parent 470fc1f commit 9d7bf2b

32 files changed

Lines changed: 953 additions & 1 deletion

‎src/ZWave.CommandClasses/BasicCommandClass.cs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public enum BasicCommand : byte
1818
Report = 0x03,
1919
}
2020

21+
/// <summary>
22+
/// Represents the state reported by a Basic Command Class device.
23+
/// </summary>
2124
public readonly struct BasicState
2225
{
2326
public BasicState(
@@ -57,6 +60,9 @@ internal BasicCommandClass(
5760
{
5861
}
5962

63+
/// <summary>
64+
/// Gets the last reported state of the device.
65+
/// </summary>
6066
public BasicState? State { get; private set; }
6167

6268
/// <inheritdoc />

‎src/ZWave.CommandClasses/BatteryCommandClass.cs‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,36 @@
11
namespace ZWave.CommandClasses;
22

3+
/// <summary>
4+
/// Represents a battery level value.
5+
/// </summary>
36
public struct BatteryLevel
47
{
58
public BatteryLevel(byte value)
69
{
710
Value = value;
811
}
912

13+
/// <summary>
14+
/// Gets the raw battery level byte.
15+
/// </summary>
1016
public byte Value { get; }
1117

18+
/// <summary>
19+
/// Gets the battery level as a percentage (0-100).
20+
/// </summary>
1221
public int Level => Value == 0xff ? 0 : Value;
1322

23+
/// <summary>
24+
/// Gets a value indicating whether the battery level is critically low.
25+
/// </summary>
1426
public bool IsLow => Value == 0xff;
1527

1628
public static implicit operator BatteryLevel(byte b) => new BatteryLevel(b);
1729
}
1830

31+
/// <summary>
32+
/// Indicates the charging status of a battery.
33+
/// </summary>
1934
public enum BatteryChargingStatus : byte
2035
{
2136
Discharging = 0x00,
@@ -25,6 +40,9 @@ public enum BatteryChargingStatus : byte
2540
Maintaining = 0x02,
2641
}
2742

43+
/// <summary>
44+
/// Indicates whether the battery needs to be recharged or replaced.
45+
/// </summary>
2846
public enum BatterRechargeOrReplaceStatus : byte
2947
{
3048
/// <summary>
@@ -45,6 +63,9 @@ public enum BatterRechargeOrReplaceStatus : byte
4563
Now = 0x03,
4664
}
4765

66+
/// <summary>
67+
/// The temperature scale used for battery temperature readings.
68+
/// </summary>
4869
public enum BatteryTemperatureScale : byte
4970
{
5071
Celcius = 0x00,
@@ -176,10 +197,17 @@ public BatteryCommandClass(CommandClassInfo info, IDriver driver, INode node)
176197
{
177198
}
178199

200+
/// <summary>
201+
/// Gets the last reported battery state.
202+
/// </summary>
179203
public BatteryState? State { get; private set; }
180204

205+
/// <summary>
206+
/// Gets the last reported battery health.
207+
/// </summary>
181208
public BatteryHealth? Health { get; private set; }
182209

210+
/// <inheritdoc />
183211
public override bool? IsCommandSupported(BatteryCommand command)
184212
=> command switch
185213
{

‎src/ZWave.CommandClasses/BinarySensorCommandClass.cs‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,78 @@
11
namespace ZWave.CommandClasses;
22

3+
/// <summary>
4+
/// Identifies the type of a binary sensor.
5+
/// </summary>
36
public enum BinarySensorType : byte
47
{
8+
/// <summary>
9+
/// General purpose sensor.
10+
/// </summary>
511
GeneralPurpose = 0x01,
12+
13+
/// <summary>
14+
/// Smoke sensor.
15+
/// </summary>
616
Smoke = 0x02,
17+
18+
/// <summary>
19+
/// Carbon monoxide sensor.
20+
/// </summary>
721
CO = 0x03,
22+
23+
/// <summary>
24+
/// Carbon dioxide sensor.
25+
/// </summary>
826
CO2 = 0x04,
27+
28+
/// <summary>
29+
/// Heat sensor.
30+
/// </summary>
931
Heat = 0x05,
32+
33+
/// <summary>
34+
/// Water sensor.
35+
/// </summary>
1036
Water = 0x06,
37+
38+
/// <summary>
39+
/// Freeze sensor.
40+
/// </summary>
1141
Freeze = 0x07,
42+
43+
/// <summary>
44+
/// Tamper sensor.
45+
/// </summary>
1246
Tamper = 0x08,
47+
48+
/// <summary>
49+
/// Auxiliary sensor.
50+
/// </summary>
1351
Aux = 0x09,
52+
53+
/// <summary>
54+
/// Door/window sensor.
55+
/// </summary>
1456
DoorWindow = 0x0a,
57+
58+
/// <summary>
59+
/// Tilt sensor.
60+
/// </summary>
1561
Tilt = 0x0b,
62+
63+
/// <summary>
64+
/// Motion sensor.
65+
/// </summary>
1666
Motion = 0x0c,
67+
68+
/// <summary>
69+
/// Glass break sensor.
70+
/// </summary>
1771
GlassBreak = 0x0d,
72+
73+
/// <summary>
74+
/// Request the first supported sensor type.
75+
/// </summary>
1876
FirstSupported = 0xff,
1977
}
2078

@@ -61,6 +119,7 @@ public BinarySensorCommandClass(CommandClassInfo info, IDriver driver, INode nod
61119
/// </summary>
62120
public IReadOnlyDictionary<BinarySensorType, bool?>? SensorValues => _sensorValues;
63121

122+
/// <inheritdoc />
64123
public override bool? IsCommandSupported(BinarySensorCommand command)
65124
=> command switch
66125
{

‎src/ZWave.CommandClasses/BinarySwitchCommandClass.cs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public enum BinarySwitchCommand : byte
1818
Report = 0x03,
1919
}
2020

21+
/// <summary>
22+
/// Represents the state reported by a Binary Switch Command Class device.
23+
/// </summary>
2124
public readonly struct BinarySwitchState
2225
{
2326
public BinarySwitchState(
@@ -54,6 +57,9 @@ internal BinarySwitchCommandClass(CommandClassInfo info, IDriver driver, INode n
5457
{
5558
}
5659

60+
/// <summary>
61+
/// Gets the last reported switch state.
62+
/// </summary>
5763
public BinarySwitchState? State { get; private set; }
5864

5965
/// <inheritdoc />

‎src/ZWave.CommandClasses/ColorSwitchCommandClass.cs‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
namespace ZWave.CommandClasses;
22

3+
/// <summary>
4+
/// Identifies a color component of a color switch device.
5+
/// </summary>
36
public enum ColorSwitchColorComponent : byte
47
{
58
WarmWhite = 0x00,
@@ -21,6 +24,9 @@ public enum ColorSwitchColorComponent : byte
2124
Index = 0x08,
2225
}
2326

27+
/// <summary>
28+
/// The direction of a color switch level change.
29+
/// </summary>
2430
public enum ColorSwitchChangeDirection : byte
2531
{
2632
Up = 0x00,
@@ -45,15 +51,30 @@ public enum ColorSwitchCommand : byte
4551
/// </summary>
4652
Get = 0x03,
4753

54+
/// <summary>
55+
/// Report the status of a specified color component.
56+
/// </summary>
4857
Report = 0x04,
4958

59+
/// <summary>
60+
/// Set the value of one or more color components.
61+
/// </summary>
5062
Set = 0x05,
5163

64+
/// <summary>
65+
/// Initiate a color component level change.
66+
/// </summary>
5267
StartLevelChange = 0x06,
5368

69+
/// <summary>
70+
/// Stop an ongoing color component level change.
71+
/// </summary>
5472
StopLevelChange = 0x07,
5573
}
5674

75+
/// <summary>
76+
/// Represents the state of a single color component.
77+
/// </summary>
5778
public readonly struct ColorSwitchColorComponentState
5879
{
5980
public ColorSwitchColorComponentState(
@@ -102,6 +123,7 @@ public ColorSwitchCommandClass(CommandClassInfo info, IDriver driver, INode node
102123
/// </summary>
103124
public IReadOnlyDictionary<ColorSwitchColorComponent, ColorSwitchColorComponentState?>? ColorComponents => _colorComponents;
104125

126+
/// <inheritdoc />
105127
public override bool? IsCommandSupported(ColorSwitchCommand command)
106128
=> command switch
107129
{

‎src/ZWave.CommandClasses/CommandClass.cs‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace ZWave.CommandClasses;
44

5+
/// <summary>
6+
/// Base class for command classes with a strongly-typed command enum.
7+
/// </summary>
58
public abstract class CommandClass<TCommand> : CommandClass
69
where TCommand : struct, Enum
710
{
@@ -28,6 +31,9 @@ internal CommandClass(CommandClassInfo info, IDriver driver, INode node)
2831
=> IsCommandSupported(Unsafe.As<byte, TCommand>(ref command));
2932
}
3033

34+
/// <summary>
35+
/// Base class for all Z-Wave command class implementations.
36+
/// </summary>
3137
public abstract class CommandClass
3238
{
3339
private record struct AwaitedReport(
@@ -52,12 +58,24 @@ internal CommandClass(
5258
Node = node;
5359
}
5460

61+
/// <summary>
62+
/// Gets information about this command class, including whether it is supported and/or controlled.
63+
/// </summary>
5564
public CommandClassInfo Info { get; private set; }
5665

66+
/// <summary>
67+
/// Gets the driver used to send commands.
68+
/// </summary>
5769
protected IDriver Driver { get; }
5870

71+
/// <summary>
72+
/// Gets the node this command class belongs to.
73+
/// </summary>
5974
public INode Node { get; }
6075

76+
/// <summary>
77+
/// Gets the version of this command class, or null if not yet determined.
78+
/// </summary>
6179
public byte? Version { get; private set; }
6280

6381
// If we don't know the version, we have to assume it's version 1

‎src/ZWave.CommandClasses/CommandClassFrame.cs‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
namespace ZWave.CommandClasses;
22

3+
/// <summary>
4+
/// Represents a command class frame containing a command class ID, command ID, and optional parameters.
5+
/// </summary>
36
public readonly struct CommandClassFrame
47
{
8+
/// <summary>
9+
/// Initializes a new instance of the <see cref="CommandClassFrame"/> struct from raw payload bytes.
10+
/// </summary>
511
public CommandClassFrame(ReadOnlyMemory<byte> data)
612
{
713
if (data.Span.Length < 2)
@@ -12,17 +18,35 @@ public CommandClassFrame(ReadOnlyMemory<byte> data)
1218
Data = data;
1319
}
1420

21+
/// <summary>
22+
/// Gets the raw frame data.
23+
/// </summary>
1524
public ReadOnlyMemory<byte> Data { get; }
1625

26+
/// <summary>
27+
/// Gets the command class identifier.
28+
/// </summary>
1729
public CommandClassId CommandClassId => (CommandClassId)Data.Span[0];
1830

31+
/// <summary>
32+
/// Gets the command identifier within the command class.
33+
/// </summary>
1934
public byte CommandId => Data.Span[1];
2035

36+
/// <summary>
37+
/// Gets the command parameters, excluding the command class ID and command ID.
38+
/// </summary>
2139
public ReadOnlyMemory<byte> CommandParameters => Data[2..];
2240

41+
/// <summary>
42+
/// Creates a new command class frame with no command parameters.
43+
/// </summary>
2344
public static CommandClassFrame Create(CommandClassId commandClassId, byte commandId)
2445
=> Create(commandClassId, commandId, ReadOnlySpan<byte>.Empty);
2546

47+
/// <summary>
48+
/// Creates a new command class frame with the specified command parameters.
49+
/// </summary>
2650
public static CommandClassFrame Create(CommandClassId commandClassId, byte commandId, ReadOnlySpan<byte> commandParameters)
2751
{
2852
byte[] data = new byte[2 + commandParameters.Length];

‎src/ZWave.CommandClasses/DurationReport.cs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ public DurationReport(byte value)
1313
Value = value;
1414
}
1515

16+
/// <summary>
17+
/// Gets the raw duration byte value.
18+
/// </summary>
1619
public byte Value { get; }
1720

21+
/// <summary>
22+
/// Gets the interpreted duration, or null if unknown.
23+
/// </summary>
1824
public TimeSpan? Duration =>
1925
Value switch
2026
{

‎src/ZWave.CommandClasses/DurationSet.cs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public DurationSet(TimeSpan duration)
4444
/// </summary>
4545
public static DurationSet FactoryDefault => new DurationSet(0xff);
4646

47+
/// <summary>
48+
/// Gets the raw duration byte value.
49+
/// </summary>
4750
public byte Value { get; }
4851

4952
public static implicit operator DurationSet(byte b) => new DurationSet(b);

0 commit comments

Comments
 (0)