Skip to content

Commit 2e0d14f

Browse files
committed
Add auto-generated messages and new serializer/deserializers
1 parent 0d5d3d2 commit 2e0d14f

33 files changed

+1755
-75
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// MatterDotNet Copyright (C) 2024
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 System.Diagnostics.CodeAnalysis;
18+
19+
namespace MatterDotNet.Messages
20+
{
21+
public class CommissionerDeclaration : TLVPayload
22+
{
23+
/// <inheritdoc />
24+
public CommissionerDeclaration() {}
25+
26+
/// <inheritdoc />
27+
[SetsRequiredMembers]
28+
public CommissionerDeclaration(Memory<byte> data) : this(new TLVReader(data)) {}
29+
30+
public ushort? ErrorCode { get; set; }
31+
public bool? NeedsPasscode { get; set; }
32+
public bool? NoAppsFound { get; set; }
33+
public bool? PasscodeDialogDisplayed { get; set; }
34+
public bool? CommissionerPasscode { get; set; }
35+
public bool? QRCodeDisplayed { get; set; }
36+
37+
/// <inheritdoc />
38+
[SetsRequiredMembers]
39+
public CommissionerDeclaration(TLVReader reader) {
40+
reader.StartStructure();
41+
if (reader.IsTag(1))
42+
ErrorCode = reader.GetUShort(1);
43+
if (reader.IsTag(2))
44+
NeedsPasscode = reader.GetBool(2);
45+
if (reader.IsTag(3))
46+
NoAppsFound = reader.GetBool(3);
47+
if (reader.IsTag(4))
48+
PasscodeDialogDisplayed = reader.GetBool(4);
49+
if (reader.IsTag(5))
50+
CommissionerPasscode = reader.GetBool(5);
51+
if (reader.IsTag(6))
52+
QRCodeDisplayed = reader.GetBool(6);
53+
}
54+
55+
/// <inheritdoc />
56+
public override void Serialize(TLVWriter writer) {
57+
writer.StartStructure();
58+
if (ErrorCode != null)
59+
writer.WriteUShort(1, ErrorCode);
60+
if (NeedsPasscode != null)
61+
writer.WriteBool(2, NeedsPasscode);
62+
if (NoAppsFound != null)
63+
writer.WriteBool(3, NoAppsFound);
64+
if (PasscodeDialogDisplayed != null)
65+
writer.WriteBool(4, PasscodeDialogDisplayed);
66+
if (CommissionerPasscode != null)
67+
writer.WriteBool(5, CommissionerPasscode);
68+
if (QRCodeDisplayed != null)
69+
writer.WriteBool(6, QRCodeDisplayed);
70+
writer.EndContainer();
71+
}
72+
}
73+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// MatterDotNet Copyright (C) 2024
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 System.Diagnostics.CodeAnalysis;
18+
19+
namespace MatterDotNet.Messages
20+
{
21+
public class Crypto_PBKDFParameterSet : TLVPayload
22+
{
23+
/// <inheritdoc />
24+
public Crypto_PBKDFParameterSet() {}
25+
26+
/// <inheritdoc />
27+
[SetsRequiredMembers]
28+
public Crypto_PBKDFParameterSet(Memory<byte> data) : this(new TLVReader(data)) {}
29+
30+
public required uint Iterations { get; set; }
31+
public required byte[] Salt { get; set; }
32+
33+
/// <inheritdoc />
34+
[SetsRequiredMembers]
35+
public Crypto_PBKDFParameterSet(TLVReader reader) {
36+
reader.StartStructure();
37+
Iterations = reader.GetUInt(1).Value;
38+
Salt = reader.GetBytes(2)!;
39+
}
40+
41+
/// <inheritdoc />
42+
public override void Serialize(TLVWriter writer) {
43+
writer.StartStructure();
44+
writer.WriteUInt(1, Iterations);
45+
writer.WriteBytes(2, Salt, 1);
46+
writer.EndContainer();
47+
}
48+
}
49+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// MatterDotNet Copyright (C) 2024
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+
using MatterDotNet.Protocol.Payloads;
14+
using System.Buffers.Binary;
15+
16+
namespace MatterDotNet.Messages
17+
{
18+
public class MessageCounterSyncRequest : IPayload
19+
{
20+
ulong Challenge { get; set; }
21+
22+
public MessageCounterSyncRequest(Memory<byte> payload)
23+
{
24+
Challenge = BinaryPrimitives.ReadUInt64LittleEndian(payload.Span);
25+
}
26+
public bool Serialize(PayloadWriter stream)
27+
{
28+
stream.Write(Challenge);
29+
return true;
30+
}
31+
}
32+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// MatterDotNet Copyright (C) 2024
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+
using MatterDotNet.Protocol.Payloads;
14+
using System.Buffers.Binary;
15+
16+
namespace MatterDotNet.Messages
17+
{
18+
public class MessageCounterSyncResponse : IPayload
19+
{
20+
uint SynchronizedCounter { get; set; }
21+
ulong Response { get; set; }
22+
23+
public MessageCounterSyncResponse(Memory<byte> payload)
24+
{
25+
SynchronizedCounter = BinaryPrimitives.ReadUInt32LittleEndian(payload.Span);
26+
Response = BinaryPrimitives.ReadUInt64LittleEndian(payload.Span.Slice(4, 8));
27+
}
28+
public bool Serialize(PayloadWriter stream)
29+
{
30+
stream.Write(SynchronizedCounter);
31+
stream.Write(Response);
32+
return true;
33+
}
34+
}
35+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// MatterDotNet Copyright (C) 2024
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 System.Diagnostics.CodeAnalysis;
18+
19+
namespace MatterDotNet.Messages
20+
{
21+
public class PBKDFParamReq : TLVPayload
22+
{
23+
/// <inheritdoc />
24+
public PBKDFParamReq() {}
25+
26+
/// <inheritdoc />
27+
[SetsRequiredMembers]
28+
public PBKDFParamReq(Memory<byte> data) : this(new TLVReader(data)) {}
29+
30+
public required byte[] InitiatorRandom { get; set; }
31+
public required ushort InitiatorSessionId { get; set; }
32+
public required ushort PasscodeId { get; set; }
33+
public required bool HasPBKDFParameters { get; set; }
34+
public SessionParameter? InitiatorSessionParams { get; set; }
35+
36+
/// <inheritdoc />
37+
[SetsRequiredMembers]
38+
public PBKDFParamReq(TLVReader reader) {
39+
reader.StartStructure();
40+
InitiatorRandom = reader.GetBytes(1)!;
41+
InitiatorSessionId = reader.GetUShort(2).Value;
42+
PasscodeId = reader.GetUShort(3).Value;
43+
HasPBKDFParameters = reader.GetBool(4).Value;
44+
if (reader.IsTag(5))
45+
InitiatorSessionParams = new SessionParameter(reader);
46+
}
47+
48+
/// <inheritdoc />
49+
public override void Serialize(TLVWriter writer) {
50+
writer.StartStructure();
51+
writer.WriteBytes(1, InitiatorRandom, 0);
52+
writer.WriteUShort(2, InitiatorSessionId);
53+
writer.WriteUShort(3, PasscodeId);
54+
writer.WriteBool(4, HasPBKDFParameters);
55+
if (InitiatorSessionParams != null)
56+
InitiatorSessionParams.Serialize(writer);
57+
writer.EndContainer();
58+
}
59+
}
60+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// MatterDotNet Copyright (C) 2024
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 System.Diagnostics.CodeAnalysis;
18+
19+
namespace MatterDotNet.Messages
20+
{
21+
public class PBKDFParamResp : TLVPayload
22+
{
23+
/// <inheritdoc />
24+
public PBKDFParamResp() {}
25+
26+
/// <inheritdoc />
27+
[SetsRequiredMembers]
28+
public PBKDFParamResp(Memory<byte> data) : this(new TLVReader(data)) {}
29+
30+
public required byte[] InitiatorRandom { get; set; }
31+
public required byte[] ResponderRandom { get; set; }
32+
public required ushort ResponderSessionId { get; set; }
33+
public required Crypto_PBKDFParameterSet Pbkdf_parameters { get; set; }
34+
public SessionParameter? ResponderSessionParams { get; set; }
35+
36+
/// <inheritdoc />
37+
[SetsRequiredMembers]
38+
public PBKDFParamResp(TLVReader reader) {
39+
reader.StartStructure();
40+
InitiatorRandom = reader.GetBytes(1)!;
41+
ResponderRandom = reader.GetBytes(2)!;
42+
ResponderSessionId = reader.GetUShort(3).Value;
43+
Pbkdf_parameters = new Crypto_PBKDFParameterSet(reader);
44+
if (reader.IsTag(5))
45+
ResponderSessionParams = new SessionParameter(reader);
46+
}
47+
48+
/// <inheritdoc />
49+
public override void Serialize(TLVWriter writer) {
50+
writer.StartStructure();
51+
writer.WriteBytes(1, InitiatorRandom, 0);
52+
writer.WriteBytes(2, ResponderRandom, 0);
53+
writer.WriteUShort(3, ResponderSessionId);
54+
Pbkdf_parameters.Serialize(writer);
55+
if (ResponderSessionParams != null)
56+
ResponderSessionParams.Serialize(writer);
57+
writer.EndContainer();
58+
}
59+
}
60+
}

MatterDotNet/Messages/Pake1.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// MatterDotNet Copyright (C) 2024
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 System.Diagnostics.CodeAnalysis;
18+
19+
namespace MatterDotNet.Messages
20+
{
21+
public class Pake1 : TLVPayload
22+
{
23+
/// <inheritdoc />
24+
public Pake1() {}
25+
26+
/// <inheritdoc />
27+
[SetsRequiredMembers]
28+
public Pake1(Memory<byte> data) : this(new TLVReader(data)) {}
29+
30+
public required byte[] PA { get; set; }
31+
32+
/// <inheritdoc />
33+
[SetsRequiredMembers]
34+
public Pake1(TLVReader reader) {
35+
reader.StartStructure();
36+
PA = reader.GetBytes(1)!;
37+
}
38+
39+
/// <inheritdoc />
40+
public override void Serialize(TLVWriter writer) {
41+
writer.StartStructure();
42+
writer.WriteBytes(1, PA, 1);
43+
writer.EndContainer();
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)