Skip to content

Commit

Permalink
Make StartUpColorTemperatureMireds nullable, per spec. (project-chip#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored and isiu-apple committed Sep 16, 2022
1 parent c322725 commit a98a53c
Show file tree
Hide file tree
Showing 32 changed files with 238 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2851,7 +2851,7 @@ server cluster ColorControl = 768 {
readonly attribute int16u colorTempPhysicalMinMireds = 16395;
readonly attribute int16u colorTempPhysicalMaxMireds = 16396;
readonly attribute int16u coupleColorTempToLevelMinMireds = 16397;
attribute access(write: manage) int16u startUpColorTemperatureMireds = 16400;
attribute access(write: manage) nullable int16u startUpColorTemperatureMireds = 16400;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@ server cluster ColorControl = 768 {
readonly attribute int16u colorTempPhysicalMinMireds = 16395;
readonly attribute int16u colorTempPhysicalMaxMireds = 16396;
readonly attribute int16u coupleColorTempToLevelMinMireds = 16397;
attribute access(write: manage) int16u startUpColorTemperatureMireds = 16400;
attribute access(write: manage) nullable int16u startUpColorTemperatureMireds = 16400;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute attrib_id attributeList[] = 65531;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ client cluster ColorControl = 768 {
readonly attribute int16u colorTempPhysicalMinMireds = 16395;
readonly attribute int16u colorTempPhysicalMaxMireds = 16396;
readonly attribute int16u coupleColorTempToLevelMinMireds = 16397;
attribute access(write: manage) int16u startUpColorTemperatureMireds = 16400;
attribute access(write: manage) nullable int16u startUpColorTemperatureMireds = 16400;
readonly attribute int16u clusterRevision = 65533;

request struct MoveToHueRequest {
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/lighting-common/lighting-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,7 @@ server cluster ColorControl = 768 {
readonly attribute int16u colorTempPhysicalMinMireds = 16395;
readonly attribute int16u colorTempPhysicalMaxMireds = 16396;
readonly attribute int16u coupleColorTempToLevelMinMireds = 16397;
attribute access(write: manage) int16u startUpColorTemperatureMireds = 16400;
attribute access(write: manage) nullable int16u startUpColorTemperatureMireds = 16400;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

Expand Down
2 changes: 1 addition & 1 deletion examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1916,7 +1916,7 @@ server cluster ColorControl = 768 {
readonly attribute int16u currentY = 4;
attribute bitmap8 options = 15;
readonly attribute int16u coupleColorTempToLevelMinMireds = 16397;
attribute access(write: manage) int16u startUpColorTemperatureMireds = 16400;
attribute access(write: manage) nullable int16u startUpColorTemperatureMireds = 16400;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

Expand Down
2 changes: 1 addition & 1 deletion examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1916,7 +1916,7 @@ server cluster ColorControl = 768 {
readonly attribute int16u currentY = 4;
attribute bitmap8 options = 15;
readonly attribute int16u coupleColorTempToLevelMinMireds = 16397;
attribute access(write: manage) int16u startUpColorTemperatureMireds = 16400;
attribute access(write: manage) nullable int16u startUpColorTemperatureMireds = 16400;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

Expand Down
16 changes: 8 additions & 8 deletions src/app/clusters/color-control-server/color-control-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2071,13 +2071,13 @@ void ColorControlServer::startUpColorTempCommand(EndpointId endpoint)
// the StartUpColorTemperatureMireds attribute are listed in the table below.
// Value Action on power up
// 0x0000-0xffef Set the ColorTemperatureMireds attribute to this value.
// 0xffff Set the ColorTemperatureMireds attribute to its previous value.
// null Set the ColorTemperatureMireds attribute to its previous value.

// Initialize startUpColorTempMireds to "maintain previous value" value 0xFFFF
uint16_t startUpColorTemp = 0xFFFF;
EmberAfStatus status = Attributes::StartUpColorTemperatureMireds::Get(endpoint, &startUpColorTemp);
// Initialize startUpColorTempMireds to "maintain previous value" value null
app::DataModel::Nullable<uint16_t> startUpColorTemp;
EmberAfStatus status = Attributes::StartUpColorTemperatureMireds::Get(endpoint, startUpColorTemp);

if (status == EMBER_ZCL_STATUS_SUCCESS)
if (status == EMBER_ZCL_STATUS_SUCCESS && !startUpColorTemp.IsNull())
{
uint16_t updatedColorTemp = MAX_TEMPERATURE_VALUE;
status = Attributes::ColorTemperature::Get(endpoint, &updatedColorTemp);
Expand All @@ -2090,13 +2090,13 @@ void ColorControlServer::startUpColorTempCommand(EndpointId endpoint)
uint16_t tempPhysicalMax = MAX_TEMPERATURE_VALUE;
Attributes::ColorTempPhysicalMaxMireds::Get(endpoint, &tempPhysicalMax);

if (tempPhysicalMin <= startUpColorTemp && startUpColorTemp <= tempPhysicalMax)
if (tempPhysicalMin <= startUpColorTemp.Value() && startUpColorTemp.Value() <= tempPhysicalMax)
{
// Apply valid startup color temp value that is within physical limits of device.
// Otherwise, the startup value is outside the device's supported range, and the
// existing setting of ColorTemp attribute will be left unchanged (i.e., treated as
// if startup color temp was set to 0xFFFF).
updatedColorTemp = startUpColorTemp;
// if startup color temp was set to null).
updatedColorTemp = startUpColorTemp.Value();
status = Attributes::ColorTemperature::Set(endpoint, updatedColorTemp);

if (status == EMBER_ZCL_STATUS_SUCCESS)
Expand Down
2 changes: 1 addition & 1 deletion src/app/zap-templates/zcl/data-model/silabs/ha.xml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ limitations under the License.
</attribute>
<!-- COLOR_POINT_B_INTENSITY -->
<attribute side="server" code="0x400D" define="COLOR_CONTROL_TEMPERATURE_LEVEL_MIN_MIREDS" type="INT16U" min="0x0000" max="0xFFFF" writable="false" optional="true">CoupleColorTempToLevelMinMireds</attribute>
<attribute side="server" code="0x4010" define="START_UP_COLOR_TEMPERATURE_MIREDS" type="INT16U" min="0x0000" max="0xFEFF" writable="true" optional="true">
<attribute side="server" code="0x4010" define="START_UP_COLOR_TEMPERATURE_MIREDS" type="INT16U" min="0x0000" max="0xFEFF" writable="true" isNullable="true" optional="true">
<description>StartUpColorTemperatureMireds</description>
<access op="read" role="view"/>
<access op="write" role="manage"/>
Expand Down
2 changes: 1 addition & 1 deletion src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -3178,7 +3178,7 @@ client cluster ColorControl = 768 {
readonly attribute int16u colorTempPhysicalMinMireds = 16395;
readonly attribute int16u colorTempPhysicalMaxMireds = 16396;
readonly attribute int16u coupleColorTempToLevelMinMireds = 16397;
attribute access(write: manage) int16u startUpColorTemperatureMireds = 16400;
attribute access(write: manage) nullable int16u startUpColorTemperatureMireds = 16400;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute attrib_id attributeList[] = 65531;
Expand Down
15 changes: 11 additions & 4 deletions src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 67 additions & 0 deletions src/controller/java/zap-generated/CHIPReadCallbacks.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions src/controller/java/zap-generated/CHIPReadCallbacks.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/controller/python/chip/clusters/Objects.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a98a53c

Please sign in to comment.