├── .gitattributes
├── .github
└── workflows
│ └── dotnet.yml
├── .gitignore
├── ExampleConsole
├── ExampleConsole.csproj
└── Program.cs
├── Examples.md
├── Generator
├── ClassGenerator.cs
├── ClusterGenerator.cs
├── Clusters
│ ├── Binding-Cluster.xml
│ ├── Descriptor-Cluster.xml
│ ├── access-control-cluster.xml
│ ├── access-control-definitions.xml
│ ├── account-login-cluster.xml
│ ├── actions-cluster.xml
│ ├── administrator-commissioning-cluster.xml
│ ├── air-quality-cluster.xml
│ ├── application-basic-cluster.xml
│ ├── application-launcher-cluster.xml
│ ├── audio-output-cluster.xml
│ ├── ballast-configuration-cluster.xml
│ ├── basic-information-cluster.xml
│ ├── boolean-state-cluster.xml
│ ├── boolean-state-configuration-cluster.xml
│ ├── bridged-device-basic-information.xml
│ ├── channel-cluster.xml
│ ├── chime-cluster.xml
│ ├── chip-ota.xml
│ ├── chip-types.xml
│ ├── clusters-extensions.xml
│ ├── color-control-cluster.xml
│ ├── commissioner-control-cluster.xml
│ ├── concentration-measurement-cluster.xml
│ ├── content-app-observer-cluster.xml
│ ├── content-control-cluster.xml
│ ├── content-launch-cluster.xml
│ ├── device-energy-management-cluster.xml
│ ├── device-energy-management-mode-cluster.xml
│ ├── diagnostic-logs-cluster.xml
│ ├── dishwasher-alarm-cluster.xml
│ ├── dishwasher-mode-cluster.xml
│ ├── door-lock-cluster.xml
│ ├── drlc-cluster.xml
│ ├── ecosystem-information-cluster.xml
│ ├── electrical-energy-measurement-cluster.xml
│ ├── electrical-power-measurement-cluster.xml
│ ├── energy-evse-cluster.xml
│ ├── energy-evse-mode-cluster.xml
│ ├── energy-preference-cluster.xml
│ ├── ethernet-network-diagnostics-cluster.xml
│ ├── fan-control-cluster.xml
│ ├── fault-injection-cluster.xml
│ ├── fixed-label-cluster.xml
│ ├── flow-measurement-cluster.xml
│ ├── general-commissioning-cluster.xml
│ ├── general-diagnostics-cluster.xml
│ ├── global-attributes.xml
│ ├── global-bitmaps.xml
│ ├── global-enums.xml
│ ├── global-structs.xml
│ ├── group-key-mgmt-cluster.xml
│ ├── groups-cluster.xml
│ ├── icd-management-cluster.xml
│ ├── identify-cluster.xml
│ ├── illuminance-measurement-cluster.xml
│ ├── keypad-input-cluster.xml
│ ├── laundry-dryer-controls-cluster.xml
│ ├── laundry-washer-mode-cluster.xml
│ ├── level-control-cluster.xml
│ ├── localization-configuration-cluster.xml
│ ├── low-power-cluster.xml
│ ├── measurement-and-sensing.xml
│ ├── media-input-cluster.xml
│ ├── media-playback-cluster.xml
│ ├── messages-cluster.xml
│ ├── microwave-oven-control-cluster.xml
│ ├── microwave-oven-mode-cluster.xml
│ ├── mode-base-cluster.xml
│ ├── mode-select-cluster.xml
│ ├── network-commissioning-cluster.xml
│ ├── occupancy-sensing-cluster.xml
│ ├── onoff-cluster.xml
│ ├── operational-credentials-cluster.xml
│ ├── operational-state-cluster.xml
│ ├── operational-state-oven-cluster.xml
│ ├── operational-state-rvc-cluster.xml
│ ├── oven-mode-cluster.xml
│ ├── power-source-cluster.xml
│ ├── power-source-configuration-cluster.xml
│ ├── power-topology-cluster.xml
│ ├── pressure-measurement-cluster.xml
│ ├── proxy-configuration-cluster.xml
│ ├── proxy-discovery-cluster.xml
│ ├── proxy-valid-cluster.xml
│ ├── pump-configuration-and-control-cluster.xml
│ ├── pwm-cluster.xml
│ ├── refrigerator-alarm.xml
│ ├── refrigerator-and-temperature-controlled-cabinet-mode-cluster.xml
│ ├── relative-humidity-measurement-cluster.xml
│ ├── resource-monitoring-cluster.xml
│ ├── rvc-clean-mode-cluster.xml
│ ├── rvc-run-mode-cluster.xml
│ ├── sample-mei-cluster.xml
│ ├── scene.xml
│ ├── semantic-tag-namespace-enums.xml
│ ├── service-area-cluster.xml
│ ├── smoke-co-alarm-cluster.xml
│ ├── software-diagnostics-cluster.xml
│ ├── switch-cluster.xml
│ ├── target-navigator-cluster.xml
│ ├── temperature-control-cluster.xml
│ ├── temperature-measurement-cluster.xml
│ ├── test-cluster.xml
│ ├── thermostat-cluster.xml
│ ├── thermostat-user-interface-configuration-cluster.xml
│ ├── thread-border-router-management-cluster.xml
│ ├── thread-network-diagnostics-cluster.xml
│ ├── thread-network-directory-cluster.xml
│ ├── time-format-localization-cluster.xml
│ ├── time-synchronization-cluster.xml
│ ├── timer-cluster.xml
│ ├── unit-localization-cluster.xml
│ ├── user-label-cluster.xml
│ ├── valve-configuration-and-control-cluster.xml
│ ├── wake-on-lan-cluster.xml
│ ├── washer-controls-cluster.xml
│ ├── water-heater-management-cluster.xml
│ ├── water-heater-mode-cluster.xml
│ ├── webrtc-provider-cluster.xml
│ ├── wifi-network-diagnostics-cluster.xml
│ ├── wifi-network-management-cluster.xml
│ └── window-covering.xml
├── CommentGenerator.cs
├── Comments
│ └── comments.xml
├── DataType.cs
├── DeviceTypeGenerator.cs
├── DeviceTypes
│ └── matter-devices.xml
├── Generator.cs
├── Generator.csproj
├── GeneratorUtil.cs
├── Schema
│ ├── Cluster.cs
│ ├── ClusterConfig.cs
│ ├── Comment.cs
│ └── DeviceType.cs
├── StructParser.cs
├── Structures
│ ├── CASE.txt
│ ├── CertificationDeclaration.txt
│ ├── IM.txt
│ ├── PASE.txt
│ └── UC.txt
└── Tag.cs
├── LICENSE.txt
├── MatterDotNet.sln
├── MatterDotNet
├── Attributes
│ ├── AllAttribute.cs
│ ├── IReportAttribute.cs
│ ├── IWriteAttribute.cs
│ ├── ReadAttribute.cs
│ ├── ReadWriteAttribute.cs
│ └── ReportAttribute.cs
├── Clusters
│ ├── Appliances
│ │ ├── DishwasherAlarmCluster.cs
│ │ ├── LaundryDryerControlsCluster.cs
│ │ ├── LaundryWasherControlsCluster.cs
│ │ ├── MicrowaveOvenControlCluster.cs
│ │ ├── OvenCavityOperationalStateCluster.cs
│ │ ├── RefrigeratorAlarmCluster.cs
│ │ └── TemperatureControlCluster.cs
│ ├── CHIP
│ │ ├── BasicInformationCluster.cs
│ │ ├── BridgedDeviceBasicInformationCluster.cs
│ │ ├── DiagnosticLogsCluster.cs
│ │ ├── NetworkCommissioningCluster.cs
│ │ ├── OTASoftwareUpdateProviderCluster.cs
│ │ ├── OTASoftwareUpdateRequestorCluster.cs
│ │ ├── PowerSourceCluster.cs
│ │ ├── PowerSourceConfigurationCluster.cs
│ │ ├── SwitchCluster.cs
│ │ └── UnitLocalizationCluster.cs
│ ├── Closures
│ │ ├── DoorLockCluster.cs
│ │ └── WindowCoveringCluster.cs
│ ├── ClusterBase.cs
│ ├── ClusterRevision.cs
│ ├── EnergyManagement
│ │ ├── DemandResponseLoadControlCluster.cs
│ │ ├── DeviceEnergyManagementCluster.cs
│ │ ├── EnergyEVSECluster.cs
│ │ ├── EnergyPreferenceCluster.cs
│ │ └── WaterHeaterManagementCluster.cs
│ ├── General
│ │ ├── AccessControlCluster.cs
│ │ ├── ActionsCluster.cs
│ │ ├── AdministratorCommissioningCluster.cs
│ │ ├── BindingCluster.cs
│ │ ├── BooleanStateCluster.cs
│ │ ├── BooleanStateConfigurationCluster.cs
│ │ ├── CommissionerControlCluster.cs
│ │ ├── DescriptorCluster.cs
│ │ ├── DeviceEnergyManagementModeCluster.cs
│ │ ├── DishwasherModeCluster.cs
│ │ ├── EcosystemInformationCluster.cs
│ │ ├── EnergyEVSEModeCluster.cs
│ │ ├── EthernetNetworkDiagnosticsCluster.cs
│ │ ├── FixedLabelCluster.cs
│ │ ├── GeneralCommissioningCluster.cs
│ │ ├── GeneralDiagnosticsCluster.cs
│ │ ├── GroupKeyManagementCluster.cs
│ │ ├── GroupsCluster.cs
│ │ ├── ICDManagementCluster.cs
│ │ ├── IdentifyCluster.cs
│ │ ├── LaundryWasherModeCluster.cs
│ │ ├── LevelControlCluster.cs
│ │ ├── LocalizationConfigurationCluster.cs
│ │ ├── LowPowerCluster.cs
│ │ ├── MessagesCluster.cs
│ │ ├── MicrowaveOvenModeCluster.cs
│ │ ├── ModeSelectCluster.cs
│ │ ├── On-OffCluster.cs
│ │ ├── OperationalCredentialsCluster.cs
│ │ ├── OperationalStateCluster.cs
│ │ ├── OvenModeCluster.cs
│ │ ├── ProxyConfigurationCluster.cs
│ │ ├── ProxyDiscoveryCluster.cs
│ │ ├── ProxyValidCluster.cs
│ │ ├── PulseWidthModulationCluster.cs
│ │ ├── RefrigeratorAndTemperatureControlledCabinetModeCluster.cs
│ │ ├── ScenesManagementCluster.cs
│ │ ├── ServiceAreaCluster.cs
│ │ ├── SoftwareDiagnosticsCluster.cs
│ │ ├── ThreadNetworkDiagnosticsCluster.cs
│ │ ├── TimeFormatLocalizationCluster.cs
│ │ ├── TimeSynchronizationCluster.cs
│ │ ├── TimerCluster.cs
│ │ ├── UserLabelCluster.cs
│ │ ├── WakeonLANCluster.cs
│ │ ├── WaterHeaterModeCluster.cs
│ │ └── Wi-FiNetworkDiagnosticsCluster.cs
│ ├── GlobalEnums.cs
│ ├── GlobalStructs.cs
│ ├── HVAC
│ │ ├── FanControlCluster.cs
│ │ ├── PumpConfigurationandControlCluster.cs
│ │ ├── ThermostatCluster.cs
│ │ ├── ThermostatUserInterfaceConfigurationCluster.cs
│ │ └── ValveConfigurationandControlCluster.cs
│ ├── Lighting
│ │ ├── BallastConfigurationCluster.cs
│ │ └── ColorControlCluster.cs
│ ├── MeasurementAndSensing.cs
│ ├── MeasurementAndSensing
│ │ ├── ActivatedCarbonFilterMonitoringCluster.cs
│ │ ├── AirQualityCluster.cs
│ │ ├── CarbonDioxideConcentrationMeasurementCluster.cs
│ │ ├── CarbonMonoxideConcentrationMeasurementCluster.cs
│ │ ├── ElectricalEnergyMeasurementCluster.cs
│ │ ├── ElectricalPowerMeasurementCluster.cs
│ │ ├── FlowMeasurementCluster.cs
│ │ ├── FormaldehydeConcentrationMeasurementCluster.cs
│ │ ├── HEPAFilterMonitoringCluster.cs
│ │ ├── IlluminanceMeasurementCluster.cs
│ │ ├── NitrogenDioxideConcentrationMeasurementCluster.cs
│ │ ├── OccupancySensingCluster.cs
│ │ ├── OzoneConcentrationMeasurementCluster.cs
│ │ ├── PM10ConcentrationMeasurementCluster.cs
│ │ ├── PM1ConcentrationMeasurementCluster.cs
│ │ ├── PM2.5ConcentrationMeasurementCluster.cs
│ │ ├── PowerTopologyCluster.cs
│ │ ├── PressureMeasurementCluster.cs
│ │ ├── RadonConcentrationMeasurementCluster.cs
│ │ ├── RelativeHumidityMeasurementCluster.cs
│ │ ├── SmokeCOAlarmCluster.cs
│ │ ├── TemperatureMeasurementCluster.cs
│ │ └── TotalVolatileOrganicCompoundsConcentrationMeasurementCluster.cs
│ ├── Media
│ │ ├── AccountLoginCluster.cs
│ │ ├── ApplicationBasicCluster.cs
│ │ ├── ApplicationLauncherCluster.cs
│ │ ├── AudioOutputCluster.cs
│ │ ├── ChannelCluster.cs
│ │ ├── ContentAppObserverCluster.cs
│ │ ├── ContentControlCluster.cs
│ │ ├── ContentLauncherCluster.cs
│ │ ├── KeypadInputCluster.cs
│ │ ├── MediaInputCluster.cs
│ │ ├── MediaPlaybackCluster.cs
│ │ └── TargetNavigatorCluster.cs
│ ├── Misc
│ │ ├── ChimeCluster.cs
│ │ └── WebRTCTransportProviderCluster.cs
│ ├── ModeBaseCluster.cs
│ ├── NetworkInfrastructure
│ │ ├── ThreadBorderRouterManagementCluster.cs
│ │ ├── ThreadNetworkDirectoryCluster.cs
│ │ └── Wi-FiNetworkManagementCluster.cs
│ ├── Robots
│ │ ├── RVCCleanModeCluster.cs
│ │ ├── RVCOperationalStateCluster.cs
│ │ └── RVCRunModeCluster.cs
│ ├── SemanticTagNamespaceEnums.cs
│ └── UnknownCluster.cs
├── Constants.cs
├── DCL
│ ├── Certificates.cs
│ └── DCLClient.cs
├── DeviceType.cs
├── Entities
│ ├── CommissioningState.cs
│ ├── Controller.cs
│ ├── EndPoint.cs
│ └── Node.cs
├── MatterDotNet.csproj
├── Messages
│ ├── CASE
│ │ ├── Sigma1.cs
│ │ ├── Sigma2.cs
│ │ ├── Sigma2Resume.cs
│ │ ├── Sigma2Tbedata.cs
│ │ ├── Sigma2Tbsdata.cs
│ │ ├── Sigma3.cs
│ │ ├── Sigma3Tbedata.cs
│ │ └── Sigma3Tbsdata.cs
│ ├── Certificates
│ │ ├── AttestationElements.cs
│ │ ├── BasicConstraints.cs
│ │ ├── CertificationElements.cs
│ │ ├── DnAttribute.cs
│ │ ├── Extension.cs
│ │ ├── MatterCertificate.cs
│ │ └── NocsrElements.cs
│ ├── InteractionModel
│ │ ├── AttributeDataIB.cs
│ │ ├── AttributePathIB.cs
│ │ ├── AttributeReportIB.cs
│ │ ├── AttributeStatusIB.cs
│ │ ├── ClusterPathIB.cs
│ │ ├── CommandDataIB.cs
│ │ ├── CommandPathIB.cs
│ │ ├── CommandStatusIB.cs
│ │ ├── DataVersionFilterIB.cs
│ │ ├── EventDataIB.cs
│ │ ├── EventFilterIB.cs
│ │ ├── EventPathIB.cs
│ │ ├── EventReportIB.cs
│ │ ├── EventStatusIB.cs
│ │ ├── InvokeRequestMessage.cs
│ │ ├── InvokeResponseIB.cs
│ │ ├── InvokeResponseMessage.cs
│ │ ├── ReadRequestMessage.cs
│ │ ├── ReportDataMessage.cs
│ │ ├── StatusIB.cs
│ │ ├── StatusResponseMessage.cs
│ │ ├── SubscribeRequestMessage.cs
│ │ ├── SubscribeResponseMessage.cs
│ │ ├── TimedRequestMessage.cs
│ │ ├── WriteRequestMessage.cs
│ │ └── WriteResponseMessage.cs
│ ├── MCSP
│ │ ├── MessageCounterSyncRequest.cs
│ │ └── MessageCounterSyncResponse.cs
│ ├── PASE
│ │ ├── Crypto_PBKDFParameterSet.cs
│ │ ├── PBKDFParamReq.cs
│ │ ├── PBKDFParamResp.cs
│ │ ├── Pake1.cs
│ │ ├── Pake2.cs
│ │ ├── Pake3.cs
│ │ └── SessionParameter.cs
│ └── UserDirectedCommissioning
│ │ ├── CommissionerDeclaration.cs
│ │ └── IdentificationDeclaration.cs
├── OperationalDiscovery
│ ├── BTDiscoveryService.cs
│ ├── CommissioningMode.cs
│ ├── CommissioningPayload.cs
│ ├── FabricInterface.cs
│ ├── IPDiscoveryService.cs
│ ├── ODNode.cs
│ └── SupportedTransportMode.cs
├── PKI
│ ├── CASEAuthenticatedTag.cs
│ ├── Fabric.cs
│ ├── OperationalCertificate.cs
│ └── VerificationLevel.cs
├── Protocol
│ ├── Connection
│ │ ├── BLEEndPoint.cs
│ │ ├── BTPConnection.cs
│ │ ├── IConnection.cs
│ │ ├── MRPConnection.cs
│ │ ├── Retransmission.cs
│ │ └── TCPConnection.cs
│ ├── Cryptography
│ │ ├── AesCtr.cs
│ │ ├── BigIntegerPoint.cs
│ │ ├── CTR_DRBG.cs
│ │ ├── Crypto.cs
│ │ ├── SPAKE2Plus.cs
│ │ └── SecP256.cs
│ ├── Payloads
│ │ ├── BTPFrame.cs
│ │ ├── Flags
│ │ │ ├── BTPFlags.cs
│ │ │ ├── ExchangeFlags.cs
│ │ │ ├── MessageFlags.cs
│ │ │ └── SecurityFlags.cs
│ │ ├── Frame.cs
│ │ ├── IPayload.cs
│ │ ├── OpCodes
│ │ │ ├── BDXOpCodes.cs
│ │ │ ├── BTPManagementOpcode.cs
│ │ │ ├── IMOpCodes.cs
│ │ │ ├── SecureOpCodes.cs
│ │ │ └── UDCOpCodes.cs
│ │ ├── PayloadWriter.cs
│ │ ├── ProtocolType.cs
│ │ ├── Status
│ │ │ ├── BDXStatusCodes.cs
│ │ │ ├── GeneralCode.cs
│ │ │ ├── IMStatusCode.cs
│ │ │ └── SecureStatusCodes.cs
│ │ ├── StatusPayload.cs
│ │ ├── TLVPayload.cs
│ │ └── Version1Payload.cs
│ ├── Sessions
│ │ ├── Exchange.cs
│ │ ├── MessageState.cs
│ │ ├── SecureSession.cs
│ │ ├── SessionContext.cs
│ │ └── SessionManager.cs
│ ├── Subprotocols
│ │ ├── CASE.cs
│ │ ├── InteractionManager.cs
│ │ └── PASE.cs
│ └── TLV
│ │ ├── ElementType.cs
│ │ ├── FieldReader.cs
│ │ ├── TLVControl.cs
│ │ ├── TLVReader.cs
│ │ └── TLVWriter.cs
├── Util
│ ├── BigIntUtil.cs
│ ├── Checksum.cs
│ ├── SpanUtil.cs
│ ├── StringUtil.cs
│ └── TimeUtil.cs
└── logo.png
├── README.md
└── Test
├── ECTests.cs
├── MatterCertTests.cs
├── PayloadParsingTests.cs
├── SpakeTests.cs
└── Test.csproj
/.github/workflows/dotnet.yml:
--------------------------------------------------------------------------------
1 | # This workflow will build a .NET project
2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3 |
4 | name: Build
5 |
6 | on:
7 | push:
8 | branches: [ "master" ]
9 | pull_request:
10 | branches: [ "master" ]
11 |
12 | jobs:
13 | build:
14 |
15 | runs-on: ubuntu-latest
16 |
17 | steps:
18 | - uses: actions/checkout@v4
19 | - name: Setup .NET
20 | uses: actions/setup-dotnet@v4
21 | with:
22 | dotnet-version: 9.0.x
23 | - name: Restore dependencies
24 | run: dotnet restore
25 | - name: Build
26 | run: dotnet build --no-restore
27 | - name: Test
28 | run: dotnet test --no-build --verbosity normal
29 |
--------------------------------------------------------------------------------
/ExampleConsole/ExampleConsole.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0-windows10.0.19041.0; net8.0
6 | true
7 | enable
8 | enable
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/ExampleConsole/Program.cs:
--------------------------------------------------------------------------------
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 .
12 |
13 | using MatterDotNet.Entities;
14 | using MatterDotNet.OperationalDiscovery;
15 |
16 | namespace ExampleConsole
17 | {
18 | internal class Program
19 | {
20 | static async Task Main(string[] args)
21 | {
22 | Console.WriteLine("Scanning for Devices....");
23 | ODNode[] discovered = await BTDiscoveryService.ScanAll();
24 | Console.Clear();
25 | Console.WriteLine("Devices Discovered: ");
26 | foreach (ODNode node in discovered)
27 | Console.WriteLine(node.ToString());
28 | Console.ReadLine();
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Generator/Clusters/Binding-Cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | General
30 | Binding
31 | 0x001e
32 | BINDING_CLUSTER
33 | The Binding Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for supporting the binding table.
34 |
35 | Binding
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Generator/Clusters/Descriptor-Cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | General
37 | Descriptor
38 | 0x001d
39 | DESCRIPTOR_CLUSTER
40 | The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters.
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | DeviceTypeList
49 | ServerList
50 | ClientList
51 | PartsList
52 | TagList
53 |
54 |
55 |
--------------------------------------------------------------------------------
/Generator/Clusters/access-control-definitions.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Generator/Clusters/air-quality-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | Air Quality
21 | Measurement & Sensing
22 | Attributes for reporting air quality classification
23 | 0x005B
24 | AIR_QUALITY_CLUSTER
25 | true
26 | true
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | AirQuality
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/Generator/Clusters/boolean-state-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 | Boolean State
22 | General
23 | This cluster provides an interface to a boolean state called StateValue.
24 | 0x0045
25 | BOOLEAN_STATE_CLUSTER
26 | true
27 | true
28 |
29 | StateValue
30 |
31 |
32 | This event SHALL be generated when the StateValue attribute changes.
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Generator/Clusters/chime-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | Chime
34 | 0x0556
35 | CHIME_CLUSTER
36 | This cluster provides facilities to configure and play Chime sounds, such as those used in a doorbell.
37 | true
38 | true
39 |
40 | InstalledChimeSounds
41 | ActiveChimeID
42 | Enabled
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/Generator/Clusters/clusters-extensions.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Generator/Clusters/fault-injection-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | CHIP
29 | Fault Injection
30 | 0xFFF1FC06
31 | FAULT_INJECTION_CLUSTER
32 | The Fault Injection Cluster provide a means for a test harness to configure faults(for example triggering a fault in the system).
33 |
34 | Configure a fault to be triggered deterministically
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | Configure a fault to be triggered randomly, with a given probability defined as a percentage
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/Generator/Clusters/fixed-label-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | General
29 | Fixed Label
30 | 0x0040
31 | FIXED_LABEL_CLUSTER
32 | The Fixed Label Cluster provides a feature for the device to tag an endpoint with zero or more read only
33 | labels.
34 | LabelList
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Generator/Clusters/flow-measurement-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | Flow Measurement
21 | Measurement & Sensing
22 | Attributes and commands for configuring the measurement of flow, and reporting flow measurements.
23 | 0x0404
24 | FLOW_MEASUREMENT_CLUSTER
25 | true
26 | true
27 | MeasuredValue
28 | MinMeasuredValue
29 | MaxMeasuredValue
30 | Tolerance
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Generator/Clusters/global-attributes.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 | ClusterRevision
20 | FeatureMap
21 | AttributeList
22 | EventList
23 | AcceptedCommandList
24 | GeneratedCommandList
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Generator/Clusters/global-bitmaps.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
23 |
24 |
25 |
26 |
27 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Generator/Clusters/global-enums.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Generator/Clusters/global-structs.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Generator/Clusters/illuminance-measurement-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 | Illuminance Measurement
22 | Measurement & Sensing
23 | Attributes and commands for configuring the measurement of illuminance, and reporting illuminance measurements.
24 | 0x0400
25 | ILLUMINANCE_MEASUREMENT_CLUSTER
26 | true
27 | true
28 |
29 | MeasuredValue
30 | MinMeasuredValue
31 | MaxMeasuredValue
32 | Tolerance
33 | LightSensorType
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Generator/Clusters/laundry-dryer-controls-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | Appliances
31 | Laundry Dryer Controls
32 | 0x004A
33 | LAUNDRY_DRYER_CONTROLS_CLUSTER
34 | true
35 | true
36 | This cluster provides a way to access options associated with the operation of
37 | a laundry dryer device type.
38 |
39 |
40 |
41 | SupportedDrynessLevels
42 | SelectedDrynessLevel
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Generator/Clusters/localization-configuration-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | General
21 | Localization Configuration
22 | 0x002b
23 | LOCALIZATION_CONFIGURATION_CLUSTER
24 | true
25 | true
26 | Nodes should be expected to be deployed to any and all regions of the world. These global regions
27 | may have differing common languages, units of measurements, and numerical formatting
28 | standards. As such, Nodes that visually or audibly convey information need a mechanism by which
29 | they can be configured to use a user’s preferred language, units, etc
30 |
31 |
32 | ActiveLocale
33 |
34 |
35 | SupportedLocales
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Generator/Clusters/low-power-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | General
21 | Low Power
22 | 0x0508
23 | LOW_POWER_CLUSTER
24 | true
25 | true
26 | This cluster provides an interface for managing low power mode on a device.
27 |
28 | This command shall put the device into low power mode.
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Generator/Clusters/power-source-configuration-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 | Power Source Configuration
22 | CHIP
23 | This cluster is used to describe the configuration and capabilities of a Device's power system.
24 | 0x002E
25 | POWER_SOURCE_CONFIGURATION_CLUSTER
26 | true
27 | true
28 |
29 | Sources
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Generator/Clusters/power-topology-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 | Measurement & Sensing
22 | Power Topology
23 | 0x009C
24 | POWER_TOPOLOGY_CLUSTER
25 | The Power Topology Cluster provides a mechanism for expressing how power is flowing between endpoints.
26 | true
27 | true
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | AvailableEndpoints
48 | ActiveEndpoints
49 |
50 |
51 |
--------------------------------------------------------------------------------
/Generator/Clusters/proxy-configuration-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 | General
22 | Proxy Configuration
23 | 0x0042
24 | PROXY_CONFIGURATION_CLUSTER
25 | Cluster to control Proxy Configuration
26 |
27 |
--------------------------------------------------------------------------------
/Generator/Clusters/proxy-discovery-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 | General
22 | Proxy Discovery
23 | 0x0043
24 | PROXY_DISCOVERY_CLUSTER
25 | Cluster to control Proxy Discovery
26 |
27 |
--------------------------------------------------------------------------------
/Generator/Clusters/proxy-valid-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 | General
22 | Proxy Valid
23 | 0x0044
24 | PROXY_VALID_CLUSTER
25 | Cluster to control Proxy Valid
26 |
27 |
--------------------------------------------------------------------------------
/Generator/Clusters/pwm-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 | General
23 | Pulse Width Modulation
24 | 0x001c
25 | PWM_CLUSTER
26 | Cluster to control pulse width modulation
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Generator/Clusters/refrigerator-alarm.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Refrigerator Alarm
25 | Appliances
26 | Attributes and commands for configuring the Refrigerator alarm.
27 | 0x0057
28 | REFRIGERATOR_ALARM_CLUSTER
29 | true
30 | true
31 |
32 | Mask
33 | State
34 | Supported
35 |
36 |
37 | Notify
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Generator/Clusters/relative-humidity-measurement-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | Relative Humidity Measurement
21 | Measurement & Sensing
22 | Attributes and commands for configuring the measurement of relative humidity, and reporting relative humidity measurements.
23 | 0x0405
24 | RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER
25 | true
26 | true
27 |
28 | MeasuredValue
29 | MinMeasuredValue
30 | MaxMeasuredValue
31 | Tolerance
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Generator/Clusters/sample-mei-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 | General
22 | Sample MEI
23 |
27 | 0xFFF1FC20
28 | SAMPLE_MEI_CLUSTER
29 | The Sample MEI cluster showcases a cluster manufacturer extensions
30 |
31 |
32 |
33 | FlipFlop
34 |
35 |
36 |
37 |
38 | Response for AddArguments that returns the sum.
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | Command that takes two uint8 arguments and returns their sum.
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | Simple command without any parameters and without a response.
55 |
56 |
57 |
58 |
59 |
60 | Example events generated by Ping command
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/Generator/Clusters/temperature-measurement-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | Temperature Measurement
21 | Measurement & Sensing
22 | Attributes and commands for configuring the measurement of temperature, and reporting temperature measurements.
23 | 0x0402
24 | TEMPERATURE_MEASUREMENT_CLUSTER
25 | true
26 | true
27 | MeasuredValue
28 | MinMeasuredValue
29 | MaxMeasuredValue
30 | Tolerance
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Generator/Clusters/unit-localization-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | CHIP
27 | Unit Localization
28 | 0x002d
29 | UNIT_LOCALIZATION_CLUSTER
30 | true
31 | true
32 | Nodes should be expected to be deployed to any and all regions of the world. These global regions
33 | may have differing preferences for the units in which values are conveyed in communication to a
34 | user. As such, Nodes that visually or audibly convey measurable values to the user need a
35 | mechanism by which they can be configured to use a user’s preferred unit.
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | TemperatureUnit
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/Generator/Clusters/user-label-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 | General
22 | User Label
23 | 0x0041
24 | USER_LABEL_CLUSTER
25 | The User Label Cluster provides a feature to tag an endpoint with zero or more labels.
26 |
27 | LabelList
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Generator/Clusters/wake-on-lan-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | General
21 | Wake on LAN
22 | 0x0503
23 | WAKE_ON_LAN_CLUSTER
24 | true
25 | true
26 | This cluster provides an interface for managing low power mode on a device that supports the Wake On LAN protocol.
27 |
28 |
29 |
30 |
31 | MACAddress
32 | LinkLocalAddress
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Generator/Clusters/wifi-network-management-cluster.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 | Network Infrastructure
22 | Wi-Fi Network Management
23 | 0x0451
24 | WIFI_NETWORK_MANAGEMENT_CLUSTER
25 | Functionality to retrieve operational information about a managed Wi-Fi network.
26 |
27 | true
28 | true
29 |
30 |
31 |
32 |
33 | SSID
34 |
35 | PassphraseSurrogate
36 |
37 |
38 |
39 |
40 | Request the current WPA-Personal passphrase or PSK associated with the managed Wi-Fi network.
41 |
42 |
43 |
44 | This is the response to a NetworkPassphraseRequest.
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/Generator/DataType.cs:
--------------------------------------------------------------------------------
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 .
12 |
13 | namespace Generator
14 | {
15 | public enum DataType
16 | {
17 | Any,
18 | Array,
19 | Boolean,
20 | Bytes,
21 | Choice,
22 | Enum,
23 | FloatingPoint,
24 | Integer,
25 | List,
26 | Null,
27 | Reference,
28 | String,
29 | Structure,
30 | UnsignedInteger,
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Generator/Generator.cs:
--------------------------------------------------------------------------------
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 .
12 |
13 | namespace Generator
14 | {
15 | internal class Generator
16 | {
17 | static void Main(string[] args)
18 | {
19 | Directory.CreateDirectory("outputs");
20 | CommentGenerator.Generate();
21 | ClusterGenerator.Generate();
22 | DeviceTypeGenerator.Generate();
23 | foreach (string file in Directory.EnumerateFiles("..\\..\\..\\Structures"))
24 | {
25 | Tag[] structs;
26 | using (FileStream fs = File.OpenRead(file))
27 | structs = StructParser.ParseStruct(fs);
28 | if (structs.Length == 0)
29 | Console.WriteLine("Failed to parse structure");
30 | else
31 | Console.WriteLine("Read Structure Successfully: \n******************************************************\n" + string.Join('\n', (object[])structs) + "\n*************************************");
32 | foreach (Tag tag in structs)
33 | {
34 | if (tag.Namespace != null && !Directory.Exists($"outputs\\{tag.Namespace}\\"))
35 | Directory.CreateDirectory($"outputs\\{tag.Namespace}\\");
36 |
37 | string path = $"outputs\\{((tag.Namespace != null) ? tag.Namespace + "\\" : "")}" + tag.Name + ".cs";
38 | if (File.Exists(path))
39 | File.Delete(path);
40 | using (FileStream outstream = File.OpenWrite(path))
41 | {
42 | if (ClassGenerator.Emit(outstream, tag))
43 | Console.WriteLine(tag.Name + " Written Successfully!");
44 | else
45 | Console.WriteLine("Write Failed");
46 | }
47 | }
48 | }
49 | }
50 |
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Generator/Generator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 | enable
7 | enable
8 | 0.1.0
9 | jdomnitz
10 | SmartHomeOS and Contributors
11 | AGPL-3.0-or-later
12 | MatterDotNet Code Generator
13 | A C# implementation of the Matter 1.3 Standard (Formally known as project chip)
14 | Copyright MatterDotNet Contributors
15 | README.md
16 | https://github.com/SmartHomeOS/MatterDotNet/
17 | matter; matter-controller; smarthome; project-chip; dotnet;
18 | Library is not yet functional. See README for details.
19 | logo.png
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Generator/Structures/CASE.txt:
--------------------------------------------------------------------------------
1 | namespace CASE
2 | {
3 | sigma-1-struct => STRUCTURE [ tag-order ]
4 | {
5 | initiatorRandom [1] : OCTET STRING [ length 32 ],
6 | initiatorSessionId [2] : UNSIGNED INTEGER [ range 16-bits ],
7 | destinationId [3] : destination-identifier,
8 | initiatorEphPubKey [4] : ec-pub-key,
9 | initiatorSessionParams [5, optional] : session-parameter-struct,
10 | resumptionId [6, optional] : OCTET STRING [ length 16 ],
11 | initiatorResumeMIC [7, optional] : OCTET STRING [ length CRYPTO_AEAD_MIC_LENGTH_BYTES ]
12 | }
13 |
14 | sigma-2-tbsdata => STRUCTURE [ tag-order ]
15 | {
16 | responderNOC [1] : OCTET STRING,
17 | responderICAC [2, optional] : OCTET STRING,
18 | responderEphPubKey [3] : ec-pub-key,
19 | initiatorEphPubKey [4] : ec-pub-key,
20 | }
21 |
22 | sigma-2-tbedata => STRUCTURE [ tag-order ]
23 | {
24 | responderNOC [1] : OCTET STRING,
25 | responderICAC [2, optional] : OCTET STRING,
26 | signature [3] : ec-signature,
27 | resumptionId [4] : OCTET STRING [ length 16 ],
28 | }
29 |
30 | sigma-2-struct => STRUCTURE [ tag-order ]
31 | {
32 | responderRandom [1] : OCTET STRING [ length 32 ],
33 | responderSessionId [2] : UNSIGNED INTEGER [ range 16-bits ],
34 | responderEphPubKey [3] : ec-pub-key,
35 | encrypted2 [4] : OCTET STRING,
36 | responderSessionParams [5, optional] : session-parameter-struct
37 | }
38 |
39 | sigma-3-tbsdata => STRUCTURE [ tag-order ]
40 | {
41 | initiatorNOC [1] : OCTET STRING,
42 | initiatorICAC [2, optional] : OCTET STRING,
43 | initiatorEphPubKey [3] : ec-pub-key,
44 | responderEphPubKey [4] : ec-pub-key,
45 | }
46 |
47 | sigma-3-tbedata => STRUCTURE [ tag-order ]
48 | {
49 | initiatorNOC [1] : OCTET STRING,
50 | initiatorICAC [2, optional] : OCTET STRING,
51 | signature [3] : ec-signature,
52 | }
53 |
54 | sigma-3-struct => STRUCTURE [ tag-order ]
55 | {
56 | encrypted3 [1] : OCTET STRING,
57 | }
58 |
59 | sigma-2-resume-struct => STRUCTURE [ tag-order ]
60 | {
61 | resumptionId [1] : OCTET STRING [ length 16 ],
62 | sigma2ResumeMIC [2] : OCTET STRING [ length 16 ],
63 | responderSessionId [3] : UNSIGNED INTEGER [ range 16-bits ],
64 | responderSessionParams [4, optional] : session-parameter-struct
65 | }
66 | }
--------------------------------------------------------------------------------
/Generator/Structures/PASE.txt:
--------------------------------------------------------------------------------
1 | namespace PASE
2 | {
3 | Crypto_PBKDFParameterSet => STRUCTURE [ tag-order ]
4 | {
5 | iterations [1] : UNSIGNED INTEGER [ range 32-bits ],
6 | salt [2] : OCTET STRING [ length 16..32 ],
7 | }
8 | // This struct was modified to add optional to 4-7. Very poor documentation.
9 | session-parameter-struct => STRUCTURE [ tag-order ]
10 | {
11 | SessionIdleInterval [1, optional] : UNSIGNED INTEGER [ range 32-bits ],
12 | SessionActiveInterval [2, optional] : UNSIGNED INTEGER [ range 32-bits ],
13 | SessionActiveThreshold [3, optional] : UNSIGNED INTEGER [ range 16-bits ],
14 | DataModelRevision [4, optional]] : UNSIGNED INTEGER [ range 16-bits ],
15 | InteractionModelRevision [5, optional]] : UNSIGNED INTEGER [ range 16-bits ],
16 | SpecificationVersion [6, optional]] : UNSIGNED INTEGER [ range 32-bits ],
17 | MaxPathsPerInvoke [7, optional]] : UNSIGNED INTEGER [ range 16-bits ],
18 | }
19 |
20 | PBKDFParamReq-struct => STRUCTURE [ tag-order ]
21 | {
22 | initiatorRandom [1] : OCTET STRING [ length 32 ],
23 | initiatorSessionId [2] : UNSIGNED INTEGER [ range 16-bits ],
24 | passcodeId [3] : UNSIGNED INTEGER [ length 16-bits ],
25 | hasPBKDFParameters [4] : BOOLEAN,
26 | initiatorSessionParams [5, optional] : session-parameter-struct
27 | }
28 |
29 | // Tag 4 is not marked optional in the spec, but it's description indicates it is optional
30 | PBKDFParamResp-struct => STRUCTURE [ tag-order ]
31 | {
32 | initiatorRandom [1] : OCTET STRING [ length 32 ],
33 | responderRandom [2] : OCTET STRING [ length 32 ],
34 | responderSessionId [3] : UNSIGNED INTEGER [ range 16-bits ],
35 | pbkdf_parameters [4, optional] : Crypto_PBKDFParameterSet,
36 | responderSessionParams [5, optional] : session-parameter-struct
37 | }
38 |
39 | pake-1-struct => STRUCTURE [ tag-order ]
40 | {
41 | pA [1] : OCTET STRING [ length CRYPTO_PUBLIC_KEY_SIZE_BYTES ],
42 | }
43 |
44 | pake-2-struct => STRUCTURE [ tag-order ]
45 | {
46 | pB [1] : OCTET STRING [ length CRYPTO_PUBLIC_KEY_SIZE_BYTES ],
47 | cB [2] : OCTET STRING [ length CRYPTO_HASH_LEN_BYTES],
48 | }
49 |
50 | pake-3-struct => STRUCTURE [ tag-order ]
51 | {
52 | cA [1] : OCTET STRING [length CRYPTO_HASH_LEN_BYTES],
53 | }
54 | }
--------------------------------------------------------------------------------
/Generator/Structures/UC.txt:
--------------------------------------------------------------------------------
1 | namespace UserDirectedCommissioning
2 | {
3 | IdentificationDeclaration-struct => STRUCTURE [ tag-order ]
4 | {
5 | VendorId [1, optional] : UNSIGNED INTEGER [ range 16-bits ],
6 | ProductId [2, optional] : UNSIGNED INTEGER [ range 16-bits ],
7 | DeviceName [3, optional] : STRING [ length 0..32 ],
8 | DeviceType [4, optional] : UNSIGNED INTEGER [ range 32-bits ],
9 | PairingInstruction [5, optional] : STRING [ length 0..32 ],
10 | PairingHint [6, optional] : UNSIGNED INTEGER [ range 32-bits ],
11 | RotatingDeviceId [7, optional] : STRING [ length 0..100 ].
12 | Port [8, optional] : UNSIGNED INTEGER [ range 16-bits ],
13 | TargetAppList [9, optional] : ARRAY OF
14 | {
15 | TargetApp [10, optional] : STRUCTURE [ tag-order ]
16 | {
17 | AppVendorId [11, optional] : UNSIGNED INTEGER [ range 16-bits ],
18 | AppProductId [12, optional] : UNSIGNED INTEGER [ range 16-bits ],
19 | },
20 | },
21 | NoPasscode [13, optional] : BOOLEAN,
22 | CdUponPasscodeDialog [14, optional] : BOOLEAN,
23 | CommissionerPasscode [15, optional] : BOOLEAN,
24 | CommissionerPasscodeReady [16, optional] : BOOLEAN,
25 | CancelPasscode [17, optional] : BOOLEAN
26 | }
27 |
28 | CommissionerDeclaration-struct => STRUCTURE [ tag-order ]
29 | {
30 | ErrorCode [1, optional] : UNSIGNED INTEGER [ range 16-bits ],
31 | NeedsPasscode [2, optional] : BOOLEAN,
32 | NoAppsFound [3, optional] : BOOLEAN,
33 | PasscodeDialogDisplayed [4, optional] : BOOLEAN,
34 | CommissionerPasscode [5, optional] : BOOLEAN,
35 | QRCodeDisplayed [6, optional] : BOOLEAN
36 | }
37 | }
--------------------------------------------------------------------------------
/Generator/Tag.cs:
--------------------------------------------------------------------------------
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 .
12 |
13 | using System.Text;
14 |
15 | namespace Generator
16 | {
17 | public class Tag
18 | {
19 | public Tag()
20 | {
21 | Children = new List();
22 | }
23 |
24 | public DataType Type { get; set; }
25 | public string? Name { get; set; }
26 | public int LengthBytes { get; set; }
27 | public long Min { get; set; }
28 | public long Max { get; set; }
29 | public bool Nullable { get; set; }
30 | public bool Optional { get; set; }
31 | public List Children { get; set; }
32 | public Tag? Parent { get; set; }
33 | public int TagNumber { get; set; }
34 | public string? ReferenceName { get; set; }
35 | public string? Namespace { get; set; }
36 |
37 | public override string ToString()
38 | {
39 | StringBuilder sb = new StringBuilder();
40 | if (Type == DataType.Reference)
41 | sb.AppendLine(ReferenceName + " " + Name + ":");
42 | sb.AppendLine(Type + " " + Name);
43 | foreach (Tag child in Children)
44 | sb.Append(getPrefix() + child.ToString());
45 | return sb.ToString();
46 | }
47 |
48 | private string getPrefix()
49 | {
50 | string prefix = string.Empty;
51 | Tag tag = this;
52 | while (tag.Parent != null)
53 | {
54 | prefix += '\t';
55 | tag = tag.Parent;
56 | }
57 | return prefix;
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/MatterDotNet.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.12.35506.116
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatterDotNet", "MatterDotNet\MatterDotNet.csproj", "{EA1A2183-F755-48C1-A431-29C280D5D493}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExampleConsole", "ExampleConsole\ExampleConsole.csproj", "{FB0B84C4-A10C-4911-9D79-36134B311B07}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{DDE2325B-62EF-460A-8A4B-6ED3311AEFAF}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator", "Generator\Generator.csproj", "{014FD19C-98D5-4CB0-8FE0-332CA37C1BA1}"
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Release|Any CPU = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {EA1A2183-F755-48C1-A431-29C280D5D493}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {EA1A2183-F755-48C1-A431-29C280D5D493}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {EA1A2183-F755-48C1-A431-29C280D5D493}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {EA1A2183-F755-48C1-A431-29C280D5D493}.Release|Any CPU.Build.0 = Release|Any CPU
24 | {FB0B84C4-A10C-4911-9D79-36134B311B07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25 | {FB0B84C4-A10C-4911-9D79-36134B311B07}.Debug|Any CPU.Build.0 = Debug|Any CPU
26 | {FB0B84C4-A10C-4911-9D79-36134B311B07}.Release|Any CPU.ActiveCfg = Release|Any CPU
27 | {FB0B84C4-A10C-4911-9D79-36134B311B07}.Release|Any CPU.Build.0 = Release|Any CPU
28 | {DDE2325B-62EF-460A-8A4B-6ED3311AEFAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29 | {DDE2325B-62EF-460A-8A4B-6ED3311AEFAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
30 | {DDE2325B-62EF-460A-8A4B-6ED3311AEFAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
31 | {DDE2325B-62EF-460A-8A4B-6ED3311AEFAF}.Release|Any CPU.Build.0 = Release|Any CPU
32 | {014FD19C-98D5-4CB0-8FE0-332CA37C1BA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33 | {014FD19C-98D5-4CB0-8FE0-332CA37C1BA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
34 | {014FD19C-98D5-4CB0-8FE0-332CA37C1BA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
35 | {014FD19C-98D5-4CB0-8FE0-332CA37C1BA1}.Release|Any CPU.Build.0 = Release|Any CPU
36 | EndGlobalSection
37 | GlobalSection(SolutionProperties) = preSolution
38 | HideSolutionNode = FALSE
39 | EndGlobalSection
40 | EndGlobal
41 |
--------------------------------------------------------------------------------
/MatterDotNet/Attributes/AllAttribute.cs:
--------------------------------------------------------------------------------
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 .
12 |
13 | using MatterDotNet.Protocol.Sessions;
14 | using MatterDotNet.Protocol.Subprotocols;
15 | using System.Data;
16 |
17 | namespace MatterDotNet.Attributes
18 | {
19 | public class AllAttribute : ReportAttribute, IWriteAttribute
20 | {
21 | internal AllAttribute(uint clusterId, ushort endPoint, ushort attributeId, bool nullable = false) : base(clusterId, endPoint, attributeId, nullable) { }
22 |
23 | ///
24 | /// Set the attribute to the provided value
25 | ///
26 | ///
27 | ///
28 | ///
29 | ///
30 | ///
31 | public async Task Set(SecureSession session, T value, CancellationToken token = default)
32 | {
33 | if (!nullable && value == null)
34 | throw new ConstraintException("Attribute " + AttributeId + " was null");
35 | Value = value;
36 | await InteractionManager.SetAttribute(session, EndPoint, ClusterId, AttributeId, Value, token);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/MatterDotNet/Attributes/IReportAttribute.cs:
--------------------------------------------------------------------------------
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 .
12 |
13 | namespace MatterDotNet.Attributes
14 | {
15 | public interface IReportAttribute
16 | {
17 | internal void Notify(object? data);
18 | ushort EndPoint { get; }
19 | uint ClusterId { get; }
20 | ushort AttributeId { get; }
21 | }
22 | }
--------------------------------------------------------------------------------
/MatterDotNet/Attributes/IWriteAttribute.cs:
--------------------------------------------------------------------------------
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 .
12 |
13 | using MatterDotNet.Protocol.Sessions;
14 |
15 | namespace MatterDotNet.Attributes
16 | {
17 | public interface IWriteAttribute
18 | {
19 | Task Set(SecureSession session, T value, CancellationToken token = default);
20 | }
21 | }
--------------------------------------------------------------------------------
/MatterDotNet/Attributes/ReadWriteAttribute.cs:
--------------------------------------------------------------------------------
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 .
12 |
13 | using MatterDotNet.Protocol.Sessions;
14 | using MatterDotNet.Protocol.Subprotocols;
15 | using System.Data;
16 |
17 | namespace MatterDotNet.Attributes
18 | {
19 | ///
20 | /// Create a Readable and Writable Attribute
21 | ///
22 | ///
23 | public class ReadWriteAttribute : ReadAttribute, IWriteAttribute
24 | {
25 | internal ReadWriteAttribute(uint clusterId, ushort endPoint, ushort attributeId, bool nullable = false) : base(clusterId, endPoint, attributeId, nullable) { }
26 |
27 | ///
28 | /// Set the attribute to the provided value
29 | ///
30 | ///
31 | ///
32 | ///
33 | ///
34 | ///
35 | public async Task Set(SecureSession session, T value, CancellationToken token = default)
36 | {
37 | if (!nullable && value == null)
38 | throw new ConstraintException("Attribute " + AttributeId + " was null");
39 | Value = value;
40 | await InteractionManager.SetAttribute(session, EndPoint, ClusterId, AttributeId, Value, token);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/MatterDotNet/Clusters/CHIP/PowerSourceConfigurationCluster.cs:
--------------------------------------------------------------------------------
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 .
12 | //
13 | // WARNING: This file was auto-generated. Do not edit.
14 |
15 | using MatterDotNet.Attributes;
16 | using MatterDotNet.Protocol.Parsers;
17 | using MatterDotNet.Protocol.Sessions;
18 | using System.Diagnostics.CodeAnalysis;
19 |
20 | namespace MatterDotNet.Clusters.CHIP
21 | {
22 | ///
23 | /// This cluster is used to describe the configuration and capabilities of a Device's power system.
24 | ///
25 | [ClusterRevision(CLUSTER_ID, 1)]
26 | public class PowerSourceConfiguration : ClusterBase
27 | {
28 | internal const uint CLUSTER_ID = 0x002E;
29 |
30 | ///
31 | /// This cluster is used to describe the configuration and capabilities of a Device's power system.
32 | ///
33 | [SetsRequiredMembers]
34 | public PowerSourceConfiguration(ushort endPoint) : this(CLUSTER_ID, endPoint) { }
35 | ///
36 | [SetsRequiredMembers]
37 | protected PowerSourceConfiguration(uint cluster, ushort endPoint) : base(cluster, endPoint) {
38 | Sources = new ReadAttribute(cluster, endPoint, 0) {
39 | Deserialize = x => {
40 | FieldReader reader = new FieldReader((IList