From e7a2d2ea4892ef98a983939a991b8407b5e79d71 Mon Sep 17 00:00:00 2001 From: William Date: Wed, 7 Aug 2024 23:11:02 +0100 Subject: [PATCH] Update service area xml from 07 (#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 --- .../rvc-app/rvc-common/include/rvc-device.h | 3 +- .../include/rvc-service-area-delegate.h | 4 +- examples/rvc-app/rvc-common/rvc-app.matter | 35 +++-- .../src/rvc-service-area-delegate.cpp | 38 +++-- .../service-area-cluster-objects.h | 120 ++++++++++------ .../service-area-delegate.cpp | 5 +- .../service-area-delegate.h | 8 +- .../service-area-server.cpp | 65 +++++---- .../service-area-server/service-area-server.h | 29 ++-- .../data-model/chip/service-area-cluster.xml | 60 ++++---- .../data_model/controller-clusters.matter | 35 +++-- .../chip/devicecontroller/ChipClusters.java | 22 +-- .../chip/devicecontroller/ChipStructs.java | 133 +++++++++++------- .../devicecontroller/ClusterIDMapping.java | 17 +++ .../devicecontroller/ClusterInfoMapping.java | 14 +- .../chip/devicecontroller/cluster/files.gni | 1 + .../ServiceAreaClusterAreaInfoStruct.kt | 53 ++----- .../structs/ServiceAreaClusterAreaStruct.kt | 4 +- .../ServiceAreaClusterLandmarkInfoStruct.kt | 66 +++++++++ .../structs/ServiceAreaClusterMapStruct.kt | 4 +- .../cluster/clusters/ServiceAreaCluster.kt | 79 +++++------ .../java/matter/controller/cluster/files.gni | 1 + .../ServiceAreaClusterAreaInfoStruct.kt | 53 ++----- .../structs/ServiceAreaClusterAreaStruct.kt | 4 +- .../ServiceAreaClusterLandmarkInfoStruct.kt | 66 +++++++++ .../structs/ServiceAreaClusterMapStruct.kt | 4 +- .../CHIPAttributeTLVValueDecoder.cpp | 122 +++++++++------- .../python/chip/clusters/CHIPClusters.py | 1 + .../python/chip/clusters/Objects.py | 48 ++++--- .../MTRAttributeTLVValueDecoder.mm | 26 ++-- .../CHIP/zap-generated/MTRBaseClusters.h | 12 +- .../CHIP/zap-generated/MTRBaseClusters.mm | 6 +- .../CHIP/zap-generated/MTRClusters.h | 6 +- .../CHIP/zap-generated/MTRClusters.mm | 6 +- .../zap-generated/MTRCommandPayloadsObjc.h | 6 +- .../zap-generated/MTRCommandPayloadsObjc.mm | 36 +++-- .../CHIP/zap-generated/MTRStructsObjc.h | 10 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 42 ++++-- .../zap-generated/cluster-enums-check.h | 1 + .../app-common/zap-generated/cluster-enums.h | 14 +- .../zap-generated/cluster-objects.cpp | 65 +++++++-- .../zap-generated/cluster-objects.h | 47 +++++-- .../zap-generated/cluster/Commands.h | 1 + .../cluster/ComplexArgumentParser.cpp | 52 ++++--- .../cluster/ComplexArgumentParser.h | 5 + .../cluster/logging/DataModelLogger.cpp | 27 ++-- .../cluster/logging/DataModelLogger.h | 3 + .../zap-generated/cluster/Commands.h | 7 + 48 files changed, 911 insertions(+), 555 deletions(-) create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt diff --git a/examples/rvc-app/rvc-common/include/rvc-device.h b/examples/rvc-app/rvc-common/include/rvc-device.h index 092ded91f76272..da03422ffbb34a 100644 --- a/examples/rvc-app/rvc-common/include/rvc-device.h +++ b/examples/rvc-app/rvc-common/include/rvc-device.h @@ -44,7 +44,8 @@ class RvcDevice mRunModeDelegate(), mRunModeInstance(&mRunModeDelegate, aRvcClustersEndpoint, RvcRunMode::Id, 0), mCleanModeDelegate(), mCleanModeInstance(&mCleanModeDelegate, aRvcClustersEndpoint, RvcCleanMode::Id, 0), mOperationalStateDelegate(), mOperationalStateInstance(&mOperationalStateDelegate, aRvcClustersEndpoint), mServiceAreaDelegate(), - mServiceAreaInstance(&mServiceAreaDelegate, aRvcClustersEndpoint, BitMask(0)) + mServiceAreaInstance(&mServiceAreaDelegate, aRvcClustersEndpoint, + BitMask(ServiceArea::Feature::kMaps, ServiceArea::Feature::kProgressReporting)) { // set the current-mode at start-up mRunModeInstance.UpdateCurrentMode(RvcRunMode::ModeIdle); 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 40f312ffb78c2f..759c22a4e609cb 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 @@ -49,7 +49,7 @@ class RvcServiceAreaDelegate : public Delegate bool IsValidSelectAreasSet(const ServiceArea::Commands::SelectAreas::DecodableType & req, ServiceArea::SelectAreasStatus & locationStatus, MutableCharSpan statusText) override; - bool HandleSkipCurrentArea(MutableCharSpan skipStatusText) override; + bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan skipStatusText) override; //************************************************************************* // Supported Locations accessors @@ -78,7 +78,7 @@ class RvcServiceAreaDelegate : public Delegate bool GetSupportedMapByIndex(uint32_t listIndex, ServiceArea::MapStructureWrapper & supportedMap) override; - bool GetSupportedMapById(uint8_t aMapId, uint32_t & listIndex, ServiceArea::MapStructureWrapper & supportedMap) override; + bool GetSupportedMapById(uint32_t aMapId, uint32_t & listIndex, ServiceArea::MapStructureWrapper & supportedMap) override; bool AddSupportedMap(const ServiceArea::MapStructureWrapper & newMap, uint32_t & listIndex) override; diff --git a/examples/rvc-app/rvc-common/rvc-app.matter b/examples/rvc-app/rvc-common/rvc-app.matter index 7a87e9e83dbe90..4467c170acc6eb 100644 --- a/examples/rvc-app/rvc-common/rvc-app.matter +++ b/examples/rvc-app/rvc-common/rvc-app.matter @@ -1424,9 +1424,9 @@ cluster RvcOperationalState = 97 { command GoHome(): OperationalCommandResponse = 128; } -/** The Service Area cluster provides an interface for controlling the locations where a device should operate, and for querying the current location. */ +/** The Service Area cluster provides an interface for controlling the areas where a device should operate, and for querying the current area being serviced. */ provisional cluster ServiceArea = 336 { - revision 1; // NOTE: Default/not specifically set + revision 1; enum OperationalStatusEnum : enum8 { kPending = 0; @@ -1447,28 +1447,33 @@ provisional cluster ServiceArea = 336 { kSuccess = 0; kInvalidAreaList = 1; kInvalidInMode = 2; + kInvalidSkippedArea = 3; } bitmap Feature : bitmap32 { - kListOrder = 0x1; - kSelectWhileRunning = 0x2; + kSelectWhileRunning = 0x1; + kProgressReporting = 0x2; + kMaps = 0x4; + } + + struct LandmarkInfoStruct { + LandmarkTag landmarkTag = 0; + nullable RelativePositionTag positionTag = 1; } struct AreaInfoStruct { nullable LocationDescriptorStruct locationInfo = 0; - nullable LandmarkTag landmarkTag = 1; - nullable PositionTag positionTag = 2; - nullable FloorSurfaceTag surfaceTag = 3; + nullable LandmarkInfoStruct landmarkInfo = 1; } struct AreaStruct { int32u areaID = 0; - nullable int8u mapID = 1; + nullable int32u mapID = 1; AreaInfoStruct areaDesc = 2; } struct MapStruct { - int8u mapID = 0; + int32u mapID = 0; char_string<64> name = 1; } @@ -1480,7 +1485,7 @@ provisional cluster ServiceArea = 336 { } readonly attribute AreaStruct supportedAreas[] = 0; - readonly attribute MapStruct supportedMaps[] = 1; + readonly attribute optional MapStruct supportedMaps[] = 1; readonly attribute int32u selectedAreas[] = 2; readonly attribute optional nullable int32u currentArea = 3; readonly attribute optional nullable epoch_s estimatedEndTime = 4; @@ -1498,18 +1503,22 @@ provisional cluster ServiceArea = 336 { response struct SelectAreasResponse = 1 { SelectAreasStatus status = 0; - optional char_string<256> statusText = 1; + char_string<256> statusText = 1; + } + + request struct SkipAreaRequest { + int32u skippedArea = 0; } response struct SkipAreaResponse = 3 { SkipAreaStatus status = 0; - optional char_string<256> statusText = 1; + char_string<256> statusText = 1; } /** 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; + command SkipArea(SkipAreaRequest): SkipAreaResponse = 2; } endpoint 0 { 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 e46d3eaa22dff7..aca96da836151d 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 @@ -17,6 +17,7 @@ */ #include #include +#include using namespace chip; using namespace chip::app::Clusters; @@ -25,8 +26,8 @@ using namespace chip::app::Clusters::ServiceArea; CHIP_ERROR RvcServiceAreaDelegate::Init() { // hardcoded fill of SUPPORTED MAPS for prototyping - uint8_t supportedMapId_XX = 3; - uint8_t supportedMapId_YY = 245; + uint32_t supportedMapId_XX = 3; + uint32_t supportedMapId_YY = 245; GetInstance()->AddSupportedMap(supportedMapId_XX, "My Map XX"_span); GetInstance()->AddSupportedMap(supportedMapId_YY, "My Map YY"_span); @@ -38,32 +39,29 @@ CHIP_ERROR RvcServiceAreaDelegate::Init() uint32_t supportedAreaID_D = 0x88888888; // Location A has name, floor number, uses map XX - GetInstance()->AddSupportedLocation( - supportedAreaID_A, DataModel::Nullable(supportedMapId_XX), "My Location A"_span, - DataModel::Nullable(4), DataModel::Nullable(), DataModel::Nullable(), - DataModel::Nullable(), DataModel::Nullable()); + GetInstance()->AddSupportedLocation(supportedAreaID_A, DataModel::Nullable(supportedMapId_XX), "My Location A"_span, + DataModel::Nullable(4), DataModel::Nullable(), + DataModel::Nullable(), + DataModel::Nullable()); // Location B has name, uses map XX - GetInstance()->AddSupportedLocation( - supportedAreaID_B, DataModel::Nullable(supportedMapId_XX), "My Location B"_span, - DataModel::Nullable(), DataModel::Nullable(), DataModel::Nullable(), - DataModel::Nullable(), DataModel::Nullable()); + GetInstance()->AddSupportedLocation(supportedAreaID_B, DataModel::Nullable(supportedMapId_XX), "My Location B"_span, + DataModel::Nullable(), DataModel::Nullable(), + DataModel::Nullable(), + DataModel::Nullable()); // Location C has full SemData, no name, Map YY - GetInstance()->AddSupportedLocation(supportedAreaID_C, DataModel::Nullable(supportedMapId_YY), CharSpan(), + GetInstance()->AddSupportedLocation(supportedAreaID_C, DataModel::Nullable(supportedMapId_YY), CharSpan(), DataModel::Nullable(-1), DataModel::Nullable(Globals::AreaTypeTag::kPlayRoom), DataModel::Nullable(Globals::LandmarkTag::kBackDoor), - DataModel::Nullable(Globals::PositionTag::kLeft), - DataModel::Nullable(Globals::FloorSurfaceTag::kConcrete)); + DataModel::Nullable(Globals::RelativePositionTag::kNextTo)); // Location D has null values for all HomeLocationStruct fields, Map YY - GetInstance()->AddSupportedLocation(supportedAreaID_D, DataModel::Nullable(supportedMapId_YY), - "My Location D"_span, DataModel::Nullable(), - DataModel::Nullable(), + GetInstance()->AddSupportedLocation(supportedAreaID_D, DataModel::Nullable(supportedMapId_YY), "My Location D"_span, + DataModel::Nullable(), DataModel::Nullable(), DataModel::Nullable(Globals::LandmarkTag::kCouch), - DataModel::Nullable(Globals::PositionTag::kLeft), - DataModel::Nullable(Globals::FloorSurfaceTag::kHardwood)); + DataModel::Nullable(Globals::RelativePositionTag::kNextTo)); GetInstance()->SetCurrentArea(supportedAreaID_C); @@ -86,7 +84,7 @@ bool RvcServiceAreaDelegate::IsValidSelectAreasSet(const Commands::SelectAreas:: return true; }; -bool RvcServiceAreaDelegate::HandleSkipCurrentArea(MutableCharSpan skipStatusText) +bool RvcServiceAreaDelegate::HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan skipStatusText) { // TODO IMPLEMENT return true; @@ -213,7 +211,7 @@ bool RvcServiceAreaDelegate::GetSupportedMapByIndex(uint32_t listIndex, MapStruc return false; }; -bool RvcServiceAreaDelegate::GetSupportedMapById(uint8_t aMapId, uint32_t & listIndex, MapStructureWrapper & aSupportedMap) +bool RvcServiceAreaDelegate::GetSupportedMapById(uint32_t aMapId, uint32_t & listIndex, MapStructureWrapper & aSupportedMap) { // We do not need to reimplement this method as it's already done by the SDK. // We are reimplementing this method, still using linear search, but with some optimization on the SDK implementation diff --git a/src/app/clusters/service-area-server/service-area-cluster-objects.h b/src/app/clusters/service-area-server/service-area-cluster-objects.h index 4436a21e284a0f..2d2694e20dbd78 100644 --- a/src/app/clusters/service-area-server/service-area-cluster-objects.h +++ b/src/app/clusters/service-area-server/service-area-cluster-objects.h @@ -39,8 +39,7 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: AreaStructureWrapper() { Set(0, 0, CharSpan(), DataModel::Nullable(), DataModel::Nullable(), - DataModel::Nullable(), DataModel::Nullable(), - DataModel::Nullable()); + DataModel::Nullable(), DataModel::Nullable()); } /** @@ -52,22 +51,20 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: * @param[in] aAreaTypeTag A common namespace Area tag - indicates an association of the location with an indoor or outdoor area * of a home. * @param[in] aLandmarkTag A common namespace Landmark tag - indicates an association of the location with a home landmark. - * @param[in] aPositionTag A common namespace Position tag - indicates the position of the location with respect to the - * landmark. - * @param[in] aSurfaceTag A common namespace Floor Surface tag - indicates an association of the location with a surface type. + * @param[in] aRelativePositionTag A common namespace Relative Position tag - indicates the position of the location with + * respect to the landmark. * * @note Requirements regarding what combinations of fields and values are valid are not checked by this class. * @note If aLocationName is larger than kLocationNameMaxSize, it will be truncated. * @note If aLocationName is an empty string and aFloorNumber and aAreaTypeTag are null, locationInfo will be set to null. */ - AreaStructureWrapper(uint32_t aAreaID, const DataModel::Nullable & aMapId, const CharSpan & aLocationName, + AreaStructureWrapper(uint32_t aAreaID, const DataModel::Nullable & aMapId, const CharSpan & aLocationName, const DataModel::Nullable & aFloorNumber, const DataModel::Nullable & aAreaTypeTag, const DataModel::Nullable & aLandmarkTag, - const DataModel::Nullable & aPositionTag, - const DataModel::Nullable & aSurfaceTag) + const DataModel::Nullable & aRelativePositionTag) { - Set(aAreaID, aMapId, aLocationName, aFloorNumber, aAreaTypeTag, aLandmarkTag, aPositionTag, aSurfaceTag); + Set(aAreaID, aMapId, aLocationName, aFloorNumber, aAreaTypeTag, aLandmarkTag, aRelativePositionTag); } /** @@ -88,16 +85,43 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: */ AreaStructureWrapper & operator=(const AreaStructureWrapper & aOther) { + areaID = aOther.areaID; + mapID = aOther.mapID; + if (aOther.areaDesc.locationInfo.IsNull()) { - Set(aOther.areaID, aOther.mapID, CharSpan(), NullOptional, NullOptional, aOther.areaDesc.landmarkTag, - aOther.areaDesc.positionTag, aOther.areaDesc.surfaceTag); + areaDesc.locationInfo.SetNull(); } else { - Set(aOther.areaID, aOther.mapID, aOther.areaDesc.locationInfo.Value().locationName, - aOther.areaDesc.locationInfo.Value().floorNumber, aOther.areaDesc.locationInfo.Value().areaType, - aOther.areaDesc.landmarkTag, aOther.areaDesc.positionTag, aOther.areaDesc.surfaceTag); + areaDesc.locationInfo.SetNonNull(); + + // deep copy the name. + auto sizeToCopy = std::min(sizeof(mLocationNameBuffer), aOther.areaDesc.locationInfo.Value().locationName.size()); + memcpy(mLocationNameBuffer, aOther.areaDesc.locationInfo.Value().locationName.data(), sizeToCopy); + areaDesc.locationInfo.Value().locationName = CharSpan(mLocationNameBuffer, sizeToCopy); + + areaDesc.locationInfo.Value().floorNumber = aOther.areaDesc.locationInfo.Value().floorNumber; + areaDesc.locationInfo.Value().areaType = aOther.areaDesc.locationInfo.Value().areaType; + } + + if (aOther.areaDesc.landmarkInfo.IsNull()) + { + areaDesc.landmarkInfo.SetNull(); + } + else + { + areaDesc.landmarkInfo.SetNonNull(); + areaDesc.landmarkInfo.Value().landmarkTag = aOther.areaDesc.landmarkInfo.Value().landmarkTag; + if (aOther.areaDesc.landmarkInfo.Value().positionTag.IsNull()) + { + areaDesc.landmarkInfo.Value().positionTag.SetNull(); + } + else + { + areaDesc.landmarkInfo.Value().positionTag.SetNonNull(); + areaDesc.landmarkInfo.Value().positionTag.Value() = aOther.areaDesc.landmarkInfo.Value().positionTag.Value(); + } } return *this; @@ -112,19 +136,17 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: * @param[in] aAreaTypeTag A common namespace Area tag - indicates an association of the location with an indoor or outdoor area * of a home. * @param[in] aLandmarkTag A common namespace Landmark tag - indicates an association of the location with a home landmark. - * @param[in] aPositionTag A common namespace Position tag - indicates the position of the location with respect to the - * landmark. - * @param[in] aSurfaceTag A common namespace Floor Surface tag - indicates an association of the location with a surface type. + * @param[in] aRelativePositionTag A common namespace Relative Position tag - indicates the position of the location with + * respect to the landmark. * * @note Requirements regarding what combinations of fields and values are valid are not checked by this class. * @note If aLocationName is larger than kLocationNameMaxSize, it will be truncated. * @note If aLocationName is an empty string and aFloorNumber and aAreaTypeTag are null, locationInfo will be set to null. */ - void Set(uint32_t aAreaID, const DataModel::Nullable & aMapId, const CharSpan & aLocationName, + void Set(uint32_t aAreaID, const DataModel::Nullable & aMapId, const CharSpan & aLocationName, const DataModel::Nullable & aFloorNumber, const DataModel::Nullable & aAreaType, const DataModel::Nullable & aLandmarkTag, - const DataModel::Nullable & aPositionTag, - const DataModel::Nullable & aSurfaceTag) + const DataModel::Nullable & aRelativePositionTag) { areaID = aAreaID; mapID = aMapId; @@ -143,30 +165,33 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: areaDesc.locationInfo.SetNull(); } - areaDesc.landmarkTag = aLandmarkTag; - areaDesc.positionTag = aPositionTag; - areaDesc.surfaceTag = aSurfaceTag; - - // this assumes areaDesc structure was created above, if appropriate - if (!areaDesc.locationInfo.IsNull()) + // todo improve this when addressing issue https://github.com/project-chip/connectedhomeip/issues/34519 + if (aLandmarkTag.IsNull()) { - if (aLocationName.empty()) - { - areaDesc.locationInfo.Value().locationName = CharSpan(mLocationNameBuffer, 0); - } - else if (aLocationName.size() > sizeof(mLocationNameBuffer)) + areaDesc.landmarkInfo.SetNull(); + } + else + { + areaDesc.landmarkInfo.SetNonNull(); + areaDesc.landmarkInfo.Value().landmarkTag = aLandmarkTag.Value(); + if (aRelativePositionTag.IsNull()) { - // Save the truncated name that fits into available size. - memcpy(mLocationNameBuffer, aLocationName.data(), sizeof(mLocationNameBuffer)); - areaDesc.locationInfo.Value().locationName = CharSpan(mLocationNameBuffer, sizeof(mLocationNameBuffer)); + areaDesc.landmarkInfo.Value().positionTag.SetNull(); } else { - // Save full name. - memcpy(mLocationNameBuffer, aLocationName.data(), aLocationName.size()); - areaDesc.locationInfo.Value().locationName = CharSpan(mLocationNameBuffer, aLocationName.size()); + areaDesc.landmarkInfo.Value().positionTag.SetNonNull(); + areaDesc.landmarkInfo.Value().positionTag.Value() = aRelativePositionTag.Value(); } } + + // this assumes areaDesc structure was created above, if appropriate + if (!areaDesc.locationInfo.IsNull()) + { + auto sizeToCopy = std::min(sizeof(mLocationNameBuffer), aLocationName.size()); + memcpy(mLocationNameBuffer, aLocationName.data(), sizeToCopy); + areaDesc.locationInfo.Value().locationName = CharSpan(mLocationNameBuffer, sizeToCopy); + } } /** @@ -238,19 +263,22 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: } } - if (areaDesc.landmarkTag != aOther.areaDesc.landmarkTag) + if (areaDesc.landmarkInfo.IsNull() != aOther.areaDesc.landmarkInfo.IsNull()) { return false; } - if (areaDesc.positionTag != aOther.areaDesc.positionTag) + if (!areaDesc.landmarkInfo.IsNull()) { - return false; - } + if (areaDesc.landmarkInfo.Value().landmarkTag != aOther.areaDesc.landmarkInfo.Value().landmarkTag) + { + return false; + } - if (areaDesc.surfaceTag != aOther.areaDesc.surfaceTag) - { - return false; + if (areaDesc.landmarkInfo.Value().positionTag != aOther.areaDesc.landmarkInfo.Value().positionTag) + { + return false; + } } return true; @@ -288,7 +316,7 @@ struct MapStructureWrapper : public chip::app::Clusters::ServiceArea::Structs::M * @note Requirements regarding what combinations of fields and values are 'valid' are not checked by this class. * @note If aMapName is larger than kMapNameMaxSize, it will be truncated. */ - MapStructureWrapper(uint8_t aMapId, const CharSpan & aMapName) { Set(aMapId, aMapName); } + MapStructureWrapper(uint32_t aMapId, const CharSpan & aMapName) { Set(aMapId, aMapName); } /** * @brief This is a copy constructor that initializes the map object with the values from another map object. All values are @@ -316,7 +344,7 @@ struct MapStructureWrapper : public chip::app::Clusters::ServiceArea::Structs::M * @note Requirements regarding what combinations of fields and values are 'valid' are not checked by this class. * @note if aMapName is larger than kMapNameMaxSize, it will be truncated. */ - void Set(uint8_t aMapId, const CharSpan & aMapName) + void Set(uint32_t aMapId, const CharSpan & aMapName) { mapID = aMapId; diff --git a/src/app/clusters/service-area-server/service-area-delegate.cpp b/src/app/clusters/service-area-server/service-area-delegate.cpp index 0d8c98a16f5d24..262fe047d22a1b 100644 --- a/src/app/clusters/service-area-server/service-area-delegate.cpp +++ b/src/app/clusters/service-area-server/service-area-delegate.cpp @@ -28,7 +28,7 @@ void Delegate::HandleSupportedAreasUpdated() mInstance->ClearProgress(); } -bool Delegate::GetSupportedMapById(uint8_t aMapId, uint32_t & listIndex, MapStructureWrapper & aSupportedMap) +bool Delegate::GetSupportedMapById(uint32_t aMapId, uint32_t & listIndex, MapStructureWrapper & aSupportedMap) { listIndex = 0; @@ -88,3 +88,6 @@ bool Delegate::IsProgressElement(uint32_t aAreaId) return GetProgressElementById(aAreaId, index, progressElement); } + +// todo: Should we add default implementations for the accessor methods of the non-mandatory attributes? +// This is so that devices that do not support these attributes are not forced to provide an implementation. 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 1c324fe2c70bc7..823eaf6b537f19 100644 --- a/src/app/clusters/service-area-server/service-area-delegate.h +++ b/src/app/clusters/service-area-server/service-area-delegate.h @@ -49,7 +49,8 @@ class Delegate virtual ~Delegate() = default; /** - * Stop this class objects from being copied. + * Due to the coupling between the Delegate and Instance classes via the references they have to each other, + * copying a Delegate object might make things confusing. */ Delegate(const Delegate &) = delete; Delegate & operator=(const Delegate &) = delete; @@ -96,6 +97,7 @@ class Delegate /** * @brief The server instance ensures that the SelectedAreas and CurrentArea attributes are not null before * calling this method. + * @param[in] skippedArea the area ID to skip. * @param[out] skipStatusText text describing why current location cannot be skipped. * @return true if command is successful, false if the received skip request cannot be handled due to the current mode of the * device. @@ -119,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(MutableCharSpan skipStatusText) + virtual bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan skipStatusText) { // device support of this command is optional CopyCharSpanToMutableCharSpan("Skip Current Location command not supported by device"_span, skipStatusText); @@ -244,7 +246,7 @@ class Delegate * * @note may be overloaded in device implementation for optimization, if desired. */ - virtual bool GetSupportedMapById(uint8_t aMapId, uint32_t & listIndex, MapStructureWrapper & aSupportedMap); + virtual bool GetSupportedMapById(uint32_t aMapId, uint32_t & listIndex, MapStructureWrapper & aSupportedMap); /** * This method is called by the server instance to add a new map to the list. 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 fa5d626a5ab06c..17b55d12aa9352 100644 --- a/src/app/clusters/service-area-server/service-area-server.cpp +++ b/src/app/clusters/service-area-server/service-area-server.cpp @@ -123,7 +123,7 @@ void Instance::InvokeCommand(HandlerContext & handlerContext) case Commands::SkipArea::Id: return CommandHandlerInterface::HandleCommand( - handlerContext, [this](HandlerContext & ctx, const auto & req) { HandleSkipCurrentAreaCmd(ctx); }); + handlerContext, [this](HandlerContext & ctx, const auto & req) { HandleSkipCurrentAreaCmd(ctx, req); }); } } @@ -217,7 +217,7 @@ void Instance::HandleSelectAreasCmd(HandlerContext & ctx, const Commands::Select auto exitResponse = [ctx](SelectAreasStatus status, CharSpan statusText) { Commands::SelectAreasResponse::Type response{ .status = status, - .statusText = Optional(statusText), + .statusText = statusText, }; ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); }; @@ -358,7 +358,7 @@ void Instance::HandleSelectAreasCmd(HandlerContext & ctx, const Commands::Select exitResponse(SelectAreasStatus::kSuccess, ""_span); } -void Instance::HandleSkipCurrentAreaCmd(HandlerContext & ctx) +void Instance::HandleSkipCurrentAreaCmd(HandlerContext & ctx, const Commands::SkipArea::DecodableType & req) { ChipLogDetail(Zcl, "Service Area: HandleSkipCurrentArea"); @@ -366,7 +366,7 @@ void Instance::HandleSkipCurrentAreaCmd(HandlerContext & ctx) auto exitResponse = [ctx](SkipAreaStatus status, CharSpan statusText) { Commands::SkipAreaResponse::Type response{ .status = status, - .statusText = Optional(statusText), + .statusText = statusText, }; ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); }; @@ -396,7 +396,7 @@ void Instance::HandleSkipCurrentAreaCmd(HandlerContext & ctx) char skipStatusBuffer[kMaxSizeStatusText]; MutableCharSpan skipStatusText(skipStatusBuffer); - if (!mDelegate->HandleSkipCurrentArea(skipStatusText)) + if (!mDelegate->HandleSkipCurrentArea(req.skippedArea, skipStatusText)) { exitResponse(SkipAreaStatus::kInvalidInMode, skipStatusText); return; @@ -449,39 +449,45 @@ bool Instance::IsSupportedLocation(uint32_t aAreaId) bool Instance::IsValidSupportedLocation(const AreaStructureWrapper & aLocation) { - // If the HomeLocationInfo field is null, the LandmarkTag field SHALL NOT be null. - // If the LandmarkTag field is null, the HomeLocationInfo field SHALL NOT be null. - if (aLocation.areaDesc.locationInfo.IsNull() && aLocation.areaDesc.landmarkTag.IsNull()) + // If the LocationInfo field is null, the LandmarkInfo field SHALL NOT be null. + // If the LandmarkInfo field is null, the LocationInfo field SHALL NOT be null. + if (aLocation.areaDesc.locationInfo.IsNull() && aLocation.areaDesc.landmarkInfo.IsNull()) { - ChipLogDetail(Zcl, "IsValidAsSupportedLocation %u - must have locationInfo and/or LandmarkTag", aLocation.areaID); + ChipLogDetail(Zcl, "IsValidAsSupportedLocation %u - must have locationInfo and/or LandmarkInfo", aLocation.areaID); return false; } - // If HomeLocationInfo is not null, and its LocationName field is an empty string, at least one of the following SHALL NOT - // be null: HomeLocationInfo's FloorNumber field, HomeLocationInfo's AreaType field, the LandmarkTag field + // If LocationInfo is not null, and its LocationName field is an empty string, at least one of the following SHALL NOT + // be null: LocationInfo's FloorNumber field, LocationInfo's AreaType field, the LandmarkInfo if (!aLocation.areaDesc.locationInfo.IsNull()) { if (aLocation.areaDesc.locationInfo.Value().locationName.empty() && aLocation.areaDesc.locationInfo.Value().floorNumber.IsNull() && - aLocation.areaDesc.locationInfo.Value().areaType.IsNull() && aLocation.areaDesc.landmarkTag.IsNull()) + aLocation.areaDesc.locationInfo.Value().areaType.IsNull() && aLocation.areaDesc.landmarkInfo.IsNull()) { ChipLogDetail( - Zcl, "IsValidAsSupportedLocation %u - LocationName is empty string, FloorNumber, AreaType, LandmarkTag are null", + Zcl, "IsValidAsSupportedLocation %u - LocationName is empty string, FloorNumber, AreaType, LandmarkInfo are null", aLocation.areaID); return false; } } - // If the LandmarkTag field is null, the PositionTag field SHALL be null. - if (aLocation.areaDesc.landmarkTag.IsNull() && !aLocation.areaDesc.positionTag.IsNull()) + // 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)) { - ChipLogDetail(Zcl, "IsValidAsSupportedLocation %u - PositionTag with no LandmarkTag", aLocation.areaID); - return false; + if (mDelegate->GetNumberOfSupportedMaps() == 0) + { + shouldMapsBeNull = true; + } + } + else + { + shouldMapsBeNull = true; } - if (mDelegate->GetNumberOfSupportedMaps() == 0) + if (shouldMapsBeNull) { - // If the SupportedMaps attribute is null, mapid SHALL be null. if (!aLocation.mapID.IsNull()) { ChipLogDetail(Zcl, "IsValidSupportedLocation %u - map Id %u is not in empty supported map list", aLocation.areaID, @@ -570,15 +576,14 @@ bool Instance::ReportEstimatedEndTimeChange(const DataModel::Nullable return (aEstimatedEndTime.Value() < mEstimatedEndTime.Value()); } -bool Instance::AddSupportedLocation(uint32_t aAreaId, const DataModel::Nullable & aMapId, const CharSpan & aLocationName, +bool Instance::AddSupportedLocation(uint32_t aAreaId, const DataModel::Nullable & aMapId, const CharSpan & aLocationName, const DataModel::Nullable & aFloorNumber, const DataModel::Nullable & aAreaType, const DataModel::Nullable & aLandmarkTag, - const DataModel::Nullable & aPositionTag, - const DataModel::Nullable & aSurfaceTag) + const DataModel::Nullable & aRelativePositionTag) { // Create location object for validation. - AreaStructureWrapper aNewArea(aAreaId, aMapId, aLocationName, aFloorNumber, aAreaType, aLandmarkTag, aPositionTag, aSurfaceTag); + AreaStructureWrapper aNewArea(aAreaId, aMapId, aLocationName, aFloorNumber, aAreaType, aLandmarkTag, aRelativePositionTag); // Does device mode allow this attribute to be updated? if (!mDelegate->IsSupportedAreasChangeAllowed()) @@ -621,12 +626,11 @@ bool Instance::AddSupportedLocation(uint32_t aAreaId, const DataModel::Nullable< return true; } -bool Instance::ModifySupportedLocation(uint32_t aAreaId, const DataModel::Nullable & aMapId, +bool Instance::ModifySupportedLocation(uint32_t aAreaId, const DataModel::Nullable & aMapId, const CharSpan & aLocationName, const DataModel::Nullable & aFloorNumber, const DataModel::Nullable & aAreaType, const DataModel::Nullable & aLandmarkTag, - const DataModel::Nullable & aPositionTag, - const DataModel::Nullable & aSurfaceTag) + const DataModel::Nullable & aRelativePositionTag) { bool mapIDChanged = false; uint32_t listIndex; @@ -653,8 +657,7 @@ bool Instance::ModifySupportedLocation(uint32_t aAreaId, const DataModel::Nullab } // create new location object for validation - AreaStructureWrapper aNewArea(aAreaId, aMapId, aLocationName, aFloorNumber, aAreaType, aLandmarkTag, aPositionTag, - aSurfaceTag); + AreaStructureWrapper aNewArea(aAreaId, aMapId, aLocationName, aFloorNumber, aAreaType, aLandmarkTag, aRelativePositionTag); // verify cluster requirements concerning valid fields and field relationships if (!IsValidSupportedLocation(aNewArea)) @@ -708,7 +711,7 @@ bool Instance::ClearSupportedAreas() //************************************************************************* // Supported Maps manipulators -bool Instance::IsSupportedMap(uint8_t aMapId) +bool Instance::IsSupportedMap(uint32_t aMapId) { uint32_t ignoredIndex; MapStructureWrapper ignoredMap; @@ -716,7 +719,7 @@ bool Instance::IsSupportedMap(uint8_t aMapId) return mDelegate->GetSupportedMapById(aMapId, ignoredIndex, ignoredMap); } -bool Instance::AddSupportedMap(uint8_t aMapId, const CharSpan & aMapName) +bool Instance::AddSupportedMap(uint32_t aMapId, const CharSpan & aMapName) { // check max# of list entries if (mDelegate->GetNumberOfSupportedMaps() >= kMaxNumSupportedMaps) @@ -769,7 +772,7 @@ bool Instance::AddSupportedMap(uint8_t aMapId, const CharSpan & aMapName) return true; } -bool Instance::RenameSupportedMap(uint8_t aMapId, const CharSpan & newMapName) +bool Instance::RenameSupportedMap(uint32_t aMapId, const CharSpan & newMapName) { uint32_t modifiedIndex; MapStructureWrapper modifiedMap; diff --git a/src/app/clusters/service-area-server/service-area-server.h b/src/app/clusters/service-area-server/service-area-server.h index 90cf4275cf3871..815ff2ed0eac72 100644 --- a/src/app/clusters/service-area-server/service-area-server.h +++ b/src/app/clusters/service-area-server/service-area-server.h @@ -115,15 +115,16 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface /** * @param[in, out] ctx Returns the Interaction Model status code which was user determined in the business logic. * If the input value is invalid, returns the Interaction Model status code of INVALID_COMMAND. - * @param[in] req the command parameters + * @param[in] req the command parameters. */ void HandleSelectAreasCmd(HandlerContext & ctx, const Commands::SelectAreas::DecodableType & req); /** * @param[in, out] ctx Returns the Interaction Model status code which was user determined in the business logic. * If the input value is invalid, returns the Interaction Model status code of INVALID_COMMAND. + * @param[in] req the command parameters. */ - void HandleSkipCurrentAreaCmd(HandlerContext & ctx); + void HandleSkipCurrentAreaCmd(HandlerContext & ctx, const Commands::SkipArea::DecodableType & req); //************************************************************************* // attribute notifications @@ -176,18 +177,17 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface * @param[in] aAreaType common namespace Area tag - indicates an association of the location with an indoor or outdoor area of a * home. * @param[in] aLandmarkTag common namespace Landmark tag - indicates an association of the location with a home landmark. - * @param[in] aPositionTag common namespace Position tag - indicates the position of the location with respect to the landmark. - * @param[in] aSurfaceTag common namespace Floor Surface tag - indicates an association of the location with a surface type. + * @param[in] aRelativePositionTag common namespace Relative Position tag - indicates the position of the location with respect + * to the landmark. * @return true if the new location passed validation checks and was successfully added to the list. * * @note if aLocationName is larger than kLocationNameMaxSize, it will be truncated. */ - bool AddSupportedLocation(uint32_t aAreaId, const DataModel::Nullable & aMapId, const CharSpan & aLocationName, + bool AddSupportedLocation(uint32_t aAreaId, const DataModel::Nullable & aMapId, const CharSpan & aLocationName, const DataModel::Nullable & aFloorNumber, const DataModel::Nullable & aAreaType, const DataModel::Nullable & aLandmarkTag, - const DataModel::Nullable & aPositionTag, - const DataModel::Nullable & aSurfaceTag); + const DataModel::Nullable & aRelativePositionTag); /** * @brief Modify/replace an existing location in the supported locations list. @@ -198,20 +198,19 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface * @param[in] aAreaType common namespace Area tag - indicates an association of the location with an indoor or outdoor area of a * home. * @param[in] aLandmarkTag common namespace Landmark tag - indicates an association of the location with a home landmark. - * @param[in] aPositionTag common namespace Position tag - indicates the position of the location with respect to the landmark. - * @param[in] aSurfaceTag common namespace Floor Surface tag - indicates an association of the location with a surface type. + * @param[in] aRelativePositionTag common namespace Relative Position tag - indicates the position of the location with respect + * to the landmark. * @return true if the location is a member of supported locations, the modifications pass all validation checks and the * location was modified. * * @note if aLocationName is larger than kLocationNameMaxSize, it will be truncated. * @note if mapID is changed, the delegate's HandleSupportedAreasUpdated method is called. */ - bool ModifySupportedLocation(uint32_t aAreaId, const DataModel::Nullable & aMapId, const CharSpan & aLocationName, + bool ModifySupportedLocation(uint32_t aAreaId, const DataModel::Nullable & aMapId, const CharSpan & aLocationName, const DataModel::Nullable & aFloorNumber, const DataModel::Nullable & aAreaType, const DataModel::Nullable & aLandmarkTag, - const DataModel::Nullable & aPositionTag, - const DataModel::Nullable & aSurfaceTag); + const DataModel::Nullable & aRelativePositionTag); /** * @return true if the SupportedAreas attribute was not already null. @@ -226,7 +225,7 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface /** * @return true if a map with the aMapId ID exists in the supported maps attribute. False otherwise. */ - bool IsSupportedMap(uint8_t aMapId); + bool IsSupportedMap(uint32_t aMapId); /** * @brief Add a new map to the supported maps list. @@ -234,7 +233,7 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface * @param[in] aMapName The name of the map to be added. This cannot be an empty string. * @return true if the new map passed validation checks and was successfully added to the list. */ - bool AddSupportedMap(uint8_t aMapId, const CharSpan & aMapName); + bool AddSupportedMap(uint32_t aMapId, const CharSpan & aMapName); /** * @brief Rename an existing map in the supported maps list. @@ -244,7 +243,7 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface * * @note if the specified map is not a member of the supported maps list, returns false with no action taken. */ - bool RenameSupportedMap(uint8_t aMapId, const CharSpan & newMapName); + bool RenameSupportedMap(uint32_t aMapId, const CharSpan & newMapName); /** * @return true if the SupportedMaps attribute was not already null. diff --git a/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml index e7b190456a2ef8..e2f0199209d4eb 100644 --- a/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml @@ -18,35 +18,31 @@ limitations under the License. Data types + + + + + + - - - - + + - - + + - - - + + + - - - - - - - - @@ -55,6 +51,14 @@ limitations under the License. + + + + + + + + @@ -69,27 +73,32 @@ limitations under the License. + General Service Area - The Service Area cluster provides an interface for controlling the locations where a device should operate, and for querying the current location. + The Service Area cluster provides an interface for controlling the areas where a device should operate, and for querying the current area being serviced. 0x0150 SERVICE_AREA_CLUSTER + - + + + + - + SupportedAreas - SupportedMaps + SupportedMaps SelectedAreas CurrentArea EstimatedEndTime @@ -107,22 +116,23 @@ limitations under the License. This command is sent by the device on receipt of the SelectAreas command. - - + + This command is used to skip an area where the device operates. + This command is sent by the device on receipt of the SkipArea command. - - + + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index a6dad3fe9dc86d..158ba6d35781f4 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -6446,9 +6446,9 @@ deprecated cluster BarrierControl = 259 { command BarrierControlStop(): DefaultSuccess = 1; } -/** The Service Area cluster provides an interface for controlling the locations where a device should operate, and for querying the current location. */ +/** The Service Area cluster provides an interface for controlling the areas where a device should operate, and for querying the current area being serviced. */ provisional cluster ServiceArea = 336 { - revision 1; // NOTE: Default/not specifically set + revision 1; enum OperationalStatusEnum : enum8 { kPending = 0; @@ -6469,28 +6469,33 @@ provisional cluster ServiceArea = 336 { kSuccess = 0; kInvalidAreaList = 1; kInvalidInMode = 2; + kInvalidSkippedArea = 3; } bitmap Feature : bitmap32 { - kListOrder = 0x1; - kSelectWhileRunning = 0x2; + kSelectWhileRunning = 0x1; + kProgressReporting = 0x2; + kMaps = 0x4; + } + + struct LandmarkInfoStruct { + LandmarkTag landmarkTag = 0; + nullable RelativePositionTag positionTag = 1; } struct AreaInfoStruct { nullable LocationDescriptorStruct locationInfo = 0; - nullable LandmarkTag landmarkTag = 1; - nullable PositionTag positionTag = 2; - nullable FloorSurfaceTag surfaceTag = 3; + nullable LandmarkInfoStruct landmarkInfo = 1; } struct AreaStruct { int32u areaID = 0; - nullable int8u mapID = 1; + nullable int32u mapID = 1; AreaInfoStruct areaDesc = 2; } struct MapStruct { - int8u mapID = 0; + int32u mapID = 0; char_string<64> name = 1; } @@ -6502,7 +6507,7 @@ provisional cluster ServiceArea = 336 { } readonly attribute AreaStruct supportedAreas[] = 0; - readonly attribute MapStruct supportedMaps[] = 1; + readonly attribute optional MapStruct supportedMaps[] = 1; readonly attribute int32u selectedAreas[] = 2; readonly attribute optional nullable int32u currentArea = 3; readonly attribute optional nullable epoch_s estimatedEndTime = 4; @@ -6520,18 +6525,22 @@ provisional cluster ServiceArea = 336 { response struct SelectAreasResponse = 1 { SelectAreasStatus status = 0; - optional char_string<256> statusText = 1; + char_string<256> statusText = 1; + } + + request struct SkipAreaRequest { + int32u skippedArea = 0; } response struct SkipAreaResponse = 3 { SkipAreaStatus status = 0; - optional char_string<256> statusText = 1; + char_string<256> statusText = 1; } /** 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; + command SkipArea(SkipAreaRequest): SkipAreaResponse = 2; } /** An interface for configuring and controlling pumps. */ diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index cdb08fa431c02c..5944e05356d9c5 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -39092,7 +39092,7 @@ public void onResponse(StructType invokeStructValue) { final long statusFieldID = 0L; Integer status = null; final long statusTextFieldID = 1L; - Optional statusText = Optional.empty(); + String statusText = null; for (StructElement element: invokeStructValue.value()) { if (element.contextTagNum() == statusFieldID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -39102,7 +39102,7 @@ public void onResponse(StructType invokeStructValue) { } else if (element.contextTagNum() == statusTextFieldID) { if (element.value(BaseTLVType.class).type() == TLVType.String) { StringType castingValue = element.value(StringType.class); - statusText = Optional.of(castingValue.value(String.class)); + statusText = castingValue.value(String.class); } } } @@ -39110,14 +39110,18 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public void skipArea(SkipAreaResponseCallback callback) { - skipArea(callback, 0); + public void skipArea(SkipAreaResponseCallback callback, Long skippedArea) { + skipArea(callback, skippedArea, 0); } - public void skipArea(SkipAreaResponseCallback callback, int timedInvokeTimeoutMs) { + public void skipArea(SkipAreaResponseCallback callback, Long skippedArea, int timedInvokeTimeoutMs) { final long commandId = 2L; ArrayList elements = new ArrayList<>(); + final long skippedAreaFieldID = 0L; + BaseTLVType skippedAreatlvValue = new UIntType(skippedArea); + elements.add(new StructElement(skippedAreaFieldID, skippedAreatlvValue)); + StructType commandArgs = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @Override @@ -39125,7 +39129,7 @@ public void onResponse(StructType invokeStructValue) { final long statusFieldID = 0L; Integer status = null; final long statusTextFieldID = 1L; - Optional statusText = Optional.empty(); + String statusText = null; for (StructElement element: invokeStructValue.value()) { if (element.contextTagNum() == statusFieldID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -39135,7 +39139,7 @@ public void onResponse(StructType invokeStructValue) { } else if (element.contextTagNum() == statusTextFieldID) { if (element.value(BaseTLVType.class).type() == TLVType.String) { StringType castingValue = element.value(StringType.class); - statusText = Optional.of(castingValue.value(String.class)); + statusText = castingValue.value(String.class); } } } @@ -39144,11 +39148,11 @@ public void onResponse(StructType invokeStructValue) { } public interface SelectAreasResponseCallback extends BaseClusterCallback { - void onSuccess(Integer status, Optional statusText); + void onSuccess(Integer status, String statusText); } public interface SkipAreaResponseCallback extends BaseClusterCallback { - void onSuccess(Integer status, Optional statusText); + void onSuccess(Integer status, String statusText); } public interface SupportedAreasAttributeCallback extends BaseAttributeCallback { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 9a410a6a8c8d59..4e07b6d86182d9 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -9171,53 +9171,36 @@ public String toString() { return output.toString(); } } -public static class ServiceAreaClusterAreaInfoStruct { - public @Nullable ChipStructs.ServiceAreaClusterLocationDescriptorStruct locationInfo; - public @Nullable Integer landmarkTag; +public static class ServiceAreaClusterLandmarkInfoStruct { + public Integer landmarkTag; public @Nullable Integer positionTag; - public @Nullable Integer surfaceTag; - private static final long LOCATION_INFO_ID = 0L; - private static final long LANDMARK_TAG_ID = 1L; - private static final long POSITION_TAG_ID = 2L; - private static final long SURFACE_TAG_ID = 3L; + private static final long LANDMARK_TAG_ID = 0L; + private static final long POSITION_TAG_ID = 1L; - public ServiceAreaClusterAreaInfoStruct( - @Nullable ChipStructs.ServiceAreaClusterLocationDescriptorStruct locationInfo, - @Nullable Integer landmarkTag, - @Nullable Integer positionTag, - @Nullable Integer surfaceTag + public ServiceAreaClusterLandmarkInfoStruct( + Integer landmarkTag, + @Nullable Integer positionTag ) { - this.locationInfo = locationInfo; this.landmarkTag = landmarkTag; this.positionTag = positionTag; - this.surfaceTag = surfaceTag; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(LOCATION_INFO_ID, locationInfo != null ? locationInfo.encodeTlv() : new NullType())); - values.add(new StructElement(LANDMARK_TAG_ID, landmarkTag != null ? new UIntType(landmarkTag) : new NullType())); + values.add(new StructElement(LANDMARK_TAG_ID, new UIntType(landmarkTag))); values.add(new StructElement(POSITION_TAG_ID, positionTag != null ? new UIntType(positionTag) : new NullType())); - values.add(new StructElement(SURFACE_TAG_ID, surfaceTag != null ? new UIntType(surfaceTag) : new NullType())); return new StructType(values); } - public static ServiceAreaClusterAreaInfoStruct decodeTlv(BaseTLVType tlvValue) { + public static ServiceAreaClusterLandmarkInfoStruct decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - @Nullable ChipStructs.ServiceAreaClusterLocationDescriptorStruct locationInfo = null; - @Nullable Integer landmarkTag = null; + Integer landmarkTag = null; @Nullable Integer positionTag = null; - @Nullable Integer surfaceTag = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == LOCATION_INFO_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.Struct) { - StructType castingValue = element.value(StructType.class); - locationInfo = ChipStructs.ServiceAreaClusterLocationDescriptorStruct.decodeTlv(castingValue); - } - } else if (element.contextTagNum() == LANDMARK_TAG_ID) { + if (element.contextTagNum() == LANDMARK_TAG_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); landmarkTag = castingValue.value(Integer.class); @@ -9227,36 +9210,84 @@ public static ServiceAreaClusterAreaInfoStruct decodeTlv(BaseTLVType tlvValue) { UIntType castingValue = element.value(UIntType.class); positionTag = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == SURFACE_TAG_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - surfaceTag = castingValue.value(Integer.class); - } } } - return new ServiceAreaClusterAreaInfoStruct( - locationInfo, + return new ServiceAreaClusterLandmarkInfoStruct( landmarkTag, - positionTag, - surfaceTag + positionTag ); } @Override public String toString() { StringBuilder output = new StringBuilder(); - output.append("ServiceAreaClusterAreaInfoStruct {\n"); - output.append("\tlocationInfo: "); - output.append(locationInfo); - output.append("\n"); + output.append("ServiceAreaClusterLandmarkInfoStruct {\n"); output.append("\tlandmarkTag: "); output.append(landmarkTag); output.append("\n"); output.append("\tpositionTag: "); output.append(positionTag); output.append("\n"); - output.append("\tsurfaceTag: "); - output.append(surfaceTag); + output.append("}\n"); + return output.toString(); + } +} +public static class ServiceAreaClusterAreaInfoStruct { + public @Nullable ChipStructs.ServiceAreaClusterLocationDescriptorStruct locationInfo; + public @Nullable ChipStructs.ServiceAreaClusterLandmarkInfoStruct landmarkInfo; + private static final long LOCATION_INFO_ID = 0L; + private static final long LANDMARK_INFO_ID = 1L; + + public ServiceAreaClusterAreaInfoStruct( + @Nullable ChipStructs.ServiceAreaClusterLocationDescriptorStruct locationInfo, + @Nullable ChipStructs.ServiceAreaClusterLandmarkInfoStruct landmarkInfo + ) { + this.locationInfo = locationInfo; + this.landmarkInfo = landmarkInfo; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(LOCATION_INFO_ID, locationInfo != null ? locationInfo.encodeTlv() : new NullType())); + values.add(new StructElement(LANDMARK_INFO_ID, landmarkInfo != null ? landmarkInfo.encodeTlv() : new NullType())); + + return new StructType(values); + } + + public static ServiceAreaClusterAreaInfoStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + @Nullable ChipStructs.ServiceAreaClusterLocationDescriptorStruct locationInfo = null; + @Nullable ChipStructs.ServiceAreaClusterLandmarkInfoStruct landmarkInfo = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == LOCATION_INFO_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + locationInfo = ChipStructs.ServiceAreaClusterLocationDescriptorStruct.decodeTlv(castingValue); + } + } else if (element.contextTagNum() == LANDMARK_INFO_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + landmarkInfo = ChipStructs.ServiceAreaClusterLandmarkInfoStruct.decodeTlv(castingValue); + } + } + } + return new ServiceAreaClusterAreaInfoStruct( + locationInfo, + landmarkInfo + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ServiceAreaClusterAreaInfoStruct {\n"); + output.append("\tlocationInfo: "); + output.append(locationInfo); + output.append("\n"); + output.append("\tlandmarkInfo: "); + output.append(landmarkInfo); output.append("\n"); output.append("}\n"); return output.toString(); @@ -9264,7 +9295,7 @@ public String toString() { } public static class ServiceAreaClusterAreaStruct { public Long areaID; - public @Nullable Integer mapID; + public @Nullable Long mapID; public ChipStructs.ServiceAreaClusterAreaInfoStruct areaDesc; private static final long AREA_I_D_ID = 0L; private static final long MAP_I_D_ID = 1L; @@ -9272,7 +9303,7 @@ public static class ServiceAreaClusterAreaStruct { public ServiceAreaClusterAreaStruct( Long areaID, - @Nullable Integer mapID, + @Nullable Long mapID, ChipStructs.ServiceAreaClusterAreaInfoStruct areaDesc ) { this.areaID = areaID; @@ -9294,7 +9325,7 @@ public static ServiceAreaClusterAreaStruct decodeTlv(BaseTLVType tlvValue) { return null; } Long areaID = null; - @Nullable Integer mapID = null; + @Nullable Long mapID = null; ChipStructs.ServiceAreaClusterAreaInfoStruct areaDesc = null; for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == AREA_I_D_ID) { @@ -9305,7 +9336,7 @@ public static ServiceAreaClusterAreaStruct decodeTlv(BaseTLVType tlvValue) { } else if (element.contextTagNum() == MAP_I_D_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - mapID = castingValue.value(Integer.class); + mapID = castingValue.value(Long.class); } } else if (element.contextTagNum() == AREA_DESC_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Struct) { @@ -9339,13 +9370,13 @@ public String toString() { } } public static class ServiceAreaClusterMapStruct { - public Integer mapID; + public Long mapID; public String name; private static final long MAP_I_D_ID = 0L; private static final long NAME_ID = 1L; public ServiceAreaClusterMapStruct( - Integer mapID, + Long mapID, String name ) { this.mapID = mapID; @@ -9364,13 +9395,13 @@ public static ServiceAreaClusterMapStruct decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Integer mapID = null; + Long mapID = null; String name = null; for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == MAP_I_D_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - mapID = castingValue.value(Integer.class); + mapID = castingValue.value(Long.class); } } else if (element.contextTagNum() == NAME_ID) { if (element.value(BaseTLVType.class).type() == TLVType.String) { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 6859e8b7f1e5b3..c6677b6aa93f47 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -11722,6 +11722,23 @@ public static SelectAreasCommandField value(int id) throws NoSuchFieldError { } throw new NoSuchFieldError(); } + }public enum SkipAreaCommandField {SkippedArea(0),; + private final int id; + SkipAreaCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static SkipAreaCommandField value(int id) throws NoSuchFieldError { + for (SkipAreaCommandField field : SkipAreaCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } }@Override public String getAttributeName(long id) throws NoSuchFieldError { return Attribute.value(id).toString(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 1295c78431d151..986d59f3635af1 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -13125,12 +13125,12 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Integer status, Optional statusText) { + public void onSuccess(Integer status, String statusText) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); - CommandResponseInfo statusTextResponseValue = new CommandResponseInfo("statusText", "Optional"); + CommandResponseInfo statusTextResponseValue = new CommandResponseInfo("statusText", "String"); responseValues.put(statusTextResponseValue, statusText); callback.onSuccess(responseValues); } @@ -13149,12 +13149,12 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Integer status, Optional statusText) { + public void onSuccess(Integer status, String statusText) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); - CommandResponseInfo statusTextResponseValue = new CommandResponseInfo("statusText", "Optional"); + CommandResponseInfo statusTextResponseValue = new CommandResponseInfo("statusText", "String"); responseValues.put(statusTextResponseValue, statusText); callback.onSuccess(responseValues); } @@ -26985,10 +26985,16 @@ public Map> getCommandMap() { serviceAreaClusterInteractionInfoMap.put("selectAreas", serviceAreaselectAreasInteractionInfo); Map serviceAreaskipAreaCommandParams = new LinkedHashMap(); + + CommandParameterInfo serviceAreaskipAreaskippedAreaCommandParameterInfo = new CommandParameterInfo("skippedArea", Long.class, Long.class); + serviceAreaskipAreaCommandParams.put("skippedArea",serviceAreaskipAreaskippedAreaCommandParameterInfo); InteractionInfo serviceAreaskipAreaInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ServiceAreaCluster) cluster) .skipArea((ChipClusters.ServiceAreaCluster.SkipAreaResponseCallback) callback + , (Long) + commandArguments.get("skippedArea") + ); }, () -> new DelegatedServiceAreaClusterSkipAreaResponseCallback(), diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index 1b0bd261bb6c31..ca6223a2c1f96e 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -125,6 +125,7 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterSceneInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationDescriptorStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterMapStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterProgressStruct.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaInfoStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaInfoStruct.kt index e11d56110d37cf..f0c591f1345946 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaInfoStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaInfoStruct.kt @@ -24,16 +24,12 @@ import matter.tlv.TlvWriter class ServiceAreaClusterAreaInfoStruct( val locationInfo: ServiceAreaClusterLocationDescriptorStruct?, - val landmarkTag: UInt?, - val positionTag: UInt?, - val surfaceTag: UInt?, + val landmarkInfo: ServiceAreaClusterLandmarkInfoStruct?, ) { override fun toString(): String = buildString { append("ServiceAreaClusterAreaInfoStruct {\n") append("\tlocationInfo : $locationInfo\n") - append("\tlandmarkTag : $landmarkTag\n") - append("\tpositionTag : $positionTag\n") - append("\tsurfaceTag : $surfaceTag\n") + append("\tlandmarkInfo : $landmarkInfo\n") append("}\n") } @@ -45,20 +41,10 @@ class ServiceAreaClusterAreaInfoStruct( } else { putNull(ContextSpecificTag(TAG_LOCATION_INFO)) } - if (landmarkTag != null) { - put(ContextSpecificTag(TAG_LANDMARK_TAG), landmarkTag) + if (landmarkInfo != null) { + landmarkInfo.toTlv(ContextSpecificTag(TAG_LANDMARK_INFO), this) } else { - putNull(ContextSpecificTag(TAG_LANDMARK_TAG)) - } - if (positionTag != null) { - put(ContextSpecificTag(TAG_POSITION_TAG), positionTag) - } else { - putNull(ContextSpecificTag(TAG_POSITION_TAG)) - } - if (surfaceTag != null) { - put(ContextSpecificTag(TAG_SURFACE_TAG), surfaceTag) - } else { - putNull(ContextSpecificTag(TAG_SURFACE_TAG)) + putNull(ContextSpecificTag(TAG_LANDMARK_INFO)) } endStructure() } @@ -66,9 +52,7 @@ class ServiceAreaClusterAreaInfoStruct( companion object { private const val TAG_LOCATION_INFO = 0 - private const val TAG_LANDMARK_TAG = 1 - private const val TAG_POSITION_TAG = 2 - private const val TAG_SURFACE_TAG = 3 + private const val TAG_LANDMARK_INFO = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterAreaInfoStruct { tlvReader.enterStructure(tlvTag) @@ -82,31 +66,20 @@ class ServiceAreaClusterAreaInfoStruct( tlvReader.getNull(ContextSpecificTag(TAG_LOCATION_INFO)) null } - val landmarkTag = - if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_LANDMARK_TAG)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_LANDMARK_TAG)) - null - } - val positionTag = + val landmarkInfo = if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_POSITION_TAG)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_POSITION_TAG)) - null - } - val surfaceTag = - if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_SURFACE_TAG)) + ServiceAreaClusterLandmarkInfoStruct.fromTlv( + ContextSpecificTag(TAG_LANDMARK_INFO), + tlvReader, + ) } else { - tlvReader.getNull(ContextSpecificTag(TAG_SURFACE_TAG)) + tlvReader.getNull(ContextSpecificTag(TAG_LANDMARK_INFO)) null } tlvReader.exitContainer() - return ServiceAreaClusterAreaInfoStruct(locationInfo, landmarkTag, positionTag, surfaceTag) + return ServiceAreaClusterAreaInfoStruct(locationInfo, landmarkInfo) } } } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaStruct.kt index 74be0531c61dc5..3f8365d49b3b78 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaStruct.kt @@ -24,7 +24,7 @@ import matter.tlv.TlvWriter class ServiceAreaClusterAreaStruct( val areaID: ULong, - val mapID: UInt?, + val mapID: ULong?, val areaDesc: ServiceAreaClusterAreaInfoStruct, ) { override fun toString(): String = buildString { @@ -59,7 +59,7 @@ class ServiceAreaClusterAreaStruct( val areaID = tlvReader.getULong(ContextSpecificTag(TAG_AREA_I_D)) val mapID = if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_MAP_I_D)) + tlvReader.getULong(ContextSpecificTag(TAG_MAP_I_D)) } else { tlvReader.getNull(ContextSpecificTag(TAG_MAP_I_D)) null diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt new file mode 100644 index 00000000000000..04970798a28433 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt @@ -0,0 +1,66 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ServiceAreaClusterLandmarkInfoStruct(val landmarkTag: UInt, val positionTag: UInt?) { + override fun toString(): String = buildString { + append("ServiceAreaClusterLandmarkInfoStruct {\n") + append("\tlandmarkTag : $landmarkTag\n") + append("\tpositionTag : $positionTag\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_LANDMARK_TAG), landmarkTag) + if (positionTag != null) { + put(ContextSpecificTag(TAG_POSITION_TAG), positionTag) + } else { + putNull(ContextSpecificTag(TAG_POSITION_TAG)) + } + endStructure() + } + } + + companion object { + private const val TAG_LANDMARK_TAG = 0 + private const val TAG_POSITION_TAG = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterLandmarkInfoStruct { + tlvReader.enterStructure(tlvTag) + val landmarkTag = tlvReader.getUInt(ContextSpecificTag(TAG_LANDMARK_TAG)) + val positionTag = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_POSITION_TAG)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_POSITION_TAG)) + null + } + + tlvReader.exitContainer() + + return ServiceAreaClusterLandmarkInfoStruct(landmarkTag, positionTag) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterMapStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterMapStruct.kt index 377ab13f0e9130..f00877354d1506 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterMapStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterMapStruct.kt @@ -22,7 +22,7 @@ import matter.tlv.Tag import matter.tlv.TlvReader import matter.tlv.TlvWriter -class ServiceAreaClusterMapStruct(val mapID: UInt, val name: String) { +class ServiceAreaClusterMapStruct(val mapID: ULong, val name: String) { override fun toString(): String = buildString { append("ServiceAreaClusterMapStruct {\n") append("\tmapID : $mapID\n") @@ -45,7 +45,7 @@ class ServiceAreaClusterMapStruct(val mapID: UInt, val name: String) { fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterMapStruct { tlvReader.enterStructure(tlvTag) - val mapID = tlvReader.getUInt(ContextSpecificTag(TAG_MAP_I_D)) + val mapID = tlvReader.getULong(ContextSpecificTag(TAG_MAP_I_D)) val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ServiceAreaCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ServiceAreaCluster.kt index 08376006435cf1..b526c0ea4c38b9 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ServiceAreaCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ServiceAreaCluster.kt @@ -40,9 +40,9 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class ServiceAreaCluster(private val controller: MatterController, private val endpointId: UShort) { - class SelectAreasResponse(val status: UByte, val statusText: String?) + class SelectAreasResponse(val status: UByte, val statusText: String) - class SkipAreaResponse(val status: UByte, val statusText: String?) + class SkipAreaResponse(val status: UByte, val statusText: String) class SupportedAreasAttribute(val value: List) @@ -55,10 +55,10 @@ class ServiceAreaCluster(private val controller: MatterController, private val e object SubscriptionEstablished : SupportedAreasAttributeSubscriptionState() } - class SupportedMapsAttribute(val value: List) + class SupportedMapsAttribute(val value: List?) sealed class SupportedMapsAttributeSubscriptionState { - data class Success(val value: List) : + data class Success(val value: List?) : SupportedMapsAttributeSubscriptionState() data class Error(val exception: Exception) : SupportedMapsAttributeSubscriptionState() @@ -190,17 +190,7 @@ class ServiceAreaCluster(private val controller: MatterController, private val e } if (tag == ContextSpecificTag(TAG_STATUS_TEXT)) { - statusText_decoded = - if (tlvReader.isNull()) { - tlvReader.getNull(tag) - null - } else { - if (tlvReader.isNextTag(tag)) { - tlvReader.getString(tag) - } else { - null - } - } + statusText_decoded = tlvReader.getString(tag) } else { tlvReader.skipElement() } @@ -210,16 +200,23 @@ class ServiceAreaCluster(private val controller: MatterController, private val e throw IllegalStateException("status not found in TLV") } + if (statusText_decoded == null) { + throw IllegalStateException("statusText not found in TLV") + } + tlvReader.exitContainer() return SelectAreasResponse(status_decoded, statusText_decoded) } - suspend fun skipArea(timedInvokeTimeout: Duration? = null): SkipAreaResponse { + suspend fun skipArea(skippedArea: UInt, timedInvokeTimeout: Duration? = null): SkipAreaResponse { val commandId: UInt = 2u val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) + + val TAG_SKIPPED_AREA_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_SKIPPED_AREA_REQ), skippedArea) tlvWriter.endStructure() val request: InvokeRequest = @@ -248,17 +245,7 @@ class ServiceAreaCluster(private val controller: MatterController, private val e } if (tag == ContextSpecificTag(TAG_STATUS_TEXT)) { - statusText_decoded = - if (tlvReader.isNull()) { - tlvReader.getNull(tag) - null - } else { - if (tlvReader.isNextTag(tag)) { - tlvReader.getString(tag) - } else { - null - } - } + statusText_decoded = tlvReader.getString(tag) } else { tlvReader.skipElement() } @@ -268,6 +255,10 @@ class ServiceAreaCluster(private val controller: MatterController, private val e throw IllegalStateException("status not found in TLV") } + if (statusText_decoded == null) { + throw IllegalStateException("statusText not found in TLV") + } + tlvReader.exitContainer() return SkipAreaResponse(status_decoded, statusText_decoded) @@ -396,13 +387,17 @@ class ServiceAreaCluster(private val controller: MatterController, private val e // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: List = - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(ServiceAreaClusterMapStruct.fromTlv(AnonymousTag, tlvReader)) + val decodedValue: List? = + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(ServiceAreaClusterMapStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() } - tlvReader.exitContainer() + } else { + null } return SupportedMapsAttribute(decodedValue) @@ -447,16 +442,20 @@ class ServiceAreaCluster(private val controller: MatterController, private val e // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: List = - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(ServiceAreaClusterMapStruct.fromTlv(AnonymousTag, tlvReader)) + val decodedValue: List? = + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(ServiceAreaClusterMapStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() } - tlvReader.exitContainer() + } else { + null } - emit(SupportedMapsAttributeSubscriptionState.Success(decodedValue)) + decodedValue?.let { emit(SupportedMapsAttributeSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { emit(SupportedMapsAttributeSubscriptionState.SubscriptionEstablished) diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index e848af60d78a98..844c6692f5b9ad 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -125,6 +125,7 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterSceneInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationDescriptorStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterMapStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterProgressStruct.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaInfoStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaInfoStruct.kt index a440d0b2ec4116..1c71c6bcd1ff68 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaInfoStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaInfoStruct.kt @@ -24,16 +24,12 @@ import matter.tlv.TlvWriter class ServiceAreaClusterAreaInfoStruct( val locationInfo: ServiceAreaClusterLocationDescriptorStruct?, - val landmarkTag: UByte?, - val positionTag: UByte?, - val surfaceTag: UByte?, + val landmarkInfo: ServiceAreaClusterLandmarkInfoStruct?, ) { override fun toString(): String = buildString { append("ServiceAreaClusterAreaInfoStruct {\n") append("\tlocationInfo : $locationInfo\n") - append("\tlandmarkTag : $landmarkTag\n") - append("\tpositionTag : $positionTag\n") - append("\tsurfaceTag : $surfaceTag\n") + append("\tlandmarkInfo : $landmarkInfo\n") append("}\n") } @@ -45,20 +41,10 @@ class ServiceAreaClusterAreaInfoStruct( } else { putNull(ContextSpecificTag(TAG_LOCATION_INFO)) } - if (landmarkTag != null) { - put(ContextSpecificTag(TAG_LANDMARK_TAG), landmarkTag) + if (landmarkInfo != null) { + landmarkInfo.toTlv(ContextSpecificTag(TAG_LANDMARK_INFO), this) } else { - putNull(ContextSpecificTag(TAG_LANDMARK_TAG)) - } - if (positionTag != null) { - put(ContextSpecificTag(TAG_POSITION_TAG), positionTag) - } else { - putNull(ContextSpecificTag(TAG_POSITION_TAG)) - } - if (surfaceTag != null) { - put(ContextSpecificTag(TAG_SURFACE_TAG), surfaceTag) - } else { - putNull(ContextSpecificTag(TAG_SURFACE_TAG)) + putNull(ContextSpecificTag(TAG_LANDMARK_INFO)) } endStructure() } @@ -66,9 +52,7 @@ class ServiceAreaClusterAreaInfoStruct( companion object { private const val TAG_LOCATION_INFO = 0 - private const val TAG_LANDMARK_TAG = 1 - private const val TAG_POSITION_TAG = 2 - private const val TAG_SURFACE_TAG = 3 + private const val TAG_LANDMARK_INFO = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterAreaInfoStruct { tlvReader.enterStructure(tlvTag) @@ -82,31 +66,20 @@ class ServiceAreaClusterAreaInfoStruct( tlvReader.getNull(ContextSpecificTag(TAG_LOCATION_INFO)) null } - val landmarkTag = - if (!tlvReader.isNull()) { - tlvReader.getUByte(ContextSpecificTag(TAG_LANDMARK_TAG)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_LANDMARK_TAG)) - null - } - val positionTag = + val landmarkInfo = if (!tlvReader.isNull()) { - tlvReader.getUByte(ContextSpecificTag(TAG_POSITION_TAG)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_POSITION_TAG)) - null - } - val surfaceTag = - if (!tlvReader.isNull()) { - tlvReader.getUByte(ContextSpecificTag(TAG_SURFACE_TAG)) + ServiceAreaClusterLandmarkInfoStruct.fromTlv( + ContextSpecificTag(TAG_LANDMARK_INFO), + tlvReader, + ) } else { - tlvReader.getNull(ContextSpecificTag(TAG_SURFACE_TAG)) + tlvReader.getNull(ContextSpecificTag(TAG_LANDMARK_INFO)) null } tlvReader.exitContainer() - return ServiceAreaClusterAreaInfoStruct(locationInfo, landmarkTag, positionTag, surfaceTag) + return ServiceAreaClusterAreaInfoStruct(locationInfo, landmarkInfo) } } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaStruct.kt index 0ffdb8c9416d01..adfe228d332c39 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaStruct.kt @@ -24,7 +24,7 @@ import matter.tlv.TlvWriter class ServiceAreaClusterAreaStruct( val areaID: UInt, - val mapID: UByte?, + val mapID: UInt?, val areaDesc: ServiceAreaClusterAreaInfoStruct, ) { override fun toString(): String = buildString { @@ -59,7 +59,7 @@ class ServiceAreaClusterAreaStruct( val areaID = tlvReader.getUInt(ContextSpecificTag(TAG_AREA_I_D)) val mapID = if (!tlvReader.isNull()) { - tlvReader.getUByte(ContextSpecificTag(TAG_MAP_I_D)) + tlvReader.getUInt(ContextSpecificTag(TAG_MAP_I_D)) } else { tlvReader.getNull(ContextSpecificTag(TAG_MAP_I_D)) null diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt new file mode 100644 index 00000000000000..119667c339d88c --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt @@ -0,0 +1,66 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ServiceAreaClusterLandmarkInfoStruct(val landmarkTag: UByte, val positionTag: UByte?) { + override fun toString(): String = buildString { + append("ServiceAreaClusterLandmarkInfoStruct {\n") + append("\tlandmarkTag : $landmarkTag\n") + append("\tpositionTag : $positionTag\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_LANDMARK_TAG), landmarkTag) + if (positionTag != null) { + put(ContextSpecificTag(TAG_POSITION_TAG), positionTag) + } else { + putNull(ContextSpecificTag(TAG_POSITION_TAG)) + } + endStructure() + } + } + + companion object { + private const val TAG_LANDMARK_TAG = 0 + private const val TAG_POSITION_TAG = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterLandmarkInfoStruct { + tlvReader.enterStructure(tlvTag) + val landmarkTag = tlvReader.getUByte(ContextSpecificTag(TAG_LANDMARK_TAG)) + val positionTag = + if (!tlvReader.isNull()) { + tlvReader.getUByte(ContextSpecificTag(TAG_POSITION_TAG)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_POSITION_TAG)) + null + } + + tlvReader.exitContainer() + + return ServiceAreaClusterLandmarkInfoStruct(landmarkTag, positionTag) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterMapStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterMapStruct.kt index 3109c9bcb82b76..528888247d791b 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterMapStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterMapStruct.kt @@ -22,7 +22,7 @@ import matter.tlv.Tag import matter.tlv.TlvReader import matter.tlv.TlvWriter -class ServiceAreaClusterMapStruct(val mapID: UByte, val name: String) { +class ServiceAreaClusterMapStruct(val mapID: UInt, val name: String) { override fun toString(): String = buildString { append("ServiceAreaClusterMapStruct {\n") append("\tmapID : $mapID\n") @@ -45,7 +45,7 @@ class ServiceAreaClusterMapStruct(val mapID: UByte, val name: String) { fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterMapStruct { tlvReader.enterStructure(tlvTag) - val mapID = tlvReader.getUByte(ContextSpecificTag(TAG_MAP_I_D)) + val mapID = tlvReader.getUInt(ContextSpecificTag(TAG_MAP_I_D)) val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) tlvReader.exitContainer() diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index ffa1de162de340..82a4a6fe42e669 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -28640,12 +28640,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } else { - std::string newElement_0_mapIDClassName = "java/lang/Integer"; - std::string newElement_0_mapIDCtorSignature = "(I)V"; - jint jninewElement_0_mapID = static_cast(entry_0.mapID.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_mapIDClassName.c_str(), - newElement_0_mapIDCtorSignature.c_str(), - jninewElement_0_mapID, newElement_0_mapID); + std::string newElement_0_mapIDClassName = "java/lang/Long"; + std::string newElement_0_mapIDCtorSignature = "(J)V"; + jlong jninewElement_0_mapID = static_cast(entry_0.mapID.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_mapIDClassName.c_str(), + newElement_0_mapIDCtorSignature.c_str(), + jninewElement_0_mapID, newElement_0_mapID); } jobject newElement_0_areaDesc; jobject newElement_0_areaDesc_locationInfo; @@ -28716,47 +28716,62 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR newElement_0_areaDesc_locationInfo_locationName, newElement_0_areaDesc_locationInfo_floorNumber, newElement_0_areaDesc_locationInfo_areaType); } - jobject newElement_0_areaDesc_landmarkTag; - if (entry_0.areaDesc.landmarkTag.IsNull()) + jobject newElement_0_areaDesc_landmarkInfo; + if (entry_0.areaDesc.landmarkInfo.IsNull()) { - newElement_0_areaDesc_landmarkTag = nullptr; + newElement_0_areaDesc_landmarkInfo = nullptr; } else { - std::string newElement_0_areaDesc_landmarkTagClassName = "java/lang/Integer"; - std::string newElement_0_areaDesc_landmarkTagCtorSignature = "(I)V"; - jint jninewElement_0_areaDesc_landmarkTag = static_cast(entry_0.areaDesc.landmarkTag.Value()); + jobject newElement_0_areaDesc_landmarkInfo_landmarkTag; + std::string newElement_0_areaDesc_landmarkInfo_landmarkTagClassName = "java/lang/Integer"; + std::string newElement_0_areaDesc_landmarkInfo_landmarkTagCtorSignature = "(I)V"; + jint jninewElement_0_areaDesc_landmarkInfo_landmarkTag = + static_cast(entry_0.areaDesc.landmarkInfo.Value().landmarkTag); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_areaDesc_landmarkTagClassName.c_str(), newElement_0_areaDesc_landmarkTagCtorSignature.c_str(), - jninewElement_0_areaDesc_landmarkTag, newElement_0_areaDesc_landmarkTag); - } - jobject newElement_0_areaDesc_positionTag; - if (entry_0.areaDesc.positionTag.IsNull()) - { - newElement_0_areaDesc_positionTag = nullptr; - } - else - { - std::string newElement_0_areaDesc_positionTagClassName = "java/lang/Integer"; - std::string newElement_0_areaDesc_positionTagCtorSignature = "(I)V"; - jint jninewElement_0_areaDesc_positionTag = static_cast(entry_0.areaDesc.positionTag.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_areaDesc_positionTagClassName.c_str(), newElement_0_areaDesc_positionTagCtorSignature.c_str(), - jninewElement_0_areaDesc_positionTag, newElement_0_areaDesc_positionTag); - } - jobject newElement_0_areaDesc_surfaceTag; - if (entry_0.areaDesc.surfaceTag.IsNull()) - { - newElement_0_areaDesc_surfaceTag = nullptr; - } - else - { - std::string newElement_0_areaDesc_surfaceTagClassName = "java/lang/Integer"; - std::string newElement_0_areaDesc_surfaceTagCtorSignature = "(I)V"; - jint jninewElement_0_areaDesc_surfaceTag = static_cast(entry_0.areaDesc.surfaceTag.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_areaDesc_surfaceTagClassName.c_str(), newElement_0_areaDesc_surfaceTagCtorSignature.c_str(), - jninewElement_0_areaDesc_surfaceTag, newElement_0_areaDesc_surfaceTag); + newElement_0_areaDesc_landmarkInfo_landmarkTagClassName.c_str(), + newElement_0_areaDesc_landmarkInfo_landmarkTagCtorSignature.c_str(), + jninewElement_0_areaDesc_landmarkInfo_landmarkTag, newElement_0_areaDesc_landmarkInfo_landmarkTag); + jobject newElement_0_areaDesc_landmarkInfo_positionTag; + if (entry_0.areaDesc.landmarkInfo.Value().positionTag.IsNull()) + { + newElement_0_areaDesc_landmarkInfo_positionTag = nullptr; + } + else + { + std::string newElement_0_areaDesc_landmarkInfo_positionTagClassName = "java/lang/Integer"; + std::string newElement_0_areaDesc_landmarkInfo_positionTagCtorSignature = "(I)V"; + jint jninewElement_0_areaDesc_landmarkInfo_positionTag = + static_cast(entry_0.areaDesc.landmarkInfo.Value().positionTag.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_areaDesc_landmarkInfo_positionTagClassName.c_str(), + newElement_0_areaDesc_landmarkInfo_positionTagCtorSignature.c_str(), + jninewElement_0_areaDesc_landmarkInfo_positionTag, newElement_0_areaDesc_landmarkInfo_positionTag); + } + + jclass landmarkInfoStructStructClass_4; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$ServiceAreaClusterLandmarkInfoStruct", + landmarkInfoStructStructClass_4); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ServiceAreaClusterLandmarkInfoStruct"); + return nullptr; + } + + jmethodID landmarkInfoStructStructCtor_4; + err = chip::JniReferences::GetInstance().FindMethod(env, landmarkInfoStructStructClass_4, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;)V", + &landmarkInfoStructStructCtor_4); + if (err != CHIP_NO_ERROR || landmarkInfoStructStructCtor_4 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$ServiceAreaClusterLandmarkInfoStruct constructor"); + return nullptr; + } + + newElement_0_areaDesc_landmarkInfo = env->NewObject( + landmarkInfoStructStructClass_4, landmarkInfoStructStructCtor_4, + newElement_0_areaDesc_landmarkInfo_landmarkTag, newElement_0_areaDesc_landmarkInfo_positionTag); } jclass areaInfoStructStructClass_2; @@ -28771,8 +28786,8 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jmethodID areaInfoStructStructCtor_2; err = chip::JniReferences::GetInstance().FindMethod( env, areaInfoStructStructClass_2, "", - "(Lchip/devicecontroller/ChipStructs$ServiceAreaClusterLocationDescriptorStruct;Ljava/lang/Integer;Ljava/lang/" - "Integer;Ljava/lang/Integer;)V", + "(Lchip/devicecontroller/ChipStructs$ServiceAreaClusterLocationDescriptorStruct;Lchip/devicecontroller/" + "ChipStructs$ServiceAreaClusterLandmarkInfoStruct;)V", &areaInfoStructStructCtor_2); if (err != CHIP_NO_ERROR || areaInfoStructStructCtor_2 == nullptr) { @@ -28781,8 +28796,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } newElement_0_areaDesc = env->NewObject(areaInfoStructStructClass_2, areaInfoStructStructCtor_2, - newElement_0_areaDesc_locationInfo, newElement_0_areaDesc_landmarkTag, - newElement_0_areaDesc_positionTag, newElement_0_areaDesc_surfaceTag); + newElement_0_areaDesc_locationInfo, newElement_0_areaDesc_landmarkInfo); jclass areaStructStructClass_1; err = chip::JniReferences::GetInstance().GetLocalClassRef( @@ -28796,7 +28810,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jmethodID areaStructStructCtor_1; err = chip::JniReferences::GetInstance().FindMethod( env, areaStructStructClass_1, "", - "(Ljava/lang/Long;Ljava/lang/Integer;Lchip/devicecontroller/ChipStructs$ServiceAreaClusterAreaInfoStruct;)V", + "(Ljava/lang/Long;Ljava/lang/Long;Lchip/devicecontroller/ChipStructs$ServiceAreaClusterAreaInfoStruct;)V", &areaStructStructCtor_1); if (err != CHIP_NO_ERROR || areaStructStructCtor_1 == nullptr) { @@ -28827,12 +28841,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR auto & entry_0 = iter_value_0.GetValue(); jobject newElement_0; jobject newElement_0_mapID; - std::string newElement_0_mapIDClassName = "java/lang/Integer"; - std::string newElement_0_mapIDCtorSignature = "(I)V"; - jint jninewElement_0_mapID = static_cast(entry_0.mapID); - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_mapIDClassName.c_str(), - newElement_0_mapIDCtorSignature.c_str(), - jninewElement_0_mapID, newElement_0_mapID); + std::string newElement_0_mapIDClassName = "java/lang/Long"; + std::string newElement_0_mapIDCtorSignature = "(J)V"; + jlong jninewElement_0_mapID = static_cast(entry_0.mapID); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_mapIDClassName.c_str(), + newElement_0_mapIDCtorSignature.c_str(), + jninewElement_0_mapID, newElement_0_mapID); jobject newElement_0_name; LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(entry_0.name, newElement_0_name)); @@ -28847,7 +28861,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jmethodID mapStructStructCtor_1; err = chip::JniReferences::GetInstance().FindMethod( - env, mapStructStructClass_1, "", "(Ljava/lang/Integer;Ljava/lang/String;)V", &mapStructStructCtor_1); + env, mapStructStructClass_1, "", "(Ljava/lang/Long;Ljava/lang/String;)V", &mapStructStructCtor_1); if (err != CHIP_NO_ERROR || mapStructStructCtor_1 == nullptr) { ChipLogError(Zcl, "Could not find ChipStructs$ServiceAreaClusterMapStruct constructor"); diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 3c67676fded7ac..c573d69dc78e6c 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -8571,6 +8571,7 @@ class ChipClusters: "commandId": 0x00000002, "commandName": "SkipArea", "args": { + "skippedArea": "int", }, }, }, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 92ea67795df89d..774b76e886af4a 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -31144,7 +31144,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="supportedAreas", Tag=0x00000000, Type=typing.List[ServiceArea.Structs.AreaStruct]), - ClusterObjectFieldDescriptor(Label="supportedMaps", Tag=0x00000001, Type=typing.List[ServiceArea.Structs.MapStruct]), + ClusterObjectFieldDescriptor(Label="supportedMaps", Tag=0x00000001, Type=typing.Optional[typing.List[ServiceArea.Structs.MapStruct]]), ClusterObjectFieldDescriptor(Label="selectedAreas", Tag=0x00000002, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="currentArea", Tag=0x00000003, Type=typing.Union[None, Nullable, uint]), ClusterObjectFieldDescriptor(Label="estimatedEndTime", Tag=0x00000004, Type=typing.Union[None, Nullable, uint]), @@ -31158,7 +31158,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ]) supportedAreas: 'typing.List[ServiceArea.Structs.AreaStruct]' = None - supportedMaps: 'typing.List[ServiceArea.Structs.MapStruct]' = None + supportedMaps: 'typing.Optional[typing.List[ServiceArea.Structs.MapStruct]]' = None selectedAreas: 'typing.List[uint]' = None currentArea: 'typing.Union[None, Nullable, uint]' = None estimatedEndTime: 'typing.Union[None, Nullable, uint]' = None @@ -31198,18 +31198,33 @@ class SkipAreaStatus(MatterIntEnum): kSuccess = 0x00 kInvalidAreaList = 0x01 kInvalidInMode = 0x02 + kInvalidSkippedArea = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only # be used by code to process how it handles receiving an unknown # enum value. This specific value should never be transmitted. - kUnknownEnumValue = 3, + kUnknownEnumValue = 4, class Bitmaps: class Feature(IntFlag): - kListOrder = 0x1 - kSelectWhileRunning = 0x2 + kSelectWhileRunning = 0x1 + kProgressReporting = 0x2 + kMaps = 0x4 class Structs: + @dataclass + class LandmarkInfoStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="landmarkTag", Tag=0, Type=Globals.Enums.LandmarkTag), + ClusterObjectFieldDescriptor(Label="positionTag", Tag=1, Type=typing.Union[Nullable, Globals.Enums.RelativePositionTag]), + ]) + + landmarkTag: 'Globals.Enums.LandmarkTag' = 0 + positionTag: 'typing.Union[Nullable, Globals.Enums.RelativePositionTag]' = NullValue + @dataclass class AreaInfoStruct(ClusterObject): @ChipUtility.classproperty @@ -31217,15 +31232,11 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="locationInfo", Tag=0, Type=typing.Union[Nullable, Globals.Structs.LocationDescriptorStruct]), - ClusterObjectFieldDescriptor(Label="landmarkTag", Tag=1, Type=typing.Union[Nullable, Globals.Enums.LandmarkTag]), - ClusterObjectFieldDescriptor(Label="positionTag", Tag=2, Type=typing.Union[Nullable, Globals.Enums.PositionTag]), - ClusterObjectFieldDescriptor(Label="surfaceTag", Tag=3, Type=typing.Union[Nullable, Globals.Enums.FloorSurfaceTag]), + ClusterObjectFieldDescriptor(Label="landmarkInfo", Tag=1, Type=typing.Union[Nullable, ServiceArea.Structs.LandmarkInfoStruct]), ]) locationInfo: 'typing.Union[Nullable, Globals.Structs.LocationDescriptorStruct]' = NullValue - landmarkTag: 'typing.Union[Nullable, Globals.Enums.LandmarkTag]' = NullValue - positionTag: 'typing.Union[Nullable, Globals.Enums.PositionTag]' = NullValue - surfaceTag: 'typing.Union[Nullable, Globals.Enums.FloorSurfaceTag]' = NullValue + landmarkInfo: 'typing.Union[Nullable, ServiceArea.Structs.LandmarkInfoStruct]' = NullValue @dataclass class AreaStruct(ClusterObject): @@ -31301,11 +31312,11 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="status", Tag=0, Type=ServiceArea.Enums.SelectAreasStatus), - ClusterObjectFieldDescriptor(Label="statusText", Tag=1, Type=typing.Optional[str]), + ClusterObjectFieldDescriptor(Label="statusText", Tag=1, Type=str), ]) status: 'ServiceArea.Enums.SelectAreasStatus' = 0 - statusText: 'typing.Optional[str]' = None + statusText: 'str' = "" @dataclass class SkipArea(ClusterCommand): @@ -31318,8 +31329,11 @@ class SkipArea(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ + ClusterObjectFieldDescriptor(Label="skippedArea", Tag=0, Type=uint), ]) + skippedArea: 'uint' = 0 + @dataclass class SkipAreaResponse(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x00000150 @@ -31332,11 +31346,11 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="status", Tag=0, Type=ServiceArea.Enums.SkipAreaStatus), - ClusterObjectFieldDescriptor(Label="statusText", Tag=1, Type=typing.Optional[str]), + ClusterObjectFieldDescriptor(Label="statusText", Tag=1, Type=str), ]) status: 'ServiceArea.Enums.SkipAreaStatus' = 0 - statusText: 'typing.Optional[str]' = None + statusText: 'str' = "" class Attributes: @dataclass @@ -31367,9 +31381,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.List[ServiceArea.Structs.MapStruct]) + return ClusterObjectFieldDescriptor(Type=typing.Optional[typing.List[ServiceArea.Structs.MapStruct]]) - value: 'typing.List[ServiceArea.Structs.MapStruct]' = field(default_factory=lambda: []) + value: 'typing.Optional[typing.List[ServiceArea.Structs.MapStruct]]' = None @dataclass class SelectedAreas(ClusterAttributeDescriptor): diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 332c53d5cb3431..f899dba1fafe44 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -11195,7 +11195,7 @@ static id _Nullable DecodeAttributeValueForServiceAreaCluster(AttributeId aAttri if (entry_0.mapID.IsNull()) { newElement_0.mapID = nil; } else { - newElement_0.mapID = [NSNumber numberWithUnsignedChar:entry_0.mapID.Value()]; + newElement_0.mapID = [NSNumber numberWithUnsignedInt:entry_0.mapID.Value()]; } newElement_0.areaDesc = [MTRServiceAreaClusterAreaInfoStruct new]; if (entry_0.areaDesc.locationInfo.IsNull()) { @@ -11219,20 +11219,16 @@ static id _Nullable DecodeAttributeValueForServiceAreaCluster(AttributeId aAttri newElement_0.areaDesc.locationInfo.areaType = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.areaDesc.locationInfo.Value().areaType.Value())]; } } - if (entry_0.areaDesc.landmarkTag.IsNull()) { - newElement_0.areaDesc.landmarkTag = nil; + if (entry_0.areaDesc.landmarkInfo.IsNull()) { + newElement_0.areaDesc.landmarkInfo = nil; } else { - newElement_0.areaDesc.landmarkTag = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.areaDesc.landmarkTag.Value())]; - } - if (entry_0.areaDesc.positionTag.IsNull()) { - newElement_0.areaDesc.positionTag = nil; - } else { - newElement_0.areaDesc.positionTag = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.areaDesc.positionTag.Value())]; - } - if (entry_0.areaDesc.surfaceTag.IsNull()) { - newElement_0.areaDesc.surfaceTag = nil; - } else { - newElement_0.areaDesc.surfaceTag = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.areaDesc.surfaceTag.Value())]; + newElement_0.areaDesc.landmarkInfo = [MTRServiceAreaClusterLandmarkInfoStruct new]; + newElement_0.areaDesc.landmarkInfo.landmarkTag = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.areaDesc.landmarkInfo.Value().landmarkTag)]; + if (entry_0.areaDesc.landmarkInfo.Value().positionTag.IsNull()) { + newElement_0.areaDesc.landmarkInfo.positionTag = nil; + } else { + newElement_0.areaDesc.landmarkInfo.positionTag = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.areaDesc.landmarkInfo.Value().positionTag.Value())]; + } } [array_0 addObject:newElement_0]; } @@ -11260,7 +11256,7 @@ static id _Nullable DecodeAttributeValueForServiceAreaCluster(AttributeId aAttri auto & entry_0 = iter_0.GetValue(); MTRServiceAreaClusterMapStruct * newElement_0; newElement_0 = [MTRServiceAreaClusterMapStruct new]; - newElement_0.mapID = [NSNumber numberWithUnsignedChar:entry_0.mapID]; + newElement_0.mapID = [NSNumber numberWithUnsignedInt:entry_0.mapID]; newElement_0.name = AsString(entry_0.name); if (newElement_0.name == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 5456773cce62cb..c9850dd3cfd50f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -9690,7 +9690,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) /** * Cluster Service Area * - * The Service Area cluster provides an interface for controlling the locations where a device should operate, and for querying the current location. + * The Service Area cluster provides an interface for controlling the areas where a device should operate, and for querying the current area being serviced. */ MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterServiceArea : MTRGenericBaseCluster @@ -9706,9 +9706,7 @@ MTR_PROVISIONALLY_AVAILABLE * * This command is used to skip an area where the device operates. */ -- (void)skipAreaWithParams:(MTRServiceAreaClusterSkipAreaParams * _Nullable)params completion:(void (^)(MTRServiceAreaClusterSkipAreaResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)skipAreaWithCompletion:(void (^)(MTRServiceAreaClusterSkipAreaResponseParams * _Nullable data, NSError * _Nullable error))completion - MTR_PROVISIONALLY_AVAILABLE; +- (void)skipAreaWithParams:(MTRServiceAreaClusterSkipAreaParams *)params completion:(void (^)(MTRServiceAreaClusterSkipAreaResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeSupportedAreasWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeSupportedAreasWithParams:(MTRSubscribeParams *)params @@ -19806,11 +19804,13 @@ typedef NS_ENUM(uint8_t, MTRServiceAreaSkipAreaStatus) { MTRServiceAreaSkipAreaStatusSuccess MTR_PROVISIONALLY_AVAILABLE = 0x00, MTRServiceAreaSkipAreaStatusInvalidAreaList MTR_PROVISIONALLY_AVAILABLE = 0x01, MTRServiceAreaSkipAreaStatusInvalidInMode MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRServiceAreaSkipAreaStatusInvalidSkippedArea MTR_PROVISIONALLY_AVAILABLE = 0x03, } MTR_PROVISIONALLY_AVAILABLE; typedef NS_OPTIONS(uint32_t, MTRServiceAreaFeature) { - MTRServiceAreaFeatureListOrder MTR_PROVISIONALLY_AVAILABLE = 0x1, - MTRServiceAreaFeatureSelectWhileRunning MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRServiceAreaFeatureSelectWhileRunning MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRServiceAreaFeatureProgressReporting MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRServiceAreaFeatureMaps MTR_PROVISIONALLY_AVAILABLE = 0x4, } MTR_PROVISIONALLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRPumpConfigurationAndControlControlMode) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 992d7ce644acd0..756425bba1b764 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -65388,11 +65388,7 @@ - (void)selectAreasWithParams:(MTRServiceAreaClusterSelectAreasParams *)params c queue:self.callbackQueue completion:responseHandler]; } -- (void)skipAreaWithCompletion:(void (^)(MTRServiceAreaClusterSkipAreaResponseParams * _Nullable data, NSError * _Nullable error))completion -{ - [self skipAreaWithParams:nil completion:completion]; -} -- (void)skipAreaWithParams:(MTRServiceAreaClusterSkipAreaParams * _Nullable)params completion:(void (^)(MTRServiceAreaClusterSkipAreaResponseParams * _Nullable data, NSError * _Nullable error))completion +- (void)skipAreaWithParams:(MTRServiceAreaClusterSkipAreaParams *)params completion:(void (^)(MTRServiceAreaClusterSkipAreaResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { params = [[MTRServiceAreaClusterSkipAreaParams diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 4a2c3d6e51b156..9db1460dbcb609 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -4505,15 +4505,13 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) /** * Cluster Service Area - * The Service Area cluster provides an interface for controlling the locations where a device should operate, and for querying the current location. + * The Service Area cluster provides an interface for controlling the areas where a device should operate, and for querying the current area being serviced. */ MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterServiceArea : MTRGenericCluster - (void)selectAreasWithParams:(MTRServiceAreaClusterSelectAreasParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRServiceAreaClusterSelectAreasResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)skipAreaWithParams:(MTRServiceAreaClusterSkipAreaParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRServiceAreaClusterSkipAreaResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)skipAreaWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRServiceAreaClusterSkipAreaResponseParams * _Nullable data, NSError * _Nullable error))completion - MTR_PROVISIONALLY_AVAILABLE; +- (void)skipAreaWithParams:(MTRServiceAreaClusterSkipAreaParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRServiceAreaClusterSkipAreaResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeSupportedAreasWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 90ff96712313c3..73ff54e52e36f2 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -12864,11 +12864,7 @@ - (void)selectAreasWithParams:(MTRServiceAreaClusterSelectAreasParams *)params e completion:responseHandler]; } -- (void)skipAreaWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRServiceAreaClusterSkipAreaResponseParams * _Nullable data, NSError * _Nullable error))completion -{ - [self skipAreaWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; -} -- (void)skipAreaWithParams:(MTRServiceAreaClusterSkipAreaParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRServiceAreaClusterSkipAreaResponseParams * _Nullable data, NSError * _Nullable error))completion +- (void)skipAreaWithParams:(MTRServiceAreaClusterSkipAreaParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRServiceAreaClusterSkipAreaResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { params = [[MTRServiceAreaClusterSkipAreaParams diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 79cc7d4011add6..b276bb8b1986ac 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -7671,7 +7671,7 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nonnull status MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSString * _Nullable statusText MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSString * _Nonnull statusText MTR_PROVISIONALLY_AVAILABLE; /** * Initialize an MTRServiceAreaClusterSelectAreasResponseParams with a response-value dictionary @@ -7689,6 +7689,8 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRServiceAreaClusterSkipAreaParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull skippedArea MTR_PROVISIONALLY_AVAILABLE; /** * Controls whether the command is a timed command (using Timed Invoke). * @@ -7720,7 +7722,7 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nonnull status MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSString * _Nullable statusText MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSString * _Nonnull statusText MTR_PROVISIONALLY_AVAILABLE; /** * Initialize an MTRServiceAreaClusterSkipAreaResponseParams with a response-value dictionary diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index eeb671df165fec..7aa736277256f6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -21891,7 +21891,7 @@ - (instancetype)init _status = @(0); - _statusText = nil; + _statusText = @""; } return self; } @@ -21962,14 +21962,10 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ServiceA self.status = [NSNumber numberWithUnsignedChar:chip::to_underlying(decodableStruct.status)]; } { - if (decodableStruct.statusText.HasValue()) { - self.statusText = AsString(decodableStruct.statusText.Value()); - if (self.statusText == nil) { - CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; - return err; - } - } else { - self.statusText = nil; + self.statusText = AsString(decodableStruct.statusText); + if (self.statusText == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + return err; } } return CHIP_NO_ERROR; @@ -21981,6 +21977,8 @@ @implementation MTRServiceAreaClusterSkipAreaParams - (instancetype)init { if (self = [super init]) { + + _skippedArea = @(0); _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -21991,6 +21989,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; { auto other = [[MTRServiceAreaClusterSkipAreaParams alloc] init]; + other.skippedArea = self.skippedArea; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; @@ -21999,7 +21998,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: skippedArea:%@; >", NSStringFromClass([self class]), _skippedArea]; return descriptionString; } @@ -22011,6 +22010,9 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { chip::app::Clusters::ServiceArea::Commands::SkipArea::Type encodableStruct; ListFreer listFreer; + { + encodableStruct.skippedArea = self.skippedArea.unsignedIntValue; + } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); if (buffer.IsNull()) { @@ -22057,7 +22059,7 @@ - (instancetype)init _status = @(0); - _statusText = nil; + _statusText = @""; } return self; } @@ -22128,14 +22130,10 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ServiceA self.status = [NSNumber numberWithUnsignedChar:chip::to_underlying(decodableStruct.status)]; } { - if (decodableStruct.statusText.HasValue()) { - self.statusText = AsString(decodableStruct.statusText.Value()); - if (self.statusText == nil) { - CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; - return err; - } - } else { - self.statusText = nil; + self.statusText = AsString(decodableStruct.statusText); + if (self.statusText == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + return err; } } return CHIP_NO_ERROR; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index db765a29de8913..8590079420a854 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1593,12 +1593,16 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @property (nonatomic, copy) NSNumber * _Nullable dataIndex MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRServiceAreaClusterLandmarkInfoStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull landmarkTag MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable positionTag MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTRServiceAreaClusterAreaInfoStruct : NSObject @property (nonatomic, copy) MTRDataTypeLocationDescriptorStruct * _Nullable locationInfo MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable landmarkTag MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable positionTag MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable surfaceTag MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRServiceAreaClusterLandmarkInfoStruct * _Nullable landmarkInfo MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 8bcfc3af65f9a7..02aac9e24ec0ae 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -6640,18 +6640,44 @@ - (NSString *)description @end -@implementation MTRServiceAreaClusterAreaInfoStruct +@implementation MTRServiceAreaClusterLandmarkInfoStruct - (instancetype)init { if (self = [super init]) { - _locationInfo = nil; - - _landmarkTag = nil; + _landmarkTag = @(0); _positionTag = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRServiceAreaClusterLandmarkInfoStruct alloc] init]; + + other.landmarkTag = self.landmarkTag; + other.positionTag = self.positionTag; - _surfaceTag = nil; + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: landmarkTag:%@; positionTag:%@; >", NSStringFromClass([self class]), _landmarkTag, _positionTag]; + return descriptionString; +} + +@end + +@implementation MTRServiceAreaClusterAreaInfoStruct +- (instancetype)init +{ + if (self = [super init]) { + + _locationInfo = nil; + + _landmarkInfo = nil; } return self; } @@ -6661,16 +6687,14 @@ - (id)copyWithZone:(NSZone * _Nullable)zone auto other = [[MTRServiceAreaClusterAreaInfoStruct alloc] init]; other.locationInfo = self.locationInfo; - other.landmarkTag = self.landmarkTag; - other.positionTag = self.positionTag; - other.surfaceTag = self.surfaceTag; + other.landmarkInfo = self.landmarkInfo; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: locationInfo:%@; landmarkTag:%@; positionTag:%@; surfaceTag:%@; >", NSStringFromClass([self class]), _locationInfo, _landmarkTag, _positionTag, _surfaceTag]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: locationInfo:%@; landmarkInfo:%@; >", NSStringFromClass([self class]), _locationInfo, _landmarkInfo]; return descriptionString; } diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index 8a951e2a54a575..b7305aa2cbfdab 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -2614,6 +2614,7 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(ServiceArea::SkipAreaSt case EnumType::kSuccess: case EnumType::kInvalidAreaList: case EnumType::kInvalidInMode: + case EnumType::kInvalidSkippedArea: return val; default: return EnumType::kUnknownEnumValue; diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index a0407517696744..b7986208f1dca8 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -3848,21 +3848,23 @@ enum class SelectAreasStatus : uint8_t // Enum for SkipAreaStatus enum class SkipAreaStatus : uint8_t { - kSuccess = 0x00, - kInvalidAreaList = 0x01, - kInvalidInMode = 0x02, + kSuccess = 0x00, + kInvalidAreaList = 0x01, + kInvalidInMode = 0x02, + kInvalidSkippedArea = 0x03, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown // enum value. This specific should never be transmitted. - kUnknownEnumValue = 3, + kUnknownEnumValue = 4, }; // Bitmap for Feature enum class Feature : uint32_t { - kListOrder = 0x1, - kSelectWhileRunning = 0x2, + kSelectWhileRunning = 0x1, + kProgressReporting = 0x2, + kMaps = 0x4, }; } // namespace ServiceArea diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 878090f033d558..90eddd9b2f1f0d 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -20357,14 +20357,12 @@ namespace Events {} // namespace Events namespace ServiceArea { namespace Structs { -namespace AreaInfoStruct { +namespace LandmarkInfoStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kLocationInfo), locationInfo); encoder.Encode(to_underlying(Fields::kLandmarkTag), landmarkTag); encoder.Encode(to_underlying(Fields::kPositionTag), positionTag); - encoder.Encode(to_underlying(Fields::kSurfaceTag), surfaceTag); return encoder.Finalize(); } @@ -20382,11 +20380,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kLocationInfo)) - { - err = DataModel::Decode(reader, locationInfo); - } - else if (__context_tag == to_underlying(Fields::kLandmarkTag)) + if (__context_tag == to_underlying(Fields::kLandmarkTag)) { err = DataModel::Decode(reader, landmarkTag); } @@ -20394,9 +20388,46 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, positionTag); } - else if (__context_tag == to_underlying(Fields::kSurfaceTag)) + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace LandmarkInfoStruct + +namespace AreaInfoStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kLocationInfo), locationInfo); + encoder.Encode(to_underlying(Fields::kLandmarkInfo), landmarkInfo); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kLocationInfo)) + { + err = DataModel::Decode(reader, locationInfo); + } + else if (__context_tag == to_underlying(Fields::kLandmarkInfo)) { - err = DataModel::Decode(reader, surfaceTag); + err = DataModel::Decode(reader, landmarkInfo); } else { @@ -20625,6 +20656,7 @@ namespace SkipArea { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kSkippedArea), skippedArea); return encoder.Finalize(); } @@ -20638,6 +20670,19 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { return std::get(__element); } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kSkippedArea)) + { + err = DataModel::Decode(reader, skippedArea); + } + else + { + } + + ReturnErrorOnFailure(err); } } } // namespace SkipArea. diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 472ce88303daaa..27ee806af6e9a9 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -28344,22 +28344,41 @@ struct TypeInfo } // namespace BarrierControl namespace ServiceArea { namespace Structs { +namespace LandmarkInfoStruct { +enum class Fields : uint8_t +{ + kLandmarkTag = 0, + kPositionTag = 1, +}; + +struct Type +{ +public: + Globals::LandmarkTag landmarkTag = static_cast(0); + DataModel::Nullable positionTag; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace LandmarkInfoStruct namespace AreaInfoStruct { enum class Fields : uint8_t { kLocationInfo = 0, - kLandmarkTag = 1, - kPositionTag = 2, - kSurfaceTag = 3, + kLandmarkInfo = 1, }; struct Type { public: DataModel::Nullable locationInfo; - DataModel::Nullable landmarkTag; - DataModel::Nullable positionTag; - DataModel::Nullable surfaceTag; + DataModel::Nullable landmarkInfo; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -28383,7 +28402,7 @@ struct Type { public: uint32_t areaID = static_cast(0); - DataModel::Nullable mapID; + DataModel::Nullable mapID; Structs::AreaInfoStruct::Type areaDesc; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -28406,7 +28425,7 @@ enum class Fields : uint8_t struct Type { public: - uint8_t mapID = static_cast(0); + uint32_t mapID = static_cast(0); chip::CharSpan name; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -28521,7 +28540,7 @@ struct Type static constexpr ClusterId GetClusterId() { return Clusters::ServiceArea::Id; } SelectAreasStatus status = static_cast(0); - Optional statusText; + chip::CharSpan statusText; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -28537,13 +28556,14 @@ struct DecodableType static constexpr ClusterId GetClusterId() { return Clusters::ServiceArea::Id; } SelectAreasStatus status = static_cast(0); - Optional statusText; + chip::CharSpan statusText; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace SelectAreasResponse namespace SkipArea { enum class Fields : uint8_t { + kSkippedArea = 0, }; struct Type @@ -28553,6 +28573,8 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::SkipArea::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ServiceArea::Id; } + uint32_t skippedArea = static_cast(0); + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; using ResponseType = Clusters::ServiceArea::Commands::SkipAreaResponse::DecodableType; @@ -28566,6 +28588,7 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::SkipArea::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ServiceArea::Id; } + uint32_t skippedArea = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace SkipArea @@ -28584,7 +28607,7 @@ struct Type static constexpr ClusterId GetClusterId() { return Clusters::ServiceArea::Id; } SkipAreaStatus status = static_cast(0); - Optional statusText; + chip::CharSpan statusText; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -28600,7 +28623,7 @@ struct DecodableType static constexpr ClusterId GetClusterId() { return Clusters::ServiceArea::Id; } SkipAreaStatus status = static_cast(0); - Optional statusText; + chip::CharSpan statusText; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace SkipAreaResponse diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 3bd79612c9050c..85a45a057b7eab 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -9429,6 +9429,7 @@ class ServiceAreaSkipArea : public ClusterCommand public: ServiceAreaSkipArea(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("skip-area", credsIssuerConfig) { + AddArgument("SkippedArea", 0, UINT32_MAX, &mRequest.skippedArea); ClusterCommand::AddArguments(); } diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index b57db005357f57..d4f67568a7f746 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -3975,7 +3975,7 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::DoorLock::Structs::Cre } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, - chip::app::Clusters::ServiceArea::Structs::AreaInfoStruct::Type & request, + chip::app::Clusters::ServiceArea::Structs::LandmarkInfoStruct::Type & request, Json::Value & value) { VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); @@ -3984,19 +3984,11 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, Json::Value valueCopy(value); ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("AreaInfoStruct.locationInfo", "locationInfo", value.isMember("locationInfo"))); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("AreaInfoStruct.landmarkTag", "landmarkTag", value.isMember("landmarkTag"))); + ComplexArgumentParser::EnsureMemberExist("LandmarkInfoStruct.landmarkTag", "landmarkTag", value.isMember("landmarkTag"))); ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("AreaInfoStruct.positionTag", "positionTag", value.isMember("positionTag"))); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("AreaInfoStruct.surfaceTag", "surfaceTag", value.isMember("surfaceTag"))); + ComplexArgumentParser::EnsureMemberExist("LandmarkInfoStruct.positionTag", "positionTag", value.isMember("positionTag"))); char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "locationInfo"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.locationInfo, value["locationInfo"])); - valueCopy.removeMember("locationInfo"); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "landmarkTag"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.landmarkTag, value["landmarkTag"])); valueCopy.removeMember("landmarkTag"); @@ -4005,9 +3997,37 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.positionTag, value["positionTag"])); valueCopy.removeMember("positionTag"); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "surfaceTag"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.surfaceTag, value["surfaceTag"])); - valueCopy.removeMember("surfaceTag"); + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ServiceArea::Structs::LandmarkInfoStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.landmarkTag); + ComplexArgumentParser::Finalize(request.positionTag); +} + +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ServiceArea::Structs::AreaInfoStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("AreaInfoStruct.locationInfo", "locationInfo", value.isMember("locationInfo"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("AreaInfoStruct.landmarkInfo", "landmarkInfo", value.isMember("landmarkInfo"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "locationInfo"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.locationInfo, value["locationInfo"])); + valueCopy.removeMember("locationInfo"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "landmarkInfo"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.landmarkInfo, value["landmarkInfo"])); + valueCopy.removeMember("landmarkInfo"); return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); } @@ -4015,9 +4035,7 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, void ComplexArgumentParser::Finalize(chip::app::Clusters::ServiceArea::Structs::AreaInfoStruct::Type & request) { ComplexArgumentParser::Finalize(request.locationInfo); - ComplexArgumentParser::Finalize(request.landmarkTag); - ComplexArgumentParser::Finalize(request.positionTag); - ComplexArgumentParser::Finalize(request.surfaceTag); + ComplexArgumentParser::Finalize(request.landmarkInfo); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::ServiceArea::Structs::AreaStruct::Type & request, diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index b08c731a32689d..dfca56f4c3afba 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -458,6 +458,11 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::DoorLock::Struc static void Finalize(chip::app::Clusters::DoorLock::Structs::CredentialStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ServiceArea::Structs::LandmarkInfoStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ServiceArea::Structs::LandmarkInfoStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ServiceArea::Structs::AreaInfoStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 51f73a1804a85b..2eddf2f356bd07 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -3516,38 +3516,47 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, } CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const chip::app::Clusters::ServiceArea::Structs::AreaInfoStruct::DecodableType & value) + const chip::app::Clusters::ServiceArea::Structs::LandmarkInfoStruct::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = LogValue("LocationInfo", indent + 1, value.locationInfo); + CHIP_ERROR err = LogValue("LandmarkTag", indent + 1, value.landmarkTag); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'LocationInfo'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'LandmarkTag'"); return err; } } { - CHIP_ERROR err = LogValue("LandmarkTag", indent + 1, value.landmarkTag); + CHIP_ERROR err = LogValue("PositionTag", indent + 1, value.positionTag); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'LandmarkTag'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PositionTag'"); return err; } } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::ServiceArea::Structs::AreaInfoStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = LogValue("PositionTag", indent + 1, value.positionTag); + CHIP_ERROR err = LogValue("LocationInfo", indent + 1, value.locationInfo); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PositionTag'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'LocationInfo'"); return err; } } { - CHIP_ERROR err = LogValue("SurfaceTag", indent + 1, value.surfaceTag); + CHIP_ERROR err = LogValue("LandmarkInfo", indent + 1, value.landmarkInfo); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'SurfaceTag'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'LandmarkInfo'"); return err; } } diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index fa3fc1a2760fc2..60398d0f3d2911 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -286,6 +286,9 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::DoorLock::Structs::CredentialStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ServiceArea::Structs::LandmarkInfoStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ServiceArea::Structs::AreaInfoStruct::DecodableType & value); diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index 3ca43d867fec72..67f8781db8fd5d 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -103950,6 +103950,9 @@ class ServiceAreaSkipArea : public ClusterCommand { ServiceAreaSkipArea() : ClusterCommand("skip-area") { +#if MTR_ENABLE_PROVISIONAL + AddArgument("SkippedArea", 0, UINT32_MAX, &mRequest.skippedArea); +#endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -103964,6 +103967,9 @@ class ServiceAreaSkipArea : public ClusterCommand { __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRServiceAreaClusterSkipAreaParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.skippedArea = [NSNumber numberWithUnsignedInt:mRequest.skippedArea]; +#endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -103990,6 +103996,7 @@ class ServiceAreaSkipArea : public ClusterCommand { } private: + chip::app::Clusters::ServiceArea::Commands::SkipArea::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL