From 1450244f36853033a72501b2922e81a64c33fa74 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 10 Nov 2023 11:17:35 -0500 Subject: [PATCH] Match `TargetNavigator Cluster` to spec (#30322) * 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 --- .../all-clusters-minimal-app.matter | 6 +++--- .../rootnode_basicvideoplayer_0ff86e943b.matter | 6 +++--- examples/placeholder/linux/apps/app1/config.matter | 10 +++++----- examples/placeholder/linux/apps/app2/config.matter | 10 +++++----- .../target-navigator/TargetNavigatorManager.cpp | 4 ++-- .../tv-app/android/java/ContentAppCommandDelegate.cpp | 3 +-- .../target-navigator/TargetNavigatorManager.cpp | 4 ++-- examples/tv-app/tv-common/tv-app.matter | 6 +++--- .../tv-casting-common/tv-casting-app.matter | 6 +++--- src/app/CompatEnumNames.h | 5 +++++ .../zcl/data-model/chip/target-navigator-cluster.xml | 8 ++++---- src/controller/data_model/controller-clusters.matter | 6 +++--- src/controller/python/chip/clusters/Objects.py | 6 +++--- .../Framework/CHIP/zap-generated/MTRBaseClusters.h | 8 ++++---- .../openiotsdk/integration-tests/tv-app/test_app.py | 2 +- .../app-common/zap-generated/cluster-enums-check.h | 4 ++-- .../app-common/zap-generated/cluster-enums.h | 4 ++-- .../app-common/zap-generated/cluster-objects.h | 4 ++-- 18 files changed, 53 insertions(+), 49 deletions(-) diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index bbcaf521b97840..1d3e4a70ff87e8 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -3202,7 +3202,7 @@ 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; @@ -3210,7 +3210,7 @@ server cluster TargetNavigator = 1285 { struct TargetInfoStruct { int8u identifier = 0; - char_string<32> name = 1; + char_string name = 1; } readonly attribute TargetInfoStruct targetList[] = 0; @@ -3227,7 +3227,7 @@ server cluster TargetNavigator = 1285 { } response struct NavigateTargetResponse = 1 { - TargetNavigatorStatusEnum status = 0; + StatusEnum status = 0; optional char_string data = 1; } diff --git a/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter b/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter index d964a8f5a7a3bf..b8420779b737f8 100644 --- a/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter +++ b/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter @@ -1173,7 +1173,7 @@ 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; @@ -1181,7 +1181,7 @@ server cluster TargetNavigator = 1285 { struct TargetInfoStruct { int8u identifier = 0; - char_string<32> name = 1; + char_string name = 1; } readonly attribute TargetInfoStruct targetList[] = 0; @@ -1198,7 +1198,7 @@ server cluster TargetNavigator = 1285 { } response struct NavigateTargetResponse = 1 { - TargetNavigatorStatusEnum status = 0; + StatusEnum status = 0; optional char_string data = 1; } diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 334225aad8fe75..f9a9dda195ce4c 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -5451,7 +5451,7 @@ 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; @@ -5459,7 +5459,7 @@ client cluster TargetNavigator = 1285 { struct TargetInfoStruct { int8u identifier = 0; - char_string<32> name = 1; + char_string name = 1; } readonly attribute TargetInfoStruct targetList[] = 0; @@ -5477,7 +5477,7 @@ client cluster TargetNavigator = 1285 { } response struct NavigateTargetResponse = 1 { - TargetNavigatorStatusEnum status = 0; + StatusEnum status = 0; optional char_string data = 1; } @@ -5487,7 +5487,7 @@ 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; @@ -5495,7 +5495,7 @@ server cluster TargetNavigator = 1285 { struct TargetInfoStruct { int8u identifier = 0; - char_string<32> name = 1; + char_string name = 1; } readonly attribute TargetInfoStruct targetList[] = 0; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index 45c2602cbc005e..24db54b8e9fca7 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -5410,7 +5410,7 @@ 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; @@ -5418,7 +5418,7 @@ client cluster TargetNavigator = 1285 { struct TargetInfoStruct { int8u identifier = 0; - char_string<32> name = 1; + char_string name = 1; } readonly attribute TargetInfoStruct targetList[] = 0; @@ -5436,7 +5436,7 @@ client cluster TargetNavigator = 1285 { } response struct NavigateTargetResponse = 1 { - TargetNavigatorStatusEnum status = 0; + StatusEnum status = 0; optional char_string data = 1; } @@ -5446,7 +5446,7 @@ 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; @@ -5454,7 +5454,7 @@ server cluster TargetNavigator = 1285 { struct TargetInfoStruct { int8u identifier = 0; - char_string<32> name = 1; + char_string name = 1; } readonly attribute TargetInfoStruct targetList[] = 0; diff --git a/examples/tv-app/android/include/target-navigator/TargetNavigatorManager.cpp b/examples/tv-app/android/include/target-navigator/TargetNavigatorManager.cpp index 5950ec32198819..f917beb6552ee1 100644 --- a/examples/tv-app/android/include/target-navigator/TargetNavigatorManager.cpp +++ b/examples/tv-app/android/include/target-navigator/TargetNavigatorManager.cpp @@ -134,13 +134,13 @@ void TargetNavigatorManager::HandleNavigateTarget(CommandResponseHelper mTargets.size()) { response.data = chip::MakeOptional(CharSpan::fromCharString("error")); - response.status = TargetNavigatorStatusEnum::kTargetNotFound; + response.status = StatusEnum::kTargetNotFound; helper.Success(response); return; } mCurrentTarget = static_cast(target); response.data = chip::MakeOptional(CharSpan::fromCharString("data response")); - response.status = TargetNavigatorStatusEnum::kSuccess; + response.status = StatusEnum::kSuccess; helper.Success(response); } diff --git a/examples/tv-app/android/java/ContentAppCommandDelegate.cpp b/examples/tv-app/android/java/ContentAppCommandDelegate.cpp index 80a1ad52d6224c..23437ee4f2b6be 100644 --- a/examples/tv-app/android/java/ContentAppCommandDelegate.cpp +++ b/examples/tv-app/android/java/ContentAppCommandDelegate.cpp @@ -277,8 +277,7 @@ NavigateTargetResponseType ContentAppCommandDelegate::FormatNavigateTargetRespon } else { - navigateTargetResponse.status = - static_cast(value[statusFieldId].asInt()); + navigateTargetResponse.status = static_cast(value[statusFieldId].asInt()); std::string dataFieldId = std::to_string(to_underlying(app::Clusters::TargetNavigator::Commands::NavigateTargetResponse::Fields::kData)); if (!value[dataFieldId].empty()) diff --git a/examples/tv-app/tv-common/clusters/target-navigator/TargetNavigatorManager.cpp b/examples/tv-app/tv-common/clusters/target-navigator/TargetNavigatorManager.cpp index ba52adace6955d..9c0599eb6df7b0 100644 --- a/examples/tv-app/tv-common/clusters/target-navigator/TargetNavigatorManager.cpp +++ b/examples/tv-app/tv-common/clusters/target-navigator/TargetNavigatorManager.cpp @@ -56,13 +56,13 @@ void TargetNavigatorManager::HandleNavigateTarget(CommandResponseHelper mTargets.size()) { response.data = chip::MakeOptional(CharSpan::fromCharString("error")); - response.status = TargetNavigatorStatusEnum::kTargetNotFound; + response.status = StatusEnum::kTargetNotFound; helper.Success(response); return; } mCurrentTarget = static_cast(target); response.data = chip::MakeOptional(CharSpan::fromCharString("data response")); - response.status = TargetNavigatorStatusEnum::kSuccess; + response.status = StatusEnum::kSuccess; helper.Success(response); } diff --git a/examples/tv-app/tv-common/tv-app.matter b/examples/tv-app/tv-common/tv-app.matter index 5b37e71960ed1b..e6b4ddf8e7e452 100644 --- a/examples/tv-app/tv-common/tv-app.matter +++ b/examples/tv-app/tv-common/tv-app.matter @@ -1934,7 +1934,7 @@ 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; @@ -1942,7 +1942,7 @@ server cluster TargetNavigator = 1285 { struct TargetInfoStruct { int8u identifier = 0; - char_string<32> name = 1; + char_string name = 1; } readonly attribute TargetInfoStruct targetList[] = 0; @@ -1960,7 +1960,7 @@ server cluster TargetNavigator = 1285 { } response struct NavigateTargetResponse = 1 { - TargetNavigatorStatusEnum status = 0; + StatusEnum status = 0; optional char_string data = 1; } diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter index 5c2a0d2b0d76df..eae72ba8cef4ad 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter @@ -1436,7 +1436,7 @@ 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; @@ -1444,7 +1444,7 @@ client cluster TargetNavigator = 1285 { struct TargetInfoStruct { int8u identifier = 0; - char_string<32> name = 1; + char_string name = 1; } readonly attribute TargetInfoStruct targetList[] = 0; @@ -1462,7 +1462,7 @@ client cluster TargetNavigator = 1285 { } response struct NavigateTargetResponse = 1 { - TargetNavigatorStatusEnum status = 0; + StatusEnum status = 0; optional char_string data = 1; } diff --git a/src/app/CompatEnumNames.h b/src/app/CompatEnumNames.h index c0829465116cea..141c37d989ff7e 100644 --- a/src/app/CompatEnumNames.h +++ b/src/app/CompatEnumNames.h @@ -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 diff --git a/src/app/zap-templates/zcl/data-model/chip/target-navigator-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/target-navigator-cluster.xml index adfa5dbc808190..0daa3817da96a4 100644 --- a/src/app/zap-templates/zcl/data-model/chip/target-navigator-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/target-navigator-cluster.xml @@ -1,6 +1,6 @@