diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index d8d15582f83b5f..cf05f16aebb408 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -6940,6 +6940,19 @@ cluster RadonConcentrationMeasurement = 1071 { readonly attribute int16u clusterRevision = 65533; } +/** This cluster provides an interface to soil measurement functionality, including configuration and provision of notifications of soil measurements. */ +provisional cluster SoilMeasurement = 1072 { + revision 1; + + readonly attribute MeasurementAccuracyStruct soilMoistureMeasurementLimits = 0; + readonly attribute nullable percent soilMoistureMeasuredValue = 1; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + /** This cluster provides an interface for managing low power mode on a device that supports the Wake On LAN protocol. */ cluster WakeOnLan = 1283 { revision 1; @@ -9660,6 +9673,16 @@ endpoint 1 { ram attribute clusterRevision default = 3; } + server cluster SoilMeasurement { + callback attribute soilMoistureMeasurementLimits; + callback attribute soilMoistureMeasuredValue; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap default = 0; + callback attribute clusterRevision; + } + server cluster WakeOnLan { ram attribute MACAddress; ram attribute featureMap default = 0; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index abd549c8c5c754..2be961baf56a3c 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -20776,6 +20776,129 @@ } ] }, + { + "name": "Soil Measurement", + "code": 1072, + "mfgCode": null, + "define": "SOIL_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 1, + "apiMaturity": "provisional", + "attributes": [ + { + "name": "SoilMoistureMeasurementLimits", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "MeasurementAccuracyStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SoilMoistureMeasuredValue", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "percent", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Wake on LAN", "code": 1283, diff --git a/examples/all-clusters-app/all-clusters-common/include/soil-measurement-stub.h b/examples/all-clusters-app/all-clusters-common/include/soil-measurement-stub.h new file mode 100644 index 00000000000000..302f30e51cd463 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/include/soil-measurement-stub.h @@ -0,0 +1,35 @@ +/* + * + * Copyright (c) 2025 Project CHIP Authors + * All rights reserved. + * + * 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. + */ + +#pragma once + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace SoilMeasurement { + +Instance * GetInstance(); + +void Shutdown(); + +} // namespace SoilMeasurement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/src/soil-measurement-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/soil-measurement-stub.cpp new file mode 100644 index 00000000000000..ed8de49207f249 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/soil-measurement-stub.cpp @@ -0,0 +1,65 @@ +/* + * + * Copyright (c) 2025 Project CHIP Authors + * All rights reserved. + * + * 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. + */ + +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::SoilMeasurement; + +static const Globals::Structs::MeasurementAccuracyRangeStruct::Type kDefaultSoilMoistureMeasurementLimitsAccuracyRange[] = { + { .rangeMin = 0, .rangeMax = 100, .percentMax = MakeOptional(static_cast(10)) } +}; + +static const Globals::Structs::MeasurementAccuracyStruct::Type kDefaultSoilMoistureMeasurementLimits = { + .measurementType = Globals::MeasurementTypeEnum::kSoilMoisture, + .measured = true, + .minMeasuredValue = 0, + .maxMeasuredValue = 100, + .accuracyRanges = DataModel::List( + kDefaultSoilMoistureMeasurementLimitsAccuracyRange) +}; + +namespace { +static std::unique_ptr gSoilMeasurementInstance; +} // namespace + +Instance * SoilMeasurement::GetInstance() +{ + return gSoilMeasurementInstance.get(); +} + +void SoilMeasurement::Shutdown() +{ + VerifyOrDie(gSoilMeasurementInstance); + gSoilMeasurementInstance->Shutdown(); + gSoilMeasurementInstance.reset(nullptr); +} + +void emberAfSoilMeasurementClusterInitCallback(EndpointId endpointId) +{ + VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. + VerifyOrDie(!gSoilMeasurementInstance); + + gSoilMeasurementInstance = std::make_unique(endpointId); + if (gSoilMeasurementInstance) + { + gSoilMeasurementInstance->Init(kDefaultSoilMoistureMeasurementLimits); + } +} diff --git a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp index 5a493183111f0f..0be5595225a821 100644 --- a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp +++ b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -567,6 +568,29 @@ void AllClustersAppCommandHandler::HandleCommand(intptr_t context) ChipLogError(NotSpecified, "Failed to store configuration version:%d", configurationVersion); } } + else if (name == "SetSimulatedSoilMoisture") + { + EndpointId endpoint = static_cast(self->mJsonValue["EndpointId"].asUInt()); + Json::Value jsonSoilMoisture = self->mJsonValue["SoilMoistureValue"]; + DataModel::Nullable soilMoistureMeasuredValue; + + if (endpoint != 1) + { + ChipLogError(NotSpecified, "Invalid EndpointId to set Soil Moisture value."); + return; + } + + if (jsonSoilMoisture.isNull()) + { + soilMoistureMeasuredValue.SetNull(); + } + else + { + soilMoistureMeasuredValue.SetNonNull(static_cast(self->mJsonValue["SoilMoistureValue"].asUInt())); + } + + self->OnSoilMoistureChange(endpoint, soilMoistureMeasuredValue); + } else { ChipLogError(NotSpecified, "Unhandled command '%s': this should never happen", name.c_str()); @@ -929,6 +953,27 @@ void AllClustersAppCommandHandler::OnAirQualityChange(uint32_t aNewValue) } } +void AllClustersAppCommandHandler::OnSoilMoistureChange(EndpointId endpointId, DataModel::Nullable soilMoisture) +{ + SoilMeasurement::Instance * soilMeasurementInstance = SoilMeasurement::GetInstance(); + + if (soilMoisture.IsNull()) + { + ChipLogDetail(NotSpecified, "Set SoilMoisture value to null"); + } + else if (soilMoisture.Value() > 100) + { + ChipLogDetail(NotSpecified, "Invalid SoilMoisture value"); + return; + } + else + { + ChipLogDetail(NotSpecified, "Set SoilMoisture value to %u", soilMoisture.Value()); + } + + soilMeasurementInstance->SetSoilMeasuredValue(soilMoisture); +} + void AllClustersAppCommandHandler::HandleSetOccupancyChange(EndpointId endpointId, uint8_t newOccupancyValue) { BitMask currentOccupancy; diff --git a/examples/all-clusters-app/linux/AllClustersCommandDelegate.h b/examples/all-clusters-app/linux/AllClustersCommandDelegate.h index 3e1f1d32df21d4..f137e3a3900684 100644 --- a/examples/all-clusters-app/linux/AllClustersCommandDelegate.h +++ b/examples/all-clusters-app/linux/AllClustersCommandDelegate.h @@ -101,6 +101,11 @@ class AllClustersAppCommandHandler */ void OnAirQualityChange(uint32_t aEnum); + /** + * Should be called when it is necessary to change the measured moisture value. + */ + void OnSoilMoistureChange(chip::EndpointId endpointId, chip::app::DataModel::Nullable soilMoisture); + /** * Should be called when it is necessary to change the operational state as a manual operation. */ diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 97babeab815d38..d7724e8da32b67 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -62,6 +62,7 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/rvc-operational-state-delegate-impl.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/software-diagnostics-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/soil-measurement-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp", diff --git a/src/app/clusters/soil-measurement-server/BUILD.gn b/src/app/clusters/soil-measurement-server/BUILD.gn new file mode 100644 index 00000000000000..e090da9550de3a --- /dev/null +++ b/src/app/clusters/soil-measurement-server/BUILD.gn @@ -0,0 +1,15 @@ +# Copyright (c) 2025 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. +group("soil-measurement-server") { +} diff --git a/src/app/clusters/soil-measurement-server/app_config_dependent_sources.cmake b/src/app/clusters/soil-measurement-server/app_config_dependent_sources.cmake new file mode 100644 index 00000000000000..cf5aae3759bb21 --- /dev/null +++ b/src/app/clusters/soil-measurement-server/app_config_dependent_sources.cmake @@ -0,0 +1,21 @@ +# Copyright (c) 2025 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. + +# This is the equivalent to app_config_dependent_sources.gni +TARGET_SOURCES( + ${APP_TARGET} + PRIVATE + "${CLUSTER_DIR}/soil-measurement-server.cpp" + "${CLUSTER_DIR}/soil-measurement-server.h" +) \ No newline at end of file diff --git a/src/app/clusters/soil-measurement-server/app_config_dependent_sources.gni b/src/app/clusters/soil-measurement-server/app_config_dependent_sources.gni new file mode 100644 index 00000000000000..816b54d7a60143 --- /dev/null +++ b/src/app/clusters/soil-measurement-server/app_config_dependent_sources.gni @@ -0,0 +1,17 @@ +# Copyright (c) 2025 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. +app_config_dependent_sources = [ + "soil-measurement-server.cpp", + "soil-measurement-server.h", +] diff --git a/src/app/clusters/soil-measurement-server/soil-measurement-server.cpp b/src/app/clusters/soil-measurement-server/soil-measurement-server.cpp new file mode 100644 index 00000000000000..6e8acbe94606e5 --- /dev/null +++ b/src/app/clusters/soil-measurement-server/soil-measurement-server.cpp @@ -0,0 +1,99 @@ +/* + * + * Copyright (c) 2025 Project CHIP Authors + * All rights reserved. + * + * 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. + */ + +#include "soil-measurement-server.h" +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::SoilMeasurement; +using namespace chip::app::Clusters::SoilMeasurement::Attributes; + +namespace chip { +namespace app { +namespace Clusters { +namespace SoilMeasurement { + +Instance::Instance(EndpointId aEndpointId) : + AttributeAccessInterface(Optional(aEndpointId), SoilMeasurement::Id), mEndpointId(aEndpointId) +{} + +Instance::~Instance() +{ + Shutdown(); +} + +CHIP_ERROR Instance::Init(const Globals::Structs::MeasurementAccuracyStruct::Type & measurementLimits) +{ + VerifyOrDie(emberAfContainsServer(mEndpointId, SoilMeasurement::Id) == true); + + VerifyOrReturnError(AttributeAccessInterfaceRegistry::Instance().Register(this), CHIP_ERROR_INCORRECT_STATE); + + mSoilMeasurementData.soilMoistureMeasurementLimits = measurementLimits; + mSoilMeasurementData.soilMoistureMeasuredValue.SetNull(); + + return CHIP_NO_ERROR; +} + +void Instance::Shutdown() +{ + AttributeAccessInterfaceRegistry::Instance().Unregister(this); +} + +CHIP_ERROR +Instance::SetSoilMeasuredValue(const Attributes::SoilMoistureMeasuredValue::TypeInfo::Type & soilMoistureMeasuredValue) +{ + if (mSoilMeasurementData.soilMoistureMeasuredValue != soilMoistureMeasuredValue) + { + mSoilMeasurementData.soilMoistureMeasuredValue = soilMoistureMeasuredValue; + + MatterReportingAttributeChangeCallback(mEndpointId, SoilMeasurement::Id, SoilMoistureMeasuredValue::Id); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) +{ + VerifyOrDie(aPath.mClusterId == SoilMeasurement::Id); + + switch (aPath.mAttributeId) + { + case SoilMoistureMeasurementLimits::Id: { + return aEncoder.Encode(mSoilMeasurementData.soilMoistureMeasurementLimits); + } + case SoilMoistureMeasuredValue::Id: { + return aEncoder.Encode(mSoilMeasurementData.soilMoistureMeasuredValue); + } + case ClusterRevision::Id: { + return aEncoder.Encode(kRevision); + } + default: + break; + } + return CHIP_NO_ERROR; +} + +} // namespace SoilMeasurement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/soil-measurement-server/soil-measurement-server.h b/src/app/clusters/soil-measurement-server/soil-measurement-server.h new file mode 100644 index 00000000000000..ef090d29a76c83 --- /dev/null +++ b/src/app/clusters/soil-measurement-server/soil-measurement-server.h @@ -0,0 +1,67 @@ +/* + * + * Copyright (c) 2025 Project CHIP Authors + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace SoilMeasurement { + +class Instance : public AttributeAccessInterface +{ +public: + /** + * Creates a soil measurement cluster instance. The Init() function needs to be called for this instance to be registered and + * called by the interaction model at the appropriate times. + * @param aEndpointId The endpoint on which this cluster exists. This must match the zap configuration. + */ + Instance(EndpointId aEndpointId); + + ~Instance() override; + + /** + * Initialises the soil measurement cluster instance + * @return Returns an error if an soil measurement cluster has not been enabled in zap for the given endpoint ID or + * if the AttributeHandler registration fails. + */ + CHIP_ERROR Init(const Globals::Structs::MeasurementAccuracyStruct::Type & measurementLimits); + + void Shutdown(); + + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + + CHIP_ERROR SetSoilMeasuredValue(const Attributes::SoilMoistureMeasuredValue::TypeInfo::Type & soilMoistureMeasuredValue); + +private: + struct MeasurementData + { + Globals::Structs::MeasurementAccuracyStruct::Type soilMoistureMeasurementLimits; + Attributes::SoilMoistureMeasuredValue::TypeInfo::Type soilMoistureMeasuredValue; + }; + + EndpointId mEndpointId = 1; + MeasurementData mSoilMeasurementData; +}; + +} // namespace SoilMeasurement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index 2b332e5bc0c66b..d9378996a8056a 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -141,6 +141,7 @@ void MatterWaterHeaterManagementPluginServerInitCallback() {} void MatterWaterHeaterModePluginServerInitCallback() {} void MatterCommodityPricePluginServerInitCallback() {} void MatterElectricalGridConditionsPluginServerInitCallback() {} +void MatterSoilMeasurementPluginServerInitCallback() {} bool emberAfContainsAttribute(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId) { diff --git a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml index c64201fcf7b9f3..54a262a559a3a6 100644 --- a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml +++ b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml @@ -3050,4 +3050,20 @@ limitations under the License. + + MA-soilsensor + CHIP + Soil Sensor + 0x0103 + 0x0045 + Simple + Endpoint + + + + + + + + diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index fce2725ce8155b..0540b044a54876 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -777,7 +777,11 @@ "FeatureMap" ], "Camera AV Settings User Level Management": ["MPTZPosition"], - "Soil Measurement": ["SoilMoistureMeasurementLimits"], + "Soil Measurement": [ + "SoilMoistureMeasurementLimits", + "SoilMoistureMeasuredValue", + "ClusterRevision" + ], "Unit Localization": ["TemperatureUnit"] }, "mandatoryDeviceTypes": "0x0016", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 3243dc07e8969b..14d82f2e053b0d 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -771,7 +771,11 @@ "FeatureMap" ], "Camera AV Settings User Level Management": ["MPTZPosition"], - "Soil Measurement": ["SoilMoistureMeasurementLimits"], + "Soil Measurement": [ + "SoilMoistureMeasurementLimits", + "SoilMoistureMeasuredValue", + "ClusterRevision" + ], "Unit Localization": ["TemperatureUnit"] }, "mandatoryDeviceTypes": "0x0016", diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index c090873d1f8376..55e7f9e783f5f5 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -317,7 +317,7 @@ "SERVICE_AREA_CLUSTER": ["service-area-server"], "SMOKE_CO_ALARM_CLUSTER": ["smoke-co-alarm-server"], "SOFTWARE_DIAGNOSTICS_CLUSTER": ["software-diagnostics-server"], - "SOIL_MEASUREMENT_CLUSTER": [], + "SOIL_MEASUREMENT_CLUSTER": ["soil-measurement-server"], "SWITCH_CLUSTER": ["switch-server"], "TARGET_NAVIGATOR_CLUSTER": ["target-navigator-server"], "TEMPERATURE_CONTROL_CLUSTER": ["temperature-control-server"], diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index e8406cb017c401..caec0c73303107 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -7856,6 +7856,7 @@ typedef NS_ENUM(uint32_t, MTRDeviceTypeIDType) { MTRDeviceTypeIDTypeWaterValveID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000042, MTRDeviceTypeIDTypeWaterLeakDetectorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000043, MTRDeviceTypeIDTypeRainSensorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000044, + MTRDeviceTypeIDTypeSoilSensorID MTR_PROVISIONALLY_AVAILABLE = 0x00000045, MTRDeviceTypeIDTypeRefrigeratorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000070, MTRDeviceTypeIDTypeTemperatureControlledCabinetID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000071, MTRDeviceTypeIDTypeRoomAirConditionerID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000072, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm b/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm index 0e80082a0bd1ad..3c219a260a4187 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm @@ -51,6 +51,7 @@ { 0x00000042, MTRDeviceTypeClass::Simple, @"Water Valve" }, { 0x00000043, MTRDeviceTypeClass::Simple, @"Water Leak Detector" }, { 0x00000044, MTRDeviceTypeClass::Simple, @"Rain Sensor" }, + { 0x00000045, MTRDeviceTypeClass::Simple, @"Soil Sensor" }, { 0x00000070, MTRDeviceTypeClass::Simple, @"Refrigerator" }, { 0x00000071, MTRDeviceTypeClass::Simple, @"Temperature Controlled Cabinet" }, { 0x00000072, MTRDeviceTypeClass::Simple, @"Room Air Conditioner" }, diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 9aaee9cd5050f5..1abff6c1f9dae5 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -33211,96 +33211,6 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) namespace SoilMeasurement { namespace Attributes { -namespace SoilMoistureMeasuredValue { - -Protocols::InteractionModel::Status Get(EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::SoilMeasurement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::Percent value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::SoilMeasurement::Id, Id), - EmberAfWriteDataInput(writable, ZCL_PERCENT_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::Percent value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::SoilMeasurement::Id, Id, writable, ZCL_PERCENT_ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status SetNull(EndpointId endpoint, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::SoilMeasurement::Id, Id), - EmberAfWriteDataInput(writable, ZCL_PERCENT_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); -} - -Protocols::InteractionModel::Status SetNull(EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::SoilMeasurement::Id, Id, writable, ZCL_PERCENT_ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty) -{ - if (value.IsNull()) - { - return SetNull(endpoint, markDirty); - } - - return Set(endpoint, value.Value(), markDirty); -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace SoilMoistureMeasuredValue - namespace FeatureMap { Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value) @@ -33348,53 +33258,6 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value) } // namespace FeatureMap -namespace ClusterRevision { - -Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::SoilMeasurement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - *value = Traits::StorageToWorking(temp); - return status; -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::SoilMeasurement::Id, Id), - EmberAfWriteDataInput(writable, ZCL_INT16U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::SoilMeasurement::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); -} - -} // namespace ClusterRevision - } // namespace Attributes } // namespace SoilMeasurement diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 735bc7739e67df..0c99466dadb8db 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -5056,29 +5056,12 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, Mar namespace SoilMeasurement { namespace Attributes { -namespace SoilMoistureMeasuredValue { -Protocols::InteractionModel::Status Get(EndpointId endpoint, DataModel::Nullable & value); // percent -Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::Percent value); -Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::Percent value, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status SetNull(EndpointId endpoint); -Protocols::InteractionModel::Status SetNull(EndpointId endpoint, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value); -Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty); -} // namespace SoilMoistureMeasuredValue - namespace FeatureMap { Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value); // bitmap32 Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value); Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); } // namespace FeatureMap -namespace ClusterRevision { -Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value); // int16u -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value); -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); -} // namespace ClusterRevision - } // namespace Attributes } // namespace SoilMeasurement diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp index 300a4f26dac115..e89891bd4c35ac 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp @@ -7049,6 +7049,8 @@ char const * DeviceTypeIdToText(chip::DeviceTypeId id) return "Water Leak Detector"; case 0x00000044: return "Rain Sensor"; + case 0x00000045: + return "Soil Sensor"; case 0x00000070: return "Refrigerator"; case 0x00000071: