| /* |
| * |
| * Copyright (c) 2021 Project CHIP Authors |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| // THIS FILE IS GENERATED BY ZAP |
| #include "CHIPReadCallbacks.h" |
| |
| #include <app-common/zap-generated/cluster-objects.h> |
| #include <zap-generated/CHIPClusters.h> |
| |
| #include <controller/java/AndroidClusterExceptions.h> |
| #include <controller/java/CHIPDefaultCallbacks.h> |
| #include <jni.h> |
| #include <lib/support/CodeUtils.h> |
| #include <platform/PlatformManager.h> |
| |
| #define JNI_METHOD(RETURN, CLASS_NAME, METHOD_NAME) \ |
| extern "C" JNIEXPORT RETURN JNICALL Java_chip_devicecontroller_ChipClusters_00024##CLASS_NAME##_##METHOD_NAME |
| |
| JNI_METHOD(void, AccessControlCluster, readAclAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AccessControl::Attributes::Acl::TypeInfo; |
| std::unique_ptr<CHIPAccessControlAclAttributeCallback, void (*)(CHIPAccessControlAclAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPAccessControlAclAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPAccessControlAclAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AccessControlCluster * cppCluster = reinterpret_cast<chip::Controller::AccessControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPAccessControlClusterAclAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, AccessControlCluster, readExtensionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AccessControl::Attributes::Extension::TypeInfo; |
| std::unique_ptr<CHIPAccessControlExtensionAttributeCallback, void (*)(CHIPAccessControlExtensionAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPAccessControlExtensionAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPAccessControlExtensionAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AccessControlCluster * cppCluster = reinterpret_cast<chip::Controller::AccessControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPAccessControlClusterExtensionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, AccessControlCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AccessControl::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPAccessControlAttributeListAttributeCallback, void (*)(CHIPAccessControlAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPAccessControlAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPAccessControlAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AccessControlCluster * cppCluster = reinterpret_cast<chip::Controller::AccessControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPAccessControlClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, AccessControlCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AccessControl::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AccessControlCluster * cppCluster = reinterpret_cast<chip::Controller::AccessControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPAccessControlClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, AccountLoginCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AccountLogin::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPAccountLoginAttributeListAttributeCallback, void (*)(CHIPAccountLoginAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPAccountLoginAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPAccountLoginAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AccountLoginCluster * cppCluster = reinterpret_cast<chip::Controller::AccountLoginCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPAccountLoginClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, AccountLoginCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AccountLogin::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AccountLoginCluster * cppCluster = reinterpret_cast<chip::Controller::AccountLoginCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPAccountLoginClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, AdministratorCommissioningCluster, readWindowStatusAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AdministratorCommissioning::Attributes::WindowStatus::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AdministratorCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::AdministratorCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPAdministratorCommissioningClusterWindowStatusAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, AdministratorCommissioningCluster, readAdminFabricIndexAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AdministratorCommissioning::Attributes::AdminFabricIndex::TypeInfo; |
| std::unique_ptr<CHIPAdministratorCommissioningAdminFabricIndexAttributeCallback, |
| void (*)(CHIPAdministratorCommissioningAdminFabricIndexAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPAdministratorCommissioningAdminFabricIndexAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPAdministratorCommissioningAdminFabricIndexAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AdministratorCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::AdministratorCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPAdministratorCommissioningClusterAdminFabricIndexAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, AdministratorCommissioningCluster, readAdminVendorIdAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AdministratorCommissioning::Attributes::AdminVendorId::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AdministratorCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::AdministratorCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPAdministratorCommissioningClusterAdminVendorIdAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, AdministratorCommissioningCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AdministratorCommissioning::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPAdministratorCommissioningAttributeListAttributeCallback, |
| void (*)(CHIPAdministratorCommissioningAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPAdministratorCommissioningAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPAdministratorCommissioningAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AdministratorCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::AdministratorCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPAdministratorCommissioningClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, AdministratorCommissioningCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AdministratorCommissioning::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AdministratorCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::AdministratorCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPAdministratorCommissioningClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ApplicationBasicCluster, readVendorNameAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ApplicationBasic::Attributes::VendorName::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ApplicationBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ApplicationBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPApplicationBasicClusterVendorNameAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ApplicationBasicCluster, readVendorIdAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ApplicationBasic::Attributes::VendorId::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ApplicationBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ApplicationBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPApplicationBasicClusterVendorIdAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ApplicationBasicCluster, readApplicationNameAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ApplicationBasic::Attributes::ApplicationName::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ApplicationBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ApplicationBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPApplicationBasicClusterApplicationNameAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ApplicationBasicCluster, readProductIdAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ApplicationBasic::Attributes::ProductId::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ApplicationBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ApplicationBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPApplicationBasicClusterProductIdAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ApplicationBasicCluster, readApplicationStatusAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ApplicationBasic::Attributes::ApplicationStatus::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ApplicationBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ApplicationBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPApplicationBasicClusterApplicationStatusAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ApplicationBasicCluster, readApplicationVersionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ApplicationBasic::Attributes::ApplicationVersion::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ApplicationBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ApplicationBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPApplicationBasicClusterApplicationVersionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ApplicationBasicCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ApplicationBasic::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPApplicationBasicAttributeListAttributeCallback, |
| void (*)(CHIPApplicationBasicAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPApplicationBasicAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPApplicationBasicAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ApplicationBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ApplicationBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPApplicationBasicClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ApplicationBasicCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ApplicationBasic::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ApplicationBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ApplicationBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPApplicationBasicClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ApplicationLauncherCluster, readApplicationLauncherListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ApplicationLauncher::Attributes::ApplicationLauncherList::TypeInfo; |
| std::unique_ptr<CHIPApplicationLauncherApplicationLauncherListAttributeCallback, |
| void (*)(CHIPApplicationLauncherApplicationLauncherListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPApplicationLauncherApplicationLauncherListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPApplicationLauncherApplicationLauncherListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ApplicationLauncherCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ApplicationLauncherCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPApplicationLauncherClusterApplicationLauncherListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ApplicationLauncherCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ApplicationLauncher::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPApplicationLauncherAttributeListAttributeCallback, |
| void (*)(CHIPApplicationLauncherAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPApplicationLauncherAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPApplicationLauncherAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ApplicationLauncherCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ApplicationLauncherCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPApplicationLauncherClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ApplicationLauncherCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ApplicationLauncher::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ApplicationLauncherCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ApplicationLauncherCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPApplicationLauncherClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, AudioOutputCluster, readAudioOutputListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AudioOutput::Attributes::AudioOutputList::TypeInfo; |
| std::unique_ptr<CHIPAudioOutputAudioOutputListAttributeCallback, void (*)(CHIPAudioOutputAudioOutputListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPAudioOutputAudioOutputListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPAudioOutputAudioOutputListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AudioOutputCluster * cppCluster = reinterpret_cast<chip::Controller::AudioOutputCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPAudioOutputClusterAudioOutputListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, AudioOutputCluster, readCurrentAudioOutputAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AudioOutput::Attributes::CurrentAudioOutput::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AudioOutputCluster * cppCluster = reinterpret_cast<chip::Controller::AudioOutputCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPAudioOutputClusterCurrentAudioOutputAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, AudioOutputCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AudioOutput::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPAudioOutputAttributeListAttributeCallback, void (*)(CHIPAudioOutputAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPAudioOutputAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPAudioOutputAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AudioOutputCluster * cppCluster = reinterpret_cast<chip::Controller::AudioOutputCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPAudioOutputClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, AudioOutputCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::AudioOutput::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::AudioOutputCluster * cppCluster = reinterpret_cast<chip::Controller::AudioOutputCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPAudioOutputClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BarrierControlCluster, readBarrierMovingStateAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BarrierControl::Attributes::BarrierMovingState::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BarrierControlCluster * cppCluster = reinterpret_cast<chip::Controller::BarrierControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBarrierControlClusterBarrierMovingStateAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BarrierControlCluster, readBarrierSafetyStatusAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BarrierControl::Attributes::BarrierSafetyStatus::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BarrierControlCluster * cppCluster = reinterpret_cast<chip::Controller::BarrierControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBarrierControlClusterBarrierSafetyStatusAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BarrierControlCluster, readBarrierCapabilitiesAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BarrierControl::Attributes::BarrierCapabilities::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BarrierControlCluster * cppCluster = reinterpret_cast<chip::Controller::BarrierControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBarrierControlClusterBarrierCapabilitiesAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BarrierControlCluster, readBarrierPositionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BarrierControl::Attributes::BarrierPosition::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BarrierControlCluster * cppCluster = reinterpret_cast<chip::Controller::BarrierControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBarrierControlClusterBarrierPositionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BarrierControlCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BarrierControl::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPBarrierControlAttributeListAttributeCallback, void (*)(CHIPBarrierControlAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPBarrierControlAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPBarrierControlAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BarrierControlCluster * cppCluster = reinterpret_cast<chip::Controller::BarrierControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBarrierControlClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BarrierControlCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BarrierControl::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BarrierControlCluster * cppCluster = reinterpret_cast<chip::Controller::BarrierControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBarrierControlClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readInteractionModelVersionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::InteractionModelVersion::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBasicClusterInteractionModelVersionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readVendorNameAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::VendorName::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBasicClusterVendorNameAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readVendorIDAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::VendorID::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBasicClusterVendorIDAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readProductNameAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::ProductName::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBasicClusterProductNameAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readProductIDAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::ProductID::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBasicClusterProductIDAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readNodeLabelAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::NodeLabel::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBasicClusterNodeLabelAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readLocationAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::Location::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBasicClusterLocationAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readHardwareVersionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::HardwareVersion::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBasicClusterHardwareVersionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readHardwareVersionStringAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::HardwareVersionString::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBasicClusterHardwareVersionStringAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readSoftwareVersionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::SoftwareVersion::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBasicClusterSoftwareVersionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readSoftwareVersionStringAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::SoftwareVersionString::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBasicClusterSoftwareVersionStringAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readManufacturingDateAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::ManufacturingDate::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBasicClusterManufacturingDateAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readPartNumberAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::PartNumber::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBasicClusterPartNumberAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readProductURLAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::ProductURL::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBasicClusterProductURLAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readProductLabelAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::ProductLabel::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBasicClusterProductLabelAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readSerialNumberAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::SerialNumber::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBasicClusterSerialNumberAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readLocalConfigDisabledAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::LocalConfigDisabled::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBasicClusterLocalConfigDisabledAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readReachableAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::Reachable::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBasicClusterReachableAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readUniqueIDAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::UniqueID::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBasicClusterUniqueIDAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPBasicAttributeListAttributeCallback, void (*)(CHIPBasicAttributeListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBasicAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPBasicAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBasicClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BasicCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Basic::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BasicCluster * cppCluster = reinterpret_cast<chip::Controller::BasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBasicClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BinaryInputBasicCluster, readOutOfServiceAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BinaryInputBasic::Attributes::OutOfService::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BinaryInputBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::BinaryInputBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBinaryInputBasicClusterOutOfServiceAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BinaryInputBasicCluster, readPresentValueAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BinaryInputBasic::Attributes::PresentValue::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BinaryInputBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::BinaryInputBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBinaryInputBasicClusterPresentValueAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BinaryInputBasicCluster, readStatusFlagsAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BinaryInputBasic::Attributes::StatusFlags::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BinaryInputBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::BinaryInputBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBinaryInputBasicClusterStatusFlagsAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BinaryInputBasicCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BinaryInputBasic::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPBinaryInputBasicAttributeListAttributeCallback, |
| void (*)(CHIPBinaryInputBasicAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPBinaryInputBasicAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPBinaryInputBasicAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BinaryInputBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::BinaryInputBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBinaryInputBasicClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BinaryInputBasicCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BinaryInputBasic::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BinaryInputBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::BinaryInputBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBinaryInputBasicClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BindingCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Binding::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPBindingAttributeListAttributeCallback, void (*)(CHIPBindingAttributeListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBindingAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPBindingAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BindingCluster * cppCluster = reinterpret_cast<chip::Controller::BindingCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBindingClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BindingCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Binding::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BindingCluster * cppCluster = reinterpret_cast<chip::Controller::BindingCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBindingClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BooleanStateCluster, readStateValueAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BooleanState::Attributes::StateValue::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BooleanStateCluster * cppCluster = reinterpret_cast<chip::Controller::BooleanStateCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBooleanStateClusterStateValueAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BooleanStateCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BooleanState::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPBooleanStateAttributeListAttributeCallback, void (*)(CHIPBooleanStateAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPBooleanStateAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPBooleanStateAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BooleanStateCluster * cppCluster = reinterpret_cast<chip::Controller::BooleanStateCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBooleanStateClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BooleanStateCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BooleanState::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BooleanStateCluster * cppCluster = reinterpret_cast<chip::Controller::BooleanStateCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBooleanStateClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BridgedActionsCluster, readActionListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BridgedActions::Attributes::ActionList::TypeInfo; |
| std::unique_ptr<CHIPBridgedActionsActionListAttributeCallback, void (*)(CHIPBridgedActionsActionListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPBridgedActionsActionListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPBridgedActionsActionListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BridgedActionsCluster * cppCluster = reinterpret_cast<chip::Controller::BridgedActionsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBridgedActionsClusterActionListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BridgedActionsCluster, readEndpointListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BridgedActions::Attributes::EndpointList::TypeInfo; |
| std::unique_ptr<CHIPBridgedActionsEndpointListAttributeCallback, void (*)(CHIPBridgedActionsEndpointListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPBridgedActionsEndpointListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPBridgedActionsEndpointListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BridgedActionsCluster * cppCluster = reinterpret_cast<chip::Controller::BridgedActionsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBridgedActionsClusterEndpointListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BridgedActionsCluster, readSetupUrlAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BridgedActions::Attributes::SetupUrl::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BridgedActionsCluster * cppCluster = reinterpret_cast<chip::Controller::BridgedActionsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBridgedActionsClusterSetupUrlAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BridgedActionsCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BridgedActions::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPBridgedActionsAttributeListAttributeCallback, void (*)(CHIPBridgedActionsAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPBridgedActionsAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPBridgedActionsAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BridgedActionsCluster * cppCluster = reinterpret_cast<chip::Controller::BridgedActionsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPBridgedActionsClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BridgedActionsCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BridgedActions::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BridgedActionsCluster * cppCluster = reinterpret_cast<chip::Controller::BridgedActionsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBridgedActionsClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BridgedDeviceBasicCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BridgedDeviceBasic::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPBridgedDeviceBasicAttributeListAttributeCallback, |
| void (*)(CHIPBridgedDeviceBasicAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPBridgedDeviceBasicAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPBridgedDeviceBasicAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BridgedDeviceBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::BridgedDeviceBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBridgedDeviceBasicClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, BridgedDeviceBasicCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::BridgedDeviceBasic::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::BridgedDeviceBasicCluster * cppCluster = |
| reinterpret_cast<chip::Controller::BridgedDeviceBasicCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPBridgedDeviceBasicClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readCurrentHueAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::CurrentHue::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterCurrentHueAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readCurrentSaturationAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::CurrentSaturation::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterCurrentSaturationAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readRemainingTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::RemainingTime::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterRemainingTimeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readCurrentXAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::CurrentX::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterCurrentXAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readCurrentYAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::CurrentY::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterCurrentYAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readDriftCompensationAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::DriftCompensation::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterDriftCompensationAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readCompensationTextAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::CompensationText::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterCompensationTextAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorTemperatureAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorTemperature::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterColorTemperatureAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorModeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorMode::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterColorModeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorControlOptionsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorControlOptions::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterColorControlOptionsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readNumberOfPrimariesAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::NumberOfPrimaries::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterNumberOfPrimariesAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary1XAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary1X::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterPrimary1XAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary1YAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary1Y::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterPrimary1YAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary1IntensityAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary1Intensity::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterPrimary1IntensityAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary2XAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary2X::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterPrimary2XAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary2YAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary2Y::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterPrimary2YAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary2IntensityAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary2Intensity::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterPrimary2IntensityAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary3XAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary3X::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterPrimary3XAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary3YAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary3Y::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterPrimary3YAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary3IntensityAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary3Intensity::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterPrimary3IntensityAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary4XAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary4X::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterPrimary4XAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary4YAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary4Y::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterPrimary4YAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary4IntensityAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary4Intensity::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterPrimary4IntensityAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary5XAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary5X::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterPrimary5XAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary5YAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary5Y::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterPrimary5YAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary5IntensityAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary5Intensity::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterPrimary5IntensityAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary6XAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary6X::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterPrimary6XAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary6YAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary6Y::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterPrimary6YAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readPrimary6IntensityAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::Primary6Intensity::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterPrimary6IntensityAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readWhitePointXAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::WhitePointX::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterWhitePointXAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readWhitePointYAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::WhitePointY::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterWhitePointYAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorPointRXAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointRX::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterColorPointRXAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorPointRYAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointRY::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterColorPointRYAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorPointRIntensityAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointRIntensity::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterColorPointRIntensityAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorPointGXAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointGX::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterColorPointGXAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorPointGYAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointGY::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterColorPointGYAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorPointGIntensityAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointGIntensity::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterColorPointGIntensityAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorPointBXAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointBX::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterColorPointBXAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorPointBYAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointBY::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterColorPointBYAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorPointBIntensityAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointBIntensity::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterColorPointBIntensityAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readEnhancedCurrentHueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::EnhancedCurrentHue::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterEnhancedCurrentHueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readEnhancedColorModeAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::EnhancedColorMode::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterEnhancedColorModeAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorLoopActiveAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorLoopActive::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterColorLoopActiveAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorLoopDirectionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorLoopDirection::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterColorLoopDirectionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorLoopTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorLoopTime::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterColorLoopTimeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorLoopStartEnhancedHueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorLoopStartEnhancedHue::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterColorLoopStartEnhancedHueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorLoopStoredEnhancedHueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorLoopStoredEnhancedHue::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterColorLoopStoredEnhancedHueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorCapabilitiesAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorCapabilities::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterColorCapabilitiesAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorTempPhysicalMinAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorTempPhysicalMin::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterColorTempPhysicalMinAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readColorTempPhysicalMaxAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorTempPhysicalMax::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPColorControlClusterColorTempPhysicalMaxAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readCoupleColorTempToLevelMinMiredsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::CoupleColorTempToLevelMinMireds::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterCoupleColorTempToLevelMinMiredsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readStartUpColorTemperatureMiredsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::StartUpColorTemperatureMireds::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterStartUpColorTemperatureMiredsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPColorControlAttributeListAttributeCallback, void (*)(CHIPColorControlAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPColorControlAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPColorControlAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ColorControlCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ColorControlCluster * cppCluster = reinterpret_cast<chip::Controller::ColorControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPColorControlClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ContentLauncherCluster, readAcceptsHeaderListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ContentLauncher::Attributes::AcceptsHeaderList::TypeInfo; |
| std::unique_ptr<CHIPContentLauncherAcceptsHeaderListAttributeCallback, |
| void (*)(CHIPContentLauncherAcceptsHeaderListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPContentLauncherAcceptsHeaderListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPContentLauncherAcceptsHeaderListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ContentLauncherCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ContentLauncherCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPContentLauncherClusterAcceptsHeaderListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ContentLauncherCluster, readSupportedStreamingProtocolsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ContentLauncherCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ContentLauncherCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPContentLauncherClusterSupportedStreamingProtocolsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ContentLauncherCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ContentLauncher::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPContentLauncherAttributeListAttributeCallback, |
| void (*)(CHIPContentLauncherAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPContentLauncherAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPContentLauncherAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ContentLauncherCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ContentLauncherCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPContentLauncherClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ContentLauncherCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ContentLauncher::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ContentLauncherCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ContentLauncherCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPContentLauncherClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DescriptorCluster, readDeviceListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Descriptor::Attributes::DeviceList::TypeInfo; |
| std::unique_ptr<CHIPDescriptorDeviceListAttributeCallback, void (*)(CHIPDescriptorDeviceListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPDescriptorDeviceListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPDescriptorDeviceListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DescriptorCluster * cppCluster = reinterpret_cast<chip::Controller::DescriptorCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDescriptorClusterDeviceListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DescriptorCluster, readServerListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Descriptor::Attributes::ServerList::TypeInfo; |
| std::unique_ptr<CHIPDescriptorServerListAttributeCallback, void (*)(CHIPDescriptorServerListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPDescriptorServerListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPDescriptorServerListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DescriptorCluster * cppCluster = reinterpret_cast<chip::Controller::DescriptorCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDescriptorClusterServerListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DescriptorCluster, readClientListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Descriptor::Attributes::ClientList::TypeInfo; |
| std::unique_ptr<CHIPDescriptorClientListAttributeCallback, void (*)(CHIPDescriptorClientListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPDescriptorClientListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPDescriptorClientListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DescriptorCluster * cppCluster = reinterpret_cast<chip::Controller::DescriptorCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDescriptorClusterClientListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DescriptorCluster, readPartsListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Descriptor::Attributes::PartsList::TypeInfo; |
| std::unique_ptr<CHIPDescriptorPartsListAttributeCallback, void (*)(CHIPDescriptorPartsListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPDescriptorPartsListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPDescriptorPartsListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DescriptorCluster * cppCluster = reinterpret_cast<chip::Controller::DescriptorCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDescriptorClusterPartsListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DescriptorCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Descriptor::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPDescriptorAttributeListAttributeCallback, void (*)(CHIPDescriptorAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPDescriptorAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPDescriptorAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DescriptorCluster * cppCluster = reinterpret_cast<chip::Controller::DescriptorCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDescriptorClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DescriptorCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Descriptor::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DescriptorCluster * cppCluster = reinterpret_cast<chip::Controller::DescriptorCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDescriptorClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DiagnosticLogsCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DiagnosticLogs::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPDiagnosticLogsAttributeListAttributeCallback, void (*)(CHIPDiagnosticLogsAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPDiagnosticLogsAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPDiagnosticLogsAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DiagnosticLogsCluster * cppCluster = reinterpret_cast<chip::Controller::DiagnosticLogsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDiagnosticLogsClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readLockStateAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::LockState::TypeInfo; |
| std::unique_ptr<CHIPDoorLockLockStateAttributeCallback, void (*)(CHIPDoorLockLockStateAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPDoorLockLockStateAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPDoorLockLockStateAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDoorLockClusterLockStateAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readLockTypeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::LockType::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDoorLockClusterLockTypeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readActuatorEnabledAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::ActuatorEnabled::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDoorLockClusterActuatorEnabledAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readDoorStateAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::DoorState::TypeInfo; |
| std::unique_ptr<CHIPDoorLockDoorStateAttributeCallback, void (*)(CHIPDoorLockDoorStateAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPDoorLockDoorStateAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPDoorLockDoorStateAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDoorLockClusterDoorStateAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readNumberOfTotalUsersSupportedAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::NumberOfTotalUsersSupported::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPDoorLockClusterNumberOfTotalUsersSupportedAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readNumberOfPINUsersSupportedAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::NumberOfPINUsersSupported::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPDoorLockClusterNumberOfPINUsersSupportedAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readMaxPINCodeLengthAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::MaxPINCodeLength::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDoorLockClusterMaxPINCodeLengthAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readMinPINCodeLengthAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::MinPINCodeLength::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDoorLockClusterMinPINCodeLengthAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readLanguageAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::Language::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDoorLockClusterLanguageAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readAutoRelockTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::AutoRelockTime::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDoorLockClusterAutoRelockTimeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readSoundVolumeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::SoundVolume::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDoorLockClusterSoundVolumeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readOperatingModeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::OperatingMode::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDoorLockClusterOperatingModeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readSupportedOperatingModesAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::SupportedOperatingModes::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPDoorLockClusterSupportedOperatingModesAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readEnableOneTouchLockingAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::EnableOneTouchLocking::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPDoorLockClusterEnableOneTouchLockingAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readEnablePrivacyModeButtonAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::EnablePrivacyModeButton::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPDoorLockClusterEnablePrivacyModeButtonAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readWrongCodeEntryLimitAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::WrongCodeEntryLimit::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDoorLockClusterWrongCodeEntryLimitAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPDoorLockAttributeListAttributeCallback, void (*)(CHIPDoorLockAttributeListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPDoorLockAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPDoorLockAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDoorLockClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, DoorLockCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::DoorLock::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast<chip::Controller::DoorLockCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPDoorLockClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ElectricalMeasurementCluster, readMeasurementTypeAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ElectricalMeasurement::Attributes::MeasurementType::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ElectricalMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ElectricalMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPElectricalMeasurementClusterMeasurementTypeAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ElectricalMeasurementCluster, readTotalActivePowerAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ElectricalMeasurement::Attributes::TotalActivePower::TypeInfo; |
| std::unique_ptr<CHIPInt32sAttributeCallback, void (*)(CHIPInt32sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ElectricalMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ElectricalMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPElectricalMeasurementClusterTotalActivePowerAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ElectricalMeasurementCluster, readRmsVoltageAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltage::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ElectricalMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ElectricalMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPElectricalMeasurementClusterRmsVoltageAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ElectricalMeasurementCluster, readRmsVoltageMinAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageMin::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ElectricalMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ElectricalMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPElectricalMeasurementClusterRmsVoltageMinAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ElectricalMeasurementCluster, readRmsVoltageMaxAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageMax::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ElectricalMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ElectricalMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPElectricalMeasurementClusterRmsVoltageMaxAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ElectricalMeasurementCluster, readRmsCurrentAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrent::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ElectricalMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ElectricalMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPElectricalMeasurementClusterRmsCurrentAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ElectricalMeasurementCluster, readRmsCurrentMinAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrentMin::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ElectricalMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ElectricalMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPElectricalMeasurementClusterRmsCurrentMinAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ElectricalMeasurementCluster, readRmsCurrentMaxAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrentMax::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ElectricalMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ElectricalMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPElectricalMeasurementClusterRmsCurrentMaxAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ElectricalMeasurementCluster, readActivePowerAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePower::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ElectricalMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ElectricalMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPElectricalMeasurementClusterActivePowerAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ElectricalMeasurementCluster, readActivePowerMinAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePowerMin::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ElectricalMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ElectricalMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPElectricalMeasurementClusterActivePowerMinAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ElectricalMeasurementCluster, readActivePowerMaxAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePowerMax::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ElectricalMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ElectricalMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPElectricalMeasurementClusterActivePowerMaxAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ElectricalMeasurementCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ElectricalMeasurement::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPElectricalMeasurementAttributeListAttributeCallback, |
| void (*)(CHIPElectricalMeasurementAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPElectricalMeasurementAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPElectricalMeasurementAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ElectricalMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ElectricalMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPElectricalMeasurementClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ElectricalMeasurementCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ElectricalMeasurement::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ElectricalMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ElectricalMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPElectricalMeasurementClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readPHYRateAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PHYRate::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::EthernetNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::EthernetNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPEthernetNetworkDiagnosticsClusterPHYRateAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readFullDuplexAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::FullDuplex::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::EthernetNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::EthernetNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPEthernetNetworkDiagnosticsClusterFullDuplexAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readPacketRxCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PacketRxCount::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::EthernetNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::EthernetNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPEthernetNetworkDiagnosticsClusterPacketRxCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readPacketTxCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PacketTxCount::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::EthernetNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::EthernetNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPEthernetNetworkDiagnosticsClusterPacketTxCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readTxErrCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::TxErrCount::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::EthernetNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::EthernetNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPEthernetNetworkDiagnosticsClusterTxErrCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readCollisionCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::CollisionCount::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::EthernetNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::EthernetNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPEthernetNetworkDiagnosticsClusterCollisionCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readOverrunCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::OverrunCount::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::EthernetNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::EthernetNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPEthernetNetworkDiagnosticsClusterOverrunCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readCarrierDetectAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::CarrierDetect::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::EthernetNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::EthernetNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPEthernetNetworkDiagnosticsClusterCarrierDetectAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readTimeSinceResetAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::TimeSinceReset::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::EthernetNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::EthernetNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPEthernetNetworkDiagnosticsClusterTimeSinceResetAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPEthernetNetworkDiagnosticsAttributeListAttributeCallback, |
| void (*)(CHIPEthernetNetworkDiagnosticsAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPEthernetNetworkDiagnosticsAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPEthernetNetworkDiagnosticsAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::EthernetNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::EthernetNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPEthernetNetworkDiagnosticsClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readFeatureMapAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::FeatureMap::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::EthernetNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::EthernetNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPEthernetNetworkDiagnosticsClusterFeatureMapAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::EthernetNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::EthernetNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPEthernetNetworkDiagnosticsClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, FixedLabelCluster, readLabelListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::FixedLabel::Attributes::LabelList::TypeInfo; |
| std::unique_ptr<CHIPFixedLabelLabelListAttributeCallback, void (*)(CHIPFixedLabelLabelListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPFixedLabelLabelListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPFixedLabelLabelListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::FixedLabelCluster * cppCluster = reinterpret_cast<chip::Controller::FixedLabelCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPFixedLabelClusterLabelListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, FixedLabelCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::FixedLabel::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPFixedLabelAttributeListAttributeCallback, void (*)(CHIPFixedLabelAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPFixedLabelAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPFixedLabelAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::FixedLabelCluster * cppCluster = reinterpret_cast<chip::Controller::FixedLabelCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPFixedLabelClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, FixedLabelCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::FixedLabel::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::FixedLabelCluster * cppCluster = reinterpret_cast<chip::Controller::FixedLabelCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPFixedLabelClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, FlowMeasurementCluster, readMeasuredValueAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::FlowMeasurement::Attributes::MeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::FlowMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::FlowMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPFlowMeasurementClusterMeasuredValueAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, FlowMeasurementCluster, readMinMeasuredValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::FlowMeasurement::Attributes::MinMeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::FlowMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::FlowMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPFlowMeasurementClusterMinMeasuredValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, FlowMeasurementCluster, readMaxMeasuredValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::FlowMeasurement::Attributes::MaxMeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::FlowMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::FlowMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPFlowMeasurementClusterMaxMeasuredValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, FlowMeasurementCluster, readToleranceAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::FlowMeasurement::Attributes::Tolerance::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::FlowMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::FlowMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPFlowMeasurementClusterToleranceAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, FlowMeasurementCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::FlowMeasurement::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPFlowMeasurementAttributeListAttributeCallback, |
| void (*)(CHIPFlowMeasurementAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPFlowMeasurementAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPFlowMeasurementAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::FlowMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::FlowMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPFlowMeasurementClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, FlowMeasurementCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::FlowMeasurement::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::FlowMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::FlowMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPFlowMeasurementClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralCommissioningCluster, readBreadcrumbAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralCommissioning::Attributes::Breadcrumb::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPGeneralCommissioningClusterBreadcrumbAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralCommissioningCluster, readBasicCommissioningInfoListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralCommissioning::Attributes::BasicCommissioningInfoList::TypeInfo; |
| std::unique_ptr<CHIPGeneralCommissioningBasicCommissioningInfoListAttributeCallback, |
| void (*)(CHIPGeneralCommissioningBasicCommissioningInfoListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPGeneralCommissioningBasicCommissioningInfoListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPGeneralCommissioningBasicCommissioningInfoListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPGeneralCommissioningClusterBasicCommissioningInfoListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralCommissioningCluster, readRegulatoryConfigAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralCommissioning::Attributes::RegulatoryConfig::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPGeneralCommissioningClusterRegulatoryConfigAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralCommissioningCluster, readLocationCapabilityAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralCommissioning::Attributes::LocationCapability::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPGeneralCommissioningClusterLocationCapabilityAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralCommissioningCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralCommissioning::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPGeneralCommissioningAttributeListAttributeCallback, |
| void (*)(CHIPGeneralCommissioningAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPGeneralCommissioningAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPGeneralCommissioningAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPGeneralCommissioningClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralCommissioningCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralCommissioning::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPGeneralCommissioningClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralDiagnosticsCluster, readNetworkInterfacesAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::NetworkInterfaces::TypeInfo; |
| std::unique_ptr<CHIPGeneralDiagnosticsNetworkInterfacesAttributeCallback, |
| void (*)(CHIPGeneralDiagnosticsNetworkInterfacesAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPGeneralDiagnosticsNetworkInterfacesAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPGeneralDiagnosticsNetworkInterfacesAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPGeneralDiagnosticsClusterNetworkInterfacesAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralDiagnosticsCluster, readRebootCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::RebootCount::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPGeneralDiagnosticsClusterRebootCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralDiagnosticsCluster, readUpTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::UpTime::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPGeneralDiagnosticsClusterUpTimeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralDiagnosticsCluster, readTotalOperationalHoursAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::TotalOperationalHours::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPGeneralDiagnosticsClusterTotalOperationalHoursAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralDiagnosticsCluster, readBootReasonsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::BootReasons::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPGeneralDiagnosticsClusterBootReasonsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralDiagnosticsCluster, readActiveHardwareFaultsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveHardwareFaults::TypeInfo; |
| std::unique_ptr<CHIPGeneralDiagnosticsActiveHardwareFaultsAttributeCallback, |
| void (*)(CHIPGeneralDiagnosticsActiveHardwareFaultsAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPGeneralDiagnosticsActiveHardwareFaultsAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPGeneralDiagnosticsActiveHardwareFaultsAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPGeneralDiagnosticsClusterActiveHardwareFaultsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralDiagnosticsCluster, readActiveRadioFaultsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveRadioFaults::TypeInfo; |
| std::unique_ptr<CHIPGeneralDiagnosticsActiveRadioFaultsAttributeCallback, |
| void (*)(CHIPGeneralDiagnosticsActiveRadioFaultsAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPGeneralDiagnosticsActiveRadioFaultsAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPGeneralDiagnosticsActiveRadioFaultsAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPGeneralDiagnosticsClusterActiveRadioFaultsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralDiagnosticsCluster, readActiveNetworkFaultsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveNetworkFaults::TypeInfo; |
| std::unique_ptr<CHIPGeneralDiagnosticsActiveNetworkFaultsAttributeCallback, |
| void (*)(CHIPGeneralDiagnosticsActiveNetworkFaultsAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPGeneralDiagnosticsActiveNetworkFaultsAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPGeneralDiagnosticsActiveNetworkFaultsAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPGeneralDiagnosticsClusterActiveNetworkFaultsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralDiagnosticsCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPGeneralDiagnosticsAttributeListAttributeCallback, |
| void (*)(CHIPGeneralDiagnosticsAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPGeneralDiagnosticsAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPGeneralDiagnosticsAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPGeneralDiagnosticsClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GeneralDiagnosticsCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GeneralDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GeneralDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPGeneralDiagnosticsClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GroupKeyManagementCluster, readGroupsAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GroupKeyManagement::Attributes::Groups::TypeInfo; |
| std::unique_ptr<CHIPGroupKeyManagementGroupsAttributeCallback, void (*)(CHIPGroupKeyManagementGroupsAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPGroupKeyManagementGroupsAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPGroupKeyManagementGroupsAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GroupKeyManagementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GroupKeyManagementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPGroupKeyManagementClusterGroupsAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GroupKeyManagementCluster, readGroupKeysAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GroupKeyManagement::Attributes::GroupKeys::TypeInfo; |
| std::unique_ptr<CHIPGroupKeyManagementGroupKeysAttributeCallback, void (*)(CHIPGroupKeyManagementGroupKeysAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPGroupKeyManagementGroupKeysAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPGroupKeyManagementGroupKeysAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GroupKeyManagementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GroupKeyManagementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPGroupKeyManagementClusterGroupKeysAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GroupKeyManagementCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GroupKeyManagement::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPGroupKeyManagementAttributeListAttributeCallback, |
| void (*)(CHIPGroupKeyManagementAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPGroupKeyManagementAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPGroupKeyManagementAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GroupKeyManagementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GroupKeyManagementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPGroupKeyManagementClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GroupKeyManagementCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::GroupKeyManagement::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GroupKeyManagementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::GroupKeyManagementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPGroupKeyManagementClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GroupsCluster, readNameSupportAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Groups::Attributes::NameSupport::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GroupsCluster * cppCluster = reinterpret_cast<chip::Controller::GroupsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPGroupsClusterNameSupportAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GroupsCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Groups::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPGroupsAttributeListAttributeCallback, void (*)(CHIPGroupsAttributeListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPGroupsAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPGroupsAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GroupsCluster * cppCluster = reinterpret_cast<chip::Controller::GroupsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPGroupsClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, GroupsCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Groups::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::GroupsCluster * cppCluster = reinterpret_cast<chip::Controller::GroupsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPGroupsClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, IdentifyCluster, readIdentifyTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Identify::Attributes::IdentifyTime::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::IdentifyCluster * cppCluster = reinterpret_cast<chip::Controller::IdentifyCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPIdentifyClusterIdentifyTimeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, IdentifyCluster, readIdentifyTypeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Identify::Attributes::IdentifyType::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::IdentifyCluster * cppCluster = reinterpret_cast<chip::Controller::IdentifyCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPIdentifyClusterIdentifyTypeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, IdentifyCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Identify::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPIdentifyAttributeListAttributeCallback, void (*)(CHIPIdentifyAttributeListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPIdentifyAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPIdentifyAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::IdentifyCluster * cppCluster = reinterpret_cast<chip::Controller::IdentifyCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPIdentifyClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, IdentifyCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Identify::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::IdentifyCluster * cppCluster = reinterpret_cast<chip::Controller::IdentifyCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPIdentifyClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, IlluminanceMeasurementCluster, readMeasuredValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::IlluminanceMeasurement::Attributes::MeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPIlluminanceMeasurementMeasuredValueAttributeCallback, |
| void (*)(CHIPIlluminanceMeasurementMeasuredValueAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPIlluminanceMeasurementMeasuredValueAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPIlluminanceMeasurementMeasuredValueAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::IlluminanceMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::IlluminanceMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPIlluminanceMeasurementClusterMeasuredValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, IlluminanceMeasurementCluster, readMinMeasuredValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::IlluminanceMeasurement::Attributes::MinMeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPIlluminanceMeasurementMinMeasuredValueAttributeCallback, |
| void (*)(CHIPIlluminanceMeasurementMinMeasuredValueAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPIlluminanceMeasurementMinMeasuredValueAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPIlluminanceMeasurementMinMeasuredValueAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::IlluminanceMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::IlluminanceMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPIlluminanceMeasurementClusterMinMeasuredValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, IlluminanceMeasurementCluster, readMaxMeasuredValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::IlluminanceMeasurement::Attributes::MaxMeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPIlluminanceMeasurementMaxMeasuredValueAttributeCallback, |
| void (*)(CHIPIlluminanceMeasurementMaxMeasuredValueAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPIlluminanceMeasurementMaxMeasuredValueAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPIlluminanceMeasurementMaxMeasuredValueAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::IlluminanceMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::IlluminanceMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPIlluminanceMeasurementClusterMaxMeasuredValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, IlluminanceMeasurementCluster, readToleranceAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::IlluminanceMeasurement::Attributes::Tolerance::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::IlluminanceMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::IlluminanceMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPIlluminanceMeasurementClusterToleranceAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, IlluminanceMeasurementCluster, readLightSensorTypeAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::IlluminanceMeasurement::Attributes::LightSensorType::TypeInfo; |
| std::unique_ptr<CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback, |
| void (*)(CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::IlluminanceMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::IlluminanceMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPIlluminanceMeasurementClusterLightSensorTypeAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, IlluminanceMeasurementCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::IlluminanceMeasurement::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPIlluminanceMeasurementAttributeListAttributeCallback, |
| void (*)(CHIPIlluminanceMeasurementAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPIlluminanceMeasurementAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPIlluminanceMeasurementAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::IlluminanceMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::IlluminanceMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPIlluminanceMeasurementClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, IlluminanceMeasurementCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::IlluminanceMeasurement::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::IlluminanceMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::IlluminanceMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPIlluminanceMeasurementClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, KeypadInputCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::KeypadInput::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPKeypadInputAttributeListAttributeCallback, void (*)(CHIPKeypadInputAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPKeypadInputAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPKeypadInputAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::KeypadInputCluster * cppCluster = reinterpret_cast<chip::Controller::KeypadInputCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPKeypadInputClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, KeypadInputCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::KeypadInput::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::KeypadInputCluster * cppCluster = reinterpret_cast<chip::Controller::KeypadInputCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPKeypadInputClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readCurrentLevelAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::CurrentLevel::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLevelControlClusterCurrentLevelAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readRemainingTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::RemainingTime::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLevelControlClusterRemainingTimeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readMinLevelAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::MinLevel::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLevelControlClusterMinLevelAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readMaxLevelAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::MaxLevel::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLevelControlClusterMaxLevelAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readCurrentFrequencyAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::CurrentFrequency::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLevelControlClusterCurrentFrequencyAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readMinFrequencyAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::MinFrequency::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLevelControlClusterMinFrequencyAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readMaxFrequencyAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::MaxFrequency::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLevelControlClusterMaxFrequencyAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readOptionsAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::Options::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLevelControlClusterOptionsAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readOnOffTransitionTimeAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::OnOffTransitionTime::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPLevelControlClusterOnOffTransitionTimeAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readOnLevelAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::OnLevel::TypeInfo; |
| std::unique_ptr<CHIPLevelControlOnLevelAttributeCallback, void (*)(CHIPLevelControlOnLevelAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPLevelControlOnLevelAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPLevelControlOnLevelAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLevelControlClusterOnLevelAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readOnTransitionTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::OnTransitionTime::TypeInfo; |
| std::unique_ptr<CHIPLevelControlOnTransitionTimeAttributeCallback, |
| void (*)(CHIPLevelControlOnTransitionTimeAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPLevelControlOnTransitionTimeAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPLevelControlOnTransitionTimeAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLevelControlClusterOnTransitionTimeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readOffTransitionTimeAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::OffTransitionTime::TypeInfo; |
| std::unique_ptr<CHIPLevelControlOffTransitionTimeAttributeCallback, |
| void (*)(CHIPLevelControlOffTransitionTimeAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPLevelControlOffTransitionTimeAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPLevelControlOffTransitionTimeAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPLevelControlClusterOffTransitionTimeAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readDefaultMoveRateAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::DefaultMoveRate::TypeInfo; |
| std::unique_ptr<CHIPLevelControlDefaultMoveRateAttributeCallback, void (*)(CHIPLevelControlDefaultMoveRateAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPLevelControlDefaultMoveRateAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPLevelControlDefaultMoveRateAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLevelControlClusterDefaultMoveRateAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readStartUpCurrentLevelAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::StartUpCurrentLevel::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPLevelControlClusterStartUpCurrentLevelAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPLevelControlAttributeListAttributeCallback, void (*)(CHIPLevelControlAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPLevelControlAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPLevelControlAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLevelControlClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LevelControlCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LevelControl::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LevelControlCluster * cppCluster = reinterpret_cast<chip::Controller::LevelControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLevelControlClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LowPowerCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LowPower::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPLowPowerAttributeListAttributeCallback, void (*)(CHIPLowPowerAttributeListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPLowPowerAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPLowPowerAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LowPowerCluster * cppCluster = reinterpret_cast<chip::Controller::LowPowerCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLowPowerClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, LowPowerCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::LowPower::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::LowPowerCluster * cppCluster = reinterpret_cast<chip::Controller::LowPowerCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPLowPowerClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, MediaInputCluster, readMediaInputListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::MediaInput::Attributes::MediaInputList::TypeInfo; |
| std::unique_ptr<CHIPMediaInputMediaInputListAttributeCallback, void (*)(CHIPMediaInputMediaInputListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPMediaInputMediaInputListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPMediaInputMediaInputListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::MediaInputCluster * cppCluster = reinterpret_cast<chip::Controller::MediaInputCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPMediaInputClusterMediaInputListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, MediaInputCluster, readCurrentMediaInputAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::MediaInput::Attributes::CurrentMediaInput::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::MediaInputCluster * cppCluster = reinterpret_cast<chip::Controller::MediaInputCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPMediaInputClusterCurrentMediaInputAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, MediaInputCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::MediaInput::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPMediaInputAttributeListAttributeCallback, void (*)(CHIPMediaInputAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPMediaInputAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPMediaInputAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::MediaInputCluster * cppCluster = reinterpret_cast<chip::Controller::MediaInputCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPMediaInputClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, MediaInputCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::MediaInput::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::MediaInputCluster * cppCluster = reinterpret_cast<chip::Controller::MediaInputCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPMediaInputClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, MediaPlaybackCluster, readPlaybackStateAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::MediaPlayback::Attributes::PlaybackState::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::MediaPlaybackCluster * cppCluster = reinterpret_cast<chip::Controller::MediaPlaybackCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPMediaPlaybackClusterPlaybackStateAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, MediaPlaybackCluster, readStartTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::MediaPlayback::Attributes::StartTime::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::MediaPlaybackCluster * cppCluster = reinterpret_cast<chip::Controller::MediaPlaybackCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPMediaPlaybackClusterStartTimeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, MediaPlaybackCluster, readDurationAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::MediaPlayback::Attributes::Duration::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::MediaPlaybackCluster * cppCluster = reinterpret_cast<chip::Controller::MediaPlaybackCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPMediaPlaybackClusterDurationAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, MediaPlaybackCluster, readPlaybackSpeedAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::MediaPlayback::Attributes::PlaybackSpeed::TypeInfo; |
| std::unique_ptr<CHIPFloatAttributeCallback, void (*)(CHIPFloatAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPFloatAttributeCallback>(callback, false), chip::Platform::Delete<CHIPFloatAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::MediaPlaybackCluster * cppCluster = reinterpret_cast<chip::Controller::MediaPlaybackCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPMediaPlaybackClusterPlaybackSpeedAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, MediaPlaybackCluster, readSeekRangeEndAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::MediaPlayback::Attributes::SeekRangeEnd::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::MediaPlaybackCluster * cppCluster = reinterpret_cast<chip::Controller::MediaPlaybackCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPMediaPlaybackClusterSeekRangeEndAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, MediaPlaybackCluster, readSeekRangeStartAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::MediaPlayback::Attributes::SeekRangeStart::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::MediaPlaybackCluster * cppCluster = reinterpret_cast<chip::Controller::MediaPlaybackCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPMediaPlaybackClusterSeekRangeStartAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, MediaPlaybackCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::MediaPlayback::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPMediaPlaybackAttributeListAttributeCallback, void (*)(CHIPMediaPlaybackAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPMediaPlaybackAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPMediaPlaybackAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::MediaPlaybackCluster * cppCluster = reinterpret_cast<chip::Controller::MediaPlaybackCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPMediaPlaybackClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, MediaPlaybackCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::MediaPlayback::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::MediaPlaybackCluster * cppCluster = reinterpret_cast<chip::Controller::MediaPlaybackCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPMediaPlaybackClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ModeSelectCluster, readCurrentModeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ModeSelect::Attributes::CurrentMode::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ModeSelectCluster * cppCluster = reinterpret_cast<chip::Controller::ModeSelectCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPModeSelectClusterCurrentModeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ModeSelectCluster, readSupportedModesAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ModeSelect::Attributes::SupportedModes::TypeInfo; |
| std::unique_ptr<CHIPModeSelectSupportedModesAttributeCallback, void (*)(CHIPModeSelectSupportedModesAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPModeSelectSupportedModesAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPModeSelectSupportedModesAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ModeSelectCluster * cppCluster = reinterpret_cast<chip::Controller::ModeSelectCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPModeSelectClusterSupportedModesAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ModeSelectCluster, readOnModeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ModeSelect::Attributes::OnMode::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ModeSelectCluster * cppCluster = reinterpret_cast<chip::Controller::ModeSelectCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPModeSelectClusterOnModeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ModeSelectCluster, readStartUpModeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ModeSelect::Attributes::StartUpMode::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ModeSelectCluster * cppCluster = reinterpret_cast<chip::Controller::ModeSelectCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPModeSelectClusterStartUpModeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ModeSelectCluster, readDescriptionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ModeSelect::Attributes::Description::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ModeSelectCluster * cppCluster = reinterpret_cast<chip::Controller::ModeSelectCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPModeSelectClusterDescriptionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ModeSelectCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ModeSelect::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPModeSelectAttributeListAttributeCallback, void (*)(CHIPModeSelectAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPModeSelectAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPModeSelectAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ModeSelectCluster * cppCluster = reinterpret_cast<chip::Controller::ModeSelectCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPModeSelectClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ModeSelectCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ModeSelect::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ModeSelectCluster * cppCluster = reinterpret_cast<chip::Controller::ModeSelectCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPModeSelectClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, NetworkCommissioningCluster, readMaxNetworksAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::NetworkCommissioning::Attributes::MaxNetworks::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::NetworkCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::NetworkCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPNetworkCommissioningClusterMaxNetworksAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, NetworkCommissioningCluster, readNetworksAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::NetworkCommissioning::Attributes::Networks::TypeInfo; |
| std::unique_ptr<CHIPNetworkCommissioningNetworksAttributeCallback, |
| void (*)(CHIPNetworkCommissioningNetworksAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPNetworkCommissioningNetworksAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPNetworkCommissioningNetworksAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::NetworkCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::NetworkCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPNetworkCommissioningClusterNetworksAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, NetworkCommissioningCluster, readScanMaxTimeSecondsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::NetworkCommissioning::Attributes::ScanMaxTimeSeconds::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::NetworkCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::NetworkCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPNetworkCommissioningClusterScanMaxTimeSecondsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, NetworkCommissioningCluster, readConnectMaxTimeSecondsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::NetworkCommissioning::Attributes::ConnectMaxTimeSeconds::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::NetworkCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::NetworkCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPNetworkCommissioningClusterConnectMaxTimeSecondsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, NetworkCommissioningCluster, readInterfaceEnabledAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::NetworkCommissioning::Attributes::InterfaceEnabled::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::NetworkCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::NetworkCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPNetworkCommissioningClusterInterfaceEnabledAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, NetworkCommissioningCluster, readLastNetworkingStatusAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::NetworkCommissioning::Attributes::LastNetworkingStatus::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::NetworkCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::NetworkCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPNetworkCommissioningClusterLastNetworkingStatusAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, NetworkCommissioningCluster, readLastNetworkIDAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::NetworkCommissioning::Attributes::LastNetworkID::TypeInfo; |
| std::unique_ptr<CHIPOctetStringAttributeCallback, void (*)(CHIPOctetStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPOctetStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOctetStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::NetworkCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::NetworkCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPNetworkCommissioningClusterLastNetworkIDAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, NetworkCommissioningCluster, readLastConnectErrorValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::NetworkCommissioning::Attributes::LastConnectErrorValue::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::NetworkCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::NetworkCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPNetworkCommissioningClusterLastConnectErrorValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, NetworkCommissioningCluster, readFeatureMapAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::NetworkCommissioning::Attributes::FeatureMap::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::NetworkCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::NetworkCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPNetworkCommissioningClusterFeatureMapAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, NetworkCommissioningCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::NetworkCommissioning::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::NetworkCommissioningCluster * cppCluster = |
| reinterpret_cast<chip::Controller::NetworkCommissioningCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPNetworkCommissioningClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPOtaSoftwareUpdateProviderAttributeListAttributeCallback, |
| void (*)(CHIPOtaSoftwareUpdateProviderAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPOtaSoftwareUpdateProviderAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOtaSoftwareUpdateProviderAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OtaSoftwareUpdateProviderCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OtaSoftwareUpdateProviderCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOtaSoftwareUpdateProviderClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OtaSoftwareUpdateProviderCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OtaSoftwareUpdateProviderCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOtaSoftwareUpdateProviderClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OtaSoftwareUpdateRequestorCluster, readDefaultOtaProviderAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::DefaultOtaProvider::TypeInfo; |
| std::unique_ptr<CHIPOctetStringAttributeCallback, void (*)(CHIPOctetStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPOctetStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOctetStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OtaSoftwareUpdateRequestorCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OtaSoftwareUpdateRequestorCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOtaSoftwareUpdateRequestorClusterDefaultOtaProviderAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OtaSoftwareUpdateRequestorCluster, readUpdatePossibleAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::UpdatePossible::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OtaSoftwareUpdateRequestorCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OtaSoftwareUpdateRequestorCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOtaSoftwareUpdateRequestorClusterUpdatePossibleAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OtaSoftwareUpdateRequestorCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPOtaSoftwareUpdateRequestorAttributeListAttributeCallback, |
| void (*)(CHIPOtaSoftwareUpdateRequestorAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPOtaSoftwareUpdateRequestorAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOtaSoftwareUpdateRequestorAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OtaSoftwareUpdateRequestorCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OtaSoftwareUpdateRequestorCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOtaSoftwareUpdateRequestorClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OtaSoftwareUpdateRequestorCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OtaSoftwareUpdateRequestorCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OtaSoftwareUpdateRequestorCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOtaSoftwareUpdateRequestorClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OccupancySensingCluster, readOccupancyAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OccupancySensing::Attributes::Occupancy::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OccupancySensingCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OccupancySensingCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOccupancySensingClusterOccupancyAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OccupancySensingCluster, readOccupancySensorTypeAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OccupancySensing::Attributes::OccupancySensorType::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OccupancySensingCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OccupancySensingCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPOccupancySensingClusterOccupancySensorTypeAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OccupancySensingCluster, readOccupancySensorTypeBitmapAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OccupancySensing::Attributes::OccupancySensorTypeBitmap::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OccupancySensingCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OccupancySensingCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOccupancySensingClusterOccupancySensorTypeBitmapAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OccupancySensingCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OccupancySensing::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPOccupancySensingAttributeListAttributeCallback, |
| void (*)(CHIPOccupancySensingAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPOccupancySensingAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOccupancySensingAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OccupancySensingCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OccupancySensingCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPOccupancySensingClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OccupancySensingCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OccupancySensing::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OccupancySensingCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OccupancySensingCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPOccupancySensingClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OnOffCluster, readOnOffAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OnOff::Attributes::OnOff::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OnOffCluster * cppCluster = reinterpret_cast<chip::Controller::OnOffCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPOnOffClusterOnOffAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OnOffCluster, readGlobalSceneControlAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OnOff::Attributes::GlobalSceneControl::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OnOffCluster * cppCluster = reinterpret_cast<chip::Controller::OnOffCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOnOffClusterGlobalSceneControlAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OnOffCluster, readOnTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OnOff::Attributes::OnTime::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OnOffCluster * cppCluster = reinterpret_cast<chip::Controller::OnOffCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPOnOffClusterOnTimeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OnOffCluster, readOffWaitTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OnOff::Attributes::OffWaitTime::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OnOffCluster * cppCluster = reinterpret_cast<chip::Controller::OnOffCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOnOffClusterOffWaitTimeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OnOffCluster, readStartUpOnOffAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OnOff::Attributes::StartUpOnOff::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OnOffCluster * cppCluster = reinterpret_cast<chip::Controller::OnOffCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOnOffClusterStartUpOnOffAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OnOffCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OnOff::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPOnOffAttributeListAttributeCallback, void (*)(CHIPOnOffAttributeListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPOnOffAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOnOffAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OnOffCluster * cppCluster = reinterpret_cast<chip::Controller::OnOffCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOnOffClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OnOffCluster, readFeatureMapAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OnOff::Attributes::FeatureMap::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OnOffCluster * cppCluster = reinterpret_cast<chip::Controller::OnOffCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPOnOffClusterFeatureMapAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OnOffCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OnOff::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OnOffCluster * cppCluster = reinterpret_cast<chip::Controller::OnOffCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOnOffClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OnOffSwitchConfigurationCluster, readSwitchTypeAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OnOffSwitchConfiguration::Attributes::SwitchType::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OnOffSwitchConfigurationCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OnOffSwitchConfigurationCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPOnOffSwitchConfigurationClusterSwitchTypeAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OnOffSwitchConfigurationCluster, readSwitchActionsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OnOffSwitchConfiguration::Attributes::SwitchActions::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OnOffSwitchConfigurationCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OnOffSwitchConfigurationCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOnOffSwitchConfigurationClusterSwitchActionsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OnOffSwitchConfigurationCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OnOffSwitchConfiguration::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPOnOffSwitchConfigurationAttributeListAttributeCallback, |
| void (*)(CHIPOnOffSwitchConfigurationAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPOnOffSwitchConfigurationAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOnOffSwitchConfigurationAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OnOffSwitchConfigurationCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OnOffSwitchConfigurationCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOnOffSwitchConfigurationClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OnOffSwitchConfigurationCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OnOffSwitchConfiguration::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OnOffSwitchConfigurationCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OnOffSwitchConfigurationCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOnOffSwitchConfigurationClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OperationalCredentialsCluster, readFabricsListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OperationalCredentials::Attributes::FabricsList::TypeInfo; |
| std::unique_ptr<CHIPOperationalCredentialsFabricsListAttributeCallback, |
| void (*)(CHIPOperationalCredentialsFabricsListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPOperationalCredentialsFabricsListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOperationalCredentialsFabricsListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OperationalCredentialsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OperationalCredentialsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPOperationalCredentialsClusterFabricsListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OperationalCredentialsCluster, readSupportedFabricsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OperationalCredentials::Attributes::SupportedFabrics::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OperationalCredentialsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OperationalCredentialsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOperationalCredentialsClusterSupportedFabricsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OperationalCredentialsCluster, readCommissionedFabricsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OperationalCredentials::Attributes::CommissionedFabrics::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OperationalCredentialsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OperationalCredentialsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOperationalCredentialsClusterCommissionedFabricsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OperationalCredentialsCluster, readTrustedRootCertificatesAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OperationalCredentials::Attributes::TrustedRootCertificates::TypeInfo; |
| std::unique_ptr<CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback, |
| void (*)(CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OperationalCredentialsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OperationalCredentialsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOperationalCredentialsClusterTrustedRootCertificatesAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OperationalCredentialsCluster, readCurrentFabricIndexAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OperationalCredentials::Attributes::CurrentFabricIndex::TypeInfo; |
| std::unique_ptr<CHIPOperationalCredentialsCurrentFabricIndexAttributeCallback, |
| void (*)(CHIPOperationalCredentialsCurrentFabricIndexAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPOperationalCredentialsCurrentFabricIndexAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOperationalCredentialsCurrentFabricIndexAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OperationalCredentialsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OperationalCredentialsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOperationalCredentialsClusterCurrentFabricIndexAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OperationalCredentialsCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OperationalCredentials::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPOperationalCredentialsAttributeListAttributeCallback, |
| void (*)(CHIPOperationalCredentialsAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPOperationalCredentialsAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOperationalCredentialsAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OperationalCredentialsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OperationalCredentialsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPOperationalCredentialsClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, OperationalCredentialsCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::OperationalCredentials::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::OperationalCredentialsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::OperationalCredentialsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPOperationalCredentialsClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceCluster, readStatusAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSource::Attributes::Status::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceCluster * cppCluster = reinterpret_cast<chip::Controller::PowerSourceCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPowerSourceClusterStatusAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceCluster, readOrderAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSource::Attributes::Order::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceCluster * cppCluster = reinterpret_cast<chip::Controller::PowerSourceCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPowerSourceClusterOrderAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceCluster, readDescriptionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSource::Attributes::Description::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceCluster * cppCluster = reinterpret_cast<chip::Controller::PowerSourceCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPowerSourceClusterDescriptionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceCluster, readBatteryVoltageAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSource::Attributes::BatteryVoltage::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceCluster * cppCluster = reinterpret_cast<chip::Controller::PowerSourceCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPowerSourceClusterBatteryVoltageAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceCluster, readBatteryPercentRemainingAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSource::Attributes::BatteryPercentRemaining::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceCluster * cppCluster = reinterpret_cast<chip::Controller::PowerSourceCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPowerSourceClusterBatteryPercentRemainingAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceCluster, readBatteryTimeRemainingAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSource::Attributes::BatteryTimeRemaining::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceCluster * cppCluster = reinterpret_cast<chip::Controller::PowerSourceCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPowerSourceClusterBatteryTimeRemainingAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceCluster, readBatteryChargeLevelAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSource::Attributes::BatteryChargeLevel::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceCluster * cppCluster = reinterpret_cast<chip::Controller::PowerSourceCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPowerSourceClusterBatteryChargeLevelAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceCluster, readActiveBatteryFaultsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSource::Attributes::ActiveBatteryFaults::TypeInfo; |
| std::unique_ptr<CHIPPowerSourceActiveBatteryFaultsAttributeCallback, |
| void (*)(CHIPPowerSourceActiveBatteryFaultsAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPPowerSourceActiveBatteryFaultsAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPPowerSourceActiveBatteryFaultsAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceCluster * cppCluster = reinterpret_cast<chip::Controller::PowerSourceCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPowerSourceClusterActiveBatteryFaultsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceCluster, readBatteryChargeStateAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSource::Attributes::BatteryChargeState::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceCluster * cppCluster = reinterpret_cast<chip::Controller::PowerSourceCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPowerSourceClusterBatteryChargeStateAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSource::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPPowerSourceAttributeListAttributeCallback, void (*)(CHIPPowerSourceAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPPowerSourceAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPPowerSourceAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceCluster * cppCluster = reinterpret_cast<chip::Controller::PowerSourceCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPowerSourceClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceCluster, readFeatureMapAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSource::Attributes::FeatureMap::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceCluster * cppCluster = reinterpret_cast<chip::Controller::PowerSourceCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPowerSourceClusterFeatureMapAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSource::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceCluster * cppCluster = reinterpret_cast<chip::Controller::PowerSourceCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPowerSourceClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceConfigurationCluster, readSourcesAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSourceConfiguration::Attributes::Sources::TypeInfo; |
| std::unique_ptr<CHIPPowerSourceConfigurationSourcesAttributeCallback, |
| void (*)(CHIPPowerSourceConfigurationSourcesAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPPowerSourceConfigurationSourcesAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPPowerSourceConfigurationSourcesAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceConfigurationCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PowerSourceConfigurationCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPowerSourceConfigurationClusterSourcesAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceConfigurationCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSourceConfiguration::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPPowerSourceConfigurationAttributeListAttributeCallback, |
| void (*)(CHIPPowerSourceConfigurationAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPPowerSourceConfigurationAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPPowerSourceConfigurationAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceConfigurationCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PowerSourceConfigurationCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPowerSourceConfigurationClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PowerSourceConfigurationCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PowerSourceConfiguration::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PowerSourceConfigurationCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PowerSourceConfigurationCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPowerSourceConfigurationClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PressureMeasurementCluster, readMeasuredValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PressureMeasurement::Attributes::MeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PressureMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PressureMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPressureMeasurementClusterMeasuredValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PressureMeasurementCluster, readMinMeasuredValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PressureMeasurement::Attributes::MinMeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PressureMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PressureMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPressureMeasurementClusterMinMeasuredValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PressureMeasurementCluster, readMaxMeasuredValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PressureMeasurement::Attributes::MaxMeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PressureMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PressureMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPressureMeasurementClusterMaxMeasuredValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PressureMeasurementCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PressureMeasurement::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPPressureMeasurementAttributeListAttributeCallback, |
| void (*)(CHIPPressureMeasurementAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPPressureMeasurementAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPPressureMeasurementAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PressureMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PressureMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPressureMeasurementClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PressureMeasurementCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PressureMeasurement::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PressureMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PressureMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPressureMeasurementClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readMaxPressureAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxPressure::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterMaxPressureAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readMaxSpeedAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxSpeed::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterMaxSpeedAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readMaxFlowAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxFlow::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterMaxFlowAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readMinConstPressureAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstPressure::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterMinConstPressureAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readMaxConstPressureAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstPressure::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterMaxConstPressureAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readMinCompPressureAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinCompPressure::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterMinCompPressureAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readMaxCompPressureAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxCompPressure::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterMaxCompPressureAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readMinConstSpeedAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstSpeed::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterMinConstSpeedAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readMaxConstSpeedAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstSpeed::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterMaxConstSpeedAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readMinConstFlowAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstFlow::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterMinConstFlowAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readMaxConstFlowAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstFlow::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterMaxConstFlowAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readMinConstTempAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstTemp::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterMinConstTempAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readMaxConstTempAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstTemp::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterMaxConstTempAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readPumpStatusAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::PumpStatus::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterPumpStatusAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readEffectiveOperationModeAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::EffectiveOperationMode::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterEffectiveOperationModeAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readEffectiveControlModeAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::EffectiveControlMode::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterEffectiveControlModeAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readCapacityAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::Capacity::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterCapacityAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readSpeedAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::Speed::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterSpeedAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readLifetimeRunningHoursAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::LifetimeRunningHours::TypeInfo; |
| std::unique_ptr<CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback, |
| void (*)(CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterLifetimeRunningHoursAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readPowerAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::Power::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterPowerAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readLifetimeEnergyConsumedAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::TypeInfo; |
| std::unique_ptr<CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback, |
| void (*)(CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterLifetimeEnergyConsumedAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readOperationModeAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::OperationMode::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterOperationModeAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readControlModeAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::ControlMode::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterControlModeAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readAlarmMaskAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::AlarmMask::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterAlarmMaskAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPPumpConfigurationAndControlAttributeListAttributeCallback, |
| void (*)(CHIPPumpConfigurationAndControlAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPPumpConfigurationAndControlAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPPumpConfigurationAndControlAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readFeatureMapAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::FeatureMap::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterFeatureMapAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, PumpConfigurationAndControlCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::PumpConfigurationAndControlCluster * cppCluster = |
| reinterpret_cast<chip::Controller::PumpConfigurationAndControlCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPPumpConfigurationAndControlClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, RelativeHumidityMeasurementCluster, readMeasuredValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::RelativeHumidityMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::RelativeHumidityMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPRelativeHumidityMeasurementClusterMeasuredValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, RelativeHumidityMeasurementCluster, readMinMeasuredValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MinMeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::RelativeHumidityMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::RelativeHumidityMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPRelativeHumidityMeasurementClusterMinMeasuredValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, RelativeHumidityMeasurementCluster, readMaxMeasuredValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MaxMeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::RelativeHumidityMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::RelativeHumidityMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPRelativeHumidityMeasurementClusterMaxMeasuredValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, RelativeHumidityMeasurementCluster, readToleranceAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::Tolerance::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::RelativeHumidityMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::RelativeHumidityMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPRelativeHumidityMeasurementClusterToleranceAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, RelativeHumidityMeasurementCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPRelativeHumidityMeasurementAttributeListAttributeCallback, |
| void (*)(CHIPRelativeHumidityMeasurementAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPRelativeHumidityMeasurementAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPRelativeHumidityMeasurementAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::RelativeHumidityMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::RelativeHumidityMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPRelativeHumidityMeasurementClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, RelativeHumidityMeasurementCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::RelativeHumidityMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::RelativeHumidityMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPRelativeHumidityMeasurementClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ScenesCluster, readSceneCountAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Scenes::Attributes::SceneCount::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ScenesCluster * cppCluster = reinterpret_cast<chip::Controller::ScenesCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPScenesClusterSceneCountAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ScenesCluster, readCurrentSceneAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Scenes::Attributes::CurrentScene::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ScenesCluster * cppCluster = reinterpret_cast<chip::Controller::ScenesCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPScenesClusterCurrentSceneAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ScenesCluster, readCurrentGroupAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Scenes::Attributes::CurrentGroup::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ScenesCluster * cppCluster = reinterpret_cast<chip::Controller::ScenesCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPScenesClusterCurrentGroupAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ScenesCluster, readSceneValidAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Scenes::Attributes::SceneValid::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ScenesCluster * cppCluster = reinterpret_cast<chip::Controller::ScenesCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPScenesClusterSceneValidAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ScenesCluster, readNameSupportAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Scenes::Attributes::NameSupport::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ScenesCluster * cppCluster = reinterpret_cast<chip::Controller::ScenesCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPScenesClusterNameSupportAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ScenesCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Scenes::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPScenesAttributeListAttributeCallback, void (*)(CHIPScenesAttributeListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPScenesAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPScenesAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ScenesCluster * cppCluster = reinterpret_cast<chip::Controller::ScenesCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPScenesClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ScenesCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Scenes::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ScenesCluster * cppCluster = reinterpret_cast<chip::Controller::ScenesCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPScenesClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, SoftwareDiagnosticsCluster, readThreadMetricsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::SoftwareDiagnostics::Attributes::ThreadMetrics::TypeInfo; |
| std::unique_ptr<CHIPSoftwareDiagnosticsThreadMetricsAttributeCallback, |
| void (*)(CHIPSoftwareDiagnosticsThreadMetricsAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPSoftwareDiagnosticsThreadMetricsAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPSoftwareDiagnosticsThreadMetricsAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::SoftwareDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::SoftwareDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPSoftwareDiagnosticsClusterThreadMetricsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, SoftwareDiagnosticsCluster, readCurrentHeapFreeAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapFree::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::SoftwareDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::SoftwareDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPSoftwareDiagnosticsClusterCurrentHeapFreeAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, SoftwareDiagnosticsCluster, readCurrentHeapUsedAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapUsed::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::SoftwareDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::SoftwareDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPSoftwareDiagnosticsClusterCurrentHeapUsedAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, SoftwareDiagnosticsCluster, readCurrentHeapHighWatermarkAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapHighWatermark::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::SoftwareDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::SoftwareDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPSoftwareDiagnosticsClusterCurrentHeapHighWatermarkAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, SoftwareDiagnosticsCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::SoftwareDiagnostics::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPSoftwareDiagnosticsAttributeListAttributeCallback, |
| void (*)(CHIPSoftwareDiagnosticsAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPSoftwareDiagnosticsAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPSoftwareDiagnosticsAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::SoftwareDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::SoftwareDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPSoftwareDiagnosticsClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, SoftwareDiagnosticsCluster, readFeatureMapAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::SoftwareDiagnostics::Attributes::FeatureMap::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::SoftwareDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::SoftwareDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPSoftwareDiagnosticsClusterFeatureMapAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, SoftwareDiagnosticsCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::SoftwareDiagnostics::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::SoftwareDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::SoftwareDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPSoftwareDiagnosticsClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, SwitchCluster, readNumberOfPositionsAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Switch::Attributes::NumberOfPositions::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::SwitchCluster * cppCluster = reinterpret_cast<chip::Controller::SwitchCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPSwitchClusterNumberOfPositionsAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, SwitchCluster, readCurrentPositionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Switch::Attributes::CurrentPosition::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::SwitchCluster * cppCluster = reinterpret_cast<chip::Controller::SwitchCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPSwitchClusterCurrentPositionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, SwitchCluster, readMultiPressMaxAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Switch::Attributes::MultiPressMax::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::SwitchCluster * cppCluster = reinterpret_cast<chip::Controller::SwitchCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPSwitchClusterMultiPressMaxAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, SwitchCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Switch::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPSwitchAttributeListAttributeCallback, void (*)(CHIPSwitchAttributeListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPSwitchAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPSwitchAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::SwitchCluster * cppCluster = reinterpret_cast<chip::Controller::SwitchCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPSwitchClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, SwitchCluster, readFeatureMapAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Switch::Attributes::FeatureMap::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::SwitchCluster * cppCluster = reinterpret_cast<chip::Controller::SwitchCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPSwitchClusterFeatureMapAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, SwitchCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Switch::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::SwitchCluster * cppCluster = reinterpret_cast<chip::Controller::SwitchCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPSwitchClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TvChannelCluster, readChannelListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TvChannel::Attributes::ChannelList::TypeInfo; |
| std::unique_ptr<CHIPTvChannelChannelListAttributeCallback, void (*)(CHIPTvChannelChannelListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPTvChannelChannelListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTvChannelChannelListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TvChannelCluster * cppCluster = reinterpret_cast<chip::Controller::TvChannelCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTvChannelClusterChannelListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TvChannelCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TvChannel::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPTvChannelAttributeListAttributeCallback, void (*)(CHIPTvChannelAttributeListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPTvChannelAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTvChannelAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TvChannelCluster * cppCluster = reinterpret_cast<chip::Controller::TvChannelCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTvChannelClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TvChannelCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TvChannel::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TvChannelCluster * cppCluster = reinterpret_cast<chip::Controller::TvChannelCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTvChannelClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TargetNavigatorCluster, readTargetNavigatorListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TargetNavigator::Attributes::TargetNavigatorList::TypeInfo; |
| std::unique_ptr<CHIPTargetNavigatorTargetNavigatorListAttributeCallback, |
| void (*)(CHIPTargetNavigatorTargetNavigatorListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTargetNavigatorTargetNavigatorListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTargetNavigatorTargetNavigatorListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TargetNavigatorCluster * cppCluster = |
| reinterpret_cast<chip::Controller::TargetNavigatorCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTargetNavigatorClusterTargetNavigatorListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TargetNavigatorCluster, readCurrentNavigatorTargetAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TargetNavigator::Attributes::CurrentNavigatorTarget::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TargetNavigatorCluster * cppCluster = |
| reinterpret_cast<chip::Controller::TargetNavigatorCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTargetNavigatorClusterCurrentNavigatorTargetAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TargetNavigatorCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TargetNavigator::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPTargetNavigatorAttributeListAttributeCallback, |
| void (*)(CHIPTargetNavigatorAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTargetNavigatorAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTargetNavigatorAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TargetNavigatorCluster * cppCluster = |
| reinterpret_cast<chip::Controller::TargetNavigatorCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTargetNavigatorClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TargetNavigatorCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TargetNavigator::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TargetNavigatorCluster * cppCluster = |
| reinterpret_cast<chip::Controller::TargetNavigatorCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTargetNavigatorClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TemperatureMeasurementCluster, readMeasuredValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TemperatureMeasurement::Attributes::MeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TemperatureMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::TemperatureMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTemperatureMeasurementClusterMeasuredValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TemperatureMeasurementCluster, readMinMeasuredValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TemperatureMeasurement::Attributes::MinMeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TemperatureMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::TemperatureMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTemperatureMeasurementClusterMinMeasuredValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TemperatureMeasurementCluster, readMaxMeasuredValueAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TemperatureMeasurement::Attributes::MaxMeasuredValue::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TemperatureMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::TemperatureMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTemperatureMeasurementClusterMaxMeasuredValueAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TemperatureMeasurementCluster, readToleranceAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TemperatureMeasurement::Attributes::Tolerance::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TemperatureMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::TemperatureMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTemperatureMeasurementClusterToleranceAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TemperatureMeasurementCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TemperatureMeasurement::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPTemperatureMeasurementAttributeListAttributeCallback, |
| void (*)(CHIPTemperatureMeasurementAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTemperatureMeasurementAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTemperatureMeasurementAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TemperatureMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::TemperatureMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTemperatureMeasurementClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TemperatureMeasurementCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TemperatureMeasurement::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TemperatureMeasurementCluster * cppCluster = |
| reinterpret_cast<chip::Controller::TemperatureMeasurementCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTemperatureMeasurementClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readBooleanAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Boolean::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterBooleanAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readBitmap8Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Bitmap8::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterBitmap8AttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readBitmap16Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Bitmap16::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterBitmap16AttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readBitmap32Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Bitmap32::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterBitmap32AttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readBitmap64Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Bitmap64::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterBitmap64AttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt8uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int8u::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt8uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt16uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int16u::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt16uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt24uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int24u::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt24uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt32uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int32u::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt32uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt40uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int40u::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt40uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt48uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int48u::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt48uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt56uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int56u::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt56uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt64uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int64u::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt64uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt8sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int8s::TypeInfo; |
| std::unique_ptr<CHIPInt8sAttributeCallback, void (*)(CHIPInt8sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt8sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt16sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int16s::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt16sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt24sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int24s::TypeInfo; |
| std::unique_ptr<CHIPInt32sAttributeCallback, void (*)(CHIPInt32sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt24sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt32sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int32s::TypeInfo; |
| std::unique_ptr<CHIPInt32sAttributeCallback, void (*)(CHIPInt32sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt32sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt40sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int40s::TypeInfo; |
| std::unique_ptr<CHIPInt64sAttributeCallback, void (*)(CHIPInt64sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt40sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt48sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int48s::TypeInfo; |
| std::unique_ptr<CHIPInt64sAttributeCallback, void (*)(CHIPInt64sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt48sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt56sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int56s::TypeInfo; |
| std::unique_ptr<CHIPInt64sAttributeCallback, void (*)(CHIPInt64sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt56sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readInt64sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int64s::TypeInfo; |
| std::unique_ptr<CHIPInt64sAttributeCallback, void (*)(CHIPInt64sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterInt64sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readEnum8Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Enum8::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterEnum8AttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readEnum16Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Enum16::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterEnum16AttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readFloatSingleAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::FloatSingle::TypeInfo; |
| std::unique_ptr<CHIPFloatAttributeCallback, void (*)(CHIPFloatAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPFloatAttributeCallback>(callback, false), chip::Platform::Delete<CHIPFloatAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterFloatSingleAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readFloatDoubleAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::FloatDouble::TypeInfo; |
| std::unique_ptr<CHIPDoubleAttributeCallback, void (*)(CHIPDoubleAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPDoubleAttributeCallback>(callback, false), chip::Platform::Delete<CHIPDoubleAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterFloatDoubleAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readOctetStringAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::OctetString::TypeInfo; |
| std::unique_ptr<CHIPOctetStringAttributeCallback, void (*)(CHIPOctetStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPOctetStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOctetStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterOctetStringAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readListInt8uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ListInt8u::TypeInfo; |
| std::unique_ptr<CHIPTestClusterListInt8uAttributeCallback, void (*)(CHIPTestClusterListInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPTestClusterListInt8uAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterListInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterListInt8uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readListOctetStringAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ListOctetString::TypeInfo; |
| std::unique_ptr<CHIPTestClusterListOctetStringAttributeCallback, void (*)(CHIPTestClusterListOctetStringAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterListOctetStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterListOctetStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterListOctetStringAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readListStructOctetStringAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ListStructOctetString::TypeInfo; |
| std::unique_ptr<CHIPTestClusterListStructOctetStringAttributeCallback, |
| void (*)(CHIPTestClusterListStructOctetStringAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterListStructOctetStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterListStructOctetStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTestClusterClusterListStructOctetStringAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readLongOctetStringAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::LongOctetString::TypeInfo; |
| std::unique_ptr<CHIPOctetStringAttributeCallback, void (*)(CHIPOctetStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPOctetStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOctetStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterLongOctetStringAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readCharStringAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::CharString::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterCharStringAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readLongCharStringAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::LongCharString::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterLongCharStringAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readEpochUsAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::EpochUs::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterEpochUsAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readEpochSAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::EpochS::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterEpochSAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readVendorIdAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::VendorId::TypeInfo; |
| std::unique_ptr<CHIPTestClusterVendorIdAttributeCallback, void (*)(CHIPTestClusterVendorIdAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPTestClusterVendorIdAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterVendorIdAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterVendorIdAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readListNullablesAndOptionalsStructAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ListNullablesAndOptionalsStruct::TypeInfo; |
| std::unique_ptr<CHIPTestClusterListNullablesAndOptionalsStructAttributeCallback, |
| void (*)(CHIPTestClusterListNullablesAndOptionalsStructAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterListNullablesAndOptionalsStructAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterListNullablesAndOptionalsStructAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterListNullablesAndOptionalsStructAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readEnumAttrAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::EnumAttr::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterEnumAttrAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readRangeRestrictedInt8uAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::RangeRestrictedInt8u::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTestClusterClusterRangeRestrictedInt8uAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readRangeRestrictedInt8sAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::RangeRestrictedInt8s::TypeInfo; |
| std::unique_ptr<CHIPInt8sAttributeCallback, void (*)(CHIPInt8sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTestClusterClusterRangeRestrictedInt8sAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readRangeRestrictedInt16uAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::RangeRestrictedInt16u::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTestClusterClusterRangeRestrictedInt16uAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readRangeRestrictedInt16sAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::RangeRestrictedInt16s::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTestClusterClusterRangeRestrictedInt16sAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readListLongOctetStringAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ListLongOctetString::TypeInfo; |
| std::unique_ptr<CHIPTestClusterListLongOctetStringAttributeCallback, |
| void (*)(CHIPTestClusterListLongOctetStringAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterListLongOctetStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterListLongOctetStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTestClusterClusterListLongOctetStringAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readTimedWriteBooleanAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::TimedWriteBoolean::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterTimedWriteBooleanAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readUnsupportedAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Unsupported::TypeInfo; |
| std::unique_ptr<CHIPBooleanAttributeCallback, void (*)(CHIPBooleanAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPBooleanAttributeCallback>(callback, false), chip::Platform::Delete<CHIPBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterUnsupportedAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableBooleanAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableBoolean::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableBooleanAttributeCallback, void (*)(CHIPTestClusterNullableBooleanAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableBooleanAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableBooleanAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableBooleanAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableBitmap8Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableBitmap8::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableBitmap8AttributeCallback, void (*)(CHIPTestClusterNullableBitmap8AttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableBitmap8AttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableBitmap8AttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableBitmap8AttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableBitmap16Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableBitmap16::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableBitmap16AttributeCallback, void (*)(CHIPTestClusterNullableBitmap16AttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableBitmap16AttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableBitmap16AttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableBitmap16AttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableBitmap32Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableBitmap32::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableBitmap32AttributeCallback, void (*)(CHIPTestClusterNullableBitmap32AttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableBitmap32AttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableBitmap32AttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableBitmap32AttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableBitmap64Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableBitmap64::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableBitmap64AttributeCallback, void (*)(CHIPTestClusterNullableBitmap64AttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableBitmap64AttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableBitmap64AttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableBitmap64AttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt8uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt8u::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt8uAttributeCallback, void (*)(CHIPTestClusterNullableInt8uAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt8uAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt8uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt16uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt16u::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt16uAttributeCallback, void (*)(CHIPTestClusterNullableInt16uAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt16uAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt16uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt24uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt24u::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt24uAttributeCallback, void (*)(CHIPTestClusterNullableInt24uAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt24uAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt24uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt24uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt32uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt32u::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt32uAttributeCallback, void (*)(CHIPTestClusterNullableInt32uAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt32uAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt32uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt40uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt40u::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt40uAttributeCallback, void (*)(CHIPTestClusterNullableInt40uAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt40uAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt40uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt40uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt48uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt48u::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt48uAttributeCallback, void (*)(CHIPTestClusterNullableInt48uAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt48uAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt48uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt48uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt56uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt56u::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt56uAttributeCallback, void (*)(CHIPTestClusterNullableInt56uAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt56uAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt56uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt56uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt64uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt64u::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt64uAttributeCallback, void (*)(CHIPTestClusterNullableInt64uAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt64uAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt64uAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt8sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt8s::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt8sAttributeCallback, void (*)(CHIPTestClusterNullableInt8sAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt8sAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt8sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt8sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt16sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt16s::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt16sAttributeCallback, void (*)(CHIPTestClusterNullableInt16sAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt16sAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt16sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt24sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt24s::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt24sAttributeCallback, void (*)(CHIPTestClusterNullableInt24sAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt24sAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt24sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt24sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt32sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt32s::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt32sAttributeCallback, void (*)(CHIPTestClusterNullableInt32sAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt32sAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt32sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt32sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt40sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt40s::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt40sAttributeCallback, void (*)(CHIPTestClusterNullableInt40sAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt40sAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt40sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt40sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt48sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt48s::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt48sAttributeCallback, void (*)(CHIPTestClusterNullableInt48sAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt48sAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt48sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt48sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt56sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt56s::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt56sAttributeCallback, void (*)(CHIPTestClusterNullableInt56sAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt56sAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt56sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt56sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableInt64sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt64s::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableInt64sAttributeCallback, void (*)(CHIPTestClusterNullableInt64sAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableInt64sAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableInt64sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableInt64sAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableEnum8Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableEnum8::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableEnum8AttributeCallback, void (*)(CHIPTestClusterNullableEnum8AttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableEnum8AttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableEnum8AttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableEnum8AttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableEnum16Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableEnum16::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableEnum16AttributeCallback, void (*)(CHIPTestClusterNullableEnum16AttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableEnum16AttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableEnum16AttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableEnum16AttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableFloatSingleAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableFloatSingle::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableFloatSingleAttributeCallback, |
| void (*)(CHIPTestClusterNullableFloatSingleAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableFloatSingleAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableFloatSingleAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTestClusterClusterNullableFloatSingleAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableFloatDoubleAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableFloatDouble::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableFloatDoubleAttributeCallback, |
| void (*)(CHIPTestClusterNullableFloatDoubleAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableFloatDoubleAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableFloatDoubleAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTestClusterClusterNullableFloatDoubleAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableOctetStringAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableOctetString::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableOctetStringAttributeCallback, |
| void (*)(CHIPTestClusterNullableOctetStringAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableOctetStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableOctetStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTestClusterClusterNullableOctetStringAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableCharStringAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableCharString::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableCharStringAttributeCallback, |
| void (*)(CHIPTestClusterNullableCharStringAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPTestClusterClusterNullableCharStringAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableEnumAttrAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableEnumAttr::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableEnumAttrAttributeCallback, void (*)(CHIPTestClusterNullableEnumAttrAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableEnumAttrAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableEnumAttrAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableEnumAttrAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableRangeRestrictedInt8uAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableRangeRestrictedInt8u::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableRangeRestrictedInt8uAttributeCallback, |
| void (*)(CHIPTestClusterNullableRangeRestrictedInt8uAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableRangeRestrictedInt8uAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableRangeRestrictedInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableRangeRestrictedInt8uAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableRangeRestrictedInt8sAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableRangeRestrictedInt8s::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableRangeRestrictedInt8sAttributeCallback, |
| void (*)(CHIPTestClusterNullableRangeRestrictedInt8sAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableRangeRestrictedInt8sAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableRangeRestrictedInt8sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableRangeRestrictedInt8sAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableRangeRestrictedInt16uAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableRangeRestrictedInt16u::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableRangeRestrictedInt16uAttributeCallback, |
| void (*)(CHIPTestClusterNullableRangeRestrictedInt16uAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableRangeRestrictedInt16uAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableRangeRestrictedInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableRangeRestrictedInt16uAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readNullableRangeRestrictedInt16sAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableRangeRestrictedInt16s::TypeInfo; |
| std::unique_ptr<CHIPTestClusterNullableRangeRestrictedInt16sAttributeCallback, |
| void (*)(CHIPTestClusterNullableRangeRestrictedInt16sAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterNullableRangeRestrictedInt16sAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterNullableRangeRestrictedInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterNullableRangeRestrictedInt16sAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPTestClusterAttributeListAttributeCallback, void (*)(CHIPTestClusterAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPTestClusterAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPTestClusterAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, TestClusterCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast<chip::Controller::TestClusterCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPTestClusterClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readLocalTemperatureAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::LocalTemperature::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThermostatClusterLocalTemperatureAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readAbsMinHeatSetpointLimitAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::AbsMinHeatSetpointLimit::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThermostatClusterAbsMinHeatSetpointLimitAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readAbsMaxHeatSetpointLimitAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::AbsMaxHeatSetpointLimit::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThermostatClusterAbsMaxHeatSetpointLimitAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readAbsMinCoolSetpointLimitAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::AbsMinCoolSetpointLimit::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThermostatClusterAbsMinCoolSetpointLimitAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readAbsMaxCoolSetpointLimitAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::AbsMaxCoolSetpointLimit::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThermostatClusterAbsMaxCoolSetpointLimitAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readOccupiedCoolingSetpointAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::OccupiedCoolingSetpoint::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThermostatClusterOccupiedCoolingSetpointAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readOccupiedHeatingSetpointAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::OccupiedHeatingSetpoint::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThermostatClusterOccupiedHeatingSetpointAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readMinHeatSetpointLimitAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::MinHeatSetpointLimit::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThermostatClusterMinHeatSetpointLimitAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readMaxHeatSetpointLimitAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::MaxHeatSetpointLimit::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThermostatClusterMaxHeatSetpointLimitAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readMinCoolSetpointLimitAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::MinCoolSetpointLimit::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThermostatClusterMinCoolSetpointLimitAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readMaxCoolSetpointLimitAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::MaxCoolSetpointLimit::TypeInfo; |
| std::unique_ptr<CHIPInt16sAttributeCallback, void (*)(CHIPInt16sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThermostatClusterMaxCoolSetpointLimitAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readMinSetpointDeadBandAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::MinSetpointDeadBand::TypeInfo; |
| std::unique_ptr<CHIPInt8sAttributeCallback, void (*)(CHIPInt8sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThermostatClusterMinSetpointDeadBandAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readControlSequenceOfOperationAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::ControlSequenceOfOperation::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThermostatClusterControlSequenceOfOperationAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readSystemModeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::SystemMode::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThermostatClusterSystemModeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readStartOfWeekAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::StartOfWeek::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThermostatClusterStartOfWeekAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readNumberOfWeeklyTransitionsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::NumberOfWeeklyTransitions::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThermostatClusterNumberOfWeeklyTransitionsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readNumberOfDailyTransitionsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::NumberOfDailyTransitions::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThermostatClusterNumberOfDailyTransitionsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPThermostatAttributeListAttributeCallback, void (*)(CHIPThermostatAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPThermostatAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPThermostatAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThermostatClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readFeatureMapAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::FeatureMap::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThermostatClusterFeatureMapAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::Thermostat::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatCluster * cppCluster = reinterpret_cast<chip::Controller::ThermostatCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThermostatClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, readTemperatureDisplayModeAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatUserInterfaceConfigurationCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThermostatUserInterfaceConfigurationCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThermostatUserInterfaceConfigurationClusterTemperatureDisplayModeAttributeCallbackType>:: |
| FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, readKeypadLockoutAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatUserInterfaceConfigurationCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThermostatUserInterfaceConfigurationCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThermostatUserInterfaceConfigurationClusterKeypadLockoutAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, readScheduleProgrammingVisibilityAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatUserInterfaceConfigurationCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThermostatUserInterfaceConfigurationCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback:: |
| Callback<CHIPThermostatUserInterfaceConfigurationClusterScheduleProgrammingVisibilityAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback, |
| void (*)(CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatUserInterfaceConfigurationCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThermostatUserInterfaceConfigurationCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThermostatUserInterfaceConfigurationClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThermostatUserInterfaceConfigurationCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThermostatUserInterfaceConfigurationCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback< |
| CHIPThermostatUserInterfaceConfigurationClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readChannelAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Channel::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterChannelAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRoutingRoleAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RoutingRole::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readNetworkNameAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::NetworkName::TypeInfo; |
| std::unique_ptr<CHIPOctetStringAttributeCallback, void (*)(CHIPOctetStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPOctetStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOctetStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterNetworkNameAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readPanIdAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PanId::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterPanIdAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readExtendedPanIdAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ExtendedPanId::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterExtendedPanIdAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readMeshLocalPrefixAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::MeshLocalPrefix::TypeInfo; |
| std::unique_ptr<CHIPOctetStringAttributeCallback, void (*)(CHIPOctetStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPOctetStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOctetStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterMeshLocalPrefixAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readOverrunCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::OverrunCount::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterOverrunCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readNeighborTableListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::NeighborTableList::TypeInfo; |
| std::unique_ptr<CHIPThreadNetworkDiagnosticsNeighborTableListAttributeCallback, |
| void (*)(CHIPThreadNetworkDiagnosticsNeighborTableListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPThreadNetworkDiagnosticsNeighborTableListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPThreadNetworkDiagnosticsNeighborTableListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterNeighborTableListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRouteTableListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RouteTableList::TypeInfo; |
| std::unique_ptr<CHIPThreadNetworkDiagnosticsRouteTableListAttributeCallback, |
| void (*)(CHIPThreadNetworkDiagnosticsRouteTableListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPThreadNetworkDiagnosticsRouteTableListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPThreadNetworkDiagnosticsRouteTableListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRouteTableListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readPartitionIdAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PartitionId::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterPartitionIdAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readWeightingAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Weighting::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterWeightingAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readDataVersionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::DataVersion::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterDataVersionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readStableDataVersionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::StableDataVersion::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterStableDataVersionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readLeaderRouterIdAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::LeaderRouterId::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterLeaderRouterIdAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readDetachedRoleCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::DetachedRoleCount::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterDetachedRoleCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readChildRoleCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ChildRoleCount::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterChildRoleCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRouterRoleCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RouterRoleCount::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRouterRoleCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readLeaderRoleCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::LeaderRoleCount::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterLeaderRoleCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readAttachAttemptCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::AttachAttemptCount::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterAttachAttemptCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readPartitionIdChangeCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PartitionIdChangeCount::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterPartitionIdChangeCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readBetterPartitionAttachAttemptCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::BetterPartitionAttachAttemptCount::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterBetterPartitionAttachAttemptCountAttributeCallbackType>:: |
| FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readParentChangeCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ParentChangeCount::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterParentChangeCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxTotalCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxTotalCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxTotalCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxUnicastCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxUnicastCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxUnicastCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxBroadcastCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBroadcastCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxBroadcastCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxAckRequestedCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxAckRequestedCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxAckRequestedCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxAckedCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxAckedCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxAckedCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxNoAckRequestedCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxNoAckRequestedCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxNoAckRequestedCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxDataCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDataCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxDataCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxDataPollCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDataPollCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxDataPollCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxBeaconCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBeaconCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxBeaconCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxBeaconRequestCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBeaconRequestCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxBeaconRequestCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxOtherCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxOtherCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxOtherCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxRetryCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxRetryCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxRetryCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxDirectMaxRetryExpiryCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDirectMaxRetryExpiryCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback< |
| CHIPThreadNetworkDiagnosticsClusterTxDirectMaxRetryExpiryCountAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxIndirectMaxRetryExpiryCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxIndirectMaxRetryExpiryCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback< |
| CHIPThreadNetworkDiagnosticsClusterTxIndirectMaxRetryExpiryCountAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxErrCcaCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrCcaCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxErrCcaCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxErrAbortCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrAbortCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxErrAbortCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxErrBusyChannelCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrBusyChannelCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterTxErrBusyChannelCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxTotalCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxTotalCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxTotalCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxUnicastCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxUnicastCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxUnicastCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxBroadcastCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBroadcastCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxBroadcastCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxDataCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDataCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxDataCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxDataPollCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDataPollCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxDataPollCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxBeaconCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBeaconCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxBeaconCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxBeaconRequestCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBeaconRequestCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxBeaconRequestCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxOtherCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxOtherCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxOtherCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxAddressFilteredCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxAddressFilteredCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxAddressFilteredCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxDestAddrFilteredCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDestAddrFilteredCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxDestAddrFilteredCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxDuplicatedCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDuplicatedCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxDuplicatedCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrNoFrameCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrNoFrameCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxErrNoFrameCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrUnknownNeighborCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrUnknownNeighborCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxErrUnknownNeighborCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrInvalidSrcAddrCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrInvalidSrcAddrCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxErrInvalidSrcAddrCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrSecCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrSecCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxErrSecCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrFcsCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrFcsCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxErrFcsCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrOtherCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrOtherCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterRxErrOtherCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readActiveTimestampAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterActiveTimestampAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readPendingTimestampAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PendingTimestamp::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterPendingTimestampAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readDelayAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Delay::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterDelayAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readSecurityPolicyAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::SecurityPolicy::TypeInfo; |
| std::unique_ptr<CHIPThreadNetworkDiagnosticsSecurityPolicyAttributeCallback, |
| void (*)(CHIPThreadNetworkDiagnosticsSecurityPolicyAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPThreadNetworkDiagnosticsSecurityPolicyAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPThreadNetworkDiagnosticsSecurityPolicyAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterSecurityPolicyAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readChannelMaskAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ChannelMask::TypeInfo; |
| std::unique_ptr<CHIPOctetStringAttributeCallback, void (*)(CHIPOctetStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPOctetStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOctetStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterChannelMaskAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readOperationalDatasetComponentsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::OperationalDatasetComponents::TypeInfo; |
| std::unique_ptr<CHIPThreadNetworkDiagnosticsOperationalDatasetComponentsAttributeCallback, |
| void (*)(CHIPThreadNetworkDiagnosticsOperationalDatasetComponentsAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPThreadNetworkDiagnosticsOperationalDatasetComponentsAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPThreadNetworkDiagnosticsOperationalDatasetComponentsAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback< |
| CHIPThreadNetworkDiagnosticsClusterOperationalDatasetComponentsAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readActiveNetworkFaultsListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveNetworkFaultsList::TypeInfo; |
| std::unique_ptr<CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback, |
| void (*)(CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterActiveNetworkFaultsListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPThreadNetworkDiagnosticsAttributeListAttributeCallback, |
| void (*)(CHIPThreadNetworkDiagnosticsAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPThreadNetworkDiagnosticsAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPThreadNetworkDiagnosticsAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readFeatureMapAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::FeatureMap::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterFeatureMapAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::ThreadNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPThreadNetworkDiagnosticsClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, UserLabelCluster, readLabelListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::UserLabel::Attributes::LabelList::TypeInfo; |
| std::unique_ptr<CHIPUserLabelLabelListAttributeCallback, void (*)(CHIPUserLabelLabelListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPUserLabelLabelListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPUserLabelLabelListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::UserLabelCluster * cppCluster = reinterpret_cast<chip::Controller::UserLabelCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPUserLabelClusterLabelListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, UserLabelCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::UserLabel::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::UserLabelCluster * cppCluster = reinterpret_cast<chip::Controller::UserLabelCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPUserLabelClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WakeOnLanCluster, readWakeOnLanMacAddressAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WakeOnLan::Attributes::WakeOnLanMacAddress::TypeInfo; |
| std::unique_ptr<CHIPCharStringAttributeCallback, void (*)(CHIPCharStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPCharStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPCharStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WakeOnLanCluster * cppCluster = reinterpret_cast<chip::Controller::WakeOnLanCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWakeOnLanClusterWakeOnLanMacAddressAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WakeOnLanCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WakeOnLan::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPWakeOnLanAttributeListAttributeCallback, void (*)(CHIPWakeOnLanAttributeListAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPWakeOnLanAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPWakeOnLanAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WakeOnLanCluster * cppCluster = reinterpret_cast<chip::Controller::WakeOnLanCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWakeOnLanClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WakeOnLanCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WakeOnLan::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WakeOnLanCluster * cppCluster = reinterpret_cast<chip::Controller::WakeOnLanCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWakeOnLanClusterClusterRevisionAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readBssidAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::Bssid::TypeInfo; |
| std::unique_ptr<CHIPOctetStringAttributeCallback, void (*)(CHIPOctetStringAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPOctetStringAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPOctetStringAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterBssidAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readSecurityTypeAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::SecurityType::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readWiFiVersionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::WiFiVersion::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterWiFiVersionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readChannelNumberAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::ChannelNumber::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterChannelNumberAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readRssiAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::Rssi::TypeInfo; |
| std::unique_ptr<CHIPInt8sAttributeCallback, void (*)(CHIPInt8sAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8sAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8sAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterRssiAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readBeaconLostCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::BeaconLostCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterBeaconLostCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readBeaconRxCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::BeaconRxCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterBeaconRxCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readPacketMulticastRxCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketMulticastRxCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterPacketMulticastRxCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readPacketMulticastTxCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketMulticastTxCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterPacketMulticastTxCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readPacketUnicastRxCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketUnicastRxCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterPacketUnicastRxCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readPacketUnicastTxCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketUnicastTxCount::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterPacketUnicastTxCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readCurrentMaxRateAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::CurrentMaxRate::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterCurrentMaxRateAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readOverrunCountAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::OverrunCount::TypeInfo; |
| std::unique_ptr<CHIPInt64uAttributeCallback, void (*)(CHIPInt64uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt64uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt64uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterOverrunCountAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readAttributeListAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPWiFiNetworkDiagnosticsAttributeListAttributeCallback, |
| void (*)(CHIPWiFiNetworkDiagnosticsAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPWiFiNetworkDiagnosticsAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPWiFiNetworkDiagnosticsAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterAttributeListAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readFeatureMapAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::FeatureMap::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterFeatureMapAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster = |
| reinterpret_cast<chip::Controller::WiFiNetworkDiagnosticsCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWiFiNetworkDiagnosticsClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readTypeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::Type::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterTypeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionLiftAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLift::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPWindowCoveringClusterCurrentPositionLiftAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionTiltAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTilt::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPWindowCoveringClusterCurrentPositionTiltAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readConfigStatusAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::ConfigStatus::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterConfigStatusAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionLiftPercentageAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLiftPercentage::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterCurrentPositionLiftPercentageAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionTiltPercentageAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTiltPercentage::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterCurrentPositionTiltPercentageAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readOperationalStatusAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::OperationalStatus::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPWindowCoveringClusterOperationalStatusAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readTargetPositionLiftPercent100thsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::TargetPositionLiftPercent100ths::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterTargetPositionLiftPercent100thsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readTargetPositionTiltPercent100thsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::TargetPositionTiltPercent100ths::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterTargetPositionTiltPercent100thsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readEndProductTypeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::EndProductType::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterEndProductTypeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionLiftPercent100thsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLiftPercent100ths::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterCurrentPositionLiftPercent100thsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionTiltPercent100thsAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTiltPercent100ths::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterCurrentPositionTiltPercent100thsAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readInstalledOpenLimitLiftAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::InstalledOpenLimitLift::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPWindowCoveringClusterInstalledOpenLimitLiftAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readInstalledClosedLimitLiftAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::InstalledClosedLimitLift::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterInstalledClosedLimitLiftAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readInstalledOpenLimitTiltAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::InstalledOpenLimitTilt::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPWindowCoveringClusterInstalledOpenLimitTiltAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readInstalledClosedLimitTiltAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::InstalledClosedLimitTilt::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterInstalledClosedLimitTiltAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readModeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::Mode::TypeInfo; |
| std::unique_ptr<CHIPInt8uAttributeCallback, void (*)(CHIPInt8uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt8uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt8uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterModeAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readSafetyStatusAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::SafetyStatus::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterSafetyStatusAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readAttributeListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::AttributeList::TypeInfo; |
| std::unique_ptr<CHIPWindowCoveringAttributeListAttributeCallback, void (*)(CHIPWindowCoveringAttributeListAttributeCallback *)> |
| onSuccess(chip::Platform::New<CHIPWindowCoveringAttributeListAttributeCallback>(callback, false), |
| chip::Platform::Delete<CHIPWindowCoveringAttributeListAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterAttributeListAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readFeatureMapAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::FeatureMap::TypeInfo; |
| std::unique_ptr<CHIPInt32uAttributeCallback, void (*)(CHIPInt32uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt32uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt32uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = |
| chip::Callback::Callback<CHIPWindowCoveringClusterFeatureMapAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |
| |
| JNI_METHOD(void, WindowCoveringCluster, readClusterRevisionAttribute) |
| (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) |
| { |
| chip::DeviceLayer::StackLock lock; |
| using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::ClusterRevision::TypeInfo; |
| std::unique_ptr<CHIPInt16uAttributeCallback, void (*)(CHIPInt16uAttributeCallback *)> onSuccess( |
| chip::Platform::New<CHIPInt16uAttributeCallback>(callback, false), chip::Platform::Delete<CHIPInt16uAttributeCallback>); |
| VerifyOrReturn(onSuccess.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); |
| |
| std::unique_ptr<chip::CHIPDefaultFailureCallback, void (*)(chip::CHIPDefaultFailureCallback *)> onFailure( |
| chip::Platform::New<chip::CHIPDefaultFailureCallback>(callback), chip::Platform::Delete<chip::CHIPDefaultFailureCallback>); |
| VerifyOrReturn(onFailure.get() != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); |
| |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| chip::Controller::WindowCoveringCluster * cppCluster = reinterpret_cast<chip::Controller::WindowCoveringCluster *>(clusterPtr); |
| VerifyOrReturn(cppCluster != nullptr, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( |
| env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); |
| |
| auto successFn = chip::Callback::Callback<CHIPWindowCoveringClusterClusterRevisionAttributeCallbackType>::FromCancelable( |
| onSuccess->Cancel()); |
| auto failureFn = chip::Callback::Callback<CHIPDefaultFailureCallbackType>::FromCancelable(onFailure->Cancel()); |
| err = cppCluster->ReadAttribute<TypeInfo>(onSuccess->mContext, successFn->mCall, failureFn->mCall); |
| VerifyOrReturn( |
| err == CHIP_NO_ERROR, |
| chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); |
| |
| onSuccess.release(); |
| onFailure.release(); |
| } |