Skip to content

Commit 77101e0

Browse files
hicklinrestyled-commits
authored andcommitted
Address comments from reviews (project-chip#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 <commits@restyled.io>
1 parent ccb4e98 commit 77101e0

File tree

4 files changed

+22
-27
lines changed

4 files changed

+22
-27
lines changed

examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ class RvcServiceAreaDelegate : public Delegate
4444
CHIP_ERROR Init() override;
4545

4646
// command support
47-
bool IsSetSelectedAreasAllowed(MutableCharSpan statusText) override;
47+
bool IsSetSelectedAreasAllowed(MutableCharSpan & statusText) override;
4848

4949
bool IsValidSelectAreasSet(const ServiceArea::Commands::SelectAreas::DecodableType & req,
50-
ServiceArea::SelectAreasStatus & areaStatus, MutableCharSpan statusText) override;
50+
ServiceArea::SelectAreasStatus & areaStatus, MutableCharSpan & statusText) override;
5151

52-
bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan skipStatusText) override;
52+
bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) override;
5353

5454
//*************************************************************************
5555
// Supported Areas accessors

examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,20 @@ CHIP_ERROR RvcServiceAreaDelegate::Init()
7777
//*************************************************************************
7878
// command support
7979

80-
bool RvcServiceAreaDelegate::IsSetSelectedAreasAllowed(MutableCharSpan statusText)
80+
bool RvcServiceAreaDelegate::IsSetSelectedAreasAllowed(MutableCharSpan & statusText)
8181
{
8282
// TODO IMPLEMENT
8383
return true;
8484
};
8585

8686
bool RvcServiceAreaDelegate::IsValidSelectAreasSet(const Commands::SelectAreas::DecodableType & req, SelectAreasStatus & areaStatus,
87-
MutableCharSpan statusText)
87+
MutableCharSpan & statusText)
8888
{
8989
// TODO IMPLEMENT
9090
return true;
9191
};
9292

93-
bool RvcServiceAreaDelegate::HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan skipStatusText)
93+
bool RvcServiceAreaDelegate::HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan & skipStatusText)
9494
{
9595
// TODO IMPLEMENT
9696
return true;

src/app/clusters/service-area-server/service-area-delegate.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Delegate
7272
* @note The statusText field SHOULD indicate why the request is not allowed, given the current mode
7373
* of the device, which may involve other clusters.
7474
*/
75-
virtual bool IsSetSelectedAreasAllowed(MutableCharSpan statusText) = 0;
75+
virtual bool IsSetSelectedAreasAllowed(MutableCharSpan & statusText) = 0;
7676

7777
/**
7878
* Given a set of locations to be set to the SelectedAreas attribute, this method should check that
@@ -92,7 +92,7 @@ class Delegate
9292
* device must stop.
9393
*/
9494
virtual bool IsValidSelectAreasSet(const Commands::SelectAreas::DecodableType & req, SelectAreasStatus & locationStatus,
95-
MutableCharSpan statusText) = 0;
95+
MutableCharSpan & statusText) = 0;
9696

9797
/**
9898
* @brief The server instance ensures that the SelectedAreas and CurrentArea attributes are not null before
@@ -121,7 +121,7 @@ class Delegate
121121
* InvalidInMode, the StatusText field SHOULD indicate why the request is not allowed, given the current mode of the device,
122122
* which may involve other clusters.
123123
*/
124-
virtual bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan skipStatusText)
124+
virtual bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan & skipStatusText)
125125
{
126126
// device support of this command is optional
127127
CopyCharSpanToMutableCharSpan("Skip Current Area command not supported by device"_span, skipStatusText);

src/app/clusters/service-area-server/service-area-server.cpp

+13-18
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,8 @@ void Instance::HandleSkipCurrentAreaCmd(HandlerContext & ctx, const Commands::Sk
399399
exitResponse(SkipAreaStatus::kInvalidInMode, skipStatusText);
400400
return;
401401
}
402+
403+
exitResponse(SkipAreaStatus::kSuccess, ""_span);
402404
}
403405

404406
//*************************************************************************
@@ -469,35 +471,28 @@ bool Instance::IsValidSupportedArea(const AreaStructureWrapper & aArea)
469471
}
470472

471473
// The mapID field SHALL be null if SupportedMaps is not supported or SupportedMaps is an empty list.
472-
bool shouldMapsBeNull = false;
473-
if (mFeature.Has(Feature::kMaps))
474+
if (mFeature.Has(Feature::kMaps) && (mDelegate->GetNumberOfSupportedMaps() > 0))
474475
{
475-
if (mDelegate->GetNumberOfSupportedMaps() == 0)
476+
if (aArea.mapID.IsNull())
476477
{
477-
shouldMapsBeNull = true;
478+
ChipLogDetail(Zcl, "IsValidSupportedArea %u - map Id should not be null when there are supported maps", aArea.areaID);
479+
return false;
478480
}
479-
}
480-
else
481-
{
482-
shouldMapsBeNull = true;
483-
}
484481

485-
if (shouldMapsBeNull)
486-
{
487-
if (!aArea.mapID.IsNull())
482+
// If the SupportedMaps attribute is not null, mapID SHALL be the ID of an entry from the SupportedMaps attribute.
483+
if (!IsSupportedMap(aArea.mapID.Value()))
488484
{
489-
ChipLogDetail(Zcl, "IsValidSupportedArea %u - map Id %u is not in empty supported map list", aArea.areaID,
490-
aArea.mapID.Value());
485+
ChipLogError(Zcl, "IsValidSupportedArea %u - map Id %u is not in supported map list", aArea.areaID,
486+
aArea.mapID.Value());
491487
return false;
492488
}
493489
}
494490
else
495491
{
496-
// If the SupportedMaps attribute is not null, mapID SHALL be the ID of an entry from the SupportedMaps attribute.
497-
if (!IsSupportedMap(aArea.mapID.Value()))
492+
if (!aArea.mapID.IsNull())
498493
{
499-
ChipLogError(Zcl, "IsValidSupportedArea %u - map Id %u is not in supported map list", aArea.areaID,
500-
aArea.mapID.Value());
494+
ChipLogDetail(Zcl, "IsValidSupportedArea %u - map Id %u is not in empty supported map list", aArea.areaID,
495+
aArea.mapID.Value());
501496
return false;
502497
}
503498
}

0 commit comments

Comments
 (0)