Skip to content

Commit

Permalink
Updates Service Area with name changes since 0.7 (#34711)
Browse files Browse the repository at this point in the history
* 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.

* spacing changes form zap regen.

* Fixed minor mistake during merge.

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
hicklin and restyled-commits authored Aug 5, 2024
1 parent bbef51a commit c53d771
Show file tree
Hide file tree
Showing 55 changed files with 1,418 additions and 1,465 deletions.
36 changes: 18 additions & 18 deletions examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,39 @@ class RvcServiceAreaDelegate : public Delegate
{
private:
// containers for array attributes.
std::vector<ServiceArea::LocationStructureWrapper> mSupportedLocations;
std::vector<ServiceArea::AreaStructureWrapper> mSupportedAreas;
std::vector<ServiceArea::MapStructureWrapper> mSupportedMaps;
std::vector<uint32_t> mSelectedLocations;
std::vector<uint32_t> mSelectedAreas;
std::vector<ServiceArea::Structs::ProgressStruct::Type> mProgressList;

public:
CHIP_ERROR Init() override;

// command support
bool IsSetSelectedLocationsAllowed(MutableCharSpan statusText) override;
bool IsSetSelectedAreasAllowed(MutableCharSpan statusText) override;

bool IsValidSelectLocationsSet(const ServiceArea::Commands::SelectLocations::DecodableType & req,
ServiceArea::SelectLocationsStatus & locationStatus, MutableCharSpan statusText) override;
bool IsValidSelectAreasSet(const ServiceArea::Commands::SelectAreas::DecodableType & req,
ServiceArea::SelectAreasStatus & locationStatus, MutableCharSpan statusText) override;

bool HandleSkipCurrentLocation(MutableCharSpan skipStatusText) override;
bool HandleSkipCurrentArea(MutableCharSpan skipStatusText) override;

//*************************************************************************
// Supported Locations accessors

bool IsSupportedLocationsChangeAllowed() override;
bool IsSupportedAreasChangeAllowed() override;

uint32_t GetNumberOfSupportedLocations() override;
uint32_t GetNumberOfSupportedAreas() override;

bool GetSupportedLocationByIndex(uint32_t listIndex, ServiceArea::LocationStructureWrapper & supportedLocation) override;
bool GetSupportedLocationByIndex(uint32_t listIndex, ServiceArea::AreaStructureWrapper & supportedLocation) override;

bool GetSupportedLocationById(uint32_t aLocationId, uint32_t & listIndex,
ServiceArea::LocationStructureWrapper & supportedLocation) override;
bool GetSupportedLocationById(uint32_t aAreaId, uint32_t & listIndex,
ServiceArea::AreaStructureWrapper & supportedLocation) override;

bool AddSupportedLocation(const ServiceArea::LocationStructureWrapper & newLocation, uint32_t & listIndex) override;
bool AddSupportedLocation(const ServiceArea::AreaStructureWrapper & newArea, uint32_t & listIndex) override;

bool ModifySupportedLocation(uint32_t listIndex, const ServiceArea::LocationStructureWrapper & modifiedLocation) override;
bool ModifySupportedLocation(uint32_t listIndex, const ServiceArea::AreaStructureWrapper & modifiedLocation) override;

bool ClearSupportedLocations() override;
bool ClearSupportedAreas() override;

//*************************************************************************
// Supported Maps accessors
Expand All @@ -89,15 +89,15 @@ class RvcServiceAreaDelegate : public Delegate
//*************************************************************************
// Selected Locations accessors

uint32_t GetNumberOfSelectedLocations() override;
uint32_t GetNumberOfSelectedAreas() override;

bool GetSelectedLocationByIndex(uint32_t listIndex, uint32_t & selectedLocation) override;

// IsSelectedLocation() no override

bool AddSelectedLocation(uint32_t aLocationId, uint32_t & listIndex) override;
bool AddSelectedLocation(uint32_t aAreaId, uint32_t & listIndex) override;

bool ClearSelectedLocations() override;
bool ClearSelectedAreas() override;

//*************************************************************************
// Progress accessors
Expand All @@ -106,7 +106,7 @@ class RvcServiceAreaDelegate : public Delegate

bool GetProgressElementByIndex(uint32_t listIndex, ServiceArea::Structs::ProgressStruct::Type & aProgressElement) override;

bool GetProgressElementById(uint32_t aLocationId, uint32_t & listIndex,
bool GetProgressElementById(uint32_t aAreaId, uint32_t & listIndex,
ServiceArea::Structs::ProgressStruct::Type & aProgressElement) override;

bool AddProgressElement(const ServiceArea::Structs::ProgressStruct::Type & newProgressElement, uint32_t & listIndex) override;
Expand Down
60 changes: 30 additions & 30 deletions examples/rvc-app/rvc-common/rvc-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1421,17 +1421,17 @@ provisional cluster ServiceArea = 336 {
kCompleted = 3;
}

enum SelectLocationsStatus : enum8 {
enum SelectAreasStatus : enum8 {
kSuccess = 0;
kUnsupportedLocation = 1;
kDuplicatedLocations = 2;
kUnsupportedArea = 1;
kDuplicatedAreas = 2;
kInvalidInMode = 3;
kInvalidSet = 4;
}

enum SkipCurrentLocationStatus : enum8 {
enum SkipAreaStatus : enum8 {
kSuccess = 0;
kInvalidLocationList = 1;
kInvalidAreaList = 1;
kInvalidInMode = 2;
}

Expand All @@ -1440,17 +1440,17 @@ provisional cluster ServiceArea = 336 {
kSelectWhileRunning = 0x2;
}

struct LocationInfoStruct {
struct AreaInfoStruct {
nullable LocationDescriptorStruct locationInfo = 0;
nullable LandmarkTag landmarkTag = 1;
nullable PositionTag positionTag = 2;
nullable FloorSurfaceTag surfaceTag = 3;
}

struct LocationStruct {
int32u locationID = 0;
struct AreaStruct {
int32u areaID = 0;
nullable int8u mapID = 1;
LocationInfoStruct locationInfo = 2;
AreaInfoStruct areaDesc = 2;
}

struct MapStruct {
Expand All @@ -1459,16 +1459,16 @@ provisional cluster ServiceArea = 336 {
}

struct ProgressStruct {
int32u locationID = 0;
int32u areaID = 0;
OperationalStatusEnum status = 1;
optional nullable elapsed_s totalOperationalTime = 2;
optional nullable elapsed_s estimatedTime = 3;
}

readonly attribute LocationStruct supportedLocations[] = 0;
readonly attribute AreaStruct supportedAreas[] = 0;
readonly attribute nullable MapStruct supportedMaps[] = 1;
readonly attribute nullable int32u selectedLocations[] = 2;
readonly attribute optional nullable int32u currentLocation = 3;
readonly attribute nullable int32u selectedAreas[] = 2;
readonly attribute optional nullable int32u currentArea = 3;
readonly attribute optional nullable epoch_s estimatedEndTime = 4;
readonly attribute optional nullable ProgressStruct progress[] = 5;
readonly attribute command_id generatedCommandList[] = 65528;
Expand All @@ -1478,24 +1478,24 @@ provisional cluster ServiceArea = 336 {
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct SelectLocationsRequest {
nullable int32u newLocations[] = 0;
request struct SelectAreasRequest {
nullable int32u newAreas[] = 0;
}

response struct SelectLocationsResponse = 1 {
SelectLocationsStatus status = 0;
response struct SelectAreasResponse = 1 {
SelectAreasStatus status = 0;
optional char_string<256> statusText = 1;
}

response struct SkipCurrentLocationResponse = 3 {
SkipCurrentLocationStatus status = 0;
response struct SkipAreaResponse = 3 {
SkipAreaStatus status = 0;
optional char_string<256> statusText = 1;
}

/** Command used to select a set of device locations, where the device is to operate */
command SelectLocations(SelectLocationsRequest): SelectLocationsResponse = 0;
/** This command is used to skip the current location where the device operates. */
command SkipCurrentLocation(): SkipCurrentLocationResponse = 2;
/** Command used to select a set of device areas, where the device is to operate. */
command SelectAreas(SelectAreasRequest): SelectAreasResponse = 0;
/** This command is used to skip an area where the device operates. */
command SkipArea(): SkipAreaResponse = 2;
}

endpoint 0 {
Expand Down Expand Up @@ -1755,10 +1755,10 @@ endpoint 1 {
}

server cluster ServiceArea {
callback attribute supportedLocations;
callback attribute supportedAreas;
callback attribute supportedMaps;
callback attribute selectedLocations;
callback attribute currentLocation;
callback attribute selectedAreas;
callback attribute currentArea;
callback attribute estimatedEndTime;
callback attribute progress;
callback attribute generatedCommandList;
Expand All @@ -1768,10 +1768,10 @@ endpoint 1 {
callback attribute featureMap;
ram attribute clusterRevision default = 1;

handle command SelectLocations;
handle command SelectLocationsResponse;
handle command SkipCurrentLocation;
handle command SkipCurrentLocationResponse;
handle command SelectAreas;
handle command SelectAreasResponse;
handle command SkipArea;
handle command SkipAreaResponse;
}
}

Expand Down
21 changes: 11 additions & 10 deletions examples/rvc-app/rvc-common/rvc-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -2885,33 +2885,34 @@
"define": "SERVICE_AREA_CLUSTER",
"side": "server",
"enabled": 1,
"apiMaturity": "provisional",
"commands": [
{
"name": "SelectLocations",
"name": "SelectAreas",
"code": 0,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "SelectLocationsResponse",
"name": "SelectAreasResponse",
"code": 1,
"mfgCode": null,
"source": "server",
"isIncoming": 0,
"isEnabled": 1
},
{
"name": "SkipCurrent",
"name": "SkipArea",
"code": 2,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "SkipCurrentResponse",
"name": "SkipAreaResponse",
"code": 3,
"mfgCode": null,
"source": "server",
Expand All @@ -2921,7 +2922,7 @@
],
"attributes": [
{
"name": "SupportedLocations",
"name": "SupportedAreas",
"code": 0,
"mfgCode": null,
"side": "server",
Expand Down Expand Up @@ -2953,7 +2954,7 @@
"reportableChange": 0
},
{
"name": "SelectedLocations",
"name": "SelectedAreas",
"code": 2,
"mfgCode": null,
"side": "server",
Expand All @@ -2969,7 +2970,7 @@
"reportableChange": 0
},
{
"name": "CurrentLocation",
"name": "CurrentArea",
"code": 3,
"mfgCode": null,
"side": "server",
Expand All @@ -2978,7 +2979,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"defaultValue": null,
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand All @@ -2994,7 +2995,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"defaultValue": null,
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -3090,7 +3091,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
"defaultValue": null,
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down
Loading

0 comments on commit c53d771

Please sign in to comment.