From 04c85c706aefd0a7732245e6c26250595926a7dc Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 9 May 2022 03:30:29 -0400 Subject: [PATCH] Enable pressure measurement attributes in controller config. (#18189) Fixes https://github.com/project-chip/connectedhomeip/issues/15473 --- .../data_model/controller-clusters.matter | 6 + .../data_model/controller-clusters.zap | 54 ++- .../CHIPAttributeTLVValueDecoder.cpp | 111 +++++ .../java/zap-generated/CHIPCallbackTypes.h | 12 + .../java/zap-generated/CHIPReadCallbacks.cpp | 201 ++++++++ .../java/zap-generated/CHIPReadCallbacks.h | 90 ++++ .../chip/devicecontroller/ChipClusters.java | 122 +++++ .../chip/devicecontroller/ChipIdLookup.java | 18 + .../devicecontroller/ClusterReadMapping.java | 81 ++++ .../python/chip/clusters/CHIPClusters.py | 36 ++ .../CHIPAttributeTLVValueDecoder.mm | 78 +++ .../CHIP/zap-generated/CHIPClustersObjc.h | 102 ++++ .../CHIP/zap-generated/CHIPClustersObjc.mm | 369 ++++++++++++++ .../cluster/CHIPTestClustersObjc.h | 6 + .../cluster/CHIPTestClustersObjc.mm | 123 +++++ .../zap-generated/cluster/Commands.h | 459 ++++++++++++++++++ 16 files changed, 1865 insertions(+), 3 deletions(-) diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 26b407a8e83406..d0d4ac5608f30c 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -3079,6 +3079,12 @@ client cluster PressureMeasurement = 1027 { readonly attribute nullable int16s measuredValue = 0; readonly attribute nullable int16s minMeasuredValue = 1; readonly attribute nullable int16s maxMeasuredValue = 2; + readonly attribute int16u tolerance = 3; + readonly attribute nullable int16s scaledValue = 16; + readonly attribute nullable int16s minScaledValue = 17; + readonly attribute nullable int16s maxScaledValue = 18; + readonly attribute int16u scaledTolerance = 19; + readonly attribute int8s scale = 20; readonly attribute attrib_id attributeList[] = 65531; readonly attribute int16u clusterRevision = 65533; } diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 06629bdf4e102f..96a0191fe00b7d 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -14103,7 +14103,7 @@ "mfgCode": null, "side": "server", "type": "int16u", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, @@ -14119,7 +14119,7 @@ "mfgCode": null, "side": "server", "type": "int16s", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, @@ -14129,13 +14129,45 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "MinScaledValue", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "int16s", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxScaledValue", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "int16s", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ScaledTolerance", "code": 19, "mfgCode": null, "side": "server", "type": "int16u", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, @@ -14145,6 +14177,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "Scale", + "code": 20, + "mfgCode": null, + "side": "server", + "type": "int8s", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 0baae5d9217045..3f7bf898e3eb08 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -10648,6 +10648,117 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } return value; } + case Attributes::Tolerance::Id: { + using TypeInfo = Attributes::Tolerance::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue, value); + return value; + } + case Attributes::ScaledValue::Id: { + using TypeInfo = Attributes::ScaledValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue.Value(), value); + } + return value; + } + case Attributes::MinScaledValue::Id: { + using TypeInfo = Attributes::MinScaledValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue.Value(), value); + } + return value; + } + case Attributes::MaxScaledValue::Id: { + using TypeInfo = Attributes::MaxScaledValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue.Value(), value); + } + return value; + } + case Attributes::ScaledTolerance::Id: { + using TypeInfo = Attributes::ScaledTolerance::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue, value); + return value; + } + case Attributes::Scale::Id: { + using TypeInfo = Attributes::Scale::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue, value); + return value; + } case Attributes::AttributeList::Id: { using TypeInfo = Attributes::AttributeList::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/controller/java/zap-generated/CHIPCallbackTypes.h b/src/controller/java/zap-generated/CHIPCallbackTypes.h index 18c695e87c4b93..a3bd9e35777dd5 100644 --- a/src/controller/java/zap-generated/CHIPCallbackTypes.h +++ b/src/controller/java/zap-generated/CHIPCallbackTypes.h @@ -1115,6 +1115,18 @@ typedef void (*CHIPPressureMeasurementClusterMinMeasuredValueAttributeCallbackTy void *, chip::app::Clusters::PressureMeasurement::Attributes::MinMeasuredValue::TypeInfo::DecodableArgType); typedef void (*CHIPPressureMeasurementClusterMaxMeasuredValueAttributeCallbackType)( void *, chip::app::Clusters::PressureMeasurement::Attributes::MaxMeasuredValue::TypeInfo::DecodableArgType); +typedef void (*CHIPPressureMeasurementClusterToleranceAttributeCallbackType)( + void *, chip::app::Clusters::PressureMeasurement::Attributes::Tolerance::TypeInfo::DecodableArgType); +typedef void (*CHIPPressureMeasurementClusterScaledValueAttributeCallbackType)( + void *, chip::app::Clusters::PressureMeasurement::Attributes::ScaledValue::TypeInfo::DecodableArgType); +typedef void (*CHIPPressureMeasurementClusterMinScaledValueAttributeCallbackType)( + void *, chip::app::Clusters::PressureMeasurement::Attributes::MinScaledValue::TypeInfo::DecodableArgType); +typedef void (*CHIPPressureMeasurementClusterMaxScaledValueAttributeCallbackType)( + void *, chip::app::Clusters::PressureMeasurement::Attributes::MaxScaledValue::TypeInfo::DecodableArgType); +typedef void (*CHIPPressureMeasurementClusterScaledToleranceAttributeCallbackType)( + void *, chip::app::Clusters::PressureMeasurement::Attributes::ScaledTolerance::TypeInfo::DecodableArgType); +typedef void (*CHIPPressureMeasurementClusterScaleAttributeCallbackType)( + void *, chip::app::Clusters::PressureMeasurement::Attributes::Scale::TypeInfo::DecodableArgType); typedef void (*CHIPPressureMeasurementClusterAttributeListAttributeCallbackType)( void *, const chip::app::Clusters::PressureMeasurement::Attributes::AttributeList::TypeInfo::DecodableType &); typedef void (*CHIPPressureMeasurementClusterClusterRevisionAttributeCallbackType)( diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index 7e9b9239309b30..1c25efa1be67cb 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -15567,6 +15567,207 @@ void CHIPPressureMeasurementMaxMeasuredValueAttributeCallback::CallbackFn(void * env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } +CHIPPressureMeasurementScaledValueAttributeCallback::CHIPPressureMeasurementScaledValueAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPPressureMeasurementScaledValueAttributeCallback::~CHIPPressureMeasurementScaledValueAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPPressureMeasurementScaledValueAttributeCallback::CallbackFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + +CHIPPressureMeasurementMinScaledValueAttributeCallback::CHIPPressureMeasurementMinScaledValueAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPPressureMeasurementMinScaledValueAttributeCallback::~CHIPPressureMeasurementMinScaledValueAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPPressureMeasurementMinScaledValueAttributeCallback::CallbackFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + +CHIPPressureMeasurementMaxScaledValueAttributeCallback::CHIPPressureMeasurementMaxScaledValueAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPPressureMeasurementMaxScaledValueAttributeCallback::~CHIPPressureMeasurementMaxScaledValueAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPPressureMeasurementMaxScaledValueAttributeCallback::CallbackFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + CHIPPressureMeasurementAttributeListAttributeCallback::CHIPPressureMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.h b/src/controller/java/zap-generated/CHIPReadCallbacks.h index 7085fc021c969e..160ca568cbe1f7 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.h +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.h @@ -6459,6 +6459,96 @@ class CHIPPressureMeasurementMaxMeasuredValueAttributeCallback bool keepAlive; }; +class CHIPPressureMeasurementScaledValueAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPPressureMeasurementScaledValueAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPPressureMeasurementScaledValueAttributeCallback(); + + static void maybeDestroy(CHIPPressureMeasurementScaledValueAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); + static void OnSubscriptionEstablished(void * context) + { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( + reinterpret_cast(context)->javaCallbackRef); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + +class CHIPPressureMeasurementMinScaledValueAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPPressureMeasurementMinScaledValueAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPPressureMeasurementMinScaledValueAttributeCallback(); + + static void maybeDestroy(CHIPPressureMeasurementMinScaledValueAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); + static void OnSubscriptionEstablished(void * context) + { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( + reinterpret_cast(context)->javaCallbackRef); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + +class CHIPPressureMeasurementMaxScaledValueAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPPressureMeasurementMaxScaledValueAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPPressureMeasurementMaxScaledValueAttributeCallback(); + + static void maybeDestroy(CHIPPressureMeasurementMaxScaledValueAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); + static void OnSubscriptionEstablished(void * context) + { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( + reinterpret_cast(context)->javaCallbackRef); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + class CHIPPressureMeasurementAttributeListAttributeCallback : public chip::Callback::Callback { diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index cebf2c0329e636..f37efa633fb75b 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -14415,6 +14415,30 @@ public interface MaxMeasuredValueAttributeCallback { default void onSubscriptionEstablished() {} } + public interface ScaledValueAttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + + default void onSubscriptionEstablished() {} + } + + public interface MinScaledValueAttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + + default void onSubscriptionEstablished() {} + } + + public interface MaxScaledValueAttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + + default void onSubscriptionEstablished() {} + } + public interface AttributeListAttributeCallback { void onSuccess(List valueList); @@ -14450,6 +14474,60 @@ public void subscribeMaxMeasuredValueAttribute( subscribeMaxMeasuredValueAttribute(chipClusterPtr, callback, minInterval, maxInterval); } + public void readToleranceAttribute(IntegerAttributeCallback callback) { + readToleranceAttribute(chipClusterPtr, callback); + } + + public void subscribeToleranceAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + subscribeToleranceAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readScaledValueAttribute(ScaledValueAttributeCallback callback) { + readScaledValueAttribute(chipClusterPtr, callback); + } + + public void subscribeScaledValueAttribute( + ScaledValueAttributeCallback callback, int minInterval, int maxInterval) { + subscribeScaledValueAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readMinScaledValueAttribute(MinScaledValueAttributeCallback callback) { + readMinScaledValueAttribute(chipClusterPtr, callback); + } + + public void subscribeMinScaledValueAttribute( + MinScaledValueAttributeCallback callback, int minInterval, int maxInterval) { + subscribeMinScaledValueAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readMaxScaledValueAttribute(MaxScaledValueAttributeCallback callback) { + readMaxScaledValueAttribute(chipClusterPtr, callback); + } + + public void subscribeMaxScaledValueAttribute( + MaxScaledValueAttributeCallback callback, int minInterval, int maxInterval) { + subscribeMaxScaledValueAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readScaledToleranceAttribute(IntegerAttributeCallback callback) { + readScaledToleranceAttribute(chipClusterPtr, callback); + } + + public void subscribeScaledToleranceAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + subscribeScaledToleranceAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readScaleAttribute(IntegerAttributeCallback callback) { + readScaleAttribute(chipClusterPtr, callback); + } + + public void subscribeScaleAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + subscribeScaleAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readAttributeListAttribute(AttributeListAttributeCallback callback) { readAttributeListAttribute(chipClusterPtr, callback); } @@ -14495,6 +14573,50 @@ private native void subscribeMaxMeasuredValueAttribute( int minInterval, int maxInterval); + private native void readToleranceAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void subscribeToleranceAttribute( + long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); + + private native void readScaledValueAttribute( + long chipClusterPtr, ScaledValueAttributeCallback callback); + + private native void subscribeScaledValueAttribute( + long chipClusterPtr, + ScaledValueAttributeCallback callback, + int minInterval, + int maxInterval); + + private native void readMinScaledValueAttribute( + long chipClusterPtr, MinScaledValueAttributeCallback callback); + + private native void subscribeMinScaledValueAttribute( + long chipClusterPtr, + MinScaledValueAttributeCallback callback, + int minInterval, + int maxInterval); + + private native void readMaxScaledValueAttribute( + long chipClusterPtr, MaxScaledValueAttributeCallback callback); + + private native void subscribeMaxScaledValueAttribute( + long chipClusterPtr, + MaxScaledValueAttributeCallback callback, + int minInterval, + int maxInterval); + + private native void readScaledToleranceAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void subscribeScaledToleranceAttribute( + long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); + + private native void readScaleAttribute(long chipClusterPtr, IntegerAttributeCallback callback); + + private native void subscribeScaleAttribute( + long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); + private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java index 52460aeb7d11e9..f3fdffaa90f5ae 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java @@ -1837,6 +1837,24 @@ public static String attributeIdToName(long clusterId, long attributeId) { if (attributeId == 2L) { return "MaxMeasuredValue"; } + if (attributeId == 3L) { + return "Tolerance"; + } + if (attributeId == 16L) { + return "ScaledValue"; + } + if (attributeId == 17L) { + return "MinScaledValue"; + } + if (attributeId == 18L) { + return "MaxScaledValue"; + } + if (attributeId == 19L) { + return "ScaledTolerance"; + } + if (attributeId == 20L) { + return "Scale"; + } if (attributeId == 65531L) { return "AttributeList"; } diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java index 7e6ac932307e5b..08984c7c335d86 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java @@ -6898,6 +6898,87 @@ public Map> getReadAttributeMap() { readPressureMeasurementInteractionInfo.put( "readMaxMeasuredValueAttribute", readPressureMeasurementMaxMeasuredValueAttributeInteractionInfo); + Map readPressureMeasurementToleranceCommandParams = + new LinkedHashMap(); + InteractionInfo readPressureMeasurementToleranceAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.PressureMeasurementCluster) cluster) + .readToleranceAttribute((ChipClusters.IntegerAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readPressureMeasurementToleranceCommandParams); + readPressureMeasurementInteractionInfo.put( + "readToleranceAttribute", readPressureMeasurementToleranceAttributeInteractionInfo); + Map readPressureMeasurementScaledValueCommandParams = + new LinkedHashMap(); + InteractionInfo readPressureMeasurementScaledValueAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.PressureMeasurementCluster) cluster) + .readScaledValueAttribute( + (ChipClusters.PressureMeasurementCluster.ScaledValueAttributeCallback) + callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readPressureMeasurementScaledValueCommandParams); + readPressureMeasurementInteractionInfo.put( + "readScaledValueAttribute", readPressureMeasurementScaledValueAttributeInteractionInfo); + Map readPressureMeasurementMinScaledValueCommandParams = + new LinkedHashMap(); + InteractionInfo readPressureMeasurementMinScaledValueAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.PressureMeasurementCluster) cluster) + .readMinScaledValueAttribute( + (ChipClusters.PressureMeasurementCluster.MinScaledValueAttributeCallback) + callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readPressureMeasurementMinScaledValueCommandParams); + readPressureMeasurementInteractionInfo.put( + "readMinScaledValueAttribute", + readPressureMeasurementMinScaledValueAttributeInteractionInfo); + Map readPressureMeasurementMaxScaledValueCommandParams = + new LinkedHashMap(); + InteractionInfo readPressureMeasurementMaxScaledValueAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.PressureMeasurementCluster) cluster) + .readMaxScaledValueAttribute( + (ChipClusters.PressureMeasurementCluster.MaxScaledValueAttributeCallback) + callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readPressureMeasurementMaxScaledValueCommandParams); + readPressureMeasurementInteractionInfo.put( + "readMaxScaledValueAttribute", + readPressureMeasurementMaxScaledValueAttributeInteractionInfo); + Map readPressureMeasurementScaledToleranceCommandParams = + new LinkedHashMap(); + InteractionInfo readPressureMeasurementScaledToleranceAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.PressureMeasurementCluster) cluster) + .readScaledToleranceAttribute((ChipClusters.IntegerAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readPressureMeasurementScaledToleranceCommandParams); + readPressureMeasurementInteractionInfo.put( + "readScaledToleranceAttribute", + readPressureMeasurementScaledToleranceAttributeInteractionInfo); + Map readPressureMeasurementScaleCommandParams = + new LinkedHashMap(); + InteractionInfo readPressureMeasurementScaleAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.PressureMeasurementCluster) cluster) + .readScaleAttribute((ChipClusters.IntegerAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readPressureMeasurementScaleCommandParams); + readPressureMeasurementInteractionInfo.put( + "readScaleAttribute", readPressureMeasurementScaleAttributeInteractionInfo); Map readPressureMeasurementAttributeListCommandParams = new LinkedHashMap(); InteractionInfo readPressureMeasurementAttributeListAttributeInteractionInfo = diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 1017e4c9fd3ad9..c15a0ea54f85ae 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -4535,6 +4535,42 @@ class ChipClusters: "type": "int", "reportable": True, }, + 0x00000003: { + "attributeName": "Tolerance", + "attributeId": 0x00000003, + "type": "int", + "reportable": True, + }, + 0x00000010: { + "attributeName": "ScaledValue", + "attributeId": 0x00000010, + "type": "int", + "reportable": True, + }, + 0x00000011: { + "attributeName": "MinScaledValue", + "attributeId": 0x00000011, + "type": "int", + "reportable": True, + }, + 0x00000012: { + "attributeName": "MaxScaledValue", + "attributeId": 0x00000012, + "type": "int", + "reportable": True, + }, + 0x00000013: { + "attributeName": "ScaledTolerance", + "attributeId": 0x00000013, + "type": "int", + "reportable": True, + }, + 0x00000014: { + "attributeName": "Scale", + "attributeId": 0x00000014, + "type": "int", + "reportable": True, + }, 0x0000FFFB: { "attributeName": "AttributeList", "attributeId": 0x0000FFFB, diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm index 11d2ea698311f5..7bf344fe7cfeb9 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm @@ -8798,6 +8798,84 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader } return value; } + case Attributes::Tolerance::Id: { + using TypeInfo = Attributes::Tolerance::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ScaledValue::Id: { + using TypeInfo = Attributes::ScaledValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::MinScaledValue::Id: { + using TypeInfo = Attributes::MinScaledValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::MaxScaledValue::Id: { + using TypeInfo = Attributes::MaxScaledValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::ScaledTolerance::Id: { + using TypeInfo = Attributes::ScaledTolerance::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Scale::Id: { + using TypeInfo = Attributes::Scale::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithChar:cppValue]; + return value; + } case Attributes::AttributeList::Id: { using TypeInfo = Attributes::AttributeList::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index 81c1a29b669f3f..e5ea3a0c4c849c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -9814,6 +9814,108 @@ NS_ASSUME_NONNULL_BEGIN completionHandler: (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)readAttributeToleranceWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; +/** + * This API does not support setting autoResubscribe to NO in the + * CHIPSubscribeParams. + */ +- (void)subscribeAttributeToleranceWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeToleranceWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; + +- (void)readAttributeScaledValueWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; +/** + * This API does not support setting autoResubscribe to NO in the + * CHIPSubscribeParams. + */ +- (void)subscribeAttributeScaledValueWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeScaledValueWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; + +- (void)readAttributeMinScaledValueWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler; +/** + * This API does not support setting autoResubscribe to NO in the + * CHIPSubscribeParams. + */ +- (void)subscribeAttributeMinScaledValueWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeMinScaledValueWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; + +- (void)readAttributeMaxScaledValueWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler; +/** + * This API does not support setting autoResubscribe to NO in the + * CHIPSubscribeParams. + */ +- (void)subscribeAttributeMaxScaledValueWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeMaxScaledValueWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; + +- (void)readAttributeScaledToleranceWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler; +/** + * This API does not support setting autoResubscribe to NO in the + * CHIPSubscribeParams. + */ +- (void)subscribeAttributeScaledToleranceWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeScaledToleranceWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; + +- (void)readAttributeScaleWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; +/** + * This API does not support setting autoResubscribe to NO in the + * CHIPSubscribeParams. + */ +- (void)subscribeAttributeScaleWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeScaleWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; + - (void)readAttributeAttributeListWithCompletionHandler:(void (^)( NSArray * _Nullable value, NSError * _Nullable error))completionHandler; /** diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index e47b7304ea8552..f63cce817b7a00 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -37361,6 +37361,375 @@ new CHIPNullableInt16sAttributeCallbackBridge(queue, completionHandler, ^(Cancel }); } +- (void)readAttributeToleranceWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPInt16uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = PressureMeasurement::Attributes::Tolerance::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeToleranceWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + new CHIPInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, reportHandler, + ^(Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::Tolerance::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + CHIPInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); +} + ++ (void)readAttributeToleranceWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPInt16uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = PressureMeasurement::Attributes::Tolerance::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeScaledValueWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPNullableInt16sAttributeCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = PressureMeasurement::Attributes::ScaledValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeScaledValueWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + new CHIPNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, reportHandler, + ^(Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::ScaledValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + CHIPNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); +} + ++ (void)readAttributeScaledValueWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPNullableInt16sAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = PressureMeasurement::Attributes::ScaledValue::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeMinScaledValueWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler +{ + new CHIPNullableInt16sAttributeCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = PressureMeasurement::Attributes::MinScaledValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeMinScaledValueWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + new CHIPNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, reportHandler, + ^(Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::MinScaledValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + CHIPNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); +} + ++ (void)readAttributeMinScaledValueWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPNullableInt16sAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = PressureMeasurement::Attributes::MinScaledValue::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeMaxScaledValueWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler +{ + new CHIPNullableInt16sAttributeCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = PressureMeasurement::Attributes::MaxScaledValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeMaxScaledValueWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + new CHIPNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, reportHandler, + ^(Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::MaxScaledValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + CHIPNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); +} + ++ (void)readAttributeMaxScaledValueWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPNullableInt16sAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = PressureMeasurement::Attributes::MaxScaledValue::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeScaledToleranceWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler +{ + new CHIPInt16uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = PressureMeasurement::Attributes::ScaledTolerance::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeScaledToleranceWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + new CHIPInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, reportHandler, + ^(Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::ScaledTolerance::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + CHIPInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); +} + ++ (void)readAttributeScaledToleranceWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPInt16uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = PressureMeasurement::Attributes::ScaledTolerance::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeScaleWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPInt8sAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = PressureMeasurement::Attributes::Scale::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeScaleWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + new CHIPInt8sAttributeCallbackSubscriptionBridge( + self.callbackQueue, reportHandler, + ^(Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::Scale::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + CHIPInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); +} + ++ (void)readAttributeScaleWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPInt8sAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = PressureMeasurement::Attributes::Scale::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + - (void)readAttributeAttributeListWithCompletionHandler:(void (^)( NSArray * _Nullable value, NSError * _Nullable error))completionHandler { diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h index afcdd348439d88..9fc467b2e032d2 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h @@ -926,6 +926,12 @@ NS_ASSUME_NONNULL_BEGIN - (void)writeAttributeMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeMinMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeMaxMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeToleranceWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeScaledValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeMinScaledValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeMaxScaledValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeScaledToleranceWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeScaleWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm index 4b7419edf6ffee..232c79cf5641b1 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm @@ -12173,6 +12173,129 @@ new CHIPDefaultSuccessCallbackBridge( }); } +- (void)writeAttributeToleranceWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = PressureMeasurement::Attributes::Tolerance::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedShortValue; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)writeAttributeScaledValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = PressureMeasurement::Attributes::ScaledValue::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = value.shortValue; + } + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)writeAttributeMinScaledValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = PressureMeasurement::Attributes::MinScaledValue::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = value.shortValue; + } + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)writeAttributeMaxScaledValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = PressureMeasurement::Attributes::MaxScaledValue::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = value.shortValue; + } + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)writeAttributeScaledToleranceWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = PressureMeasurement::Attributes::ScaledTolerance::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedShortValue; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)writeAttributeScaleWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = PressureMeasurement::Attributes::Scale::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.charValue; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + - (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h index 9b0741b2e8799d..d131e0857c9b2f 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h @@ -46651,6 +46651,453 @@ class SubscribeAttributePressureMeasurementMaxMeasuredValue : public SubscribeAt } }; +/* + * Attribute Tolerance + */ +class ReadPressureMeasurementTolerance : public ReadAttribute { +public: + ReadPressureMeasurementTolerance() + : ReadAttribute("tolerance") + { + } + + ~ReadPressureMeasurementTolerance() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000003) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPPressureMeasurement * cluster = [[CHIPPressureMeasurement alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIP_ERROR __block err = CHIP_NO_ERROR; + [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"PressureMeasurement.Tolerance response %@", [value description]); + err = [CHIPError errorToCHIPErrorCode:error]; + + if (error != nil) { + ChipLogError(chipTool, "PressureMeasurement Tolerance read Error: %s", chip::ErrorStr(err)); + } + SetCommandExitStatus(err); + }]; + return err; + } +}; + +class SubscribeAttributePressureMeasurementTolerance : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementTolerance() + : SubscribeAttribute("tolerance") + { + } + + ~SubscribeAttributePressureMeasurementTolerance() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000003) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPPressureMeasurement * cluster = [[CHIPPressureMeasurement alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + params.keepPreviousSubscriptions + = mKeepSubscriptions.HasValue() ? [NSNumber numberWithBool:mKeepSubscriptions.Value()] : nil; + params.fabricFiltered = mFabricFiltered.HasValue() ? [NSNumber numberWithBool:mFabricFiltered.Value()] : nil; + [cluster subscribeAttributeToleranceWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:nullptr + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"PressureMeasurement.Tolerance response %@", [value description]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } +}; + +/* + * Attribute ScaledValue + */ +class ReadPressureMeasurementScaledValue : public ReadAttribute { +public: + ReadPressureMeasurementScaledValue() + : ReadAttribute("scaled-value") + { + } + + ~ReadPressureMeasurementScaledValue() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000010) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPPressureMeasurement * cluster = [[CHIPPressureMeasurement alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIP_ERROR __block err = CHIP_NO_ERROR; + [cluster readAttributeScaledValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"PressureMeasurement.ScaledValue response %@", [value description]); + err = [CHIPError errorToCHIPErrorCode:error]; + + if (error != nil) { + ChipLogError(chipTool, "PressureMeasurement ScaledValue read Error: %s", chip::ErrorStr(err)); + } + SetCommandExitStatus(err); + }]; + return err; + } +}; + +class SubscribeAttributePressureMeasurementScaledValue : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementScaledValue() + : SubscribeAttribute("scaled-value") + { + } + + ~SubscribeAttributePressureMeasurementScaledValue() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000010) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPPressureMeasurement * cluster = [[CHIPPressureMeasurement alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + params.keepPreviousSubscriptions + = mKeepSubscriptions.HasValue() ? [NSNumber numberWithBool:mKeepSubscriptions.Value()] : nil; + params.fabricFiltered = mFabricFiltered.HasValue() ? [NSNumber numberWithBool:mFabricFiltered.Value()] : nil; + [cluster subscribeAttributeScaledValueWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:nullptr + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"PressureMeasurement.ScaledValue response %@", [value description]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } +}; + +/* + * Attribute MinScaledValue + */ +class ReadPressureMeasurementMinScaledValue : public ReadAttribute { +public: + ReadPressureMeasurementMinScaledValue() + : ReadAttribute("min-scaled-value") + { + } + + ~ReadPressureMeasurementMinScaledValue() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000011) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPPressureMeasurement * cluster = [[CHIPPressureMeasurement alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIP_ERROR __block err = CHIP_NO_ERROR; + [cluster readAttributeMinScaledValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"PressureMeasurement.MinScaledValue response %@", [value description]); + err = [CHIPError errorToCHIPErrorCode:error]; + + if (error != nil) { + ChipLogError(chipTool, "PressureMeasurement MinScaledValue read Error: %s", chip::ErrorStr(err)); + } + SetCommandExitStatus(err); + }]; + return err; + } +}; + +class SubscribeAttributePressureMeasurementMinScaledValue : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementMinScaledValue() + : SubscribeAttribute("min-scaled-value") + { + } + + ~SubscribeAttributePressureMeasurementMinScaledValue() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000011) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPPressureMeasurement * cluster = [[CHIPPressureMeasurement alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + params.keepPreviousSubscriptions + = mKeepSubscriptions.HasValue() ? [NSNumber numberWithBool:mKeepSubscriptions.Value()] : nil; + params.fabricFiltered = mFabricFiltered.HasValue() ? [NSNumber numberWithBool:mFabricFiltered.Value()] : nil; + [cluster + subscribeAttributeMinScaledValueWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:nullptr + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"PressureMeasurement.MinScaledValue response %@", [value description]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } +}; + +/* + * Attribute MaxScaledValue + */ +class ReadPressureMeasurementMaxScaledValue : public ReadAttribute { +public: + ReadPressureMeasurementMaxScaledValue() + : ReadAttribute("max-scaled-value") + { + } + + ~ReadPressureMeasurementMaxScaledValue() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000012) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPPressureMeasurement * cluster = [[CHIPPressureMeasurement alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIP_ERROR __block err = CHIP_NO_ERROR; + [cluster readAttributeMaxScaledValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"PressureMeasurement.MaxScaledValue response %@", [value description]); + err = [CHIPError errorToCHIPErrorCode:error]; + + if (error != nil) { + ChipLogError(chipTool, "PressureMeasurement MaxScaledValue read Error: %s", chip::ErrorStr(err)); + } + SetCommandExitStatus(err); + }]; + return err; + } +}; + +class SubscribeAttributePressureMeasurementMaxScaledValue : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementMaxScaledValue() + : SubscribeAttribute("max-scaled-value") + { + } + + ~SubscribeAttributePressureMeasurementMaxScaledValue() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000012) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPPressureMeasurement * cluster = [[CHIPPressureMeasurement alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + params.keepPreviousSubscriptions + = mKeepSubscriptions.HasValue() ? [NSNumber numberWithBool:mKeepSubscriptions.Value()] : nil; + params.fabricFiltered = mFabricFiltered.HasValue() ? [NSNumber numberWithBool:mFabricFiltered.Value()] : nil; + [cluster + subscribeAttributeMaxScaledValueWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:nullptr + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"PressureMeasurement.MaxScaledValue response %@", [value description]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } +}; + +/* + * Attribute ScaledTolerance + */ +class ReadPressureMeasurementScaledTolerance : public ReadAttribute { +public: + ReadPressureMeasurementScaledTolerance() + : ReadAttribute("scaled-tolerance") + { + } + + ~ReadPressureMeasurementScaledTolerance() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000013) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPPressureMeasurement * cluster = [[CHIPPressureMeasurement alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIP_ERROR __block err = CHIP_NO_ERROR; + [cluster readAttributeScaledToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"PressureMeasurement.ScaledTolerance response %@", [value description]); + err = [CHIPError errorToCHIPErrorCode:error]; + + if (error != nil) { + ChipLogError(chipTool, "PressureMeasurement ScaledTolerance read Error: %s", chip::ErrorStr(err)); + } + SetCommandExitStatus(err); + }]; + return err; + } +}; + +class SubscribeAttributePressureMeasurementScaledTolerance : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementScaledTolerance() + : SubscribeAttribute("scaled-tolerance") + { + } + + ~SubscribeAttributePressureMeasurementScaledTolerance() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000013) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPPressureMeasurement * cluster = [[CHIPPressureMeasurement alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + params.keepPreviousSubscriptions + = mKeepSubscriptions.HasValue() ? [NSNumber numberWithBool:mKeepSubscriptions.Value()] : nil; + params.fabricFiltered = mFabricFiltered.HasValue() ? [NSNumber numberWithBool:mFabricFiltered.Value()] : nil; + [cluster + subscribeAttributeScaledToleranceWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:nullptr + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"PressureMeasurement.ScaledTolerance response %@", [value description]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } +}; + +/* + * Attribute Scale + */ +class ReadPressureMeasurementScale : public ReadAttribute { +public: + ReadPressureMeasurementScale() + : ReadAttribute("scale") + { + } + + ~ReadPressureMeasurementScale() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReadAttribute (0x00000014) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPPressureMeasurement * cluster = [[CHIPPressureMeasurement alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIP_ERROR __block err = CHIP_NO_ERROR; + [cluster readAttributeScaleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"PressureMeasurement.Scale response %@", [value description]); + err = [CHIPError errorToCHIPErrorCode:error]; + + if (error != nil) { + ChipLogError(chipTool, "PressureMeasurement Scale read Error: %s", chip::ErrorStr(err)); + } + SetCommandExitStatus(err); + }]; + return err; + } +}; + +class SubscribeAttributePressureMeasurementScale : public SubscribeAttribute { +public: + SubscribeAttributePressureMeasurementScale() + : SubscribeAttribute("scale") + { + } + + ~SubscribeAttributePressureMeasurementScale() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000403) ReportAttribute (0x00000014) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPPressureMeasurement * cluster = [[CHIPPressureMeasurement alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + params.keepPreviousSubscriptions + = mKeepSubscriptions.HasValue() ? [NSNumber numberWithBool:mKeepSubscriptions.Value()] : nil; + params.fabricFiltered = mFabricFiltered.HasValue() ? [NSNumber numberWithBool:mFabricFiltered.Value()] : nil; + [cluster subscribeAttributeScaleWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:nullptr + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"PressureMeasurement.Scale response %@", [value description]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } +}; + /* * Attribute AttributeList */ @@ -78821,6 +79268,18 @@ void registerClusterPressureMeasurement(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), //