Documentation
¶
Overview ¶
Package schema exposes typed Go lookups for Matter cluster and device-type metadata extracted from matter.js HEAD. The primary data lives in the generated files clusters.go and devicetypes.go (maps keyed by uint32 ID); this file adds the hand-written lookup helpers that wrap the maps.
Source of truth: parity/schema.json — the same embedded snapshot every parity test in this module reads, extracted from a matter.js HEAD checkout by script/extract-from-matter-js.ts (usage block at the end of that file). Refreshing the snapshot is a deliberate, manual step: a revision bump can carry attribute, constraint and command changes that need review.
After updating the snapshot, regenerate the Go code:
go generate ./schema/...
Mirrors matter.js HEAD `packages/model/src/standard/elements/*.element.ts`.
Index ¶
- Constants
- Variables
- func AttributeChangesOmitted(clusterID, attrID uint32) bool
- func AttributeWritable(clusterID, attrID uint32) (writable, known bool)
- func AttributeWritePrivilege(clusterID, attrID uint32) uint8
- func ClusterBindable(clusterID uint32) bool
- func ClusterClassification(clusterID uint32) (string, bool)
- func ClusterFeatureNames(clusterID, featureMap uint32) []string
- func ClusterHasChangesOmittedAttribute(clusterID uint32) bool
- func ClusterName(id uint32) (string, bool)
- func ClusterRevision(id uint32) (uint16, bool)
- func ConditionScopeOf(dt *DeviceTypeDefinition) []string
- func DeviceTypeAllowsServerCluster(deviceType DeviceTypeID, clusterID uint32) (allowed, known bool)
- func DeviceTypeConditionScope(id DeviceTypeID) []string
- func DeviceTypeConditions(id DeviceTypeID) []string
- func DeviceTypeName(id DeviceTypeID) (string, bool)
- func DeviceTypeRequiresServerCluster(deviceType DeviceTypeID, clusterID uint32) bool
- func DeviceTypeRevision(id DeviceTypeID) (uint16, bool)
- func InvokePrivilege(clusterID, commandID uint32) uint8
- func IsFabricScopedInvoke(clusterID, commandID uint32) bool
- func IsTimedInvoke(clusterID, commandID uint32) bool
- type ClusterFeature
- type Composition
- type ConditionLocation
- type Conformance
- type ConformanceChoice
- type CountRange
- type DeviceTypeDefinition
- type DeviceTypeID
- type DeviceTypeRequirement
- type Referent
- type RequirementElement
Constants ¶
const ( PrivilegeOperate uint8 = 3 PrivilegeManage uint8 = 4 PrivilegeAdminister uint8 = 5 )
Invoke privileges, as matter.js's AccessLevel numbers them (View=1, ProxyView=2, Operate=3, Manage=4, Administer=5).
const SchemaSnapshotSHA256 = "3b18deb666e85dab9401a536f86946be841a99a5532f1fd52faa913fd87cb3b0"
SchemaSnapshotSHA256 is the SHA-256 hex digest of parity/schema.json at generation time. The TestMatterSchemaSnapshotHashMatchesEmbedded test recomputes the hash at test time and fails when they diverge — catching hand-edits to generated constants that did not go through the generator.
Variables ¶
var ClusterNames = map[uint32]string{}/* 135 elements not displayed */
ClusterNames maps every cluster ID to its canonical matter.js name.
var ClusterRevisions = map[uint32]uint16{}/* 135 elements not displayed */
ClusterRevisions maps every cluster ID present in the matter.js HEAD schema snapshot to its revision number. Generated from parity/schema.json.
var DeviceTypeMandatoryServerClusters = map[DeviceTypeID][]uint32{
0x000A: {
0x0003,
0x0101,
},
0x000F: {
0x0003,
0x003B,
},
0x0011: {
0x002F,
},
0x0012: {
0x002A,
},
0x0013: {
0x0039,
},
0x0014: {
0x0029,
},
0x0015: {
0x0003,
0x0045,
},
0x0016: {
0x001F,
0x0028,
0x0030,
0x0033,
0x003C,
0x003E,
0x003F,
},
0x0019: {
0x0031,
},
0x0022: {
0x0006,
0x0008,
},
0x0023: {
0x0006,
0x0506,
0x0509,
0x050A,
},
0x0024: {
0x0509,
0x050C,
0x050D,
},
0x0027: {
0x0050,
},
0x0028: {
0x0006,
0x0506,
0x0509,
},
0x002B: {
0x0003,
0x0004,
0x0202,
},
0x002C: {
0x0003,
0x005B,
},
0x002D: {
0x0003,
0x0202,
},
0x0041: {
0x0003,
0x0045,
},
0x0042: {
0x0003,
0x0081,
},
0x0043: {
0x0003,
0x0045,
},
0x0044: {
0x0003,
0x0045,
},
0x0045: {
0x0003,
0x0430,
},
0x0071: {
0x0056,
},
0x0072: {
0x0003,
0x0006,
0x0201,
},
0x0073: {
0x0060,
},
0x0074: {
0x0003,
0x0054,
0x0061,
},
0x0075: {
0x0060,
},
0x0076: {
0x0003,
0x005C,
},
0x0078: {
0x0006,
},
0x0079: {
0x005E,
0x005F,
0x0060,
},
0x007A: {
0x0202,
},
0x007C: {
0x0060,
},
0x0090: {
0x0035,
0x0451,
0x0452,
0x0453,
},
0x0091: {
0x0035,
0x0452,
},
0x0100: {
0x0003,
0x0004,
0x0006,
0x0062,
},
0x0101: {
0x0003,
0x0004,
0x0006,
0x0008,
0x0062,
},
0x0103: {
0x0003,
},
0x0104: {
0x0003,
},
0x0105: {
0x0003,
},
0x0106: {
0x0003,
0x0400,
},
0x0107: {
0x0003,
0x0406,
},
0x010A: {
0x0003,
0x0004,
0x0006,
0x0062,
},
0x010B: {
0x0003,
0x0004,
0x0006,
0x0008,
0x0062,
},
0x010C: {
0x0003,
0x0004,
0x0006,
0x0008,
0x0062,
0x0300,
},
0x010D: {
0x0003,
0x0004,
0x0006,
0x0008,
0x0062,
0x0300,
},
0x010F: {
0x0003,
0x0004,
0x0006,
0x0062,
},
0x0110: {
0x0003,
0x0004,
0x0006,
0x0008,
0x0062,
},
0x0130: {
0x0752,
0x0753,
},
0x0140: {
0x0551,
0x0553,
0x0554,
},
0x0141: {
0x0003,
0x003B,
0x0551,
0x0553,
},
0x0142: {
0x0551,
0x0553,
},
0x0145: {
0x0551,
},
0x0146: {
0x0556,
},
0x0147: {
0x0554,
},
0x0148: {
0x0003,
0x003B,
},
0x0202: {
0x0003,
0x0102,
},
0x0230: {
0x0003,
0x0104,
},
0x0231: {
0x0105,
},
0x0301: {
0x0003,
0x0201,
},
0x0302: {
0x0003,
0x0402,
},
0x0303: {
0x0003,
0x0006,
0x0200,
},
0x0304: {
0x0003,
},
0x0305: {
0x0003,
0x0403,
},
0x0306: {
0x0003,
0x0404,
},
0x0307: {
0x0003,
0x0405,
},
0x050C: {
0x0099,
0x009D,
},
0x050D: {
0x0098,
},
0x050F: {
0x0094,
0x009E,
0x0201,
},
0x0510: {
0x009C,
},
0x0511: {
0x0003,
0x0B06,
},
0x0512: {
0x0003,
},
0x0514: {
0x0090,
0x0091,
},
0x0840: {
0x0003,
},
0x0850: {
0x0003,
},
}
DeviceTypeMandatoryServerClusters maps every device-type ID to the server clusters the Matter Device Library makes unconditionally mandatory for it (conformance exactly M) — the set matter.js mounts by default for a device type (its `requirements.server.mandatory`). A cluster whose conformance carries a condition, a feature or a revision gate is absent: whether it applies is the projection's decision, not the schema's.
Generated from parity/schema.json.
var DeviceTypeNames = map[DeviceTypeID]string{
0x000A: "DoorLock",
0x000B: "DoorLockController",
0x000E: "Aggregator",
0x000F: "GenericSwitch",
0x0011: "PowerSource",
0x0012: "OtaRequestor",
0x0013: "BridgedNode",
0x0014: "OtaProvider",
0x0015: "ContactSensor",
0x0016: "RootNode",
0x0017: "SolarPower",
0x0018: "BatteryStorage",
0x0019: "SecondaryNetworkInterface",
0x0022: "Speaker",
0x0023: "CastingVideoPlayer",
0x0024: "ContentApp",
0x0027: "ModeSelect",
0x0028: "BasicVideoPlayer",
0x0029: "CastingVideoClient",
0x002A: "VideoRemoteControl",
0x002B: "Fan",
0x002C: "AirQualitySensor",
0x002D: "AirPurifier",
0x0040: "IrrigationSystem",
0x0041: "WaterFreezeDetector",
0x0042: "WaterValve",
0x0043: "WaterLeakDetector",
0x0044: "RainSensor",
0x0045: "SoilSensor",
0x0070: "Refrigerator",
0x0071: "TemperatureControlledCabinet",
0x0072: "RoomAirConditioner",
0x0073: "LaundryWasher",
0x0074: "RoboticVacuumCleaner",
0x0075: "Dishwasher",
0x0076: "SmokeCoAlarm",
0x0077: "CookSurface",
0x0078: "Cooktop",
0x0079: "MicrowaveOven",
0x007A: "ExtractorHood",
0x007B: "Oven",
0x007C: "LaundryDryer",
0x0090: "NetworkInfrastructureManager",
0x0091: "ThreadBorderRouter",
0x0100: "OnOffLight",
0x0101: "DimmableLight",
0x0103: "OnOffLightSwitch",
0x0104: "DimmerSwitch",
0x0105: "ColorDimmerSwitch",
0x0106: "LightSensor",
0x0107: "OccupancySensor",
0x010A: "OnOffPlugInUnit",
0x010B: "DimmablePlugInUnit",
0x010C: "ColorTemperatureLight",
0x010D: "ExtendedColorLight",
0x010F: "MountedOnOffControl",
0x0110: "MountedDimmableLoadControl",
0x0130: "JointFabricAdministrator",
0x0140: "Intercom",
0x0141: "AudioDoorbell",
0x0142: "Camera",
0x0143: "VideoDoorbell",
0x0144: "FloodlightCamera",
0x0145: "SnapshotCamera",
0x0146: "Chime",
0x0147: "CameraController",
0x0148: "Doorbell",
0x0202: "WindowCovering",
0x0203: "WindowCoveringController",
0x0230: "Closure",
0x0231: "ClosurePanel",
0x023E: "ClosureController",
0x0301: "Thermostat",
0x0302: "TemperatureSensor",
0x0303: "Pump",
0x0304: "PumpController",
0x0305: "PressureSensor",
0x0306: "FlowSensor",
0x0307: "HumiditySensor",
0x0309: "HeatPump",
0x030A: "ThermostatController",
0x050C: "EnergyEvse",
0x050D: "DeviceEnergyManagement",
0x050F: "WaterHeater",
0x0510: "ElectricalSensor",
0x0511: "ElectricalUtilityMeter",
0x0512: "MeterReferencePoint",
0x0513: "ElectricalEnergyTariff",
0x0514: "ElectricalMeter",
0x0840: "ControlBridge",
0x0850: "OnOffSensor",
}
DeviceTypeNames maps every device-type ID to its canonical matter.js name.
var DeviceTypeRevisions = map[DeviceTypeID]uint16{
0x000A: 4,
0x000B: 4,
0x000E: 2,
0x000F: 3,
0x0011: 1,
0x0012: 1,
0x0013: 3,
0x0014: 1,
0x0015: 2,
0x0016: 5,
0x0017: 1,
0x0018: 2,
0x0019: 1,
0x0022: 1,
0x0023: 2,
0x0024: 2,
0x0027: 1,
0x0028: 2,
0x0029: 2,
0x002A: 2,
0x002B: 5,
0x002C: 1,
0x002D: 3,
0x0040: 1,
0x0041: 2,
0x0042: 1,
0x0043: 2,
0x0044: 2,
0x0045: 1,
0x0070: 3,
0x0071: 6,
0x0072: 4,
0x0073: 2,
0x0074: 4,
0x0075: 2,
0x0076: 2,
0x0077: 2,
0x0078: 1,
0x0079: 2,
0x007A: 1,
0x007B: 2,
0x007C: 2,
0x0090: 2,
0x0091: 2,
0x0100: 4,
0x0101: 4,
0x0103: 4,
0x0104: 4,
0x0105: 4,
0x0106: 4,
0x0107: 4,
0x010A: 5,
0x010B: 6,
0x010C: 5,
0x010D: 5,
0x010F: 3,
0x0110: 3,
0x0130: 1,
0x0140: 2,
0x0141: 2,
0x0142: 1,
0x0143: 1,
0x0144: 1,
0x0145: 1,
0x0146: 2,
0x0147: 1,
0x0148: 2,
0x0202: 7,
0x0203: 5,
0x0230: 1,
0x0231: 1,
0x023E: 2,
0x0301: 7,
0x0302: 3,
0x0303: 4,
0x0304: 5,
0x0305: 3,
0x0306: 3,
0x0307: 3,
0x0309: 1,
0x030A: 2,
0x050C: 2,
0x050D: 3,
0x050F: 1,
0x0510: 1,
0x0511: 1,
0x0512: 1,
0x0513: 1,
0x0514: 1,
0x0840: 4,
0x0850: 4,
}
DeviceTypeRevisions maps every device-type ID present in the matter.js HEAD schema snapshot to its revision number. Generated from parity/schema.json.
var DeviceTypeServerClusters = map[DeviceTypeID][]uint32{
0x000A: {
0x0003,
0x001D,
0x0101,
},
0x000B: {
0x001D,
},
0x000E: {
0x0003,
0x001D,
0x0025,
0x0751,
},
0x000F: {
0x0003,
0x001D,
0x003B,
},
0x0011: {
0x001D,
0x002F,
},
0x0012: {
0x001D,
0x002A,
},
0x0013: {
0x001D,
0x002E,
0x002F,
0x0039,
0x003C,
0x0750,
},
0x0014: {
0x001D,
0x0029,
},
0x0015: {
0x0003,
0x001D,
0x0045,
0x0080,
},
0x0016: {
0x001D,
0x001F,
0x0028,
0x002B,
0x002C,
0x002D,
0x002E,
0x0030,
0x0031,
0x0032,
0x0033,
0x0034,
0x0035,
0x0036,
0x0037,
0x0038,
0x003C,
0x003E,
0x003F,
0x0046,
0x0065,
0x0801,
0x0802,
},
0x0017: {
0x0003,
0x001D,
},
0x0018: {
0x0003,
0x001D,
},
0x0019: {
0x001D,
0x0031,
0x0035,
0x0036,
0x0037,
},
0x0022: {
0x0006,
0x0008,
0x001D,
},
0x0023: {
0x0006,
0x001D,
0x0097,
0x0503,
0x0504,
0x0505,
0x0506,
0x0507,
0x0508,
0x0509,
0x050A,
0x050B,
0x050C,
0x050E,
0x050F,
},
0x0024: {
0x001D,
0x0504,
0x0505,
0x0506,
0x0509,
0x050A,
0x050C,
0x050D,
0x050E,
},
0x0027: {
0x001D,
0x0050,
},
0x0028: {
0x0006,
0x001D,
0x0097,
0x0503,
0x0504,
0x0505,
0x0506,
0x0507,
0x0508,
0x0509,
0x050B,
0x050F,
},
0x0029: {
0x001D,
0x0510,
},
0x002A: {
0x001D,
},
0x002B: {
0x0003,
0x0004,
0x0006,
0x001D,
0x0202,
},
0x002C: {
0x0003,
0x001D,
0x005B,
0x0402,
0x0405,
0x040C,
0x040D,
0x0413,
0x0415,
0x042A,
0x042B,
0x042C,
0x042D,
0x042E,
0x042F,
},
0x002D: {
0x0003,
0x0004,
0x0006,
0x001D,
0x0071,
0x0072,
0x0202,
},
0x0040: {
0x0003,
0x001D,
0x0060,
0x0404,
},
0x0041: {
0x0003,
0x001D,
0x0045,
0x0080,
},
0x0042: {
0x0003,
0x001D,
0x0081,
0x0404,
},
0x0043: {
0x0003,
0x001D,
0x0045,
0x0080,
},
0x0044: {
0x0003,
0x001D,
0x0045,
0x0080,
},
0x0045: {
0x0003,
0x001D,
0x0402,
0x0430,
},
0x0070: {
0x0003,
0x001D,
0x0052,
0x0057,
0x0072,
},
0x0071: {
0x001D,
0x0048,
0x0049,
0x0052,
0x0056,
0x0064,
0x0402,
},
0x0072: {
0x0003,
0x0004,
0x0006,
0x001D,
0x0062,
0x0071,
0x0072,
0x0201,
0x0202,
0x0204,
0x0402,
0x0405,
},
0x0073: {
0x0003,
0x0006,
0x001D,
0x0051,
0x0053,
0x0056,
0x0060,
},
0x0074: {
0x0003,
0x001D,
0x0054,
0x0055,
0x0061,
0x0150,
},
0x0075: {
0x0003,
0x0006,
0x001D,
0x0056,
0x0059,
0x005D,
0x0060,
},
0x0076: {
0x0003,
0x0004,
0x001D,
0x005C,
0x0402,
0x0405,
0x040C,
},
0x0077: {
0x0006,
0x001D,
0x0056,
0x0402,
},
0x0078: {
0x0003,
0x0006,
0x001D,
},
0x0079: {
0x0003,
0x001D,
0x005E,
0x005F,
0x0060,
0x0202,
},
0x007A: {
0x0003,
0x001D,
0x0071,
0x0072,
0x0202,
},
0x007B: {
0x0003,
0x001D,
},
0x007C: {
0x0003,
0x0006,
0x001D,
0x004A,
0x0051,
0x0056,
0x0060,
},
0x0090: {
0x001D,
0x0035,
0x0451,
0x0452,
0x0453,
},
0x0091: {
0x001D,
0x0035,
0x0452,
0x0453,
},
0x0100: {
0x0003,
0x0004,
0x0006,
0x0008,
0x001D,
0x0062,
},
0x0101: {
0x0003,
0x0004,
0x0006,
0x0008,
0x001D,
0x0062,
},
0x0103: {
0x0003,
0x001D,
},
0x0104: {
0x0003,
0x001D,
},
0x0105: {
0x0003,
0x001D,
},
0x0106: {
0x0003,
0x001D,
0x0400,
},
0x0107: {
0x0003,
0x001D,
0x0080,
0x0406,
},
0x010A: {
0x0003,
0x0004,
0x0006,
0x0008,
0x001D,
0x0062,
},
0x010B: {
0x0003,
0x0004,
0x0006,
0x0008,
0x001D,
0x0062,
},
0x010C: {
0x0003,
0x0004,
0x0006,
0x0008,
0x001D,
0x0062,
0x0300,
},
0x010D: {
0x0003,
0x0004,
0x0006,
0x0008,
0x001D,
0x0062,
0x0300,
},
0x010F: {
0x0003,
0x0004,
0x0006,
0x0008,
0x001D,
0x0062,
},
0x0110: {
0x0003,
0x0004,
0x0006,
0x0008,
0x001D,
0x0062,
},
0x0130: {
0x001D,
0x0752,
0x0753,
},
0x0140: {
0x0003,
0x001D,
0x0551,
0x0552,
0x0553,
0x0554,
},
0x0141: {
0x0003,
0x001D,
0x003B,
0x0551,
0x0553,
0x0554,
0x0555,
},
0x0142: {
0x0003,
0x001D,
0x0406,
0x0550,
0x0551,
0x0552,
0x0553,
0x0554,
0x0555,
},
0x0143: {
0x001D,
},
0x0144: {
0x001D,
},
0x0145: {
0x0003,
0x001D,
0x0406,
0x0550,
0x0551,
0x0552,
},
0x0146: {
0x0003,
0x001D,
0x0556,
},
0x0147: {
0x001D,
0x0554,
},
0x0148: {
0x0003,
0x001D,
0x003B,
},
0x0202: {
0x0003,
0x0004,
0x001D,
0x0102,
},
0x0203: {
0x0003,
0x001D,
},
0x0230: {
0x0003,
0x001D,
0x0104,
},
0x0231: {
0x001D,
0x0105,
},
0x023E: {
0x001D,
},
0x0301: {
0x0003,
0x0004,
0x001D,
0x009B,
0x0201,
0x0204,
},
0x0302: {
0x0003,
0x001D,
0x0204,
0x0402,
},
0x0303: {
0x0003,
0x0004,
0x0006,
0x0008,
0x001D,
0x0062,
0x0200,
0x0402,
0x0403,
0x0404,
},
0x0304: {
0x0003,
0x001D,
},
0x0305: {
0x0003,
0x001D,
0x0403,
},
0x0306: {
0x0003,
0x001D,
0x0404,
},
0x0307: {
0x0003,
0x001D,
0x0405,
},
0x0309: {
0x0003,
0x001D,
},
0x030A: {
0x001D,
},
0x050C: {
0x0003,
0x001D,
0x0099,
0x009D,
0x0402,
},
0x050D: {
0x001D,
0x0098,
0x009F,
},
0x050F: {
0x0003,
0x001D,
0x0094,
0x009E,
0x0201,
},
0x0510: {
0x001D,
0x0090,
0x0091,
0x009C,
},
0x0511: {
0x0003,
0x001D,
0x0B06,
},
0x0512: {
0x0003,
0x001D,
},
0x0513: {
0x001D,
0x0095,
0x00A0,
0x0700,
},
0x0514: {
0x001D,
0x0090,
0x0091,
0x0095,
0x00A0,
0x0700,
0x0B07,
},
0x0840: {
0x0003,
0x001D,
},
0x0850: {
0x0003,
0x001D,
},
}
DeviceTypeServerClusters maps every device-type ID to the cluster IDs the Matter Device Library specifies for it as a SERVER cluster, excluding those whose conformance is X (disallowed). A cluster absent from a type's set may not be mounted as a server on an endpoint of that type: the device would be non-conformant, and ecosystems reject it in ways that range from ignoring the extra cluster to mis-categorising the whole accessory. Clusters the type specifies only as a CLIENT are deliberately absent here — a client requirement means the type CONSUMES that cluster from another endpoint, not that it may serve it.
Generated from parity/schema.json.
Functions ¶
func AttributeChangesOmitted ¶ added in v0.2.0
AttributeChangesOmitted reports whether matter.js gives the attribute the "C" (changesOmitted) quality: a change to it is never reported to a subscriber, though it reads normally. Mirrors matter.js ProtocolService.addCluster, which leaves such attributes out of the changed set, and ServerBehaviorBacking, which suppresses their change broadcasts. Generated from parity/schema.json (changesOmittedAttributes).
func AttributeWritable ¶
AttributeWritable reports the matter.js writability verdict for a cluster attribute. It returns (writable=false, known=true) for an attribute the bridge-exposed schema marks read-only (access "R …"), and (writable=true, known=false) for every other (clusterID, attrID) pair — meaning "no read-only record; treat as writable and leave the outcome to the cluster server". Because the table records only read-only attributes, the writable return is authoritative only when known is true (then it is always false); callers gate on known && !writable.
Mirrors matter.js `limits.writable` (../matter.js/packages/model/src/aspects/Access.ts:44-46) as consumed by AttributeWriteResponse.ts:229 (concrete write) and :329 (wildcard write).
func AttributeWritePrivilege ¶ added in v0.2.0
AttributeWritePrivilege returns the privilege a subject needs to write the attribute: matter.js's write privilege from the access string (generated into attributeWritePrivileges), Operate when it names none higher. Mirrors AccessControl(attribute).limits.writeLevel (matter.js packages/protocol/src/action/server/AttributeWriteResponse.ts authorizes the write with it).
func ClusterBindable ¶ added in v0.2.0
ClusterBindable reports whether a Binding entry may direct a client of the cluster: false only for a cluster whose own mechanism chooses its peer (OTA Software Update Provider, WebRTC Transport Provider …). Such a client does not count for Base's Client condition.
Mirrors matter.js ClusterModel.effectiveBindable.
func ClusterClassification ¶ added in v0.2.0
ClusterClassification returns a cluster's effective classification — "application", "endpoint" (an endpoint utility) or "node" (a node utility) — or ("", false) for a cluster the snapshot does not classify.
Mirrors matter.js ClusterModel.effectiveClassification (Core § 7.10.8).
func ClusterFeatureNames ¶ added in v0.2.0
ClusterFeatureNames decodes a FeatureMap value into the codes of the features it sets, in bit order. A set bit the snapshot defines no feature for is skipped.
Mirrors matter.js ClusterModel.supportedFeatures read from a FeatureMap.
func ClusterHasChangesOmittedAttribute ¶ added in v0.4.0
ClusterHasChangesOmittedAttribute reports whether any attribute of the cluster carries the "C" quality — the set matter.js's client structure enumerates on the ClusterModel when it decides whether a read may skip a cluster's DataVersion filter (packages/node/src/node/client/ClientStructure.ts hasChangesOmittedAttribute, :1674-1692 at 0ceb202d). The model knows every snapshot cluster, so the answer does not depend on a generated definition.
func ClusterName ¶
ClusterName returns the canonical matter.js cluster name for the given id, or ("", false) if the cluster is not present in the snapshot.
func ClusterRevision ¶
ClusterRevision returns the matter.js HEAD revision for the given cluster id, or (0, false) if the cluster is not present in the snapshot.
Mirrors matter.js packages/model/src/standard/elements/<name>.element.ts ClusterRevision attribute defaults.
func ConditionScopeOf ¶ added in v0.2.0
func ConditionScopeOf(dt *DeviceTypeDefinition) []string
ConditionScopeOf is DeviceTypeConditionScope for a definition, so the Base device type (no id) answers too.
func DeviceTypeAllowsServerCluster ¶
func DeviceTypeAllowsServerCluster(deviceType DeviceTypeID, clusterID uint32) (allowed, known bool)
DeviceTypeAllowsServerCluster reports whether the Matter Device Library permits clusterID to be mounted as a SERVER cluster on an endpoint whose primary device type is deviceType, and whether deviceType is known at all.
A cluster the device type specifies only as a CLIENT requirement is NOT permitted: a client requirement means the type consumes that cluster from another endpoint. Thermostat (0x0301) is the canonical case — it names TemperatureMeasurement and RelativeHumidityMeasurement as clientCluster, so a thermostat that serves either is non-conformant even though the cluster appears in its requirement list.
Callers must distinguish the two return values: an unknown device type (known=false) means the snapshot cannot answer the question, which is not the same as a definite "no".
func DeviceTypeConditionScope ¶ added in v0.2.0
func DeviceTypeConditionScope(id DeviceTypeID) []string
DeviceTypeConditionScope returns every condition the requirements of a device type may name unqualified: its own, those of the device types it derives from, and the Base device type's — each spelled as declared, the nearest declaration winning. Nil for an unknown device type.
Mirrors matter.js RequirementResolver.conditionsOf, without its qualified ("Declarer.Condition") keys (packages/model/src/logic/ RequirementResolver.ts).
func DeviceTypeConditions ¶ added in v0.2.0
func DeviceTypeConditions(id DeviceTypeID) []string
DeviceTypeConditions returns the conditions a device type declares itself, in declaration order, or nil for an unknown device type.
func DeviceTypeName ¶
func DeviceTypeName(id DeviceTypeID) (string, bool)
DeviceTypeName returns the canonical matter.js device-type name for the given id, or ("", false) if the device type is not present in the snapshot.
func DeviceTypeRequiresServerCluster ¶ added in v0.2.0
func DeviceTypeRequiresServerCluster(deviceType DeviceTypeID, clusterID uint32) bool
DeviceTypeRequiresServerCluster reports whether the Matter Device Library makes clusterID an unconditionally mandatory server cluster of deviceType (conformance M) — a cluster matter.js mounts on every endpoint of that type by default (packages/node/src/devices/<name>.ts, `requirements.server.mandatory`). An unknown device type requires nothing.
func DeviceTypeRevision ¶
func DeviceTypeRevision(id DeviceTypeID) (uint16, bool)
DeviceTypeRevision returns the matter.js HEAD revision for the given device-type id, or (0, false) if the device type is not present in the snapshot.
This is the codegen'd counterpart of endpoint.deviceTypeRevision: callers that need to advertise a device-type revision in Descriptor.DeviceTypeList should prefer this function so updates to the matter.js snapshot propagate automatically on the next `go generate ./schema/...` run.
Mirrors matter.js packages/node/src/devices/<name>.ts revision fields.
func InvokePrivilege ¶ added in v0.2.0
InvokePrivilege returns the privilege a subject needs to invoke the command: the matter.js access level of the command, Operate when matter.js gives it none above the default. Mirrors matter.js AccessControl(command).limits.writeLevel (AccessControl.ts).
func IsFabricScopedInvoke ¶ added in v0.2.0
IsFabricScopedInvoke reports whether the (cluster, command) pair carries matter.js's fabric-scoped access quality. Mirrors matter.js Access.Fabric.Scoped on a command (AccessControl.ts:524 `fabricScoped`).
func IsTimedInvoke ¶
IsTimedInvoke reports whether the (cluster, command) pair is timed-required per the matter.js "T" access quality — it may only be invoked inside a Timed interaction. Mirrors matter.js Access.Timed.Required (CommandInvokeResponse.ts:292 `limits.timed`).
Types ¶
type ClusterFeature ¶ added in v0.2.0
ClusterFeature is one feature of a cluster: its code and its bit in the FeatureMap.
func ClusterFeatures ¶ added in v0.2.0
func ClusterFeatures(clusterID uint32) []ClusterFeature
ClusterFeatures returns a cluster's features in bit order, or nil for a cluster without features or unknown to the snapshot.
type Composition ¶ added in v0.2.0
type Composition string
Composition is how a device type composes its endpoint's PartsList: matter.js's EndpointComposition (DeviceTypeModel.effectiveComposition, Core § 9.2.7).
const ( // CompositionTree: the PartsList holds the endpoint's children. CompositionTree Composition = "tree" // CompositionFullFamily: the PartsList holds every descendant. CompositionFullFamily Composition = "full-family" )
Compositions.
type ConditionLocation ¶ added in v0.2.0
type ConditionLocation string
ConditionLocation is where a condition requirement asserts its condition: matter.js's RequirementElement.Location (Core § 9.2.6). Empty for every requirement that is not a condition requirement.
const ( // LocationRoot asserts the condition on the node endpoint. LocationRoot ConditionLocation = "Root" // LocationSelf asserts it on the endpoint of the stating device type. LocationSelf ConditionLocation = "Self" // LocationDescendant asserts it on the endpoints of the condition's // declaring device type in the stating endpoint's composition. LocationDescendant ConditionLocation = "Descendant" )
Condition locations.
type Conformance ¶ added in v0.2.0
type Conformance struct {
// Text is the expression as matter.js prints it; set on the root only.
Text string
Op string
// Name is the referenced name of a "name" node: a condition or a
// feature code.
Name string
// Value is the JSON text of a "value" node.
Value string
// Rev is the revision of a "revision" node ("Rev >= v4").
Rev int
// Choice is the parameter of a "choice" node ("O.a+").
Choice *ConformanceChoice
// Args are the operands, in matter.js's order: the terms of an
// otherwise list, [lhs, rhs] of a binary operator, the operand of "!",
// an optionalIf or a choice.
Args []Conformance
}
Conformance is a conformance expression as matter.js parses it (Conformance.Ast, packages/model/src/aspects/Conformance.ts): the same tree cluster/spec's Conformance evaluates, kept here as a plain value so package schema keeps no dependency. Op is matter.js's node type ("M", "O", "name", "&", "otherwise", …); the zero value is "no conformance stated", which matter.js evaluates as optional.
type ConformanceChoice ¶ added in v0.2.0
ConformanceChoice is the parameter of a choice node.
type CountRange ¶ added in v0.2.0
CountRange is the numeric range a requirement's constraint states — matter.js's RequirementModel.componentCountRange: the number of endpoints a component device type or a Descendant condition requirement must reach. Set is false when the constraint bounds no number.
func (CountRange) Contains ¶ added in v0.2.0
func (r CountRange) Contains(n int) bool
Contains reports whether n lies in the range (both ends inclusive).
type DeviceTypeDefinition ¶ added in v0.2.0
type DeviceTypeDefinition struct {
// ID is the device-type id; zero for the Base device type, which has
// none.
ID uint32
Name string
Classification string
Revision uint16
Composition Composition
// Base names the device type this one derives from ("OnOffLight" for
// DimmableLight); empty when it derives from none.
Base string
// Conditions are the conditions the device type declares itself.
Conditions []string
// Requirements are the device type's own requirements, in declaration
// order — matter.js judges and reports them in that order.
Requirements []DeviceTypeRequirement
}
DeviceTypeDefinition is one device type of the snapshot as matter.js's device type validation reads it (DeviceTypeModel).
func BaseDeviceTypes ¶ added in v0.2.0
func BaseDeviceTypes() []*DeviceTypeDefinition
BaseDeviceTypes returns the device types classified "base" — the Base device type, whose requirements apply to every endpoint that lists a device type and whose conditions every device type may name. Shared: callers must not modify them.
Mirrors matter.js ModelLookups.baseDeviceTypes.
func DeviceTypeDefinitionOf ¶ added in v0.2.0
func DeviceTypeDefinitionOf(id DeviceTypeID) (*DeviceTypeDefinition, bool)
DeviceTypeDefinitionOf returns the snapshot's definition of a device type, or (nil, false) when the snapshot has none. The definition is shared: callers must not modify it.
Mirrors matter.js ModelLookups.deviceTypeOf (packages/model/src/logic/ device-types/ModelLookups.ts).
type DeviceTypeID ¶ added in v0.10.0
type DeviceTypeID uint16
DeviceTypeID is a Matter device type id (DimmableLight 0x0101): the key of the device-type tables below and the type of the generated device-type constants (device.DimmableLightID, ...). The Descriptor's DeviceTypeList carries it as a 32-bit devtype-id whose upper half is zero for every standard device type.
func DeviceTypeIDOf ¶ added in v0.10.0
func DeviceTypeIDOf(devtype uint32) (DeviceTypeID, bool)
DeviceTypeIDOf returns the device type id a Descriptor's 32-bit devtype-id carries: the id and true for one whose upper half is zero (a standard device type), false for a manufacturer-specific id, which no table here holds.
type DeviceTypeRequirement ¶ added in v0.2.0
type DeviceTypeRequirement struct {
Element RequirementElement
// Name is the requirement's name as matter.js states it.
Name string
// ID is the cluster or device-type id; HasID is false for an element or
// condition requirement, which names its referent by Name.
ID uint32
HasID bool
// Type is a condition requirement's qualified condition
// ("RootNode.GroupcastListenerCond").
Type string
// Instance numbers a component requirement one of several of the same
// device type; zero when it states none.
Instance int
// Location is where a condition requirement asserts its condition.
Location ConditionLocation
Conformance Conformance
// Constraint is the requirement's constraint as matter.js prints it;
// Count is the range it states, where it states one.
Constraint string
Count CountRange
// Singleton is the "I" quality (Core § 7.7.3): only the declaring
// endpoint, or one whose device types list the cluster, may carry it.
Singleton bool
Referent Referent
// Requirements are the nested requirements, in declaration order.
Requirements []DeviceTypeRequirement
}
DeviceTypeRequirement is one requirement of a device type, as matter.js's device type validation reads it (RequirementModel): a server or client cluster with its nested feature / attribute / command / event requirements, a component device type with the cluster requirements its endpoint must meet, or a condition requirement.
func DeviceTypeClusterRequirement ¶ added in v0.2.0
func DeviceTypeClusterRequirement(deviceType DeviceTypeID, clusterID uint32, side RequirementElement) (DeviceTypeRequirement, bool)
DeviceTypeClusterRequirement returns a device type's requirement of clusterID on one side (RequirementServerCluster or RequirementClientCluster), with its nested element requirements, or (zero, false) when the device type states none.
func DeviceTypeElementRequirements ¶ added in v0.2.0
func DeviceTypeElementRequirements(deviceType DeviceTypeID, clusterID uint32) []DeviceTypeRequirement
DeviceTypeElementRequirements returns the feature, attribute, command and event requirements a device type states for its server cluster clusterID, in declaration order — what an endpoint of the type must (or must not) offer on that cluster beyond the cluster's own conformance. Nil when the device type states none.
type Referent ¶ added in v0.2.0
type Referent struct {
Resolved bool
// ID is the cluster, attribute, command, event, command-field or
// device-type id, or a feature's bit.
ID uint32
Name string
// Command names the command of a command field.
Command string
// Declarer names the device type declaring an asserted condition.
Declarer string
// Provisional marks a feature, attribute, command or event whose own
// conformance is provisional: matter.js never reports one missing.
Provisional bool
}
Referent is what a requirement resolves to in matter.js's model (RequirementResolver): the cluster, the feature, the attribute / command / event, the command field, the component device type or the asserted condition. Resolved is false when it names nothing the model defines, which matter.js leaves unjudged.
type RequirementElement ¶ added in v0.2.0
type RequirementElement string
RequirementElement is what a device-type requirement requires: matter.js's RequirementElement.ElementType values verbatim (packages/model/src/elements/RequirementElement.ts).
const ( RequirementServerCluster RequirementElement = "serverCluster" RequirementClientCluster RequirementElement = "clientCluster" RequirementFeature RequirementElement = "feature" RequirementAttribute RequirementElement = "attribute" RequirementCommand RequirementElement = "command" RequirementEvent RequirementElement = "event" RequirementCommandField RequirementElement = "commandField" RequirementDeviceType RequirementElement = "deviceType" RequirementCondition RequirementElement = "condition" )
Requirement elements.