diff --git a/data_model/clusters/BooleanSensorConfiguration.xml b/data_model/clusters/BooleanSensorConfiguration.xml deleted file mode 100644 index 7321a70113087f..00000000000000 --- a/data_model/clusters/BooleanSensorConfiguration.xml +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file 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 a63bd698b5f656..e1dace194762d8 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 @@ -3716,6 +3716,64 @@ cluster ActivatedCarbonFilterMonitoring = 114 { command ResetCondition(): DefaultSuccess = 0; } +/** This cluster is used to configure a boolean sensor. */ +provisional cluster BooleanStateConfiguration = 128 { + revision 1; + + bitmap AlarmModeBitmap : bitmap8 { + kVisual = 0x1; + kAudible = 0x2; + } + + bitmap Feature : bitmap32 { + kVisual = 0x1; + kAudible = 0x2; + kAlarmSuppress = 0x4; + kSensitivityLevel = 0x8; + } + + bitmap SensorFaultBitmap : bitmap16 { + kGeneralFault = 0x1; + } + + info event AlarmsStateChanged = 0 { + AlarmModeBitmap alarmsActive = 0; + optional AlarmModeBitmap alarmsSuppressed = 1; + } + + info event SensorFault = 1 { + SensorFaultBitmap sensorFault = 0; + } + + attribute optional int8u currentSensitivityLevel = 0; + readonly attribute optional int8u supportedSensitivityLevels = 1; + readonly attribute optional int8u defaultSensitivityLevel = 2; + readonly attribute optional AlarmModeBitmap alarmsActive = 3; + readonly attribute optional AlarmModeBitmap alarmsSuppressed = 4; + readonly attribute optional AlarmModeBitmap alarmsEnabled = 5; + readonly attribute optional AlarmModeBitmap alarmsSupported = 6; + readonly attribute optional SensorFaultBitmap sensorFault = 7; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct SuppressAlarmRequest { + AlarmModeBitmap alarmsToSuppress = 0; + } + + request struct EnableDisableAlarmRequest { + AlarmModeBitmap alarmsToEnableDisable = 0; + } + + /** This command is used to suppress the specified alarm mode. */ + command SuppressAlarm(SuppressAlarmRequest): DefaultSuccess = 0; + /** This command is used to enable or disable the specified alarm mode. */ + command EnableDisableAlarm(EnableDisableAlarmRequest): DefaultSuccess = 1; +} + /** This cluster is used to configure a valve. */ provisional cluster ValveConfigurationAndControl = 129 { revision 1; @@ -7492,6 +7550,28 @@ endpoint 1 { handle command ResetCondition; } + server cluster BooleanStateConfiguration { + emits event AlarmsStateChanged; + emits event SensorFault; + callback attribute currentSensitivityLevel; + ram attribute supportedSensitivityLevels default = 3; + ram attribute defaultSensitivityLevel default = 2; + ram attribute alarmsActive; + ram attribute alarmsSuppressed; + persist attribute alarmsEnabled; + ram attribute alarmsSupported default = 0x03; + ram attribute sensorFault default = 0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0x0F; + ram attribute clusterRevision default = 1; + + handle command SuppressAlarm; + handle command EnableDisableAlarm; + } + server cluster ValveConfigurationAndControl { emits event ValveStateChanged; emits event ValveFault; 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 c69cbe4cd4c4bf..fabe40ca88f598 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 @@ -11803,6 +11803,275 @@ } ] }, + { + "name": "Boolean State Configuration", + "code": 128, + "mfgCode": null, + "define": "BOOLEAN_STATE_CONFIGURATION_CLUSTER", + "side": "server", + "enabled": 1, + "apiMaturity": "provisional", + "commands": [ + { + "name": "SuppressAlarm", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "EnableDisableAlarm", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "CurrentSensitivityLevel", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SupportedSensitivityLevels", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "DefaultSensitivityLevel", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AlarmsActive", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "AlarmModeBitmap", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AlarmsSuppressed", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "AlarmModeBitmap", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AlarmsEnabled", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "AlarmModeBitmap", + "included": 1, + "storageOption": "NVM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AlarmsSupported", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "AlarmModeBitmap", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x03", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SensorFault", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "SensorFaultBitmap", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "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": null, + "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": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "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": null, + "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": "0x0F", + "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 + } + ], + "events": [ + { + "name": "AlarmsStateChanged", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "SensorFault", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, { "name": "Valve Configuration and Control", "code": 129, diff --git a/examples/all-clusters-app/all-clusters-common/src/boolcfg-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/boolcfg-stub.cpp new file mode 100644 index 00000000000000..36716ec69ce52e --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/boolcfg-stub.cpp @@ -0,0 +1,49 @@ +/* + * + * 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. + */ + +#include +#include + +#include + +using namespace chip; +using namespace chip::app::Clusters::BooleanStateConfiguration; +using namespace chip::DeviceLayer; + +bool HandleBooleanStateConfigurationTestEventTrigger(uint64_t eventTrigger) +{ + BooleanStateConfigurationTrigger trigger = static_cast(eventTrigger); + + switch (trigger) + { + case BooleanStateConfigurationTrigger::kSensorTrigger: + ChipLogProgress(Support, "[BooleanStateConfiguration-Test-Event] => Trigger sensor"); + SetAllEnabledAlarmsActive(1); + break; + + case BooleanStateConfigurationTrigger::kSensorUntrigger: + ChipLogProgress(Support, "[BooleanStateConfiguration-Test-Event] => Untrigger sensor"); + ClearAllAlarms(1); + break; + + default: + + return false; + } + + return true; +} diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 08f0673223b34a..89ce7c1c872160 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -39,6 +39,7 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/administrator-commissioning-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/test-cluster-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/boolean-state-configuration-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/descriptor" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fault-injection-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fan-control-server" diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 43a3e94506784a..b2cc122b5090ab 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -23,6 +23,7 @@ source_set("chip-all-clusters-common") { sources = [ "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/boolcfg-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-alarm-stub.cpp", diff --git a/examples/all-clusters-app/linux/args.gni b/examples/all-clusters-app/linux/args.gni index 1bcd86f18843b8..d414ad5dedaf5d 100644 --- a/examples/all-clusters-app/linux/args.gni +++ b/examples/all-clusters-app/linux/args.gni @@ -28,3 +28,4 @@ matter_enable_tracing_support = true matter_log_json_payload_decode_full = true matter_log_json_payload_hex = true chip_enable_smoke_co_trigger = true +chip_enable_boolean_state_configuration_trigger = true diff --git a/examples/platform/linux/AppMain.cpp b/examples/platform/linux/AppMain.cpp index 04ed5ad74fa8cc..86382f75665c06 100644 --- a/examples/platform/linux/AppMain.cpp +++ b/examples/platform/linux/AppMain.cpp @@ -80,6 +80,9 @@ #if CHIP_DEVICE_CONFIG_ENABLE_SMOKE_CO_TRIGGER #include #endif +#if CHIP_DEVICE_CONFIG_ENABLE_BOOLEAN_STATE_CONFIGURATION_TRIGGER +#include +#endif #include #include @@ -551,6 +554,12 @@ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl) ByteSpan(LinuxDeviceOptions::GetInstance().testEventTriggerEnableKey), otherDelegate }; otherDelegate = &smokeCOTestEventTriggerDelegate; +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_BOOLEAN_STATE_CONFIGURATION_TRIGGER + static BooleanStateConfigurationTestEventTriggerDelegate booleanStateConfigurationTestEventTriggerDelegate{ + ByteSpan(LinuxDeviceOptions::GetInstance().testEventTriggerEnableKey), otherDelegate + }; + otherDelegate = &booleanStateConfigurationTestEventTriggerDelegate; #endif // For general testing of TestEventTrigger, we have a common "core" event trigger delegate. static SampleTestEventTriggerDelegate testEventTriggerDelegate; diff --git a/examples/platform/linux/BUILD.gn b/examples/platform/linux/BUILD.gn index 46229c5f7ed42c..4a4099c4150bf5 100644 --- a/examples/platform/linux/BUILD.gn +++ b/examples/platform/linux/BUILD.gn @@ -21,6 +21,8 @@ import("${chip_root}/src/tracing/tracing_args.gni") declare_args() { chip_enable_smoke_co_trigger = false + + chip_enable_boolean_state_configuration_trigger = false } config("app-main-config") { @@ -37,6 +39,10 @@ source_set("smco-test-event-trigger") { sources = [ "${chip_root}/src/app/clusters/smoke-co-alarm-server/SmokeCOTestEventTriggerDelegate.h" ] } +source_set("boolean-state-configuration-test-event-trigger") { + sources = [ "${chip_root}/src/app/clusters/boolean-state-configuration-server/BooleanStateConfigurationTestEventTriggerDelegate.h" ] +} + source_set("app-main") { defines = [ "ENABLE_TRACING=${matter_enable_tracing_support}" ] sources = [ @@ -59,6 +65,7 @@ source_set("app-main") { ] public_deps = [ + ":boolean-state-configuration-test-event-trigger", ":smco-test-event-trigger", "${chip_root}/src/lib", "${chip_root}/src/platform/logging:force_stdio", @@ -94,7 +101,10 @@ source_set("app-main") { ] } - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_SMOKE_CO_TRIGGER=${chip_enable_smoke_co_trigger}" ] + defines += [ + "CHIP_DEVICE_CONFIG_ENABLE_SMOKE_CO_TRIGGER=${chip_enable_smoke_co_trigger}", + "CHIP_DEVICE_CONFIG_ENABLE_BOOLEAN_STATE_CONFIGURATION_TRIGGER=${chip_enable_boolean_state_configuration_trigger}", + ] public_configs = [ ":app-main-config" ] } diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index b882c875dc3ac2..a22e4811433802 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -324,6 +324,13 @@ template("chip_data_model") { "${_app_root}/clusters/${cluster}/SmokeCOTestEventTriggerDelegate.cpp", "${_app_root}/clusters/${cluster}/SmokeCOTestEventTriggerDelegate.h", ] + } else if (cluster == "boolean-state-configuration-server") { + sources += [ + "${_app_root}/clusters/${cluster}/${cluster}.cpp", + "${_app_root}/clusters/${cluster}/${cluster}.h", + "${_app_root}/clusters/${cluster}/BooleanStateConfigurationTestEventTriggerDelegate.cpp", + "${_app_root}/clusters/${cluster}/BooleanStateConfigurationTestEventTriggerDelegate.h", + ] } else if (cluster == "air-quality-server") { sources += [ "${_app_root}/clusters/${cluster}/${cluster}.cpp", diff --git a/src/app/clusters/boolean-state-configuration-server/BooleanStateConfigurationTestEventTriggerDelegate.cpp b/src/app/clusters/boolean-state-configuration-server/BooleanStateConfigurationTestEventTriggerDelegate.cpp new file mode 100644 index 00000000000000..00a42592929671 --- /dev/null +++ b/src/app/clusters/boolean-state-configuration-server/BooleanStateConfigurationTestEventTriggerDelegate.cpp @@ -0,0 +1,42 @@ +/* + * + * 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. + */ + +#include "BooleanStateConfigurationTestEventTriggerDelegate.h" + +using namespace chip::app::Clusters::BooleanStateConfiguration; + +namespace chip { + +bool BooleanStateConfigurationTestEventTriggerDelegate::DoesEnableKeyMatch(const ByteSpan & enableKey) const +{ + return !mEnableKey.empty() && mEnableKey.data_equal(enableKey); +} + +CHIP_ERROR BooleanStateConfigurationTestEventTriggerDelegate::HandleEventTrigger(uint64_t eventTrigger) +{ + if (HandleBooleanStateConfigurationTestEventTrigger(eventTrigger)) + { + return CHIP_NO_ERROR; + } + if (mOtherDelegate != nullptr) + { + return mOtherDelegate->HandleEventTrigger(eventTrigger); + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +} // namespace chip diff --git a/src/app/clusters/boolean-state-configuration-server/BooleanStateConfigurationTestEventTriggerDelegate.h b/src/app/clusters/boolean-state-configuration-server/BooleanStateConfigurationTestEventTriggerDelegate.h new file mode 100644 index 00000000000000..43b68e284497e0 --- /dev/null +++ b/src/app/clusters/boolean-state-configuration-server/BooleanStateConfigurationTestEventTriggerDelegate.h @@ -0,0 +1,60 @@ +/* + * + * 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. + */ + +#pragma once + +#include +#include + +namespace chip { + +enum class BooleanStateConfigurationTrigger : uint64_t +{ + kSensorTrigger = 0x0080000000000000, + kSensorUntrigger = 0x0080000000000001, +}; + +class BooleanStateConfigurationTestEventTriggerDelegate : public TestEventTriggerDelegate +{ +public: + explicit BooleanStateConfigurationTestEventTriggerDelegate(const ByteSpan & enableKey, + TestEventTriggerDelegate * otherDelegate) : + mEnableKey(enableKey), + mOtherDelegate(otherDelegate) + {} + + bool DoesEnableKeyMatch(const ByteSpan & enableKey) const override; + CHIP_ERROR HandleEventTrigger(uint64_t eventTrigger) override; + +private: + ByteSpan mEnableKey; + TestEventTriggerDelegate * mOtherDelegate; +}; + +} // namespace chip + +/** + * @brief User handler for handling the test event trigger + * + * @note If TestEventTrigger is enabled, it needs to be implemented in the app + * + * @param eventTrigger Event trigger to handle + * + * @retval true on success + * @retval false if error happened + */ +bool HandleBooleanStateConfigurationTestEventTrigger(uint64_t eventTrigger); diff --git a/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-delegate.h b/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-delegate.h new file mode 100644 index 00000000000000..4fd84a43f43cda --- /dev/null +++ b/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-delegate.h @@ -0,0 +1,47 @@ +/* + * + * Copyright (c) 2023 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 +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace BooleanStateConfiguration { + +/** @brief + * Defines methods for implementing application-specific logic for the Boolean State Configuration Cluster. + */ +class Delegate +{ +public: + Delegate(){}; + + virtual CHIP_ERROR HandleSuppressAlarm(BooleanStateConfiguration::AlarmModeBitmap alarmToSuppress) = 0; + virtual CHIP_ERROR HandleEnableDisableAlarms(chip::BitMask alarms) = 0; + + virtual ~Delegate() = default; +}; + +} // namespace BooleanStateConfiguration +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-server.cpp b/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-server.cpp new file mode 100644 index 00000000000000..dd81c90cd00191 --- /dev/null +++ b/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-server.cpp @@ -0,0 +1,443 @@ +/** + * + * 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. + * + */ + +#include "boolean-state-configuration-server.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::BooleanStateConfiguration::Attributes; +using chip::app::Clusters::BooleanStateConfiguration::Delegate; +using chip::Protocols::InteractionModel::Status; + +static constexpr size_t kBooleanStateConfigurationDelegateTableSize = + EMBER_AF_BOOLEAN_STATE_CONFIGURATION_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; + +static_assert(kBooleanStateConfigurationDelegateTableSize <= kEmberInvalidEndpointIndex, + "BooleanStateConfiguration Delegate table size error"); + +static constexpr uint8_t kMinSupportedSensitivityLevels = 2; +static constexpr uint8_t kMaxSupportedSensitivityLevels = 10; + +static CHIP_ERROR StoreCurrentSensitivityLevel(EndpointId ep, uint8_t level); + +namespace { +Delegate * gDelegateTable[kBooleanStateConfigurationDelegateTableSize] = { nullptr }; + +Delegate * GetDelegate(EndpointId endpoint) +{ + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, BooleanStateConfiguration::Id, + EMBER_AF_BOOLEAN_STATE_CONFIGURATION_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kBooleanStateConfigurationDelegateTableSize ? nullptr : gDelegateTable[ep]); +} + +bool isDelegateNull(Delegate * delegate) +{ + if (delegate == nullptr) + { + return true; + } + return false; +} + +class BooleanStateConfigAttrAccess : public AttributeAccessInterface +{ +public: + BooleanStateConfigAttrAccess() : AttributeAccessInterface(Optional::Missing(), BooleanStateConfiguration::Id) {} + + CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override; + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + +private: + CHIP_ERROR WriteCurrentSensitivityLevel(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder); + CHIP_ERROR ReadCurrentSensitivityLevel(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder); +}; + +BooleanStateConfigAttrAccess gAttrAccess; + +CHIP_ERROR BooleanStateConfigAttrAccess::WriteCurrentSensitivityLevel(const ConcreteDataAttributePath & aPath, + AttributeValueDecoder & aDecoder) +{ + uint8_t curSenLevel; + ReturnErrorOnFailure(aDecoder.Decode(curSenLevel)); + + return StoreCurrentSensitivityLevel(aPath.mEndpointId, curSenLevel); +} + +CHIP_ERROR BooleanStateConfigAttrAccess::ReadCurrentSensitivityLevel(const ConcreteReadAttributePath & aPath, + AttributeValueEncoder & aEncoder) +{ + uint8_t senLevel; + CHIP_ERROR err = GetSafeAttributePersistenceProvider()->ReadScalarValue(aPath, senLevel); + if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) + { + uint8_t supportedSensLevel; + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == SupportedSensitivityLevels::Get(aPath.mEndpointId, &supportedSensLevel), + CHIP_IM_GLOBAL_STATUS(Failure)); + VerifyOrReturnError(supportedSensLevel >= kMinSupportedSensitivityLevels, CHIP_IM_GLOBAL_STATUS(Failure)); + VerifyOrReturnError(supportedSensLevel <= kMaxSupportedSensitivityLevels, CHIP_IM_GLOBAL_STATUS(Failure)); + senLevel = static_cast(supportedSensLevel - 1); + } + else if (err != CHIP_NO_ERROR) + { + return err; + } + + ReturnErrorOnFailure(aEncoder.Encode(senLevel)); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR BooleanStateConfigAttrAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) +{ + if (aPath.mClusterId != BooleanStateConfiguration::Id) + { + return CHIP_ERROR_INVALID_PATH_LIST; + } + + switch (aPath.mAttributeId) + { + case CurrentSensitivityLevel::Id: { + return ReadCurrentSensitivityLevel(aPath, aEncoder); + } + default: { + break; + } + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR BooleanStateConfigAttrAccess::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) +{ + if (aPath.mClusterId != BooleanStateConfiguration::Id) + { + return CHIP_ERROR_INVALID_PATH_LIST; + } + + switch (aPath.mAttributeId) + { + case CurrentSensitivityLevel::Id: { + return WriteCurrentSensitivityLevel(aPath, aDecoder); + } + default: { + break; + } + } + + return CHIP_NO_ERROR; +} +} // namespace + +static bool emitAlarmsStateChangedEvent(EndpointId ep) +{ + if (!HasFeature(ep, BooleanStateConfiguration::Feature::kAudible) && + !HasFeature(ep, BooleanStateConfiguration::Feature::kVisual)) + { + return false; + } + + BooleanStateConfiguration::Events::AlarmsStateChanged::Type event; + BitMask active; + VerifyOrReturnValue(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Get(ep, &active), false); + event.alarmsActive = active; + + if (HasFeature(ep, BooleanStateConfiguration::Feature::kAlarmSuppress)) + { + BitMask suppressed; + VerifyOrReturnValue(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Get(ep, &suppressed), false); + event.alarmsSuppressed.SetValue(suppressed); + } + + EventNumber eventNumber; + + CHIP_ERROR error = LogEvent(event, ep, eventNumber); + + if (CHIP_NO_ERROR != error) + { + ChipLogError(Zcl, "Unable to emit AlarmsStateChanged event [ep=%d]", ep); + return false; + } + + ChipLogProgress(Zcl, "Emit AlarmsStateChanged event [ep=%d]", ep); + return true; +} + +static CHIP_ERROR emitSensorFaultEvent(EndpointId ep, BitMask fault) +{ + BooleanStateConfiguration::Events::SensorFault::Type event; + EventNumber eventNumber; + + event.sensorFault = fault; + + CHIP_ERROR error = LogEvent(event, ep, eventNumber); + + if (CHIP_NO_ERROR != error) + { + ChipLogError(Zcl, "Unable to emit SensorFault event [ep=%d]", ep); + return error; + } + + ChipLogProgress(Zcl, "Emit SensorFault event [ep=%d]", ep); + return CHIP_NO_ERROR; +} + +static CHIP_ERROR StoreCurrentSensitivityLevel(EndpointId ep, uint8_t level) +{ + uint8_t supportedSensLevel; + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == SupportedSensitivityLevels::Get(ep, &supportedSensLevel), + CHIP_IM_GLOBAL_STATUS(Failure)); + VerifyOrReturnError(supportedSensLevel >= kMinSupportedSensitivityLevels, CHIP_IM_GLOBAL_STATUS(ConstraintError)); + VerifyOrReturnError(supportedSensLevel <= kMaxSupportedSensitivityLevels, CHIP_IM_GLOBAL_STATUS(ConstraintError)); + VerifyOrReturnError(level < supportedSensLevel, CHIP_IM_GLOBAL_STATUS(ConstraintError)); + + ReturnErrorOnFailure(GetSafeAttributePersistenceProvider()->WriteScalarValue( + ConcreteAttributePath(ep, BooleanStateConfiguration::Id, CurrentSensitivityLevel::Id), level)); + + return CHIP_NO_ERROR; +} + +namespace chip { +namespace app { +namespace Clusters { +namespace BooleanStateConfiguration { + +void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) +{ + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, BooleanStateConfiguration::Id, + EMBER_AF_BOOLEAN_STATE_CONFIGURATION_CLUSTER_SERVER_ENDPOINT_COUNT); + // if endpoint is found + if (ep < kBooleanStateConfigurationDelegateTableSize) + { + gDelegateTable[ep] = delegate; + } +} + +Delegate * GetDefaultDelegate(EndpointId endpoint) +{ + return GetDelegate(endpoint); +} + +CHIP_ERROR SetAlarmsActive(EndpointId ep, BitMask alarms) +{ + VerifyOrReturnError(HasFeature(ep, BooleanStateConfiguration::Feature::kVisual) || + HasFeature(ep, BooleanStateConfiguration::Feature::kAudible), + CHIP_IM_GLOBAL_STATUS(Failure)); + + BitMask alarmsEnabled; + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsEnabled::Get(ep, &alarmsEnabled), + CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); + VerifyOrReturnError(alarmsEnabled.HasAll(alarms), CHIP_IM_GLOBAL_STATUS(Failure)); + + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Set(ep, alarms), CHIP_IM_GLOBAL_STATUS(Failure)); + emitAlarmsStateChangedEvent(ep); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR SetAllEnabledAlarmsActive(EndpointId ep) +{ + VerifyOrReturnError(HasFeature(ep, BooleanStateConfiguration::Feature::kVisual) || + HasFeature(ep, BooleanStateConfiguration::Feature::kAudible), + CHIP_IM_GLOBAL_STATUS(Failure)); + + BitMask alarmsEnabled; + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsEnabled::Get(ep, &alarmsEnabled), + CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); + + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Set(ep, alarmsEnabled), CHIP_IM_GLOBAL_STATUS(Failure)); + emitAlarmsStateChangedEvent(ep); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR ClearAllAlarms(EndpointId ep) +{ + BitMask alarmsActive, alarmsSuppressed; + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Get(ep, &alarmsActive), + CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Get(ep, &alarmsSuppressed), + CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); + + if (alarmsActive.HasAny() || alarmsSuppressed.HasAny()) + { + alarmsActive.ClearAll(); + alarmsSuppressed.ClearAll(); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Set(ep, alarmsActive), + CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Set(ep, alarmsSuppressed), + CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); + emitAlarmsStateChangedEvent(ep); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR SuppressAlarms(EndpointId ep, BitMask alarm) +{ + CHIP_ERROR attribute_error = CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + + VerifyOrReturnError(HasFeature(ep, BooleanStateConfiguration::Feature::kAlarmSuppress), + CHIP_IM_GLOBAL_STATUS(UnsupportedCommand)); + VerifyOrReturnError(HasFeature(ep, BooleanStateConfiguration::Feature::kVisual) || + HasFeature(ep, BooleanStateConfiguration::Feature::kAudible), + CHIP_IM_GLOBAL_STATUS(UnsupportedCommand)); + + BitMask alarmsActive, alarmsSuppressed, alarmsSupported; + + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSupported::Get(ep, &alarmsSupported), attribute_error); + VerifyOrReturnError(alarmsSupported.HasAll(alarm), CHIP_IM_GLOBAL_STATUS(ConstraintError)); + + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Get(ep, &alarmsActive), attribute_error); + VerifyOrReturnError(alarmsActive.HasAll(alarm), CHIP_IM_GLOBAL_STATUS(InvalidInState)); + + Delegate * delegate = GetDelegate(ep); + if (!isDelegateNull(delegate)) + { + delegate->HandleSuppressAlarm(alarm); + } + + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Get(ep, &alarmsSuppressed), attribute_error); + alarmsSuppressed.Set(alarm); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Set(ep, alarmsSuppressed), attribute_error); + + emitAlarmsStateChangedEvent(ep); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR SetCurrentSensitivityLevel(EndpointId ep, uint8_t level) +{ + return StoreCurrentSensitivityLevel(ep, level); +} + +CHIP_ERROR EmitSensorFault(EndpointId ep, BitMask fault) +{ + ReturnErrorOnFailure(emitSensorFaultEvent(ep, fault)); + return CHIP_NO_ERROR; +} + +} // namespace BooleanStateConfiguration +} // namespace Clusters +} // namespace app +} // namespace chip + +bool emberAfBooleanStateConfigurationClusterSuppressAlarmCallback( + CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const BooleanStateConfiguration::Commands::SuppressAlarm::DecodableType & commandData) +{ + const auto & alarms = commandData.alarmsToSuppress; + CHIP_ERROR err = BooleanStateConfiguration::SuppressAlarms(commandPath.mEndpointId, alarms); + if (err == CHIP_NO_ERROR) + { + commandObj->AddStatus(commandPath, Status::Success); + } + else if (err == CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)) + { + commandObj->AddStatus(commandPath, Status::Failure); + } + else + { + commandObj->AddStatus(commandPath, StatusIB(err).mStatus); + } + + return true; +} + +bool emberAfBooleanStateConfigurationClusterEnableDisableAlarmCallback( + CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const BooleanStateConfiguration::Commands::EnableDisableAlarm::DecodableType & commandData) +{ + const auto & alarms = commandData.alarmsToEnableDisable; + const auto & ep = commandPath.mEndpointId; + Optional status = Optional::Missing(); + + if (!HasFeature(ep, BooleanStateConfiguration::Feature::kVisual) && + !HasFeature(ep, BooleanStateConfiguration::Feature::kAudible)) + { + commandObj->AddStatus(commandPath, Status::UnsupportedCommand); + return true; + } + + BitMask alarmsActive, alarmsSuppressed, alarmsSupported, alarmsToDisable; + Delegate * delegate = GetDelegate(ep); + bool emit = false; + uint8_t rawAlarm = static_cast(~alarms.Raw() & 0x03); // 0x03 is the current max bitmap + alarmsToDisable = BitMask(rawAlarm); + + VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsSupported::Get(ep, &alarmsSupported), status.Emplace(Status::Failure)); + VerifyOrExit(alarmsSupported.HasAll(alarms), status.Emplace(Status::ConstraintError)); + + VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsEnabled::Set(ep, alarms), status.Emplace(Status::Failure)); + + if (!isDelegateNull(delegate)) + { + delegate->HandleEnableDisableAlarms(alarms); + } + + VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Get(ep, &alarmsActive), status.Emplace(Status::Failure)); + if (alarmsActive.HasAny(alarmsToDisable)) + { + alarmsActive.Clear(alarmsToDisable); + VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Set(ep, alarmsActive), status.Emplace(Status::Failure)); + emit = true; + } + + VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Get(ep, &alarmsSuppressed), status.Emplace(Status::Failure)); + if (alarmsSuppressed.HasAny(alarmsToDisable)) + { + alarmsSuppressed.Clear(alarmsToDisable); + VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Set(ep, alarmsSuppressed), status.Emplace(Status::Failure)); + emit = true; + } + + if (emit) + { + emitAlarmsStateChangedEvent(ep); + } + +exit: + if (status.HasValue()) + { + commandObj->AddStatus(commandPath, status.Value()); + } + else + { + commandObj->AddStatus(commandPath, Status::Success); + } + + return true; +} + +void MatterBooleanStateConfigurationPluginServerInitCallback() +{ + registerAttributeAccessOverride(&gAttrAccess); +} diff --git a/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-server.h b/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-server.h new file mode 100644 index 00000000000000..21813208c77249 --- /dev/null +++ b/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-server.h @@ -0,0 +1,56 @@ +/** + * + * 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. + */ + +/** + * @file API declarations for boolean state configuration cluster. + */ + +#pragma once + +#include "boolean-state-configuration-delegate.h" + +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace BooleanStateConfiguration { + +void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate); +Delegate * GetDefaultDelegate(EndpointId endpoint); + +CHIP_ERROR SetAlarmsActive(EndpointId ep, chip::BitMask alarms); +CHIP_ERROR SetAllEnabledAlarmsActive(EndpointId ep); +CHIP_ERROR ClearAllAlarms(EndpointId ep); +CHIP_ERROR SuppressAlarms(EndpointId ep, chip::BitMask alarms); +CHIP_ERROR SetCurrentSensitivityLevel(EndpointId ep, uint8_t level); +CHIP_ERROR EmitSensorFault(EndpointId ep, chip::BitMask fault); + +inline bool HasFeature(EndpointId ep, Feature feature) +{ + uint32_t map; + bool success = (Attributes::FeatureMap::Get(ep, &map) == EMBER_ZCL_STATUS_SUCCESS); + return success ? (map & to_underlying(feature)) : false; +} + +} // namespace BooleanStateConfiguration +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index 2f43df991a345c..e7fa8c2b2374d8 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -159,7 +159,6 @@ void MatterOperationalStatePluginServerInitCallback() {} void MatterRvcOperationalStatePluginServerInitCallback() {} void MatterOvenModePluginServerInitCallback() {} void MatterDishwasherAlarmPluginServerInitCallback() {} -void MatterBooleanStateConfigurationPluginServerInitCallback() {} void MatterMicrowaveOvenModePluginServerInitCallback() {} // **************************************** // Print out information about each cluster 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 83b541897d7abc..ecbcea088f51b5 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -560,7 +560,8 @@ "PeriodicEnergyImported", "PeriodicEnergyExported" ], - "Valve Configuration and Control": ["RemainingDuration"] + "Valve Configuration and Control": ["RemainingDuration"], + "Boolean State Configuration": ["CurrentSensitivityLevel"] }, "defaultReportingPolicy": "mandatory", "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 0e0e0f925f7885..80b9ff7bbd84f9 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -558,7 +558,8 @@ "PeriodicEnergyImported", "PeriodicEnergyExported" ], - "Valve Configuration and Control": ["RemainingDuration"] + "Valve Configuration and Control": ["RemainingDuration"], + "Boolean State Configuration": ["CurrentSensitivityLevel"] }, "defaultReportingPolicy": "mandatory", "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index 021cc8aa466f4d..4d38466edb17aa 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -148,7 +148,9 @@ "BINARY_INPUT_BASIC_CLUSTER": [], "BINDING_CLUSTER": ["bindings"], "BOOLEAN_STATE_CLUSTER": [], - "BOOLEAN_STATE_CONFIGURATION_CLUSTER": [], + "BOOLEAN_STATE_CONFIGURATION_CLUSTER": [ + "boolean-state-configuration-server" + ], "BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER": [ "bridged-device-basic-information-server" ], 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 ee8e52fb08d776..7f8664022616bb 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 @@ -9316,37 +9316,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace BooleanStateConfiguration { namespace Attributes { -namespace CurrentSensitivityLevel { - -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::BooleanStateConfiguration::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::BooleanStateConfiguration::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); -} - -} // namespace CurrentSensitivityLevel - namespace SupportedSensitivityLevels { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) 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 e9969a14e8ed00..c80c58fe04468c 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 @@ -1827,11 +1827,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace BooleanStateConfiguration { namespace Attributes { -namespace CurrentSensitivityLevel { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); -} // namespace CurrentSensitivityLevel - namespace SupportedSensitivityLevels { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value);