Skip to content

Commit

Permalink
Add optionality to attributes in matter IDL (project-chip#26002)
Browse files Browse the repository at this point in the history
* Add optionality to attributes

* Update global check

* zap regen all

* Fix inverted condition

* zap regen all

* zap regen all

* Update check for global logic

* Do not filter out optional values in java for delegates and callbacks - use global callbacks

* Make eventList not optional for now

* Remove extra newline in idl zapt

---------

Co-authored-by: Andrei Litvin <andreilitvin@google.com>
  • Loading branch information
andy31415 and andreilitvin authored Apr 11, 2023
1 parent ef05822 commit 9f4cbc6
Show file tree
Hide file tree
Showing 20 changed files with 766 additions and 763 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ client cluster OnOff = 6 {
}

readonly attribute boolean onOff = 0;
readonly attribute boolean globalSceneControl = 16384;
attribute int16u onTime = 16385;
attribute int16u offWaitTime = 16386;
attribute access(write: manage) nullable OnOffStartUpOnOff startUpOnOff = 16387;
readonly attribute optional boolean globalSceneControl = 16384;
attribute optional int16u onTime = 16385;
attribute optional int16u offWaitTime = 16386;
attribute access(write: manage) optional nullable OnOffStartUpOnOff startUpOnOff = 16387;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
2 changes: 1 addition & 1 deletion examples/bridge-app/bridge-common/bridge-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ client cluster AccessControl = 31 {
}

attribute access(read: administer, write: administer) AccessControlEntryStruct acl[] = 0;
attribute access(read: administer, write: administer) AccessControlExtensionStruct extension[] = 1;
attribute access(read: administer, write: administer) optional AccessControlExtensionStruct extension[] = 1;
readonly attribute int16u subjectsPerAccessControlEntry = 2;
readonly attribute int16u targetsPerAccessControlEntry = 3;
readonly attribute int16u accessControlEntriesPerFabric = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1440,15 +1440,15 @@ client cluster OccupancySensing = 1030 {
readonly attribute OccupancyBitmap occupancy = 0;
readonly attribute OccupancySensorTypeEnum occupancySensorType = 1;
readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2;
attribute access(write: manage) int16u PIROccupiedToUnoccupiedDelay = 16;
attribute access(write: manage) int16u PIRUnoccupiedToOccupiedDelay = 17;
attribute access(write: manage) int8u PIRUnoccupiedToOccupiedThreshold = 18;
attribute access(write: manage) int16u ultrasonicOccupiedToUnoccupiedDelay = 32;
attribute access(write: manage) int16u ultrasonicUnoccupiedToOccupiedDelay = 33;
attribute access(write: manage) int8u ultrasonicUnoccupiedToOccupiedThreshold = 34;
attribute access(write: manage) int16u physicalContactOccupiedToUnoccupiedDelay = 48;
attribute access(write: manage) int16u physicalContactUnoccupiedToOccupiedDelay = 49;
attribute access(write: manage) int8u physicalContactUnoccupiedToOccupiedThreshold = 50;
attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16;
attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17;
attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18;
attribute access(write: manage) optional int16u ultrasonicOccupiedToUnoccupiedDelay = 32;
attribute access(write: manage) optional int16u ultrasonicUnoccupiedToOccupiedDelay = 33;
attribute access(write: manage) optional int8u ultrasonicUnoccupiedToOccupiedThreshold = 34;
attribute access(write: manage) optional int16u physicalContactOccupiedToUnoccupiedDelay = 48;
attribute access(write: manage) optional int16u physicalContactUnoccupiedToOccupiedDelay = 49;
attribute access(write: manage) optional int8u physicalContactUnoccupiedToOccupiedThreshold = 50;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
18 changes: 9 additions & 9 deletions examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1304,15 +1304,15 @@ client cluster OccupancySensing = 1030 {
readonly attribute OccupancyBitmap occupancy = 0;
readonly attribute OccupancySensorTypeEnum occupancySensorType = 1;
readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2;
attribute access(write: manage) int16u PIROccupiedToUnoccupiedDelay = 16;
attribute access(write: manage) int16u PIRUnoccupiedToOccupiedDelay = 17;
attribute access(write: manage) int8u PIRUnoccupiedToOccupiedThreshold = 18;
attribute access(write: manage) int16u ultrasonicOccupiedToUnoccupiedDelay = 32;
attribute access(write: manage) int16u ultrasonicUnoccupiedToOccupiedDelay = 33;
attribute access(write: manage) int8u ultrasonicUnoccupiedToOccupiedThreshold = 34;
attribute access(write: manage) int16u physicalContactOccupiedToUnoccupiedDelay = 48;
attribute access(write: manage) int16u physicalContactUnoccupiedToOccupiedDelay = 49;
attribute access(write: manage) int8u physicalContactUnoccupiedToOccupiedThreshold = 50;
attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16;
attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17;
attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18;
attribute access(write: manage) optional int16u ultrasonicOccupiedToUnoccupiedDelay = 32;
attribute access(write: manage) optional int16u ultrasonicUnoccupiedToOccupiedDelay = 33;
attribute access(write: manage) optional int8u ultrasonicUnoccupiedToOccupiedThreshold = 34;
attribute access(write: manage) optional int16u physicalContactOccupiedToUnoccupiedDelay = 48;
attribute access(write: manage) optional int16u physicalContactUnoccupiedToOccupiedDelay = 49;
attribute access(write: manage) optional int8u physicalContactUnoccupiedToOccupiedThreshold = 50;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
92 changes: 46 additions & 46 deletions examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1342,54 +1342,54 @@ client cluster Thermostat = 513 {
}

readonly attribute nullable int16s localTemperature = 0;
readonly attribute nullable int16s outdoorTemperature = 1;
readonly attribute bitmap8 occupancy = 2;
readonly attribute int16s absMinHeatSetpointLimit = 3;
readonly attribute int16s absMaxHeatSetpointLimit = 4;
readonly attribute int16s absMinCoolSetpointLimit = 5;
readonly attribute int16s absMaxCoolSetpointLimit = 6;
readonly attribute int8u PICoolingDemand = 7;
readonly attribute int8u PIHeatingDemand = 8;
attribute access(write: manage) bitmap8 HVACSystemTypeConfiguration = 9;
attribute access(write: manage) int8s localTemperatureCalibration = 16;
attribute int16s occupiedCoolingSetpoint = 17;
attribute int16s occupiedHeatingSetpoint = 18;
attribute int16s unoccupiedCoolingSetpoint = 19;
attribute int16s unoccupiedHeatingSetpoint = 20;
attribute access(write: manage) int16s minHeatSetpointLimit = 21;
attribute access(write: manage) int16s maxHeatSetpointLimit = 22;
attribute access(write: manage) int16s minCoolSetpointLimit = 23;
attribute access(write: manage) int16s maxCoolSetpointLimit = 24;
attribute access(write: manage) int8s minSetpointDeadBand = 25;
attribute access(write: manage) bitmap8 remoteSensing = 26;
readonly attribute optional nullable int16s outdoorTemperature = 1;
readonly attribute optional bitmap8 occupancy = 2;
readonly attribute optional int16s absMinHeatSetpointLimit = 3;
readonly attribute optional int16s absMaxHeatSetpointLimit = 4;
readonly attribute optional int16s absMinCoolSetpointLimit = 5;
readonly attribute optional int16s absMaxCoolSetpointLimit = 6;
readonly attribute optional int8u PICoolingDemand = 7;
readonly attribute optional int8u PIHeatingDemand = 8;
attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9;
attribute access(write: manage) optional int8s localTemperatureCalibration = 16;
attribute optional int16s occupiedCoolingSetpoint = 17;
attribute optional int16s occupiedHeatingSetpoint = 18;
attribute optional int16s unoccupiedCoolingSetpoint = 19;
attribute optional int16s unoccupiedHeatingSetpoint = 20;
attribute access(write: manage) optional int16s minHeatSetpointLimit = 21;
attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22;
attribute access(write: manage) optional int16s minCoolSetpointLimit = 23;
attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24;
attribute access(write: manage) optional int8s minSetpointDeadBand = 25;
attribute access(write: manage) optional bitmap8 remoteSensing = 26;
attribute access(write: manage) ThermostatControlSequence controlSequenceOfOperation = 27;
attribute access(write: manage) enum8 systemMode = 28;
readonly attribute enum8 thermostatRunningMode = 30;
readonly attribute enum8 startOfWeek = 32;
readonly attribute int8u numberOfWeeklyTransitions = 33;
readonly attribute int8u numberOfDailyTransitions = 34;
attribute access(write: manage) enum8 temperatureSetpointHold = 35;
attribute access(write: manage) nullable int16u temperatureSetpointHoldDuration = 36;
attribute access(write: manage) bitmap8 thermostatProgrammingOperationMode = 37;
readonly attribute bitmap16 thermostatRunningState = 41;
readonly attribute enum8 setpointChangeSource = 48;
readonly attribute nullable int16s setpointChangeAmount = 49;
readonly attribute epoch_s setpointChangeSourceTimestamp = 50;
attribute access(write: manage) nullable int8u occupiedSetback = 52;
readonly attribute nullable int8u occupiedSetbackMin = 53;
readonly attribute nullable int8u occupiedSetbackMax = 54;
attribute access(write: manage) nullable int8u unoccupiedSetback = 55;
readonly attribute nullable int8u unoccupiedSetbackMin = 56;
readonly attribute nullable int8u unoccupiedSetbackMax = 57;
attribute access(write: manage) int8u emergencyHeatDelta = 58;
attribute access(write: manage) enum8 ACType = 64;
attribute access(write: manage) int16u ACCapacity = 65;
attribute access(write: manage) enum8 ACRefrigerantType = 66;
attribute access(write: manage) enum8 ACCompressorType = 67;
attribute access(write: manage) bitmap32 ACErrorCode = 68;
attribute access(write: manage) enum8 ACLouverPosition = 69;
readonly attribute nullable int16s ACCoilTemperature = 70;
attribute access(write: manage) enum8 ACCapacityformat = 71;
readonly attribute optional enum8 thermostatRunningMode = 30;
readonly attribute optional enum8 startOfWeek = 32;
readonly attribute optional int8u numberOfWeeklyTransitions = 33;
readonly attribute optional int8u numberOfDailyTransitions = 34;
attribute access(write: manage) optional enum8 temperatureSetpointHold = 35;
attribute access(write: manage) optional nullable int16u temperatureSetpointHoldDuration = 36;
attribute access(write: manage) optional bitmap8 thermostatProgrammingOperationMode = 37;
readonly attribute optional bitmap16 thermostatRunningState = 41;
readonly attribute optional enum8 setpointChangeSource = 48;
readonly attribute optional nullable int16s setpointChangeAmount = 49;
readonly attribute optional epoch_s setpointChangeSourceTimestamp = 50;
attribute access(write: manage) optional nullable int8u occupiedSetback = 52;
readonly attribute optional nullable int8u occupiedSetbackMin = 53;
readonly attribute optional nullable int8u occupiedSetbackMax = 54;
attribute access(write: manage) optional nullable int8u unoccupiedSetback = 55;
readonly attribute optional nullable int8u unoccupiedSetbackMin = 56;
readonly attribute optional nullable int8u unoccupiedSetbackMax = 57;
attribute access(write: manage) optional int8u emergencyHeatDelta = 58;
attribute access(write: manage) optional enum8 ACType = 64;
attribute access(write: manage) optional int16u ACCapacity = 65;
attribute access(write: manage) optional enum8 ACRefrigerantType = 66;
attribute access(write: manage) optional enum8 ACCompressorType = 67;
attribute access(write: manage) optional bitmap32 ACErrorCode = 68;
attribute access(write: manage) optional enum8 ACLouverPosition = 69;
readonly attribute optional nullable int16s ACCoilTemperature = 70;
attribute access(write: manage) optional enum8 ACCapacityformat = 71;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ client cluster OnOff = 6 {
}

readonly attribute boolean onOff = 0;
readonly attribute boolean globalSceneControl = 16384;
attribute int16u onTime = 16385;
attribute int16u offWaitTime = 16386;
attribute access(write: manage) nullable OnOffStartUpOnOff startUpOnOff = 16387;
readonly attribute optional boolean globalSceneControl = 16384;
attribute optional int16u onTime = 16385;
attribute optional int16u offWaitTime = 16386;
attribute access(write: manage) optional nullable OnOffStartUpOnOff startUpOnOff = 16387;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
36 changes: 18 additions & 18 deletions examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1283,13 +1283,13 @@ client cluster FanControl = 514 {
attribute FanModeSequenceType fanModeSequence = 1;
attribute nullable int8u percentSetting = 2;
readonly attribute int8u percentCurrent = 3;
readonly attribute int8u speedMax = 4;
attribute nullable int8u speedSetting = 5;
readonly attribute int8u speedCurrent = 6;
readonly attribute bitmap8 rockSupport = 7;
attribute bitmap8 rockSetting = 8;
readonly attribute bitmap8 windSupport = 9;
attribute bitmap8 windSetting = 10;
readonly attribute optional int8u speedMax = 4;
attribute optional nullable int8u speedSetting = 5;
readonly attribute optional int8u speedCurrent = 6;
readonly attribute optional bitmap8 rockSupport = 7;
attribute optional bitmap8 rockSetting = 8;
readonly attribute optional bitmap8 windSupport = 9;
attribute optional bitmap8 windSetting = 10;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand All @@ -1315,7 +1315,7 @@ client cluster TemperatureMeasurement = 1026 {
readonly attribute nullable int16s measuredValue = 0;
readonly attribute nullable int16s minMeasuredValue = 1;
readonly attribute nullable int16s maxMeasuredValue = 2;
readonly attribute int16u tolerance = 3;
readonly attribute optional int16u tolerance = 3;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand All @@ -1329,7 +1329,7 @@ client cluster RelativeHumidityMeasurement = 1029 {
readonly attribute nullable int16u measuredValue = 0;
readonly attribute nullable int16u minMeasuredValue = 1;
readonly attribute nullable int16u maxMeasuredValue = 2;
readonly attribute int16u tolerance = 3;
readonly attribute optional int16u tolerance = 3;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down Expand Up @@ -1360,15 +1360,15 @@ client cluster OccupancySensing = 1030 {
readonly attribute OccupancyBitmap occupancy = 0;
readonly attribute OccupancySensorTypeEnum occupancySensorType = 1;
readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2;
attribute access(write: manage) int16u PIROccupiedToUnoccupiedDelay = 16;
attribute access(write: manage) int16u PIRUnoccupiedToOccupiedDelay = 17;
attribute access(write: manage) int8u PIRUnoccupiedToOccupiedThreshold = 18;
attribute access(write: manage) int16u ultrasonicOccupiedToUnoccupiedDelay = 32;
attribute access(write: manage) int16u ultrasonicUnoccupiedToOccupiedDelay = 33;
attribute access(write: manage) int8u ultrasonicUnoccupiedToOccupiedThreshold = 34;
attribute access(write: manage) int16u physicalContactOccupiedToUnoccupiedDelay = 48;
attribute access(write: manage) int16u physicalContactUnoccupiedToOccupiedDelay = 49;
attribute access(write: manage) int8u physicalContactUnoccupiedToOccupiedThreshold = 50;
attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16;
attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17;
attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18;
attribute access(write: manage) optional int16u ultrasonicOccupiedToUnoccupiedDelay = 32;
attribute access(write: manage) optional int16u ultrasonicUnoccupiedToOccupiedDelay = 33;
attribute access(write: manage) optional int8u ultrasonicUnoccupiedToOccupiedThreshold = 34;
attribute access(write: manage) optional int16u physicalContactOccupiedToUnoccupiedDelay = 48;
attribute access(write: manage) optional int16u physicalContactUnoccupiedToOccupiedDelay = 49;
attribute access(write: manage) optional int8u physicalContactUnoccupiedToOccupiedThreshold = 50;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ client cluster AccessControl = 31 {
}

attribute access(read: administer, write: administer) AccessControlEntryStruct acl[] = 0;
attribute access(read: administer, write: administer) AccessControlExtensionStruct extension[] = 1;
attribute access(read: administer, write: administer) optional AccessControlExtensionStruct extension[] = 1;
readonly attribute int16u subjectsPerAccessControlEntry = 2;
readonly attribute int16u targetsPerAccessControlEntry = 3;
readonly attribute int16u accessControlEntriesPerFabric = 4;
Expand Down
Loading

0 comments on commit 9f4cbc6

Please sign in to comment.