Skip to content

Commit d19eee5

Browse files
Fix Darwin to handle renames of Color Control data types.
project-chip#33612 made the following changes to the Color Control cluster: 1) Renamed HueDirection to DirectionEnum 2) Renamed the ShortestDistance and LongestDistance values of DirectionEnum to Shortest and Longest, respectively. 3) Renamed HueMoveMode to MoveModeEnum. 4) Renamed HueStepMode to StepModeEnum. 5) Removed SaturationMoveMode in favor of MoveModeEnum. 6) Removed SaturationStepMode in favor of StepModeEnum. 7) Renamed ColorMode to ColorModeEnum. 8) Renamed the ColorTemperature value to ColorTemperatureMireds 8) Renamed ColorCapabilities to ColorCapabilitiesBitmap. 9) Renamed various fields of ColorCapabilitiesBitmap. 10) Renamed ColorLoopUpdateFlags to UpdateFlagsBitmap. 11) Renamed ColorLoopAction to ColorLoopActionEnum. 12) Added OptionsBitmap, EnhancedColorModeEnum, DriftCompensationEnum. 13) Renamed ColorLoopDirection to ColorLoopDirectionEnum. 14) Renamed the DecrementHue and IncrementHue values of ColorLoopDirectionEnum to Decrement and Increment, respectively. This change adds the right renamed/introduced/deprecated annotations for the above changes, and adds manual shims for the enums that got removed.
1 parent 6f22db0 commit d19eee5

File tree

3 files changed

+296
-53
lines changed

3 files changed

+296
-53
lines changed

src/darwin/Framework/CHIP/MTRBackwardsCompatShims.h

+29
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,33 @@ typedef NS_ENUM(uint8_t, MTROTASoftwareUpdateRequestorOTAUpdateState) {
159159
= 0x08,
160160
} MTR_DEPRECATED("Please use MTROTASoftwareUpdateRequestorUpdateState", ios(16.4, 17.2), macos(13.3, 14.2), watchos(9.4, 10.2), tvos(16.4, 17.2));
161161

162+
/**
163+
* ColorControl used to have HueMoveMode/SaturationMoveMode and HueStepMode/SaturationStepMode that had
164+
* identical values. Those got replaced with MoveModeEnum and StepModeEnum respectively. We codegen
165+
* HueMoveMode and HueStepMode as aliases of MoveModeEnum and StepModeEnum, but we need manual shims for
166+
* SaturationMoveMode and SaturationStepMode.
167+
*/
168+
typedef NS_ENUM(uint8_t, MTRColorControlSaturationMoveMode) {
169+
MTRColorControlSaturationMoveModeStop MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
170+
MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeStop")
171+
= 0x00,
172+
MTRColorControlSaturationMoveModeUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
173+
MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeUp")
174+
= 0x01,
175+
MTRColorControlSaturationMoveModeDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
176+
MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeDown")
177+
= 0x03,
178+
} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
179+
MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveMode");
180+
181+
typedef NS_ENUM(uint8_t, MTRColorControlSaturationStepMode) {
182+
MTRColorControlSaturationStepModeUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
183+
MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepModeUp")
184+
= 0x01,
185+
MTRColorControlSaturationStepModeDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
186+
MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepModeDown")
187+
= 0x03,
188+
} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
189+
MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepMode");
190+
162191
NS_ASSUME_NONNULL_END

src/darwin/Framework/CHIP/templates/availability.yaml

+137-6
Original file line numberDiff line numberDiff line change
@@ -3237,9 +3237,15 @@
32373237
- FanModeSequenceType
32383238
- FanModeType
32393239
ColorControl:
3240-
- ColorLoopAction
3241-
- ColorLoopDirection
3242-
- ColorMode
3240+
# ColorLoopActionEnum, ColorLoopDirectionEnum and ColorModeEnum
3241+
# were originally named ColorLoopAction, ColorLoopDirection, and
3242+
# ColorMode, but we generate the same API for the names
3243+
# with/without "Enum" at the end and the cluster name
3244+
# present/absent at the beginning, so the names can just change
3245+
# here.
3246+
- ColorLoopActionEnum
3247+
- ColorLoopDirectionEnum
3248+
- ColorModeEnum
32433249
- HueDirection
32443250
- HueMoveMode
32453251
- HueStepMode
@@ -3980,14 +3986,20 @@
39803986
- Auto
39813987
- Smart
39823988
ColorControl:
3983-
ColorLoopAction:
3989+
# ColorLoopActionEnum, ColorLoopDirectionEnum and ColorModeEnum
3990+
# were originally named ColorLoopAction, ColorLoopDirection, and
3991+
# ColorMode, but we generate the same API for the names
3992+
# with/without "Enum" at the end and the cluster name
3993+
# present/absent at the beginning, so the names can just change
3994+
# here.
3995+
ColorLoopActionEnum:
39843996
- Deactivate
39853997
- ActivateFromColorLoopStartEnhancedHue
39863998
- ActivateFromEnhancedCurrentHue
3987-
ColorLoopDirection:
3999+
ColorLoopDirectionEnum:
39884000
- DecrementHue
39894001
- IncrementHue
3990-
ColorMode:
4002+
ColorModeEnum:
39914003
- CurrentHueAndCurrentSaturation
39924004
- CurrentXAndCurrentY
39934005
- ColorTemperature
@@ -9682,6 +9694,64 @@
96829694

96839695
- release: "Future"
96849696
versions: "future"
9697+
introduced:
9698+
enums:
9699+
ColorControl:
9700+
- DirectionEnum
9701+
- DriftCompensationEnum
9702+
- EnhancedColorModeEnum
9703+
- MoveModeEnum
9704+
- StepModeEnum
9705+
enum values:
9706+
ColorControl:
9707+
ColorLoopDirectionEnum:
9708+
- Decrement
9709+
- Increment
9710+
ColorModeEnum:
9711+
- ColorTemperatureMireds
9712+
DirectionEnum:
9713+
- Shortest
9714+
- Longest
9715+
- Up
9716+
- Down
9717+
DriftCompensationEnum:
9718+
- None
9719+
- OtherOrUnknown
9720+
- TemperatureMonitoring
9721+
- OpticalLuminanceMonitoringAndFeedback
9722+
- OpticalColorMonitoringAndFeedback
9723+
EnhancedColorModeEnum:
9724+
- CurrentHueAndCurrentSaturation
9725+
- CurrentXAndCurrentY
9726+
- ColorTemperatureMireds
9727+
- EnhancedCurrentHueAndCurrentSaturation
9728+
MoveModeEnum:
9729+
- Stop
9730+
- Up
9731+
- Down
9732+
StepModeEnum:
9733+
- Up
9734+
- Down
9735+
bitmaps:
9736+
ColorControl:
9737+
- ColorCapabilitiesBitmap
9738+
- OptionsBitmap
9739+
- UpdateFlagsBitmap
9740+
bitmap values:
9741+
ColorControl:
9742+
ColorCapabilitiesBitmap:
9743+
- HueSaturation
9744+
- EnhancedHue
9745+
- ColorLoop
9746+
- XY
9747+
- ColorTemperature
9748+
OptionsBitmap:
9749+
- ExecuteIfOff
9750+
UpdateFlagsBitmap:
9751+
- UpdateAction
9752+
- UpdateDirection
9753+
- UpdateTime
9754+
- UpdateStartHue
96859755
provisional:
96869756
clusters:
96879757
# Targeting 1.4
@@ -9820,3 +9890,64 @@
98209890
Feature:
98219891
# Targeting 1.4
98229892
- ActionSwitch
9893+
renames:
9894+
enums:
9895+
ColorControl:
9896+
DirectionEnum: HueDirection
9897+
MoveModeEnum: HueMoveMode
9898+
StepModeEnum: HueStepMode
9899+
enum values:
9900+
ColorControl:
9901+
ColorLoopDirectionEnum:
9902+
Decrement: DecrementHue
9903+
Increment: IncrementHue
9904+
ColorModeEnum:
9905+
ColorTemperatureMireds: ColorTemperature
9906+
HueDirection:
9907+
Shortest: ShortestDistance
9908+
Longest: LongestDistance
9909+
bitmaps:
9910+
ColorControl:
9911+
ColorCapabilitiesBitmap: ColorCapabilities
9912+
UpdateFlagsBitmap: ColorLoopUpdateFlags
9913+
bitmap values:
9914+
ColorControl:
9915+
ColorCapabilities:
9916+
HueSaturation: HueSaturationSupported
9917+
EnhancedHue: EnhancedHueSupported
9918+
ColorLoop: ColorLoopSupported
9919+
XY: XYAttributesSupported
9920+
ColorTemperature: ColorTemperatureSupported
9921+
deprecated:
9922+
enums:
9923+
ColorControl:
9924+
- HueDirection
9925+
- HueMoveMode
9926+
- HueStepMode
9927+
enum values:
9928+
ColorControl:
9929+
ColorLoopDirectionEnum:
9930+
- DecrementHue
9931+
- IncrementHue
9932+
ColorModeEnum:
9933+
- ColorTemperature
9934+
bitmaps:
9935+
ColorControl:
9936+
- ColorCapabilities
9937+
- ColorLoopUpdateFlags
9938+
removed:
9939+
enum values:
9940+
ColorControl:
9941+
# Don't expose the new value names on the old enum names
9942+
HueDirection:
9943+
- Shortest
9944+
- Longest
9945+
bitmap values:
9946+
ColorControl:
9947+
# Don't expose the new field names on the old bitmap names
9948+
ColorCapabilities:
9949+
- HueSaturation
9950+
- EnhancedHue
9951+
- ColorLoop
9952+
- XY
9953+
- ColorTemperature

0 commit comments

Comments
 (0)