From a190f440b8f89bd405e725d127249318e3150dfe Mon Sep 17 00:00:00 2001 From: William Date: Fri, 9 Aug 2024 15:12:39 +0100 Subject: [PATCH 1/2] Address comments from reviews (#34884) * Updated the golabl data type's XMLs, removing the cluster entries. * Zap generated after XML update. * Fixed namespaces used of global structs. * Restyled by clang-format * Renamed LocationInfoStruct to AreaInfoStruct. * Zap generated after XML update. * Renamed LocationStruct to AreaStruct and its LocationID and LocationDesc fields. * Zap generated after XML update. * Updated SDK and example code to match the new naming. * Updated the ProgressStruct's LocationID name to AreaID. * Zap generated after XML update. * Updated the SDK code following name changes. * Updated the SelectLocationsStatus and SkipLocationStatus enum names and some of their enums. * Zap generated after XML update. * Updated the SelectLocationsStatus and SkipCurrentLocationStatus names and their enum names. * Updated the names of the SupportedLocations, SelectedLocations and CurrentLocation attributes. * Zap generated after XML update. * Updated the changed names in the SDK. * Updated the service area command names in XML. * Zap generated after XML update. * Updated the service area command names in the SDK. * Updated the rvc-example zap file. * Refactored LocationStructureWrapper to AreaStructureWrapper. * Restyled by clang-format * Regenerated zap files due to changes upsteram. * Removed unused generated file. * Updated the Service Area XML marking previously nullabel attributes as not-nullable. * Zap generated after XML update. * Updated the attribute encoding and some server logic following the romoval of the nullable quality for some attributes. * Explicitly set the Service Area version. * Zap generated after XML update. * Updated the service area features in the XML to match the current spec. * Zap generated after XML update. * Updated the SupportedArea validation logic as if the MAPS feature is not supported, the Delegate may choose not to implement map related methods. * Change the type of the MapID to uint32 to match the spec. * Added the SkippedArea arg to the SkipArea command. * Zap generated after XML update. * Updated the Service Area server code to handle the new SkippedArea command arg. * Updated the service area XML to match the current spec. This includes the addition of the LandmarkInfoStruct and updates of AreaInfoStruct, SelectAreasStatus. * Zap generated after XML update. * Updated SDK server code and rvc-example after changes to the XML. * Restyled by whitespace * added vector include. * spacing changes form zap regen. * Fixed minor mistake during merge. * Restyled by clang-format * Applied suggestions from review. * Restyled by whitespace * Updated the LondmarkInfoSturct PositionTag type. * Zap generated after XML update. * Fixed SDK following update to the position type. * Restyled by clang-format * Updated the AeraStructWrapper to not contain methods with a large number of params. Updated some relate Instance and Delegate methods. * Restyled by whitespace * Restyled by clang-format * Missed a submudule update. * Made the setters reture a ref to the sturct to allow chaining. * simplified the = oporator and add the == operator. * Restyled by clang-format * minor change to get restyler going. * Restyled by clang-format * Fixed status text referance issue. * Fixed issue casued by a change in the way that registrations are made. * Fixed styling and minor bug in IsValidSupportedArea. --------- Co-authored-by: Restyled.io --- .../include/rvc-service-area-delegate.h | 6 ++-- .../src/rvc-service-area-delegate.cpp | 6 ++-- .../service-area-delegate.h | 6 ++-- .../service-area-server.cpp | 31 ++++++++----------- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h b/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h index 5397e3096c14ae..41b8415c3dbde6 100644 --- a/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h +++ b/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h @@ -44,12 +44,12 @@ class RvcServiceAreaDelegate : public Delegate CHIP_ERROR Init() override; // command support - bool IsSetSelectedAreasAllowed(MutableCharSpan statusText) override; + bool IsSetSelectedAreasAllowed(MutableCharSpan & statusText) override; bool IsValidSelectAreasSet(const ServiceArea::Commands::SelectAreas::DecodableType & req, - ServiceArea::SelectAreasStatus & areaStatus, MutableCharSpan statusText) override; + ServiceArea::SelectAreasStatus & areaStatus, MutableCharSpan & statusText) override; - bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan skipStatusText) override; + bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) override; //************************************************************************* // Supported Areas accessors diff --git a/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp b/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp index 1bc60baa0774cd..d92910ea1abaae 100644 --- a/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp +++ b/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp @@ -77,20 +77,20 @@ CHIP_ERROR RvcServiceAreaDelegate::Init() //************************************************************************* // command support -bool RvcServiceAreaDelegate::IsSetSelectedAreasAllowed(MutableCharSpan statusText) +bool RvcServiceAreaDelegate::IsSetSelectedAreasAllowed(MutableCharSpan & statusText) { // TODO IMPLEMENT return true; }; bool RvcServiceAreaDelegate::IsValidSelectAreasSet(const Commands::SelectAreas::DecodableType & req, SelectAreasStatus & areaStatus, - MutableCharSpan statusText) + MutableCharSpan & statusText) { // TODO IMPLEMENT return true; }; -bool RvcServiceAreaDelegate::HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan skipStatusText) +bool RvcServiceAreaDelegate::HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) { // TODO IMPLEMENT return true; diff --git a/src/app/clusters/service-area-server/service-area-delegate.h b/src/app/clusters/service-area-server/service-area-delegate.h index e31abf98f9e745..24db2b10a7dcc6 100644 --- a/src/app/clusters/service-area-server/service-area-delegate.h +++ b/src/app/clusters/service-area-server/service-area-delegate.h @@ -72,7 +72,7 @@ class Delegate * @note The statusText field SHOULD indicate why the request is not allowed, given the current mode * of the device, which may involve other clusters. */ - virtual bool IsSetSelectedAreasAllowed(MutableCharSpan statusText) = 0; + virtual bool IsSetSelectedAreasAllowed(MutableCharSpan & statusText) = 0; /** * Given a set of locations to be set to the SelectedAreas attribute, this method should check that @@ -92,7 +92,7 @@ class Delegate * device must stop. */ virtual bool IsValidSelectAreasSet(const Commands::SelectAreas::DecodableType & req, SelectAreasStatus & locationStatus, - MutableCharSpan statusText) = 0; + MutableCharSpan & statusText) = 0; /** * @brief The server instance ensures that the SelectedAreas and CurrentArea attributes are not null before @@ -121,7 +121,7 @@ class Delegate * InvalidInMode, the StatusText field SHOULD indicate why the request is not allowed, given the current mode of the device, * which may involve other clusters. */ - virtual bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan skipStatusText) + virtual bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) { // device support of this command is optional CopyCharSpanToMutableCharSpan("Skip Current Area command not supported by device"_span, skipStatusText); diff --git a/src/app/clusters/service-area-server/service-area-server.cpp b/src/app/clusters/service-area-server/service-area-server.cpp index d745c04b5d468e..5f8b8ea70e179d 100644 --- a/src/app/clusters/service-area-server/service-area-server.cpp +++ b/src/app/clusters/service-area-server/service-area-server.cpp @@ -399,6 +399,8 @@ void Instance::HandleSkipCurrentAreaCmd(HandlerContext & ctx, const Commands::Sk exitResponse(SkipAreaStatus::kInvalidInMode, skipStatusText); return; } + + exitResponse(SkipAreaStatus::kSuccess, ""_span); } //************************************************************************* @@ -469,35 +471,28 @@ bool Instance::IsValidSupportedArea(const AreaStructureWrapper & aArea) } // The mapID field SHALL be null if SupportedMaps is not supported or SupportedMaps is an empty list. - bool shouldMapsBeNull = false; - if (mFeature.Has(Feature::kMaps)) + if (mFeature.Has(Feature::kMaps) && (mDelegate->GetNumberOfSupportedMaps() > 0)) { - if (mDelegate->GetNumberOfSupportedMaps() == 0) + if (aArea.mapID.IsNull()) { - shouldMapsBeNull = true; + ChipLogDetail(Zcl, "IsValidSupportedArea %u - map Id should not be null when there are supported maps", aArea.areaID); + return false; } - } - else - { - shouldMapsBeNull = true; - } - if (shouldMapsBeNull) - { - if (!aArea.mapID.IsNull()) + // If the SupportedMaps attribute is not null, mapID SHALL be the ID of an entry from the SupportedMaps attribute. + if (!IsSupportedMap(aArea.mapID.Value())) { - ChipLogDetail(Zcl, "IsValidSupportedArea %u - map Id %u is not in empty supported map list", aArea.areaID, - aArea.mapID.Value()); + ChipLogError(Zcl, "IsValidSupportedArea %u - map Id %u is not in supported map list", aArea.areaID, + aArea.mapID.Value()); return false; } } else { - // If the SupportedMaps attribute is not null, mapID SHALL be the ID of an entry from the SupportedMaps attribute. - if (!IsSupportedMap(aArea.mapID.Value())) + if (!aArea.mapID.IsNull()) { - ChipLogError(Zcl, "IsValidSupportedArea %u - map Id %u is not in supported map list", aArea.areaID, - aArea.mapID.Value()); + ChipLogDetail(Zcl, "IsValidSupportedArea %u - map Id %u is not in empty supported map list", aArea.areaID, + aArea.mapID.Value()); return false; } } From 6cff19c2ec3107b2023d47648b2742ca7c801d49 Mon Sep 17 00:00:00 2001 From: Rohan Sahay Date: Fri, 9 Aug 2024 20:23:16 +0530 Subject: [PATCH 2/2] feat: Add lazy loading for images in BaseApplicationDelegate (#34774) --- examples/platform/silabs/BaseApplication.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/examples/platform/silabs/BaseApplication.cpp b/examples/platform/silabs/BaseApplication.cpp index beda9d3a6981f1..99123c5bf764d1 100644 --- a/examples/platform/silabs/BaseApplication.cpp +++ b/examples/platform/silabs/BaseApplication.cpp @@ -188,6 +188,17 @@ void BaseApplicationDelegate::OnCommissioningWindowClosed() } } #endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 + if (BaseApplication::GetProvisionStatus()) + { +#ifdef DISPLAY_ENABLED +#ifdef QR_CODE_ENABLED + SilabsLCD::Screen_e screen; + slLCD.GetScreen(screen); + VerifyOrReturn(screen == SilabsLCD::Screen_e::QRCodeScreen); + slLCD.SetScreen(SilabsLCD::Screen_e::DemoScreen); +#endif // QR_CODE_ENABLED +#endif // DISPLAY_ENABLED + } } void BaseApplicationDelegate::OnFabricCommitted(const FabricTable & fabricTable, FabricIndex fabricIndex)