Skip to content

Commit 75337f1

Browse files
committed
Generate more clusters
1 parent 68a32b9 commit 75337f1

21 files changed

+4068
-2
lines changed

Generator/ClusterGenerator.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ private static void WriteCommands(Cluster cluster, TextWriter writer)
931931
writer.WriteLine(" InvokeResponseIB resp = await InteractionManager.ExecCommand(session, endPoint, cluster, " + cmd.id + ");");
932932
}
933933
}
934-
if (response == null)
934+
if (response == null || response.field == null)
935935
{
936936
if (cmd.response != "N")
937937
writer.WriteLine(" return ValidateResponse(resp);");
@@ -1128,7 +1128,8 @@ private static void WriteFeatures(clusterFeature[] features, TextWriter writer)
11281128
writer.WriteLine(" public enum Feature {");
11291129
foreach (clusterFeature item in features)
11301130
{
1131-
writer.WriteLine(" /// <summary>\n /// " + GeneratorUtil.SanitizeComment(item.summary) + "\n /// </summary>");
1131+
if (item.summary != null)
1132+
writer.WriteLine(" /// <summary>\n /// " + GeneratorUtil.SanitizeComment(item.summary) + "\n /// </summary>");
11321133
writer.WriteLine(" " + GeneratorUtil.SanitizeName(item.name) + " = " + (1 << item.bit) + ",");
11331134
}
11341135
writer.WriteLine(" }");
@@ -1422,6 +1423,8 @@ private static string SanitizeDefault(string value, string? type, string? listTy
14221423
return "TimeUtil.EPOCH";
14231424
if (type == "elapsed-s")
14241425
{
1426+
if (value == "null")
1427+
return value;
14251428
if (value.EndsWith('s'))
14261429
value = value.Substring(0, value.Length - 1);
14271430
return $"TimeSpan.FromSeconds({value})";
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
// MatterDotNet Copyright (C) 2025
2+
//
3+
// This program is free software: you can redistribute it and/or modify
4+
// it under the terms of the GNU Affero General Public License as published by
5+
// the Free Software Foundation, either version 3 of the License, or any later version.
6+
// This program is distributed in the hope that it will be useful,
7+
// but WITHOUT ANY WARRANTY, without even the implied warranty of
8+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9+
// See the GNU Affero General Public License for more details.
10+
// You should have received a copy of the GNU Affero General Public License
11+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
12+
//
13+
// WARNING: This file was auto-generated. Do not edit.
14+
15+
using MatterDotNet.Messages.InteractionModel;
16+
using MatterDotNet.Protocol.Parsers;
17+
using MatterDotNet.Protocol.Payloads;
18+
using MatterDotNet.Protocol.Sessions;
19+
using MatterDotNet.Protocol.Subprotocols;
20+
21+
namespace MatterDotNet.Clusters.Application
22+
{
23+
/// <summary>
24+
/// Account Login Cluster
25+
/// </summary>
26+
[ClusterRevision(CLUSTER_ID, 2)]
27+
public class AccountLoginCluster : ClusterBase
28+
{
29+
internal const uint CLUSTER_ID = 0x050E;
30+
31+
/// <summary>
32+
/// Account Login Cluster
33+
/// </summary>
34+
public AccountLoginCluster(ushort endPoint) : base(CLUSTER_ID, endPoint) { }
35+
/// <inheritdoc />
36+
protected AccountLoginCluster(uint cluster, ushort endPoint) : base(cluster, endPoint) { }
37+
38+
#region Payloads
39+
private record GetSetupPINPayload : TLVPayload {
40+
public required string TempAccountIdentifier { get; set; }
41+
internal override void Serialize(TLVWriter writer, long structNumber = -1) {
42+
writer.StartStructure(structNumber);
43+
writer.WriteString(0, TempAccountIdentifier, 100, 16);
44+
writer.EndContainer();
45+
}
46+
}
47+
48+
/// <summary>
49+
/// Get Setup PIN Response - Reply from server
50+
/// </summary>
51+
public struct GetSetupPINResponse() {
52+
public required string SetupPIN { get; set; }
53+
}
54+
55+
private record LoginPayload : TLVPayload {
56+
public required string TempAccountIdentifier { get; set; }
57+
public required string SetupPIN { get; set; }
58+
public ulong? Node { get; set; }
59+
internal override void Serialize(TLVWriter writer, long structNumber = -1) {
60+
writer.StartStructure(structNumber);
61+
writer.WriteString(0, TempAccountIdentifier, 100, 16);
62+
writer.WriteString(1, SetupPIN, int.MaxValue, 8);
63+
if (Node != null)
64+
writer.WriteULong(2, Node);
65+
writer.EndContainer();
66+
}
67+
}
68+
69+
private record LogoutPayload : TLVPayload {
70+
public ulong? Node { get; set; }
71+
internal override void Serialize(TLVWriter writer, long structNumber = -1) {
72+
writer.StartStructure(structNumber);
73+
if (Node != null)
74+
writer.WriteULong(0, Node);
75+
writer.EndContainer();
76+
}
77+
}
78+
#endregion Payloads
79+
80+
#region Commands
81+
/// <summary>
82+
/// Get Setup PIN
83+
/// </summary>
84+
public async Task<GetSetupPINResponse?> GetSetupPIN(SecureSession session, ushort commandTimeoutMS, string TempAccountIdentifier) {
85+
GetSetupPINPayload requestFields = new GetSetupPINPayload() {
86+
TempAccountIdentifier = TempAccountIdentifier,
87+
};
88+
InvokeResponseIB resp = await InteractionManager.ExecTimedCommand(session, endPoint, cluster, commandTimeoutMS, 0x00, requestFields);
89+
if (!ValidateResponse(resp))
90+
return null;
91+
return new GetSetupPINResponse() {
92+
SetupPIN = (string)GetField(resp, 0),
93+
};
94+
}
95+
96+
/// <summary>
97+
/// Login
98+
/// </summary>
99+
public async Task<bool> Login(SecureSession session, ushort commandTimeoutMS, string TempAccountIdentifier, string SetupPIN, ulong? Node) {
100+
LoginPayload requestFields = new LoginPayload() {
101+
TempAccountIdentifier = TempAccountIdentifier,
102+
SetupPIN = SetupPIN,
103+
Node = Node,
104+
};
105+
InvokeResponseIB resp = await InteractionManager.ExecTimedCommand(session, endPoint, cluster, commandTimeoutMS, 0x02, requestFields);
106+
return ValidateResponse(resp);
107+
}
108+
109+
/// <summary>
110+
/// Logout
111+
/// </summary>
112+
public async Task<bool> Logout(SecureSession session, ushort commandTimeoutMS, ulong? Node) {
113+
LogoutPayload requestFields = new LogoutPayload() {
114+
Node = Node,
115+
};
116+
InvokeResponseIB resp = await InteractionManager.ExecTimedCommand(session, endPoint, cluster, commandTimeoutMS, 0x03, requestFields);
117+
return ValidateResponse(resp);
118+
}
119+
#endregion Commands
120+
121+
122+
/// <inheritdoc />
123+
public override string ToString() {
124+
return "Account Login Cluster";
125+
}
126+
}
127+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// MatterDotNet Copyright (C) 2025
2+
//
3+
// This program is free software: you can redistribute it and/or modify
4+
// it under the terms of the GNU Affero General Public License as published by
5+
// the Free Software Foundation, either version 3 of the License, or any later version.
6+
// This program is distributed in the hope that it will be useful,
7+
// but WITHOUT ANY WARRANTY, without even the implied warranty of
8+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9+
// See the GNU Affero General Public License for more details.
10+
// You should have received a copy of the GNU Affero General Public License
11+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
12+
//
13+
// WARNING: This file was auto-generated. Do not edit.
14+
15+
using MatterDotNet.Protocol.Parsers;
16+
using MatterDotNet.Protocol.Payloads;
17+
using MatterDotNet.Protocol.Sessions;
18+
using System.Diagnostics.CodeAnalysis;
19+
20+
namespace MatterDotNet.Clusters.Application
21+
{
22+
/// <summary>
23+
/// Device Energy Management Mode Cluster
24+
/// </summary>
25+
[ClusterRevision(CLUSTER_ID, 1)]
26+
public class DeviceEnergyManagementModeCluster : ModeBaseCluster
27+
{
28+
internal const uint CLUSTER_ID = 0x009F;
29+
30+
/// <summary>
31+
/// Device Energy Management Mode Cluster
32+
/// </summary>
33+
public DeviceEnergyManagementModeCluster(ushort endPoint) : base(CLUSTER_ID, endPoint) { }
34+
35+
#region Records
36+
/// <summary>
37+
/// Mode Option
38+
/// </summary>
39+
public record ModeOption : TLVPayload {
40+
/// <summary>
41+
/// Mode Option
42+
/// </summary>
43+
public ModeOption() { }
44+
45+
[SetsRequiredMembers]
46+
internal ModeOption(object[] fields) {
47+
FieldReader reader = new FieldReader(fields);
48+
}
49+
internal override void Serialize(TLVWriter writer, long structNumber = -1) {
50+
writer.StartStructure(structNumber);
51+
writer.EndContainer();
52+
}
53+
}
54+
#endregion Records
55+
56+
57+
/// <inheritdoc />
58+
public override string ToString() {
59+
return "Device Energy Management Mode Cluster";
60+
}
61+
}
62+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// MatterDotNet Copyright (C) 2025
2+
//
3+
// This program is free software: you can redistribute it and/or modify
4+
// it under the terms of the GNU Affero General Public License as published by
5+
// the Free Software Foundation, either version 3 of the License, or any later version.
6+
// This program is distributed in the hope that it will be useful,
7+
// but WITHOUT ANY WARRANTY, without even the implied warranty of
8+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9+
// See the GNU Affero General Public License for more details.
10+
// You should have received a copy of the GNU Affero General Public License
11+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
12+
//
13+
// WARNING: This file was auto-generated. Do not edit.
14+
15+
using MatterDotNet.Protocol.Parsers;
16+
using MatterDotNet.Protocol.Payloads;
17+
using MatterDotNet.Protocol.Sessions;
18+
using System.Diagnostics.CodeAnalysis;
19+
20+
namespace MatterDotNet.Clusters.Application
21+
{
22+
/// <summary>
23+
/// Dishwasher Mode Cluster
24+
/// </summary>
25+
[ClusterRevision(CLUSTER_ID, 2)]
26+
public class DishwasherModeCluster : ModeBaseCluster
27+
{
28+
internal const uint CLUSTER_ID = 0x0059;
29+
30+
/// <summary>
31+
/// Dishwasher Mode Cluster
32+
/// </summary>
33+
public DishwasherModeCluster(ushort endPoint) : base(CLUSTER_ID, endPoint) { }
34+
35+
#region Records
36+
/// <summary>
37+
/// Mode Option
38+
/// </summary>
39+
public record ModeOption : TLVPayload {
40+
/// <summary>
41+
/// Mode Option
42+
/// </summary>
43+
public ModeOption() { }
44+
45+
[SetsRequiredMembers]
46+
internal ModeOption(object[] fields) {
47+
FieldReader reader = new FieldReader(fields);
48+
}
49+
internal override void Serialize(TLVWriter writer, long structNumber = -1) {
50+
writer.StartStructure(structNumber);
51+
writer.EndContainer();
52+
}
53+
}
54+
#endregion Records
55+
56+
#region Attributes
57+
#endregion Attributes
58+
59+
/// <inheritdoc />
60+
public override string ToString() {
61+
return "Dishwasher Mode Cluster";
62+
}
63+
}
64+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// MatterDotNet Copyright (C) 2025
2+
//
3+
// This program is free software: you can redistribute it and/or modify
4+
// it under the terms of the GNU Affero General Public License as published by
5+
// the Free Software Foundation, either version 3 of the License, or any later version.
6+
// This program is distributed in the hope that it will be useful,
7+
// but WITHOUT ANY WARRANTY, without even the implied warranty of
8+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9+
// See the GNU Affero General Public License for more details.
10+
// You should have received a copy of the GNU Affero General Public License
11+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
12+
//
13+
// WARNING: This file was auto-generated. Do not edit.
14+
15+
using MatterDotNet.Protocol.Parsers;
16+
using MatterDotNet.Protocol.Sessions;
17+
18+
namespace MatterDotNet.Clusters.Application
19+
{
20+
/// <summary>
21+
/// Energy EVSE Mode Cluster
22+
/// </summary>
23+
[ClusterRevision(CLUSTER_ID, 1)]
24+
public class EnergyEVSEModeCluster : ModeBaseCluster
25+
{
26+
internal const uint CLUSTER_ID = 0x009D;
27+
28+
/// <summary>
29+
/// Energy EVSE Mode Cluster
30+
/// </summary>
31+
public EnergyEVSEModeCluster(ushort endPoint) : base(CLUSTER_ID, endPoint) { }
32+
33+
34+
/// <inheritdoc />
35+
public override string ToString() {
36+
return "Energy EVSE Mode Cluster";
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)