From f54046f4a9a2c645d8074fd7e74cf8a085592fb4 Mon Sep 17 00:00:00 2001 From: Lazar Kovacic Date: Wed, 15 Dec 2021 16:56:29 +0100 Subject: [PATCH] Restyle fix --- .../android/java/ContentLauncherManager.cpp | 7 +- .../ContentLauncherManager.cpp | 10 +-- examples/tv-app/tv-common/tv-app.zap | 45 ------------ .../tv-casting-common/tv-casting-app.zap | 29 ++------ .../content-launch-delegate.h | 5 +- .../content-launch-server.cpp | 68 ++++++++++--------- third_party/qpg_sdk/repo | 2 +- .../tv-app/zap-generated/attribute-size.cpp | 20 +++--- .../zap-generated/attribute-size.cpp | 20 +++--- 9 files changed, 74 insertions(+), 132 deletions(-) diff --git a/examples/tv-app/android/java/ContentLauncherManager.cpp b/examples/tv-app/android/java/ContentLauncherManager.cpp index ab035dab5971b3..373ec9fbe667ff 100644 --- a/examples/tv-app/android/java/ContentLauncherManager.cpp +++ b/examples/tv-app/android/java/ContentLauncherManager.cpp @@ -46,9 +46,8 @@ using namespace chip; ContentLauncherManager ContentLauncherManager::sInstance; ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::EndpointId endpointId, - const std::list & parameterList, - bool autoplay, - const chip::CharSpan & data) + const std::list & parameterList, + bool autoplay, const chip::CharSpan & data) { ContentLaunchResponse response; CHIP_ERROR err = CHIP_NO_ERROR; @@ -103,7 +102,7 @@ ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::Endpoint ContentLaunchResponse ContentLauncherManager::HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, - const ContentLaunchBrandingInformation & brandingInformation) + const std::list & brandingInformation) { ContentLaunchResponse response; CHIP_ERROR err = CHIP_NO_ERROR; diff --git a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp index 7bf78790c90912..17e5d5ef8d4080 100644 --- a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp +++ b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp @@ -39,8 +39,8 @@ using namespace std; using namespace chip::AppPlatform; ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::EndpointId endpointId, - const std::list & parameterList, bool autoplay, - const chip::CharSpan & data) + const std::list & parameterList, + bool autoplay, const chip::CharSpan & data) { ChipLogProgress(Zcl, "ContentLauncherManager::HandleLaunchContent "); string dataString(data.data(), data.size()); @@ -61,9 +61,9 @@ ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::Endpoint return response; } -ContentLaunchResponse ContentLauncherManager::HandleLaunchUrl(const chip::CharSpan & contentUrl, - const chip::CharSpan & displayString, - const std::list & brandingInformation) +ContentLaunchResponse +ContentLauncherManager::HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, + const std::list & brandingInformation) { ChipLogProgress(Zcl, "ContentLauncherManager::HandleLaunchUrl"); diff --git a/examples/tv-app/tv-common/tv-app.zap b/examples/tv-app/tv-common/tv-app.zap index e279ecbe8e77e0..c70f50d5b69af2 100644 --- a/examples/tv-app/tv-common/tv-app.zap +++ b/examples/tv-app/tv-common/tv-app.zap @@ -9389,21 +9389,6 @@ "maxInterval": 65344, "reportableChange": 0 }, - { - "name": "allowed vendor list", - "code": 7, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x01", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "ClusterRevision", "code": 65533, @@ -9868,21 +9853,6 @@ "maxInterval": 65344, "reportableChange": 0 }, - { - "name": "allowed vendor list", - "code": 7, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x01", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "ClusterRevision", "code": 65533, @@ -10145,21 +10115,6 @@ "maxInterval": 65344, "reportableChange": 0 }, - { - "name": "allowed vendor list", - "code": 7, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x01", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "ClusterRevision", "code": 65533, diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap index 3b19c27da39d3d..272131c4846351 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap @@ -1703,7 +1703,7 @@ "reportableChange": 0 }, { - "name": "NetworkDisabled", + "name": "InterfaceEnabled", "code": 4, "mfgCode": null, "side": "server", @@ -11934,7 +11934,7 @@ ], "attributes": [ { - "name": "tv channel list", + "name": "channel list", "code": 0, "mfgCode": null, "side": "server", @@ -11949,7 +11949,7 @@ "reportableChange": 0 }, { - "name": "tv channel lineup", + "name": "channel lineup", "code": 1, "mfgCode": null, "side": "server", @@ -11964,7 +11964,7 @@ "reportableChange": 0 }, { - "name": "current tv channel", + "name": "current channel", "code": 2, "mfgCode": null, "side": "server", @@ -12557,7 +12557,7 @@ "reportableChange": 0 }, { - "name": "supported streaming types", + "name": "supported streaming protocols", "code": 1, "mfgCode": null, "side": "server", @@ -12853,7 +12853,7 @@ "reportableChange": 0 }, { - "name": "application id", + "name": "application status", "code": 5, "mfgCode": null, "side": "server", @@ -12868,7 +12868,7 @@ "reportableChange": 0 }, { - "name": "catalog vendor id", + "name": "application version", "code": 6, "mfgCode": null, "side": "server", @@ -12882,21 +12882,6 @@ "maxInterval": 65344, "reportableChange": 0 }, - { - "name": "application status", - "code": 7, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x01", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "ClusterRevision", "code": 65533, diff --git a/src/app/clusters/content-launch-server/content-launch-delegate.h b/src/app/clusters/content-launch-server/content-launch-delegate.h index 9c95f7fe73c958..9974b2c2bde0b4 100644 --- a/src/app/clusters/content-launch-server/content-launch-delegate.h +++ b/src/app/clusters/content-launch-server/content-launch-delegate.h @@ -44,8 +44,9 @@ namespace ContentLauncher { class Delegate { public: - virtual ContentLaunchResponse HandleLaunchContent(chip::EndpointId endpointId, const std::list & parameterList, - bool autoplay, const chip::CharSpan & data) = 0; + virtual ContentLaunchResponse HandleLaunchContent(chip::EndpointId endpointId, + const std::list & parameterList, bool autoplay, + const chip::CharSpan & data) = 0; virtual ContentLaunchResponse HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, const std::list & brandingInformation) = 0; diff --git a/src/app/clusters/content-launch-server/content-launch-server.cpp b/src/app/clusters/content-launch-server/content-launch-server.cpp index b23a8a504015cd..7211a157157c51 100644 --- a/src/app/clusters/content-launch-server/content-launch-server.cpp +++ b/src/app/clusters/content-launch-server/content-launch-server.cpp @@ -75,7 +75,6 @@ bool SendStatusIfDelegateNull(Delegate * delegate, EndpointId endpoint) if (delegate == nullptr) { ChipLogError(Zcl, "No ContentLauncher Delegate set for ep:%" PRIu16, endpoint); - emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_UNSUP_COMMAND); return true; } return false; @@ -127,12 +126,10 @@ ContentLauncherAttrAccess gContentLauncherAttrAccess; CHIP_ERROR ContentLauncherAttrAccess::Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) { + CHIP_ERROR err = CHIP_NO_ERROR; EndpointId endpoint = aPath.mEndpointId; Delegate * delegate = GetDelegate(endpoint); - if (SendStatusIfDelegateNull(delegate, endpoint)) - { - return CHIP_NO_ERROR; - } + VerifyOrExit(SendStatusIfDelegateNull(delegate, endpoint) != true, err = CHIP_ERROR_INCORRECT_STATE); switch (aPath.mAttributeId) { @@ -146,7 +143,16 @@ CHIP_ERROR ContentLauncherAttrAccess::Read(const app::ConcreteReadAttributePath break; } } - return CHIP_NO_ERROR; + +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "ContentLauncherAttrAccess::Read error: %s", err.AsString()); + + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + } + + return err; } CHIP_ERROR ContentLauncherAttrAccess::ReadAcceptHeaderAttribute(app::AttributeValueEncoder & aEncoder, Delegate * delegate) @@ -181,27 +187,26 @@ bool emberAfContentLauncherClusterLaunchContentCallback( chip::app::Clusters::ContentLauncher::Commands::LaunchContentResponse::Type response; EndpointId endpoint = commandPath.mEndpointId; - auto & autoplay = commandData.autoPlay; - auto & data = commandData.data; + auto & autoplay = commandData.autoPlay; + auto & data = commandData.data; // TODO: Decode the paramater and pass it to delegate // auto searchIterator = commandData.search.begin(); std::list parameterList; Delegate * delegate = GetDelegate(endpoint); - if (SendStatusIfDelegateNull(delegate, endpoint)) + VerifyOrExit(SendStatusIfDelegateNull(delegate, endpoint) != true, err = CHIP_ERROR_INCORRECT_STATE); + { - return true; + ContentLaunchResponse resp = delegate->HandleLaunchContent(emberAfCurrentEndpoint(), parameterList, autoplay, data); + VerifyOrExit(resp.err == CHIP_NO_ERROR, err = resp.err); + + response.contentLaunchStatus = resp.status; + response.data = resp.data; + + err = commandObj->AddResponseData(commandPath, response); + SuccessOrExit(err); } - ContentLaunchResponse resp = delegate->HandleLaunchContent(emberAfCurrentEndpoint(), parameterList, autoplay, data); - VerifyOrExit(resp.err == CHIP_NO_ERROR, err = resp.err); - - response.contentLaunchStatus = resp.status; - response.data = resp.data; - - err = commandObj->AddResponseData(commandPath, response); - SuccessOrExit(err); - exit: if (err != CHIP_NO_ERROR) { @@ -221,28 +226,25 @@ bool emberAfContentLauncherClusterLaunchURLCallback( chip::app::Clusters::ContentLauncher::Commands::LaunchURLResponse::Type response; EndpointId endpoint = commandPath.mEndpointId; - - auto & contentUrl = commandData.contentURL; - auto & displayString = commandData.displayString; + auto & contentUrl = commandData.contentURL; + auto & displayString = commandData.displayString; // TODO: Decode the paramater and pass it to delegate // auto brandingInformationIterator = commandData.brandingInformation.begin(); std::list brandingInformationList; - Delegate * delegate = GetDelegate(endpoint); - if (SendStatusIfDelegateNull(delegate, endpoint)) - { - return true; - } + VerifyOrExit(SendStatusIfDelegateNull(delegate, endpoint) != true, err = CHIP_ERROR_INCORRECT_STATE); - ContentLaunchResponse resp = delegate->HandleLaunchUrl(contentUrl, displayString, brandingInformationList); - VerifyOrExit(resp.err == CHIP_NO_ERROR, err = resp.err); + { + ContentLaunchResponse resp = delegate->HandleLaunchUrl(contentUrl, displayString, brandingInformationList); + VerifyOrExit(resp.err == CHIP_NO_ERROR, err = resp.err); - response.contentLaunchStatus = resp.status; - response.data = resp.data; + response.contentLaunchStatus = resp.status; + response.data = resp.data; - err = commandObj->AddResponseData(commandPath, response); - SuccessOrExit(err); + err = commandObj->AddResponseData(commandPath, response); + SuccessOrExit(err); + } exit: if (err != CHIP_NO_ERROR) diff --git a/third_party/qpg_sdk/repo b/third_party/qpg_sdk/repo index 8742616cc7e8fe..edb134291c9f0c 160000 --- a/third_party/qpg_sdk/repo +++ b/third_party/qpg_sdk/repo @@ -1 +1 @@ -Subproject commit 8742616cc7e8fef7ec40241b9d6ff550627e0500 +Subproject commit edb134291c9f0cb661c2e95dcf643cd334dca810 diff --git a/zzz_generated/tv-app/zap-generated/attribute-size.cpp b/zzz_generated/tv-app/zap-generated/attribute-size.cpp index 455380a3520a50..c4e02a5c0a02cf 100644 --- a/zzz_generated/tv-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/tv-app/zap-generated/attribute-size.cpp @@ -158,7 +158,7 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo uint16_t entryOffset = kSizeLengthInBytes; switch (am->attributeId) { - case 0x0000: // accepts header list + case 0x0000: // accept header list { entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, static_cast(index - 1)); if (entryOffset == 0) @@ -167,22 +167,22 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo return 0; } - ByteSpan * acceptsHeaderListSpan = reinterpret_cast(write ? src : dest); // OCTET_STRING - uint16_t acceptsHeaderListRemainingSpace = static_cast(am->size - entryOffset); + ByteSpan * acceptHeaderListSpan = reinterpret_cast(write ? src : dest); // OCTET_STRING + uint16_t acceptHeaderListRemainingSpace = static_cast(am->size - entryOffset); if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, acceptsHeaderListRemainingSpace, acceptsHeaderListSpan) - : ReadByteSpan(src + entryOffset, acceptsHeaderListRemainingSpace, acceptsHeaderListSpan))) + (write ? WriteByteSpan(dest + entryOffset, acceptHeaderListRemainingSpace, acceptHeaderListSpan) + : ReadByteSpan(src + entryOffset, acceptHeaderListRemainingSpace, acceptHeaderListSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - if (!CanCastTo(acceptsHeaderListSpan->size())) + if (!CanCastTo(acceptHeaderListSpan->size())) { - ChipLogError(Zcl, "Span size %zu is too large", acceptsHeaderListSpan->size()); + ChipLogError(Zcl, "Span size %zu is too large", acceptHeaderListSpan->size()); return 0; } - entryLength = static_cast(acceptsHeaderListSpan->size()); + entryLength = static_cast(acceptHeaderListSpan->size()); break; } } @@ -864,7 +864,7 @@ uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attribut case 0x050A: // Content Launcher Cluster switch (attributeId) { - case 0x0000: // accepts header list + case 0x0000: // accept header list // chip::ByteSpan return GetByteSpanOffsetFromIndex(buffer, 256, entryCount); break; @@ -1019,4 +1019,4 @@ uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attribut } return static_cast(totalSize); -} +} \ No newline at end of file diff --git a/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp b/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp index f23dd96d4c3c84..15358d0ab4dc0e 100644 --- a/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp @@ -158,7 +158,7 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo uint16_t entryOffset = kSizeLengthInBytes; switch (am->attributeId) { - case 0x0000: // accepts header list + case 0x0000: // accept header list { entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, static_cast(index - 1)); if (entryOffset == 0) @@ -167,22 +167,22 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo return 0; } - ByteSpan * acceptsHeaderListSpan = reinterpret_cast(write ? src : dest); // OCTET_STRING - uint16_t acceptsHeaderListRemainingSpace = static_cast(am->size - entryOffset); + ByteSpan * acceptHeaderListSpan = reinterpret_cast(write ? src : dest); // OCTET_STRING + uint16_t acceptHeaderListRemainingSpace = static_cast(am->size - entryOffset); if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, acceptsHeaderListRemainingSpace, acceptsHeaderListSpan) - : ReadByteSpan(src + entryOffset, acceptsHeaderListRemainingSpace, acceptsHeaderListSpan))) + (write ? WriteByteSpan(dest + entryOffset, acceptHeaderListRemainingSpace, acceptHeaderListSpan) + : ReadByteSpan(src + entryOffset, acceptHeaderListRemainingSpace, acceptHeaderListSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - if (!CanCastTo(acceptsHeaderListSpan->size())) + if (!CanCastTo(acceptHeaderListSpan->size())) { - ChipLogError(Zcl, "Span size %zu is too large", acceptsHeaderListSpan->size()); + ChipLogError(Zcl, "Span size %zu is too large", acceptHeaderListSpan->size()); return 0; } - entryLength = static_cast(acceptsHeaderListSpan->size()); + entryLength = static_cast(acceptHeaderListSpan->size()); break; } } @@ -974,7 +974,7 @@ uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attribut case 0x050A: // Content Launcher Cluster switch (attributeId) { - case 0x0000: // accepts header list + case 0x0000: // accept header list // chip::ByteSpan return GetByteSpanOffsetFromIndex(buffer, 256, entryCount); break; @@ -1155,4 +1155,4 @@ uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attribut } return static_cast(totalSize); -} +} \ No newline at end of file