Skip to content

Commit e7a2d2e

Browse files
hicklinrestyled-commits
authored andcommitted
Update service area xml from 07 (project-chip#34738)
* 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 * Missed a submudule update. --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent ed7983d commit e7a2d2e

File tree

48 files changed

+911
-555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+911
-555
lines changed

examples/rvc-app/rvc-common/include/rvc-device.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ class RvcDevice
4444
mRunModeDelegate(), mRunModeInstance(&mRunModeDelegate, aRvcClustersEndpoint, RvcRunMode::Id, 0), mCleanModeDelegate(),
4545
mCleanModeInstance(&mCleanModeDelegate, aRvcClustersEndpoint, RvcCleanMode::Id, 0), mOperationalStateDelegate(),
4646
mOperationalStateInstance(&mOperationalStateDelegate, aRvcClustersEndpoint), mServiceAreaDelegate(),
47-
mServiceAreaInstance(&mServiceAreaDelegate, aRvcClustersEndpoint, BitMask<ServiceArea::Feature>(0))
47+
mServiceAreaInstance(&mServiceAreaDelegate, aRvcClustersEndpoint,
48+
BitMask<ServiceArea::Feature>(ServiceArea::Feature::kMaps, ServiceArea::Feature::kProgressReporting))
4849
{
4950
// set the current-mode at start-up
5051
mRunModeInstance.UpdateCurrentMode(RvcRunMode::ModeIdle);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class RvcServiceAreaDelegate : public Delegate
4949
bool IsValidSelectAreasSet(const ServiceArea::Commands::SelectAreas::DecodableType & req,
5050
ServiceArea::SelectAreasStatus & locationStatus, MutableCharSpan statusText) override;
5151

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

5454
//*************************************************************************
5555
// Supported Locations accessors
@@ -78,7 +78,7 @@ class RvcServiceAreaDelegate : public Delegate
7878

7979
bool GetSupportedMapByIndex(uint32_t listIndex, ServiceArea::MapStructureWrapper & supportedMap) override;
8080

81-
bool GetSupportedMapById(uint8_t aMapId, uint32_t & listIndex, ServiceArea::MapStructureWrapper & supportedMap) override;
81+
bool GetSupportedMapById(uint32_t aMapId, uint32_t & listIndex, ServiceArea::MapStructureWrapper & supportedMap) override;
8282

8383
bool AddSupportedMap(const ServiceArea::MapStructureWrapper & newMap, uint32_t & listIndex) override;
8484

examples/rvc-app/rvc-common/rvc-app.matter

+22-13
Original file line numberDiff line numberDiff line change
@@ -1424,9 +1424,9 @@ cluster RvcOperationalState = 97 {
14241424
command GoHome(): OperationalCommandResponse = 128;
14251425
}
14261426

1427-
/** The Service Area cluster provides an interface for controlling the locations where a device should operate, and for querying the current location. */
1427+
/** The Service Area cluster provides an interface for controlling the areas where a device should operate, and for querying the current area being serviced. */
14281428
provisional cluster ServiceArea = 336 {
1429-
revision 1; // NOTE: Default/not specifically set
1429+
revision 1;
14301430

14311431
enum OperationalStatusEnum : enum8 {
14321432
kPending = 0;
@@ -1447,28 +1447,33 @@ provisional cluster ServiceArea = 336 {
14471447
kSuccess = 0;
14481448
kInvalidAreaList = 1;
14491449
kInvalidInMode = 2;
1450+
kInvalidSkippedArea = 3;
14501451
}
14511452

14521453
bitmap Feature : bitmap32 {
1453-
kListOrder = 0x1;
1454-
kSelectWhileRunning = 0x2;
1454+
kSelectWhileRunning = 0x1;
1455+
kProgressReporting = 0x2;
1456+
kMaps = 0x4;
1457+
}
1458+
1459+
struct LandmarkInfoStruct {
1460+
LandmarkTag landmarkTag = 0;
1461+
nullable RelativePositionTag positionTag = 1;
14551462
}
14561463

14571464
struct AreaInfoStruct {
14581465
nullable LocationDescriptorStruct locationInfo = 0;
1459-
nullable LandmarkTag landmarkTag = 1;
1460-
nullable PositionTag positionTag = 2;
1461-
nullable FloorSurfaceTag surfaceTag = 3;
1466+
nullable LandmarkInfoStruct landmarkInfo = 1;
14621467
}
14631468

14641469
struct AreaStruct {
14651470
int32u areaID = 0;
1466-
nullable int8u mapID = 1;
1471+
nullable int32u mapID = 1;
14671472
AreaInfoStruct areaDesc = 2;
14681473
}
14691474

14701475
struct MapStruct {
1471-
int8u mapID = 0;
1476+
int32u mapID = 0;
14721477
char_string<64> name = 1;
14731478
}
14741479

@@ -1480,7 +1485,7 @@ provisional cluster ServiceArea = 336 {
14801485
}
14811486

14821487
readonly attribute AreaStruct supportedAreas[] = 0;
1483-
readonly attribute MapStruct supportedMaps[] = 1;
1488+
readonly attribute optional MapStruct supportedMaps[] = 1;
14841489
readonly attribute int32u selectedAreas[] = 2;
14851490
readonly attribute optional nullable int32u currentArea = 3;
14861491
readonly attribute optional nullable epoch_s estimatedEndTime = 4;
@@ -1498,18 +1503,22 @@ provisional cluster ServiceArea = 336 {
14981503

14991504
response struct SelectAreasResponse = 1 {
15001505
SelectAreasStatus status = 0;
1501-
optional char_string<256> statusText = 1;
1506+
char_string<256> statusText = 1;
1507+
}
1508+
1509+
request struct SkipAreaRequest {
1510+
int32u skippedArea = 0;
15021511
}
15031512

15041513
response struct SkipAreaResponse = 3 {
15051514
SkipAreaStatus status = 0;
1506-
optional char_string<256> statusText = 1;
1515+
char_string<256> statusText = 1;
15071516
}
15081517

15091518
/** Command used to select a set of device areas, where the device is to operate. */
15101519
command SelectAreas(SelectAreasRequest): SelectAreasResponse = 0;
15111520
/** This command is used to skip an area where the device operates. */
1512-
command SkipArea(): SkipAreaResponse = 2;
1521+
command SkipArea(SkipAreaRequest): SkipAreaResponse = 2;
15131522
}
15141523

15151524
endpoint 0 {

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

+18-20
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
#include <app-common/zap-generated/attributes/Accessors.h>
1919
#include <rvc-service-area-delegate.h>
20+
#include <vector>
2021

2122
using namespace chip;
2223
using namespace chip::app::Clusters;
@@ -25,8 +26,8 @@ using namespace chip::app::Clusters::ServiceArea;
2526
CHIP_ERROR RvcServiceAreaDelegate::Init()
2627
{
2728
// hardcoded fill of SUPPORTED MAPS for prototyping
28-
uint8_t supportedMapId_XX = 3;
29-
uint8_t supportedMapId_YY = 245;
29+
uint32_t supportedMapId_XX = 3;
30+
uint32_t supportedMapId_YY = 245;
3031

3132
GetInstance()->AddSupportedMap(supportedMapId_XX, "My Map XX"_span);
3233
GetInstance()->AddSupportedMap(supportedMapId_YY, "My Map YY"_span);
@@ -38,32 +39,29 @@ CHIP_ERROR RvcServiceAreaDelegate::Init()
3839
uint32_t supportedAreaID_D = 0x88888888;
3940

4041
// Location A has name, floor number, uses map XX
41-
GetInstance()->AddSupportedLocation(
42-
supportedAreaID_A, DataModel::Nullable<uint_fast8_t>(supportedMapId_XX), "My Location A"_span,
43-
DataModel::Nullable<int16_t>(4), DataModel::Nullable<Globals::AreaTypeTag>(), DataModel::Nullable<Globals::LandmarkTag>(),
44-
DataModel::Nullable<Globals::PositionTag>(), DataModel::Nullable<Globals::FloorSurfaceTag>());
42+
GetInstance()->AddSupportedLocation(supportedAreaID_A, DataModel::Nullable<uint32_t>(supportedMapId_XX), "My Location A"_span,
43+
DataModel::Nullable<int16_t>(4), DataModel::Nullable<Globals::AreaTypeTag>(),
44+
DataModel::Nullable<Globals::LandmarkTag>(),
45+
DataModel::Nullable<Globals::RelativePositionTag>());
4546

4647
// Location B has name, uses map XX
47-
GetInstance()->AddSupportedLocation(
48-
supportedAreaID_B, DataModel::Nullable<uint_fast8_t>(supportedMapId_XX), "My Location B"_span,
49-
DataModel::Nullable<int16_t>(), DataModel::Nullable<Globals::AreaTypeTag>(), DataModel::Nullable<Globals::LandmarkTag>(),
50-
DataModel::Nullable<Globals::PositionTag>(), DataModel::Nullable<Globals::FloorSurfaceTag>());
48+
GetInstance()->AddSupportedLocation(supportedAreaID_B, DataModel::Nullable<uint32_t>(supportedMapId_XX), "My Location B"_span,
49+
DataModel::Nullable<int16_t>(), DataModel::Nullable<Globals::AreaTypeTag>(),
50+
DataModel::Nullable<Globals::LandmarkTag>(),
51+
DataModel::Nullable<Globals::RelativePositionTag>());
5152

5253
// Location C has full SemData, no name, Map YY
53-
GetInstance()->AddSupportedLocation(supportedAreaID_C, DataModel::Nullable<uint_fast8_t>(supportedMapId_YY), CharSpan(),
54+
GetInstance()->AddSupportedLocation(supportedAreaID_C, DataModel::Nullable<uint32_t>(supportedMapId_YY), CharSpan(),
5455
DataModel::Nullable<int16_t>(-1),
5556
DataModel::Nullable<Globals::AreaTypeTag>(Globals::AreaTypeTag::kPlayRoom),
5657
DataModel::Nullable<Globals::LandmarkTag>(Globals::LandmarkTag::kBackDoor),
57-
DataModel::Nullable<Globals::PositionTag>(Globals::PositionTag::kLeft),
58-
DataModel::Nullable<Globals::FloorSurfaceTag>(Globals::FloorSurfaceTag::kConcrete));
58+
DataModel::Nullable<Globals::RelativePositionTag>(Globals::RelativePositionTag::kNextTo));
5959

6060
// Location D has null values for all HomeLocationStruct fields, Map YY
61-
GetInstance()->AddSupportedLocation(supportedAreaID_D, DataModel::Nullable<uint_fast8_t>(supportedMapId_YY),
62-
"My Location D"_span, DataModel::Nullable<int16_t>(),
63-
DataModel::Nullable<Globals::AreaTypeTag>(),
61+
GetInstance()->AddSupportedLocation(supportedAreaID_D, DataModel::Nullable<uint32_t>(supportedMapId_YY), "My Location D"_span,
62+
DataModel::Nullable<int16_t>(), DataModel::Nullable<Globals::AreaTypeTag>(),
6463
DataModel::Nullable<Globals::LandmarkTag>(Globals::LandmarkTag::kCouch),
65-
DataModel::Nullable<Globals::PositionTag>(Globals::PositionTag::kLeft),
66-
DataModel::Nullable<Globals::FloorSurfaceTag>(Globals::FloorSurfaceTag::kHardwood));
64+
DataModel::Nullable<Globals::RelativePositionTag>(Globals::RelativePositionTag::kNextTo));
6765

6866
GetInstance()->SetCurrentArea(supportedAreaID_C);
6967

@@ -86,7 +84,7 @@ bool RvcServiceAreaDelegate::IsValidSelectAreasSet(const Commands::SelectAreas::
8684
return true;
8785
};
8886

89-
bool RvcServiceAreaDelegate::HandleSkipCurrentArea(MutableCharSpan skipStatusText)
87+
bool RvcServiceAreaDelegate::HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan skipStatusText)
9088
{
9189
// TODO IMPLEMENT
9290
return true;
@@ -213,7 +211,7 @@ bool RvcServiceAreaDelegate::GetSupportedMapByIndex(uint32_t listIndex, MapStruc
213211
return false;
214212
};
215213

216-
bool RvcServiceAreaDelegate::GetSupportedMapById(uint8_t aMapId, uint32_t & listIndex, MapStructureWrapper & aSupportedMap)
214+
bool RvcServiceAreaDelegate::GetSupportedMapById(uint32_t aMapId, uint32_t & listIndex, MapStructureWrapper & aSupportedMap)
217215
{
218216
// We do not need to reimplement this method as it's already done by the SDK.
219217
// We are reimplementing this method, still using linear search, but with some optimization on the SDK implementation

0 commit comments

Comments
 (0)