Skip to content

Commit

Permalink
Match TargetNavigator Cluster to spec (#30322)
Browse files Browse the repository at this point in the history
* TargetNavigator: fix enum name, remove constraint from target info struct name (spec has no restriction)

* zap regen

* Rename TargetNavigatorStatusEnum inside files

* Add compat

* Minor change to kick CI

* Restyle
  • Loading branch information
andy31415 authored and pull[bot] committed Jan 9, 2024
1 parent 75461f2 commit 1450244
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3202,15 +3202,15 @@ server cluster Channel = 1284 {

/** This cluster provides an interface for UX navigation within a set of targets on a device or endpoint. */
server cluster TargetNavigator = 1285 {
enum TargetNavigatorStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kTargetNotFound = 1;
kNotAllowed = 2;
}

struct TargetInfoStruct {
int8u identifier = 0;
char_string<32> name = 1;
char_string name = 1;
}

readonly attribute TargetInfoStruct targetList[] = 0;
Expand All @@ -3227,7 +3227,7 @@ server cluster TargetNavigator = 1285 {
}

response struct NavigateTargetResponse = 1 {
TargetNavigatorStatusEnum status = 0;
StatusEnum status = 0;
optional char_string data = 1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1173,15 +1173,15 @@ server cluster Channel = 1284 {

/** This cluster provides an interface for UX navigation within a set of targets on a device or endpoint. */
server cluster TargetNavigator = 1285 {
enum TargetNavigatorStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kTargetNotFound = 1;
kNotAllowed = 2;
}

struct TargetInfoStruct {
int8u identifier = 0;
char_string<32> name = 1;
char_string name = 1;
}

readonly attribute TargetInfoStruct targetList[] = 0;
Expand All @@ -1198,7 +1198,7 @@ server cluster TargetNavigator = 1285 {
}

response struct NavigateTargetResponse = 1 {
TargetNavigatorStatusEnum status = 0;
StatusEnum status = 0;
optional char_string data = 1;
}

Expand Down
10 changes: 5 additions & 5 deletions examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -5451,15 +5451,15 @@ server cluster Channel = 1284 {

/** This cluster provides an interface for UX navigation within a set of targets on a device or endpoint. */
client cluster TargetNavigator = 1285 {
enum TargetNavigatorStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kTargetNotFound = 1;
kNotAllowed = 2;
}

struct TargetInfoStruct {
int8u identifier = 0;
char_string<32> name = 1;
char_string name = 1;
}

readonly attribute TargetInfoStruct targetList[] = 0;
Expand All @@ -5477,7 +5477,7 @@ client cluster TargetNavigator = 1285 {
}

response struct NavigateTargetResponse = 1 {
TargetNavigatorStatusEnum status = 0;
StatusEnum status = 0;
optional char_string data = 1;
}

Expand All @@ -5487,15 +5487,15 @@ client cluster TargetNavigator = 1285 {

/** This cluster provides an interface for UX navigation within a set of targets on a device or endpoint. */
server cluster TargetNavigator = 1285 {
enum TargetNavigatorStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kTargetNotFound = 1;
kNotAllowed = 2;
}

struct TargetInfoStruct {
int8u identifier = 0;
char_string<32> name = 1;
char_string name = 1;
}

readonly attribute TargetInfoStruct targetList[] = 0;
Expand Down
10 changes: 5 additions & 5 deletions examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -5410,15 +5410,15 @@ server cluster Channel = 1284 {

/** This cluster provides an interface for UX navigation within a set of targets on a device or endpoint. */
client cluster TargetNavigator = 1285 {
enum TargetNavigatorStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kTargetNotFound = 1;
kNotAllowed = 2;
}

struct TargetInfoStruct {
int8u identifier = 0;
char_string<32> name = 1;
char_string name = 1;
}

readonly attribute TargetInfoStruct targetList[] = 0;
Expand All @@ -5436,7 +5436,7 @@ client cluster TargetNavigator = 1285 {
}

response struct NavigateTargetResponse = 1 {
TargetNavigatorStatusEnum status = 0;
StatusEnum status = 0;
optional char_string data = 1;
}

Expand All @@ -5446,15 +5446,15 @@ client cluster TargetNavigator = 1285 {

/** This cluster provides an interface for UX navigation within a set of targets on a device or endpoint. */
server cluster TargetNavigator = 1285 {
enum TargetNavigatorStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kTargetNotFound = 1;
kNotAllowed = 2;
}

struct TargetInfoStruct {
int8u identifier = 0;
char_string<32> name = 1;
char_string name = 1;
}

readonly attribute TargetInfoStruct targetList[] = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ void TargetNavigatorManager::HandleNavigateTarget(CommandResponseHelper<Navigate
if (target == kNoCurrentTarget || target > mTargets.size())
{
response.data = chip::MakeOptional(CharSpan::fromCharString("error"));
response.status = TargetNavigatorStatusEnum::kTargetNotFound;
response.status = StatusEnum::kTargetNotFound;
helper.Success(response);
return;
}
mCurrentTarget = static_cast<uint8_t>(target);

response.data = chip::MakeOptional(CharSpan::fromCharString("data response"));
response.status = TargetNavigatorStatusEnum::kSuccess;
response.status = StatusEnum::kSuccess;
helper.Success(response);
}
3 changes: 1 addition & 2 deletions examples/tv-app/android/java/ContentAppCommandDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,7 @@ NavigateTargetResponseType ContentAppCommandDelegate::FormatNavigateTargetRespon
}
else
{
navigateTargetResponse.status =
static_cast<app::Clusters::TargetNavigator::TargetNavigatorStatusEnum>(value[statusFieldId].asInt());
navigateTargetResponse.status = static_cast<app::Clusters::TargetNavigator::StatusEnum>(value[statusFieldId].asInt());
std::string dataFieldId =
std::to_string(to_underlying(app::Clusters::TargetNavigator::Commands::NavigateTargetResponse::Fields::kData));
if (!value[dataFieldId].empty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ void TargetNavigatorManager::HandleNavigateTarget(CommandResponseHelper<Navigate
if (target == kNoCurrentTarget || target > mTargets.size())
{
response.data = chip::MakeOptional(CharSpan::fromCharString("error"));
response.status = TargetNavigatorStatusEnum::kTargetNotFound;
response.status = StatusEnum::kTargetNotFound;
helper.Success(response);
return;
}
mCurrentTarget = static_cast<uint8_t>(target);

response.data = chip::MakeOptional(CharSpan::fromCharString("data response"));
response.status = TargetNavigatorStatusEnum::kSuccess;
response.status = StatusEnum::kSuccess;
helper.Success(response);
}
6 changes: 3 additions & 3 deletions examples/tv-app/tv-common/tv-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1934,15 +1934,15 @@ server cluster Channel = 1284 {

/** This cluster provides an interface for UX navigation within a set of targets on a device or endpoint. */
server cluster TargetNavigator = 1285 {
enum TargetNavigatorStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kTargetNotFound = 1;
kNotAllowed = 2;
}

struct TargetInfoStruct {
int8u identifier = 0;
char_string<32> name = 1;
char_string name = 1;
}

readonly attribute TargetInfoStruct targetList[] = 0;
Expand All @@ -1960,7 +1960,7 @@ server cluster TargetNavigator = 1285 {
}

response struct NavigateTargetResponse = 1 {
TargetNavigatorStatusEnum status = 0;
StatusEnum status = 0;
optional char_string data = 1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1436,15 +1436,15 @@ client cluster Channel = 1284 {

/** This cluster provides an interface for UX navigation within a set of targets on a device or endpoint. */
client cluster TargetNavigator = 1285 {
enum TargetNavigatorStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kTargetNotFound = 1;
kNotAllowed = 2;
}

struct TargetInfoStruct {
int8u identifier = 0;
char_string<32> name = 1;
char_string name = 1;
}

readonly attribute TargetInfoStruct targetList[] = 0;
Expand All @@ -1462,7 +1462,7 @@ client cluster TargetNavigator = 1285 {
}

response struct NavigateTargetResponse = 1 {
TargetNavigatorStatusEnum status = 0;
StatusEnum status = 0;
optional char_string data = 1;
}

Expand Down
5 changes: 5 additions & 0 deletions src/app/CompatEnumNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ namespace Channel {
using ChannelStatusEnum = StatusEnum;
} // namespace Channel

namespace TargetNavigator {
// https://github.com/project-chip/connectedhomeip/pull/30322 renamed this
using TargetNavigatorStatusEnum = StatusEnum;
} // namespace TargetNavigator

} // namespace Clusters
} // namespace app
} // namespace chip
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2021 Project CHIP Authors
Copyright (c) 2021-2023 Project CHIP Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,12 +35,12 @@ limitations under the License.

<command source="server" code="0x01" name="NavigateTargetResponse" optional="false">
<description>This command SHALL be generated in response to NavigateTarget commands.</description>
<arg name="Status" type="TargetNavigatorStatusEnum"/>
<arg name="Status" type="StatusEnum"/>
<arg name="Data" type="char_string" optional="true"/>
</command>
</cluster>

<enum name="TargetNavigatorStatusEnum" type="enum8">
<enum name="StatusEnum" type="enum8">
<cluster code="0x0505"/>
<item name="Success" value="0x00"/>
<item name="TargetNotFound" value="0x01"/>
Expand All @@ -50,6 +50,6 @@ limitations under the License.
<struct name="TargetInfoStruct">
<cluster code="0x0505"/>
<item name="Identifier" type="int8u"/>
<item name="Name" type="char_string" length="32"/>
<item name="Name" type="char_string"/>
</struct>
</configurator>
6 changes: 3 additions & 3 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -5960,15 +5960,15 @@ client cluster Channel = 1284 {

/** This cluster provides an interface for UX navigation within a set of targets on a device or endpoint. */
client cluster TargetNavigator = 1285 {
enum TargetNavigatorStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kTargetNotFound = 1;
kNotAllowed = 2;
}

struct TargetInfoStruct {
int8u identifier = 0;
char_string<32> name = 1;
char_string name = 1;
}

readonly attribute TargetInfoStruct targetList[] = 0;
Expand All @@ -5986,7 +5986,7 @@ client cluster TargetNavigator = 1285 {
}

response struct NavigateTargetResponse = 1 {
TargetNavigatorStatusEnum status = 0;
StatusEnum status = 0;
optional char_string data = 1;
}

Expand Down
6 changes: 3 additions & 3 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.

8 changes: 4 additions & 4 deletions src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h

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

Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def test_tv_ctrl(device, controller):
dict(target=current_target_id, data=None),
requestTimeoutMs=1000)
assert err == 0
assert res.status == TargetNavigator.Enums.TargetNavigatorStatusEnum.kSuccess
assert res.status == TargetNavigator.Enums.StatusEnum.kSuccess

err, res = read_zcl_attribute(devCtrl, "TargetNavigator", "CurrentTarget", nodeId, endpoint)
assert err == 0
Expand Down

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.

0 comments on commit 1450244

Please sign in to comment.