Skip to content

Commit

Permalink
Move Channel Cluster to match the spec (#30137)
Browse files Browse the repository at this point in the history
* Replace enum name

* zap regen

* Fix Darwin availability annotations.

* Add alias in CompatEnumNames.h

---------

Co-authored-by: Boris Zbarsky <[email protected]>
Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
3 people authored and pull[bot] committed Feb 13, 2024
1 parent 98fdd07 commit 31c0c4e
Show file tree
Hide file tree
Showing 20 changed files with 111 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3141,16 +3141,16 @@ server cluster WakeOnLan = 1283 {

/** This cluster provides an interface for controlling the current Channel on a device. */
server cluster Channel = 1284 {
enum ChannelStatusEnum : enum8 {
enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

enum StatusEnum : enum8 {
kSuccess = 0;
kMultipleMatches = 1;
kNoMatches = 2;
}

enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

bitmap Feature : bitmap32 {
kChannelList = 0x1;
kLineupInfo = 0x2;
Expand Down
6 changes: 3 additions & 3 deletions examples/chef/common/chef-channel-manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,18 @@ void ChefChannelManager::HandleChangeChannel(CommandResponseHelper<ChangeChannel
// Error: Found multiple matches
if (totalMatchedChannels > 1)
{
response.status = chip::app::Clusters::Channel::ChannelStatusEnum::kMultipleMatches;
response.status = chip::app::Clusters::Channel::StatusEnum::kMultipleMatches;
helper.Success(response);
}
else if (totalMatchedChannels == 0)
{
// Error: Found no match
response.status = chip::app::Clusters::Channel::ChannelStatusEnum::kNoMatches;
response.status = chip::app::Clusters::Channel::StatusEnum::kNoMatches;
helper.Success(response);
}
else
{
response.status = chip::app::Clusters::Channel::ChannelStatusEnum::kSuccess;
response.status = chip::app::Clusters::Channel::StatusEnum::kSuccess;
response.data = chip::MakeOptional(CharSpan::fromCharString("data response"));
mCurrentChannelIndex = index;
helper.Success(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1099,16 +1099,16 @@ server cluster WakeOnLan = 1283 {

/** This cluster provides an interface for controlling the current Channel on a device. */
server cluster Channel = 1284 {
enum ChannelStatusEnum : enum8 {
enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

enum StatusEnum : enum8 {
kSuccess = 0;
kMultipleMatches = 1;
kNoMatches = 2;
}

enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

bitmap Feature : bitmap32 {
kChannelList = 0x1;
kLineupInfo = 0x2;
Expand Down Expand Up @@ -1153,7 +1153,7 @@ server cluster Channel = 1284 {
}

response struct ChangeChannelResponse = 1 {
ChannelStatusEnum status = 0;
StatusEnum status = 0;
optional char_string data = 1;
}

Expand Down
22 changes: 11 additions & 11 deletions examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -5314,16 +5314,16 @@ server cluster OccupancySensing = 1030 {

/** This cluster provides an interface for controlling the current Channel on a device. */
client cluster Channel = 1284 {
enum ChannelStatusEnum : enum8 {
enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

enum StatusEnum : enum8 {
kSuccess = 0;
kMultipleMatches = 1;
kNoMatches = 2;
}

enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

bitmap Feature : bitmap32 {
kChannelList = 0x1;
kLineupInfo = 0x2;
Expand Down Expand Up @@ -5359,7 +5359,7 @@ client cluster Channel = 1284 {
}

response struct ChangeChannelResponse = 1 {
ChannelStatusEnum status = 0;
StatusEnum status = 0;
optional char_string data = 1;
}

Expand All @@ -5382,16 +5382,16 @@ client cluster Channel = 1284 {

/** This cluster provides an interface for controlling the current Channel on a device. */
server cluster Channel = 1284 {
enum ChannelStatusEnum : enum8 {
enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

enum StatusEnum : enum8 {
kSuccess = 0;
kMultipleMatches = 1;
kNoMatches = 2;
}

enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

bitmap Feature : bitmap32 {
kChannelList = 0x1;
kLineupInfo = 0x2;
Expand Down
22 changes: 11 additions & 11 deletions examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -5273,16 +5273,16 @@ server cluster OccupancySensing = 1030 {

/** This cluster provides an interface for controlling the current Channel on a device. */
client cluster Channel = 1284 {
enum ChannelStatusEnum : enum8 {
enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

enum StatusEnum : enum8 {
kSuccess = 0;
kMultipleMatches = 1;
kNoMatches = 2;
}

enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

bitmap Feature : bitmap32 {
kChannelList = 0x1;
kLineupInfo = 0x2;
Expand Down Expand Up @@ -5318,7 +5318,7 @@ client cluster Channel = 1284 {
}

response struct ChangeChannelResponse = 1 {
ChannelStatusEnum status = 0;
StatusEnum status = 0;
optional char_string data = 1;
}

Expand All @@ -5341,16 +5341,16 @@ client cluster Channel = 1284 {

/** This cluster provides an interface for controlling the current Channel on a device. */
server cluster Channel = 1284 {
enum ChannelStatusEnum : enum8 {
enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

enum StatusEnum : enum8 {
kSuccess = 0;
kMultipleMatches = 1;
kNoMatches = 2;
}

enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

bitmap Feature : bitmap32 {
kChannelList = 0x1;
kLineupInfo = 0x2;
Expand Down
2 changes: 1 addition & 1 deletion examples/tv-app/android/java/ChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ void ChannelManager::HandleChangeChannel(CommandResponseHelper<ChangeChannelResp

jfieldID getStatusField = env->GetFieldID(channelClass, "status", "I");
jint jstatus = env->GetIntField(channelObject, getStatusField);
response.status = static_cast<app::Clusters::Channel::ChannelStatusEnum>(jstatus);
response.status = static_cast<app::Clusters::Channel::StatusEnum>(jstatus);

jfieldID getNameField = env->GetFieldID(channelClass, "name", "Ljava/lang/String;");
jstring jname = static_cast<jstring>(env->GetObjectField(channelObject, getNameField));
Expand Down
6 changes: 3 additions & 3 deletions examples/tv-app/tv-common/clusters/channel/ChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,18 @@ void ChannelManager::HandleChangeChannel(CommandResponseHelper<ChangeChannelResp
// Error: Found multiple matches
if (matchedChannels.size() > 1)
{
response.status = chip::app::Clusters::Channel::ChannelStatusEnum::kMultipleMatches;
response.status = chip::app::Clusters::Channel::StatusEnum::kMultipleMatches;
helper.Success(response);
}
else if (matchedChannels.size() == 0)
{
// Error: Found no match
response.status = chip::app::Clusters::Channel::ChannelStatusEnum::kNoMatches;
response.status = chip::app::Clusters::Channel::StatusEnum::kNoMatches;
helper.Success(response);
}
else
{
response.status = chip::app::Clusters::Channel::ChannelStatusEnum::kSuccess;
response.status = chip::app::Clusters::Channel::StatusEnum::kSuccess;
response.data = chip::MakeOptional(CharSpan::fromCharString("data response"));
mCurrentChannel = matchedChannels[0];
mCurrentChannelIndex = index;
Expand Down
12 changes: 6 additions & 6 deletions examples/tv-app/tv-common/tv-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1839,16 +1839,16 @@ server cluster WakeOnLan = 1283 {

/** This cluster provides an interface for controlling the current Channel on a device. */
server cluster Channel = 1284 {
enum ChannelStatusEnum : enum8 {
enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

enum StatusEnum : enum8 {
kSuccess = 0;
kMultipleMatches = 1;
kNoMatches = 2;
}

enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

bitmap Feature : bitmap32 {
kChannelList = 0x1;
kLineupInfo = 0x2;
Expand Down Expand Up @@ -1893,7 +1893,7 @@ server cluster Channel = 1284 {
}

response struct ChangeChannelResponse = 1 {
ChannelStatusEnum status = 0;
StatusEnum status = 0;
optional char_string data = 1;
}

Expand Down
12 changes: 6 additions & 6 deletions examples/tv-casting-app/tv-casting-common/tv-casting-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1358,16 +1358,16 @@ client cluster WakeOnLan = 1283 {

/** This cluster provides an interface for controlling the current Channel on a device. */
client cluster Channel = 1284 {
enum ChannelStatusEnum : enum8 {
enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

enum StatusEnum : enum8 {
kSuccess = 0;
kMultipleMatches = 1;
kNoMatches = 2;
}

enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

bitmap Feature : bitmap32 {
kChannelList = 0x1;
kLineupInfo = 0x2;
Expand Down Expand Up @@ -1403,7 +1403,7 @@ client cluster Channel = 1284 {
}

response struct ChangeChannelResponse = 1 {
ChannelStatusEnum status = 0;
StatusEnum status = 0;
optional char_string data = 1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3105,7 +3105,7 @@ server cluster WakeOnLan = 1283 {
}

server cluster Channel = 1284 {
enum ChannelStatusEnum : ENUM8 {
enum StatusEnum : ENUM8 {
kSuccess = 0;
kMultipleMatches = 1;
kNoMatches = 2;
Expand Down
4 changes: 4 additions & 0 deletions src/app/CompatEnumNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ using OTAChangeReasonEnum = ChangeReasonEnum;
using OTAUpdateStateEnum = UpdateStateEnum;
} // namespace OtaSoftwareUpdateRequestor

namespace Channel {
using ChannelStatusEnum = StatusEnum;
} // namespace Channel

} // namespace Clusters
} // namespace app
} // namespace chip
4 changes: 2 additions & 2 deletions src/app/zap-templates/zcl/data-model/chip/channel-cluster.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ limitations under the License.

<command source="server" code="0x01" name="ChangeChannelResponse" optional="true">
<description>Upon receipt, this SHALL display the active status of the input list on screen.</description>
<arg name="Status" type="ChannelStatusEnum"/>
<arg name="Status" type="StatusEnum"/>
<arg name="Data" type="char_string" optional="true"/>
</command>

Expand Down Expand Up @@ -74,7 +74,7 @@ limitations under the License.
<item name="MSO" value="0x00"/>
</enum>

<enum name="ChannelStatusEnum" type="enum8">
<enum name="StatusEnum" type="enum8">
<cluster code="0x0504"/>
<item name="Success" value="0x00"/>
<item name="MultipleMatches" value="0x01"/>
Expand Down
12 changes: 6 additions & 6 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -5870,16 +5870,16 @@ client cluster WakeOnLan = 1283 {

/** This cluster provides an interface for controlling the current Channel on a device. */
client cluster Channel = 1284 {
enum ChannelStatusEnum : enum8 {
enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

enum StatusEnum : enum8 {
kSuccess = 0;
kMultipleMatches = 1;
kNoMatches = 2;
}

enum LineupInfoTypeEnum : enum8 {
kMSO = 0;
}

bitmap Feature : bitmap32 {
kChannelList = 0x1;
kLineupInfo = 0x2;
Expand Down Expand Up @@ -5915,7 +5915,7 @@ client cluster Channel = 1284 {
}

response struct ChangeChannelResponse = 1 {
ChannelStatusEnum status = 0;
StatusEnum status = 0;
optional char_string data = 1;
}

Expand Down
20 changes: 10 additions & 10 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.

Loading

0 comments on commit 31c0c4e

Please sign in to comment.