diff --git a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp index 37e966c18b3949..e0ec2af2ecc61f 100644 --- a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp @@ -28,10 +28,12 @@ #include #include #include +#include #include #include #include #include +#include #include #define JNI_METHOD(RETURN, CLASS_NAME, METHOD_NAME) \ @@ -59,6 +61,120 @@ JNI_METHOD(jlong, AccessControlCluster, initWithDevice)(JNIEnv * env, jobject se return reinterpret_cast(cppCluster); } +JNI_METHOD(void, AccessControlCluster, subscribeAclAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + AccessControlCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::AccessControl::Attributes::Acl::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPAccessControlAclAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, AccessControlCluster, subscribeExtensionAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + AccessControlCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::AccessControl::Attributes::Extension::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPAccessControlExtensionAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, AccessControlCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + AccessControlCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::AccessControl::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPAccessControlAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, AccessControlCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -112,9 +228,14 @@ JNI_METHOD(void, AccountLoginCluster, getSetupPINRequest) CHIP_ERROR err = CHIP_NO_ERROR; AccountLoginCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::AccountLogin::Commands::GetSetupPINRequest::Type request; - request.tempAccountIdentifier = chip::JniUtfString(env, static_cast(tempAccountIdentifier)).charSpan(); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto tempAccountIdentifierJni = chip::Platform::New(env, static_cast(tempAccountIdentifier)); + cleanupStrings.push_back(tempAccountIdentifierJni); + request.tempAccountIdentifier = tempAccountIdentifierJni->charSpan(); std::unique_ptr @@ -144,6 +265,11 @@ JNI_METHOD(void, AccountLoginCluster, getSetupPINRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -155,10 +281,17 @@ JNI_METHOD(void, AccountLoginCluster, loginRequest) CHIP_ERROR err = CHIP_NO_ERROR; AccountLoginCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::AccountLogin::Commands::LoginRequest::Type request; - request.tempAccountIdentifier = chip::JniUtfString(env, static_cast(tempAccountIdentifier)).charSpan(); - request.setupPIN = chip::JniUtfString(env, static_cast(setupPIN)).charSpan(); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto tempAccountIdentifierJni = chip::Platform::New(env, static_cast(tempAccountIdentifier)); + cleanupStrings.push_back(tempAccountIdentifierJni); + request.tempAccountIdentifier = tempAccountIdentifierJni->charSpan(); + auto setupPINJni = chip::Platform::New(env, static_cast(setupPIN)); + cleanupStrings.push_back(setupPINJni); + request.setupPIN = setupPINJni->charSpan(); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -192,6 +325,11 @@ JNI_METHOD(void, AccountLoginCluster, loginRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -202,8 +340,12 @@ JNI_METHOD(void, AccountLoginCluster, logoutRequest) CHIP_ERROR err = CHIP_NO_ERROR; AccountLoginCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::AccountLogin::Commands::LogoutRequest::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -229,6 +371,49 @@ JNI_METHOD(void, AccountLoginCluster, logoutRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, AccountLoginCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + AccountLoginCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::AccountLogin::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPAccountLoginAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + onSuccess.release(); onFailure.release(); } @@ -285,9 +470,12 @@ JNI_METHOD(void, AdministratorCommissioningCluster, openBasicCommissioningWindow CHIP_ERROR err = CHIP_NO_ERROR; AdministratorCommissioningCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type request; - request.commissioningTimeout = static_cast( + std::list cleanupByteArrays; + std::list cleanupStrings; + request.commissioningTimeout = static_cast>( chip::JniReferences::GetInstance().IntegerToPrimitive(commissioningTimeout)); std::unique_ptr onSuccess( @@ -322,6 +510,11 @@ JNI_METHOD(void, AdministratorCommissioningCluster, openBasicCommissioningWindow AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -333,17 +526,25 @@ JNI_METHOD(void, AdministratorCommissioningCluster, openCommissioningWindow) CHIP_ERROR err = CHIP_NO_ERROR; AdministratorCommissioningCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type request; - request.commissioningTimeout = static_cast( + std::list cleanupByteArrays; + std::list cleanupStrings; + request.commissioningTimeout = static_cast>( chip::JniReferences::GetInstance().IntegerToPrimitive(commissioningTimeout)); - request.PAKEVerifier = chip::JniByteArray(env, static_cast(PAKEVerifier)).byteSpan(); - request.discriminator = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(discriminator)); - request.iterations = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(iterations)); - request.salt = chip::JniByteArray(env, static_cast(salt)).byteSpan(); - request.passcodeID = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(passcodeID)); + auto PAKEVerifierJni = chip::Platform::New(env, static_cast(PAKEVerifier)); + cleanupByteArrays.push_back(PAKEVerifierJni); + request.PAKEVerifier = PAKEVerifierJni->byteSpan(); + request.discriminator = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(discriminator)); + request.iterations = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(iterations)); + auto saltJni = chip::Platform::New(env, static_cast(salt)); + cleanupByteArrays.push_back(saltJni); + request.salt = saltJni->byteSpan(); + request.passcodeID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(passcodeID)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -377,6 +578,11 @@ JNI_METHOD(void, AdministratorCommissioningCluster, openCommissioningWindow) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -387,8 +593,12 @@ JNI_METHOD(void, AdministratorCommissioningCluster, revokeCommissioning) CHIP_ERROR err = CHIP_NO_ERROR; AdministratorCommissioningCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -421,6 +631,11 @@ JNI_METHOD(void, AdministratorCommissioningCluster, revokeCommissioning) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -541,6 +756,47 @@ JNI_METHOD(void, AdministratorCommissioningCluster, subscribeAdminVendorIdAttrib onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, AdministratorCommissioningCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + AdministratorCommissioningCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::AdministratorCommissioning::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPAdministratorCommissioningAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, AdministratorCommissioningCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -810,6 +1066,84 @@ JNI_METHOD(void, ApplicationBasicCluster, subscribeApplicationVersionAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, ApplicationBasicCluster, subscribeAllowedVendorListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ApplicationBasicCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ApplicationBasic::Attributes::AllowedVendorList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPApplicationBasicAllowedVendorListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, ApplicationBasicCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ApplicationBasicCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ApplicationBasic::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPApplicationBasicAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, ApplicationBasicCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -857,16 +1191,29 @@ JNI_METHOD(jlong, ApplicationLauncherCluster, initWithDevice)(JNIEnv * env, jobj } JNI_METHOD(void, ApplicationLauncherCluster, hideAppRequest) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject catalogVendorId, jstring applicationId, - jobject timedInvokeTimeoutMs) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject application, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; ApplicationLauncherCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ApplicationLauncher::Commands::HideAppRequest::Type request; - request.application = chip::app::Clusters::ApplicationLauncher::Structs::ApplicationLauncherApplication::Type(); + std::list cleanupByteArrays; + std::list cleanupStrings; + jobject application_catalogVendorIdItem_0; + chip::JniReferences::GetInstance().GetObjectField(application, "catalogVendorId", "Ljava/lang/Integer;", + application_catalogVendorIdItem_0); + request.application.catalogVendorId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(application_catalogVendorIdItem_0)); + jobject application_applicationIdItem_0; + chip::JniReferences::GetInstance().GetObjectField(application, "applicationId", "Ljava/lang/String;", + application_applicationIdItem_0); + auto application_applicationIdItem_0Jni = + chip::Platform::New(env, static_cast(application_applicationIdItem_0)); + cleanupStrings.push_back(application_applicationIdItem_0Jni); + request.application.applicationId = application_applicationIdItem_0Jni->charSpan(); std::unique_ptr @@ -903,21 +1250,41 @@ JNI_METHOD(void, ApplicationLauncherCluster, hideAppRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } JNI_METHOD(void, ApplicationLauncherCluster, launchAppRequest) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jstring data, jobject catalogVendorId, jstring applicationId, - jobject timedInvokeTimeoutMs) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jstring data, jobject application, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; ApplicationLauncherCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ApplicationLauncher::Commands::LaunchAppRequest::Type request; - request.data = chip::JniUtfString(env, static_cast(data)).charSpan(); - request.application = chip::app::Clusters::ApplicationLauncher::Structs::ApplicationLauncherApplication::Type(); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto dataJni = chip::Platform::New(env, static_cast(data)); + cleanupStrings.push_back(dataJni); + request.data = dataJni->charSpan(); + jobject application_catalogVendorIdItem_0; + chip::JniReferences::GetInstance().GetObjectField(application, "catalogVendorId", "Ljava/lang/Integer;", + application_catalogVendorIdItem_0); + request.application.catalogVendorId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(application_catalogVendorIdItem_0)); + jobject application_applicationIdItem_0; + chip::JniReferences::GetInstance().GetObjectField(application, "applicationId", "Ljava/lang/String;", + application_applicationIdItem_0); + auto application_applicationIdItem_0Jni = + chip::Platform::New(env, static_cast(application_applicationIdItem_0)); + cleanupStrings.push_back(application_applicationIdItem_0Jni); + request.application.applicationId = application_applicationIdItem_0Jni->charSpan(); std::unique_ptr @@ -954,20 +1321,38 @@ JNI_METHOD(void, ApplicationLauncherCluster, launchAppRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } JNI_METHOD(void, ApplicationLauncherCluster, stopAppRequest) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject catalogVendorId, jstring applicationId, - jobject timedInvokeTimeoutMs) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject application, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; ApplicationLauncherCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ApplicationLauncher::Commands::StopAppRequest::Type request; - request.application = chip::app::Clusters::ApplicationLauncher::Structs::ApplicationLauncherApplication::Type(); + std::list cleanupByteArrays; + std::list cleanupStrings; + jobject application_catalogVendorIdItem_0; + chip::JniReferences::GetInstance().GetObjectField(application, "catalogVendorId", "Ljava/lang/Integer;", + application_catalogVendorIdItem_0); + request.application.catalogVendorId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(application_catalogVendorIdItem_0)); + jobject application_applicationIdItem_0; + chip::JniReferences::GetInstance().GetObjectField(application, "applicationId", "Ljava/lang/String;", + application_applicationIdItem_0); + auto application_applicationIdItem_0Jni = + chip::Platform::New(env, static_cast(application_applicationIdItem_0)); + cleanupStrings.push_back(application_applicationIdItem_0Jni); + request.application.applicationId = application_applicationIdItem_0Jni->charSpan(); std::unique_ptr @@ -1004,15 +1389,22 @@ JNI_METHOD(void, ApplicationLauncherCluster, stopAppRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, ApplicationLauncherCluster, subscribeClusterRevisionAttribute) +JNI_METHOD(void, ApplicationLauncherCluster, subscribeApplicationLauncherListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -1029,14 +1421,16 @@ JNI_METHOD(void, ApplicationLauncherCluster, subscribeClusterRevisionAttribute) chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::ApplicationLauncher::Attributes::ClusterRevision::TypeInfo; - auto successFn = chip::Callback::Callback::FromCancelable( - onSuccess->Cancel()); + using TypeInfo = chip::app::Clusters::ApplicationLauncher::Attributes::ApplicationLauncherList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); - err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, - static_cast(minInterval), static_cast(maxInterval), - CHIPInt16uAttributeCallback::OnSubscriptionEstablished); + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPApplicationLauncherApplicationLauncherListAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -1044,14 +1438,90 @@ JNI_METHOD(void, ApplicationLauncherCluster, subscribeClusterRevisionAttribute) onSuccess.release(); onFailure.release(); } -JNI_METHOD(jlong, AudioOutputCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) +JNI_METHOD(void, ApplicationLauncherCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - AudioOutputCluster * cppCluster = new AudioOutputCluster(); + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); - return reinterpret_cast(cppCluster); -} + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ApplicationLauncherCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ApplicationLauncher::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPApplicationLauncherAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, ApplicationLauncherCluster, subscribeClusterRevisionAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ApplicationLauncherCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ApplicationLauncher::Attributes::ClusterRevision::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt16uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(jlong, AudioOutputCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) +{ + chip::DeviceLayer::StackLock lock; + AudioOutputCluster * cppCluster = new AudioOutputCluster(); + + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + return reinterpret_cast(cppCluster); +} JNI_METHOD(void, AudioOutputCluster, renameOutputRequest) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject index, jstring name, jobject timedInvokeTimeoutMs) @@ -1060,10 +1530,16 @@ JNI_METHOD(void, AudioOutputCluster, renameOutputRequest) CHIP_ERROR err = CHIP_NO_ERROR; AudioOutputCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::AudioOutput::Commands::RenameOutputRequest::Type request; - request.index = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(index)); - request.name = chip::JniUtfString(env, static_cast(name)).charSpan(); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.index = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(index)); + auto nameJni = chip::Platform::New(env, static_cast(name)); + cleanupStrings.push_back(nameJni); + request.name = nameJni->charSpan(); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1097,6 +1573,11 @@ JNI_METHOD(void, AudioOutputCluster, renameOutputRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1107,9 +1588,13 @@ JNI_METHOD(void, AudioOutputCluster, selectOutputRequest) CHIP_ERROR err = CHIP_NO_ERROR; AudioOutputCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::AudioOutput::Commands::SelectOutputRequest::Type request; - request.index = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(index)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.index = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(index)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1143,6 +1628,49 @@ JNI_METHOD(void, AudioOutputCluster, selectOutputRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, AudioOutputCluster, subscribeAudioOutputListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + AudioOutputCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::AudioOutput::Attributes::AudioOutputList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPAudioOutputAudioOutputListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + onSuccess.release(); onFailure.release(); } @@ -1183,6 +1711,44 @@ JNI_METHOD(void, AudioOutputCluster, subscribeCurrentAudioOutputAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, AudioOutputCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + AudioOutputCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::AudioOutput::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPAudioOutputAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, AudioOutputCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -1236,10 +1802,13 @@ JNI_METHOD(void, BarrierControlCluster, barrierControlGoToPercent) CHIP_ERROR err = CHIP_NO_ERROR; BarrierControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::BarrierControl::Commands::BarrierControlGoToPercent::Type request; - request.percentOpen = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(percentOpen)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.percentOpen = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(percentOpen)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1273,6 +1842,11 @@ JNI_METHOD(void, BarrierControlCluster, barrierControlGoToPercent) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1283,8 +1857,12 @@ JNI_METHOD(void, BarrierControlCluster, barrierControlStop) CHIP_ERROR err = CHIP_NO_ERROR; BarrierControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::BarrierControl::Commands::BarrierControlStop::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -1317,6 +1895,11 @@ JNI_METHOD(void, BarrierControlCluster, barrierControlStop) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1468,6 +2051,44 @@ JNI_METHOD(void, BarrierControlCluster, subscribeBarrierPositionAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, BarrierControlCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + BarrierControlCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::BarrierControl::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPBarrierControlAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, BarrierControlCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -1521,8 +2142,12 @@ JNI_METHOD(void, BasicCluster, mfgSpecificPing) CHIP_ERROR err = CHIP_NO_ERROR; BasicCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Basic::Commands::MfgSpecificPing::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -1555,6 +2180,11 @@ JNI_METHOD(void, BasicCluster, mfgSpecificPing) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2253,6 +2883,44 @@ JNI_METHOD(void, BasicCluster, subscribeUniqueIDAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, BasicCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + BasicCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::Basic::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPBasicAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, BasicCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -2410,6 +3078,45 @@ JNI_METHOD(void, BinaryInputBasicCluster, subscribeStatusFlagsAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, BinaryInputBasicCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + BinaryInputBasicCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::BinaryInputBasic::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPBinaryInputBasicAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, BinaryInputBasicCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -2464,13 +3171,19 @@ JNI_METHOD(void, BindingCluster, bind) CHIP_ERROR err = CHIP_NO_ERROR; BindingCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Binding::Commands::Bind::Type request; - request.nodeId = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(nodeId)); - request.groupId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); - request.endpointId = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(endpointId)); - request.clusterId = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(clusterId)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.nodeId = + static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(nodeId)); + request.groupId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); + request.endpointId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(endpointId)); + request.clusterId = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(clusterId)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2504,6 +3217,11 @@ JNI_METHOD(void, BindingCluster, bind) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2515,13 +3233,19 @@ JNI_METHOD(void, BindingCluster, unbind) CHIP_ERROR err = CHIP_NO_ERROR; BindingCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Binding::Commands::Unbind::Type request; - request.nodeId = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(nodeId)); - request.groupId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); - request.endpointId = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(endpointId)); - request.clusterId = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(clusterId)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.nodeId = + static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(nodeId)); + request.groupId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); + request.endpointId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(endpointId)); + request.clusterId = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(clusterId)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2555,15 +3279,21 @@ JNI_METHOD(void, BindingCluster, unbind) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, BindingCluster, subscribeClusterRevisionAttribute) +JNI_METHOD(void, BindingCluster, subscribeAttributeListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -2580,14 +3310,14 @@ JNI_METHOD(void, BindingCluster, subscribeClusterRevisionAttribute) chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::Binding::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = chip::app::Clusters::Binding::Attributes::AttributeList::TypeInfo; auto successFn = - chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), static_cast(maxInterval), - CHIPInt16uAttributeCallback::OnSubscriptionEstablished); + CHIPBindingAttributeListAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -2595,21 +3325,12 @@ JNI_METHOD(void, BindingCluster, subscribeClusterRevisionAttribute) onSuccess.release(); onFailure.release(); } -JNI_METHOD(jlong, BooleanStateCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) -{ - chip::DeviceLayer::StackLock lock; - BooleanStateCluster * cppCluster = new BooleanStateCluster(); - - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); - return reinterpret_cast(cppCluster); -} - -JNI_METHOD(void, BooleanStateCluster, subscribeStateValueAttribute) +JNI_METHOD(void, BindingCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -2620,8 +3341,54 @@ JNI_METHOD(void, BooleanStateCluster, subscribeStateValueAttribute) chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); - CHIP_ERROR err = CHIP_NO_ERROR; - BooleanStateCluster * cppCluster = reinterpret_cast(clusterPtr); + CHIP_ERROR err = CHIP_NO_ERROR; + BindingCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::Binding::Attributes::ClusterRevision::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt16uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(jlong, BooleanStateCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) +{ + chip::DeviceLayer::StackLock lock; + BooleanStateCluster * cppCluster = new BooleanStateCluster(); + + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + return reinterpret_cast(cppCluster); +} + +JNI_METHOD(void, BooleanStateCluster, subscribeStateValueAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + BooleanStateCluster * cppCluster = reinterpret_cast(clusterPtr); VerifyOrReturn(cppCluster != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); @@ -2641,6 +3408,44 @@ JNI_METHOD(void, BooleanStateCluster, subscribeStateValueAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, BooleanStateCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + BooleanStateCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::BooleanState::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPBooleanStateAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, BooleanStateCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -2694,12 +3499,21 @@ JNI_METHOD(void, BridgedActionsCluster, disableAction) CHIP_ERROR err = CHIP_NO_ERROR; BridgedActionsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::BridgedActions::Commands::DisableAction::Type request; - request.actionID = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); - chip::JniReferences::GetInstance().GetOptionalValue(invokeID, invokeID); - request.invokeID = chip::Optional( - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(invokeID))); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.actionID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); + if (invokeID != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(invokeID, optionalValue_0); + auto & definedValue_0 = request.invokeID.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(optionalValue_0)); + } std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2733,6 +3547,11 @@ JNI_METHOD(void, BridgedActionsCluster, disableAction) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2744,13 +3563,23 @@ JNI_METHOD(void, BridgedActionsCluster, disableActionWithDuration) CHIP_ERROR err = CHIP_NO_ERROR; BridgedActionsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::BridgedActions::Commands::DisableActionWithDuration::Type request; - request.actionID = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); - chip::JniReferences::GetInstance().GetOptionalValue(invokeID, invokeID); - request.invokeID = chip::Optional( - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(invokeID))); - request.duration = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(duration)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.actionID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); + if (invokeID != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(invokeID, optionalValue_0); + auto & definedValue_0 = request.invokeID.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(optionalValue_0)); + } + request.duration = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(duration)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2784,6 +3613,11 @@ JNI_METHOD(void, BridgedActionsCluster, disableActionWithDuration) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2794,12 +3628,21 @@ JNI_METHOD(void, BridgedActionsCluster, enableAction) CHIP_ERROR err = CHIP_NO_ERROR; BridgedActionsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::BridgedActions::Commands::EnableAction::Type request; - request.actionID = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); - chip::JniReferences::GetInstance().GetOptionalValue(invokeID, invokeID); - request.invokeID = chip::Optional( - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(invokeID))); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.actionID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); + if (invokeID != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(invokeID, optionalValue_0); + auto & definedValue_0 = request.invokeID.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(optionalValue_0)); + } std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2833,6 +3676,11 @@ JNI_METHOD(void, BridgedActionsCluster, enableAction) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2844,13 +3692,23 @@ JNI_METHOD(void, BridgedActionsCluster, enableActionWithDuration) CHIP_ERROR err = CHIP_NO_ERROR; BridgedActionsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::BridgedActions::Commands::EnableActionWithDuration::Type request; - request.actionID = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); - chip::JniReferences::GetInstance().GetOptionalValue(invokeID, invokeID); - request.invokeID = chip::Optional( - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(invokeID))); - request.duration = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(duration)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.actionID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); + if (invokeID != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(invokeID, optionalValue_0); + auto & definedValue_0 = request.invokeID.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(optionalValue_0)); + } + request.duration = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(duration)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2884,6 +3742,11 @@ JNI_METHOD(void, BridgedActionsCluster, enableActionWithDuration) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2894,12 +3757,21 @@ JNI_METHOD(void, BridgedActionsCluster, instantAction) CHIP_ERROR err = CHIP_NO_ERROR; BridgedActionsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::BridgedActions::Commands::InstantAction::Type request; - request.actionID = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); - chip::JniReferences::GetInstance().GetOptionalValue(invokeID, invokeID); - request.invokeID = chip::Optional( - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(invokeID))); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.actionID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); + if (invokeID != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(invokeID, optionalValue_0); + auto & definedValue_0 = request.invokeID.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(optionalValue_0)); + } std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2933,6 +3805,11 @@ JNI_METHOD(void, BridgedActionsCluster, instantAction) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2944,14 +3821,23 @@ JNI_METHOD(void, BridgedActionsCluster, instantActionWithTransition) CHIP_ERROR err = CHIP_NO_ERROR; BridgedActionsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::BridgedActions::Commands::InstantActionWithTransition::Type request; - request.actionID = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); - chip::JniReferences::GetInstance().GetOptionalValue(invokeID, invokeID); - request.invokeID = chip::Optional( - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(invokeID))); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.actionID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); + if (invokeID != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(invokeID, optionalValue_0); + auto & definedValue_0 = request.invokeID.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(optionalValue_0)); + } + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2985,6 +3871,11 @@ JNI_METHOD(void, BridgedActionsCluster, instantActionWithTransition) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2995,12 +3886,21 @@ JNI_METHOD(void, BridgedActionsCluster, pauseAction) CHIP_ERROR err = CHIP_NO_ERROR; BridgedActionsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::BridgedActions::Commands::PauseAction::Type request; - request.actionID = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); - chip::JniReferences::GetInstance().GetOptionalValue(invokeID, invokeID); - request.invokeID = chip::Optional( - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(invokeID))); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.actionID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); + if (invokeID != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(invokeID, optionalValue_0); + auto & definedValue_0 = request.invokeID.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(optionalValue_0)); + } std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3034,6 +3934,11 @@ JNI_METHOD(void, BridgedActionsCluster, pauseAction) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3045,13 +3950,23 @@ JNI_METHOD(void, BridgedActionsCluster, pauseActionWithDuration) CHIP_ERROR err = CHIP_NO_ERROR; BridgedActionsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::BridgedActions::Commands::PauseActionWithDuration::Type request; - request.actionID = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); - chip::JniReferences::GetInstance().GetOptionalValue(invokeID, invokeID); - request.invokeID = chip::Optional( - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(invokeID))); - request.duration = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(duration)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.actionID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); + if (invokeID != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(invokeID, optionalValue_0); + auto & definedValue_0 = request.invokeID.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(optionalValue_0)); + } + request.duration = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(duration)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3085,6 +4000,11 @@ JNI_METHOD(void, BridgedActionsCluster, pauseActionWithDuration) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3095,12 +4015,21 @@ JNI_METHOD(void, BridgedActionsCluster, resumeAction) CHIP_ERROR err = CHIP_NO_ERROR; BridgedActionsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::BridgedActions::Commands::ResumeAction::Type request; - request.actionID = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); - chip::JniReferences::GetInstance().GetOptionalValue(invokeID, invokeID); - request.invokeID = chip::Optional( - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(invokeID))); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.actionID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); + if (invokeID != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(invokeID, optionalValue_0); + auto & definedValue_0 = request.invokeID.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(optionalValue_0)); + } std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3134,6 +4063,11 @@ JNI_METHOD(void, BridgedActionsCluster, resumeAction) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3144,12 +4078,21 @@ JNI_METHOD(void, BridgedActionsCluster, startAction) CHIP_ERROR err = CHIP_NO_ERROR; BridgedActionsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::BridgedActions::Commands::StartAction::Type request; - request.actionID = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); - chip::JniReferences::GetInstance().GetOptionalValue(invokeID, invokeID); - request.invokeID = chip::Optional( - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(invokeID))); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.actionID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); + if (invokeID != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(invokeID, optionalValue_0); + auto & definedValue_0 = request.invokeID.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(optionalValue_0)); + } std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3183,6 +4126,11 @@ JNI_METHOD(void, BridgedActionsCluster, startAction) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3194,13 +4142,23 @@ JNI_METHOD(void, BridgedActionsCluster, startActionWithDuration) CHIP_ERROR err = CHIP_NO_ERROR; BridgedActionsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::BridgedActions::Commands::StartActionWithDuration::Type request; - request.actionID = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); - chip::JniReferences::GetInstance().GetOptionalValue(invokeID, invokeID); - request.invokeID = chip::Optional( - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(invokeID))); - request.duration = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(duration)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.actionID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); + if (invokeID != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(invokeID, optionalValue_0); + auto & definedValue_0 = request.invokeID.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(optionalValue_0)); + } + request.duration = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(duration)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3234,6 +4192,11 @@ JNI_METHOD(void, BridgedActionsCluster, startActionWithDuration) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3244,12 +4207,21 @@ JNI_METHOD(void, BridgedActionsCluster, stopAction) CHIP_ERROR err = CHIP_NO_ERROR; BridgedActionsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::BridgedActions::Commands::StopAction::Type request; - request.actionID = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); - chip::JniReferences::GetInstance().GetOptionalValue(invokeID, invokeID); - request.invokeID = chip::Optional( - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(invokeID))); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.actionID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(actionID)); + if (invokeID != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(invokeID, optionalValue_0); + auto & definedValue_0 = request.invokeID.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(optionalValue_0)); + } std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3283,6 +4255,87 @@ JNI_METHOD(void, BridgedActionsCluster, stopAction) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, BridgedActionsCluster, subscribeActionListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + BridgedActionsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::BridgedActions::Attributes::ActionList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPBridgedActionsActionListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, BridgedActionsCluster, subscribeEndpointListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + BridgedActionsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::BridgedActions::Attributes::EndpointList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPBridgedActionsEndpointListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + onSuccess.release(); onFailure.release(); } @@ -3323,6 +4376,44 @@ JNI_METHOD(void, BridgedActionsCluster, subscribeSetupUrlAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, BridgedActionsCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + BridgedActionsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::BridgedActions::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPBridgedActionsAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, BridgedActionsCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -3369,6 +4460,45 @@ JNI_METHOD(jlong, BridgedDeviceBasicCluster, initWithDevice)(JNIEnv * env, jobje return reinterpret_cast(cppCluster); } +JNI_METHOD(void, BridgedDeviceBasicCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + BridgedDeviceBasicCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::BridgedDeviceBasic::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPBridgedDeviceBasicAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, BridgedDeviceBasicCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -3423,12 +4553,15 @@ JNI_METHOD(void, ChannelCluster, changeChannelByNumberRequest) CHIP_ERROR err = CHIP_NO_ERROR; ChannelCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Channel::Commands::ChangeChannelByNumberRequest::Type request; - request.majorNumber = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(majorNumber)); - request.minorNumber = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(minorNumber)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.majorNumber = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(majorNumber)); + request.minorNumber = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(minorNumber)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3462,6 +4595,11 @@ JNI_METHOD(void, ChannelCluster, changeChannelByNumberRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3472,9 +4610,14 @@ JNI_METHOD(void, ChannelCluster, changeChannelRequest) CHIP_ERROR err = CHIP_NO_ERROR; ChannelCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Channel::Commands::ChangeChannelRequest::Type request; - request.match = chip::JniUtfString(env, static_cast(match)).charSpan(); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto matchJni = chip::Platform::New(env, static_cast(match)); + cleanupStrings.push_back(matchJni); + request.match = matchJni->charSpan(); std::unique_ptr onSuccess(Platform::New(callback), @@ -3510,6 +4653,11 @@ JNI_METHOD(void, ChannelCluster, changeChannelRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3520,9 +4668,13 @@ JNI_METHOD(void, ChannelCluster, skipChannelRequest) CHIP_ERROR err = CHIP_NO_ERROR; ChannelCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Channel::Commands::SkipChannelRequest::Type request; - request.count = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(count)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.count = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(count)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3556,15 +4708,21 @@ JNI_METHOD(void, ChannelCluster, skipChannelRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, ChannelCluster, subscribeClusterRevisionAttribute) +JNI_METHOD(void, ChannelCluster, subscribeChannelListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -3581,14 +4739,14 @@ JNI_METHOD(void, ChannelCluster, subscribeClusterRevisionAttribute) chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::Channel::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = chip::app::Clusters::Channel::Attributes::ChannelList::TypeInfo; auto successFn = - chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), static_cast(maxInterval), - CHIPInt16uAttributeCallback::OnSubscriptionEstablished); + CHIPChannelChannelListAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -3596,13 +4754,88 @@ JNI_METHOD(void, ChannelCluster, subscribeClusterRevisionAttribute) onSuccess.release(); onFailure.release(); } -JNI_METHOD(jlong, ColorControlCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) +JNI_METHOD(void, ChannelCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - ColorControlCluster * cppCluster = new ColorControlCluster(); + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); - return reinterpret_cast(cppCluster); + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ChannelCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::Channel::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPChannelAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, ChannelCluster, subscribeClusterRevisionAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ChannelCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::Channel::Attributes::ClusterRevision::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt16uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(jlong, ColorControlCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) +{ + chip::DeviceLayer::StackLock lock; + ColorControlCluster * cppCluster = new ColorControlCluster(); + + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + return reinterpret_cast(cppCluster); } JNI_METHOD(void, ColorControlCluster, colorLoopSet) @@ -3613,18 +4846,25 @@ JNI_METHOD(void, ColorControlCluster, colorLoopSet) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; - request.updateFlags = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(updateFlags)); - request.action = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(action)); - request.direction = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(direction)); - request.time = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(time)); - request.startHue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(startHue)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.updateFlags = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(updateFlags)); + request.action = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(action)); + request.direction = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(direction)); + request.time = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(time)); + request.startHue = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(startHue)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3658,6 +4898,11 @@ JNI_METHOD(void, ColorControlCluster, colorLoopSet) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3669,14 +4914,19 @@ JNI_METHOD(void, ColorControlCluster, enhancedMoveHue) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type request; - request.moveMode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(moveMode)); - request.rate = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(rate)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.moveMode = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(moveMode)); + request.rate = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(rate)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3710,6 +4960,11 @@ JNI_METHOD(void, ColorControlCluster, enhancedMoveHue) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3721,17 +4976,21 @@ JNI_METHOD(void, ColorControlCluster, enhancedMoveToHue) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type request; - request.enhancedHue = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(enhancedHue)); - request.direction = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(direction)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.enhancedHue = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(enhancedHue)); + request.direction = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(direction)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3765,6 +5024,11 @@ JNI_METHOD(void, ColorControlCluster, enhancedMoveToHue) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3776,18 +5040,21 @@ JNI_METHOD(void, ColorControlCluster, enhancedMoveToHueAndSaturation) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHueAndSaturation::Type request; - request.enhancedHue = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(enhancedHue)); - request.saturation = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(saturation)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.enhancedHue = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(enhancedHue)); + request.saturation = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(saturation)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3821,6 +5088,11 @@ JNI_METHOD(void, ColorControlCluster, enhancedMoveToHueAndSaturation) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3832,16 +5104,21 @@ JNI_METHOD(void, ColorControlCluster, enhancedStepHue) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::EnhancedStepHue::Type request; - request.stepMode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(stepMode)); - request.stepSize = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(stepSize)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.stepMode = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(stepMode)); + request.stepSize = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(stepSize)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3875,6 +5152,11 @@ JNI_METHOD(void, ColorControlCluster, enhancedStepHue) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3886,14 +5168,19 @@ JNI_METHOD(void, ColorControlCluster, moveColor) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::MoveColor::Type request; - request.rateX = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(rateX)); - request.rateY = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(rateY)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.rateX = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(rateX)); + request.rateY = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(rateY)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3927,6 +5214,11 @@ JNI_METHOD(void, ColorControlCluster, moveColor) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3938,18 +5230,23 @@ JNI_METHOD(void, ColorControlCluster, moveColorTemperature) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type request; - request.moveMode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(moveMode)); - request.rate = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(rate)); - request.colorTemperatureMinimum = static_cast( + std::list cleanupByteArrays; + std::list cleanupStrings; + request.moveMode = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(moveMode)); + request.rate = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(rate)); + request.colorTemperatureMinimum = static_cast>( chip::JniReferences::GetInstance().IntegerToPrimitive(colorTemperatureMinimum)); - request.colorTemperatureMaximum = static_cast( + request.colorTemperatureMaximum = static_cast>( chip::JniReferences::GetInstance().IntegerToPrimitive(colorTemperatureMaximum)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3983,6 +5280,11 @@ JNI_METHOD(void, ColorControlCluster, moveColorTemperature) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3994,14 +5296,19 @@ JNI_METHOD(void, ColorControlCluster, moveHue) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::MoveHue::Type request; - request.moveMode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(moveMode)); - request.rate = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(rate)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.moveMode = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(moveMode)); + request.rate = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(rate)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4035,6 +5342,11 @@ JNI_METHOD(void, ColorControlCluster, moveHue) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4046,14 +5358,19 @@ JNI_METHOD(void, ColorControlCluster, moveSaturation) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type request; - request.moveMode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(moveMode)); - request.rate = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(rate)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.moveMode = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(moveMode)); + request.rate = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(rate)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4087,6 +5404,11 @@ JNI_METHOD(void, ColorControlCluster, moveSaturation) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4098,16 +5420,21 @@ JNI_METHOD(void, ColorControlCluster, moveToColor) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::MoveToColor::Type request; - request.colorX = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(colorX)); - request.colorY = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(colorY)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.colorX = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(colorX)); + request.colorY = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(colorY)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4141,6 +5468,11 @@ JNI_METHOD(void, ColorControlCluster, moveToColor) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4152,16 +5484,19 @@ JNI_METHOD(void, ColorControlCluster, moveToColorTemperature) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::Type request; - request.colorTemperature = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(colorTemperature)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.colorTemperature = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(colorTemperature)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4195,6 +5530,11 @@ JNI_METHOD(void, ColorControlCluster, moveToColorTemperature) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4206,16 +5546,21 @@ JNI_METHOD(void, ColorControlCluster, moveToHue) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::MoveToHue::Type request; - request.hue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(hue)); - request.direction = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(direction)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.hue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(hue)); + request.direction = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(direction)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4249,6 +5594,11 @@ JNI_METHOD(void, ColorControlCluster, moveToHue) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4260,17 +5610,21 @@ JNI_METHOD(void, ColorControlCluster, moveToHueAndSaturation) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::MoveToHueAndSaturation::Type request; - request.hue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(hue)); - request.saturation = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(saturation)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.hue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(hue)); + request.saturation = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(saturation)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4304,6 +5658,11 @@ JNI_METHOD(void, ColorControlCluster, moveToHueAndSaturation) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4315,16 +5674,19 @@ JNI_METHOD(void, ColorControlCluster, moveToSaturation) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type request; - request.saturation = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(saturation)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.saturation = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(saturation)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4358,6 +5720,11 @@ JNI_METHOD(void, ColorControlCluster, moveToSaturation) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4369,16 +5736,21 @@ JNI_METHOD(void, ColorControlCluster, stepColor) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::StepColor::Type request; - request.stepX = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(stepX)); - request.stepY = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(stepY)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.stepX = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(stepX)); + request.stepY = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(stepY)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4412,6 +5784,11 @@ JNI_METHOD(void, ColorControlCluster, stepColor) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4424,20 +5801,25 @@ JNI_METHOD(void, ColorControlCluster, stepColorTemperature) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::StepColorTemperature::Type request; - request.stepMode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(stepMode)); - request.stepSize = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(stepSize)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.colorTemperatureMinimum = static_cast( + std::list cleanupByteArrays; + std::list cleanupStrings; + request.stepMode = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(stepMode)); + request.stepSize = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(stepSize)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + request.colorTemperatureMinimum = static_cast>( chip::JniReferences::GetInstance().IntegerToPrimitive(colorTemperatureMinimum)); - request.colorTemperatureMaximum = static_cast( + request.colorTemperatureMaximum = static_cast>( chip::JniReferences::GetInstance().IntegerToPrimitive(colorTemperatureMaximum)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4471,6 +5853,11 @@ JNI_METHOD(void, ColorControlCluster, stepColorTemperature) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4482,16 +5869,21 @@ JNI_METHOD(void, ColorControlCluster, stepHue) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::StepHue::Type request; - request.stepMode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(stepMode)); - request.stepSize = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(stepSize)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.stepMode = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(stepMode)); + request.stepSize = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(stepSize)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4525,6 +5917,11 @@ JNI_METHOD(void, ColorControlCluster, stepHue) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4536,16 +5933,21 @@ JNI_METHOD(void, ColorControlCluster, stepSaturation) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::StepSaturation::Type request; - request.stepMode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(stepMode)); - request.stepSize = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(stepSize)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.stepMode = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(stepMode)); + request.stepSize = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(stepSize)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4579,6 +5981,11 @@ JNI_METHOD(void, ColorControlCluster, stepSaturation) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4590,12 +5997,15 @@ JNI_METHOD(void, ColorControlCluster, stopMoveStep) CHIP_ERROR err = CHIP_NO_ERROR; ColorControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ColorControl::Commands::StopMoveStep::Type request; - request.optionsMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); - request.optionsOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.optionsMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsMask)); + request.optionsOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionsOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4629,6 +6039,11 @@ JNI_METHOD(void, ColorControlCluster, stopMoveStep) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -6560,6 +7975,44 @@ JNI_METHOD(void, ColorControlCluster, subscribeStartUpColorTemperatureMiredsAttr onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, ColorControlCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ColorControlCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ColorControl::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPColorControlAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, ColorControlCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -6607,18 +8060,126 @@ JNI_METHOD(jlong, ContentLauncherCluster, initWithDevice)(JNIEnv * env, jobject } JNI_METHOD(void, ContentLauncherCluster, launchContentRequest) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject autoPlay, jstring data, jobject parameterList, +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject autoPlay, jstring data, jobject search, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; ContentLauncherCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ContentLauncher::Commands::LaunchContentRequest::Type request; - request.autoPlay = static_cast(chip::JniReferences::GetInstance().BooleanToPrimitive(autoPlay)); - request.data = chip::JniUtfString(env, static_cast(data)).charSpan(); - request.search = chip::app::DataModel::List(); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.autoPlay = static_cast>( + chip::JniReferences::GetInstance().BooleanToPrimitive(autoPlay)); + auto dataJni = chip::Platform::New(env, static_cast(data)); + cleanupStrings.push_back(dataJni); + request.data = dataJni->charSpan(); + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint searchSize; + chip::JniReferences::GetInstance().GetArrayListSize(search, searchSize); + if (searchSize != 0) + { + auto * listHolder_0 = new ListHolder(searchSize); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(searchSize); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(search, i_0, element_0); + jobject element_0_parameterListItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "parameterList", "Ljava/util/ArrayList;", + element_0_parameterListItem_1); + { + using ListType_2 = std::remove_reference_tmList[i_0].parameterList)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + jint element_0_parameterListItem_1Size; + chip::JniReferences::GetInstance().GetArrayListSize(element_0_parameterListItem_1, + element_0_parameterListItem_1Size); + if (element_0_parameterListItem_1Size != 0) + { + auto * listHolder_2 = new ListHolder(element_0_parameterListItem_1Size); + listFreer.add(listHolder_2); + + for (size_t i_2 = 0; i_2 < static_cast(element_0_parameterListItem_1Size); ++i_2) + { + jobject element_2; + chip::JniReferences::GetInstance().GetArrayListItem(element_0_parameterListItem_1, i_2, element_2); + jobject element_2_typeItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_2, "type", "Ljava/lang/Integer;", + element_2_typeItem_3); + listHolder_2->mList[i_2].type = + static_castmList[i_2].type)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_2_typeItem_3)); + jobject element_2_valueItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_2, "value", "Ljava/lang/String;", + element_2_valueItem_3); + auto element_2_valueItem_3Jni = + chip::Platform::New(env, static_cast(element_2_valueItem_3)); + cleanupStrings.push_back(element_2_valueItem_3Jni); + listHolder_2->mList[i_2].value = element_2_valueItem_3Jni->charSpan(); + jobject element_2_externalIDListItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_2, "externalIDList", "Ljava/util/ArrayList;", + element_2_externalIDListItem_3); + { + using ListType_4 = std::remove_reference_tmList[i_2].externalIDList)>; + using ListMemberType_4 = ListMemberTypeGetter::Type; + jint element_2_externalIDListItem_3Size; + chip::JniReferences::GetInstance().GetArrayListSize(element_2_externalIDListItem_3, + element_2_externalIDListItem_3Size); + if (element_2_externalIDListItem_3Size != 0) + { + auto * listHolder_4 = new ListHolder(element_2_externalIDListItem_3Size); + listFreer.add(listHolder_4); + + for (size_t i_4 = 0; i_4 < static_cast(element_2_externalIDListItem_3Size); ++i_4) + { + jobject element_4; + chip::JniReferences::GetInstance().GetArrayListItem(element_2_externalIDListItem_3, i_4, + element_4); + jobject element_4_nameItem_5; + chip::JniReferences::GetInstance().GetObjectField(element_4, "name", "Ljava/lang/String;", + element_4_nameItem_5); + auto element_4_nameItem_5Jni = chip::Platform::New( + env, static_cast(element_4_nameItem_5)); + cleanupStrings.push_back(element_4_nameItem_5Jni); + listHolder_4->mList[i_4].name = element_4_nameItem_5Jni->charSpan(); + jobject element_4_valueItem_5; + chip::JniReferences::GetInstance().GetObjectField(element_4, "value", "Ljava/lang/String;", + element_4_valueItem_5); + auto element_4_valueItem_5Jni = chip::Platform::New( + env, static_cast(element_4_valueItem_5)); + cleanupStrings.push_back(element_4_valueItem_5Jni); + listHolder_4->mList[i_4].value = element_4_valueItem_5Jni->charSpan(); + } + listHolder_2->mList[i_2].externalIDList = + ListType_4(listHolder_4->mList, element_2_externalIDListItem_3Size); + } + else + { + listHolder_2->mList[i_2].externalIDList = ListType_4(); + } + } + } + listHolder_0->mList[i_0].parameterList = ListType_2(listHolder_2->mList, element_0_parameterListItem_1Size); + } + else + { + listHolder_0->mList[i_0].parameterList = ListType_2(); + } + } + } + request.search = ListType_0(listHolder_0->mList, searchSize); + } + else + { + request.search = ListType_0(); + } + } std::unique_ptr onSuccess(Platform::New(callback), @@ -6654,22 +8215,248 @@ JNI_METHOD(void, ContentLauncherCluster, launchContentRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } JNI_METHOD(void, ContentLauncherCluster, launchURLRequest) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jstring contentURL, jstring displayString, jstring providerName, - jobject background, jobject logo, jobject progressBar, jobject splash, jobject waterMark, jobject timedInvokeTimeoutMs) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jstring contentURL, jstring displayString, + jobject brandingInformation, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; ContentLauncherCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ContentLauncher::Commands::LaunchURLRequest::Type request; - request.contentURL = chip::JniUtfString(env, static_cast(contentURL)).charSpan(); - request.displayString = chip::JniUtfString(env, static_cast(displayString)).charSpan(); - request.brandingInformation = chip::app::Clusters::ContentLauncher::Structs::BrandingInformation::Type(); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto contentURLJni = chip::Platform::New(env, static_cast(contentURL)); + cleanupStrings.push_back(contentURLJni); + request.contentURL = contentURLJni->charSpan(); + auto displayStringJni = chip::Platform::New(env, static_cast(displayString)); + cleanupStrings.push_back(displayStringJni); + request.displayString = displayStringJni->charSpan(); + jobject brandingInformation_providerNameItem_0; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation, "providerName", "Ljava/lang/String;", + brandingInformation_providerNameItem_0); + auto brandingInformation_providerNameItem_0Jni = + chip::Platform::New(env, static_cast(brandingInformation_providerNameItem_0)); + cleanupStrings.push_back(brandingInformation_providerNameItem_0Jni); + request.brandingInformation.providerName = brandingInformation_providerNameItem_0Jni->charSpan(); + jobject brandingInformation_backgroundItem_0; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation, "background", + "Lchip/devicecontroller/ChipStructs$ContentLauncherClusterStyleInformation;", + brandingInformation_backgroundItem_0); + jobject brandingInformation_backgroundItem_0_imageUrlItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_backgroundItem_0, "imageUrl", "Ljava/lang/String;", + brandingInformation_backgroundItem_0_imageUrlItem_1); + auto brandingInformation_backgroundItem_0_imageUrlItem_1Jni = + chip::Platform::New(env, static_cast(brandingInformation_backgroundItem_0_imageUrlItem_1)); + cleanupStrings.push_back(brandingInformation_backgroundItem_0_imageUrlItem_1Jni); + request.brandingInformation.background.imageUrl = brandingInformation_backgroundItem_0_imageUrlItem_1Jni->charSpan(); + jobject brandingInformation_backgroundItem_0_colorItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_backgroundItem_0, "color", "Ljava/lang/String;", + brandingInformation_backgroundItem_0_colorItem_1); + auto brandingInformation_backgroundItem_0_colorItem_1Jni = + chip::Platform::New(env, static_cast(brandingInformation_backgroundItem_0_colorItem_1)); + cleanupStrings.push_back(brandingInformation_backgroundItem_0_colorItem_1Jni); + request.brandingInformation.background.color = brandingInformation_backgroundItem_0_colorItem_1Jni->charSpan(); + jobject brandingInformation_backgroundItem_0_sizeItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_backgroundItem_0, "size", + "Lchip/devicecontroller/ChipStructs$ContentLauncherClusterDimension;", + brandingInformation_backgroundItem_0_sizeItem_1); + jobject brandingInformation_backgroundItem_0_sizeItem_1_widthItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_backgroundItem_0_sizeItem_1, "width", + "Ljava/lang/Double;", + brandingInformation_backgroundItem_0_sizeItem_1_widthItem_2); + request.brandingInformation.background.size.width = + static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(brandingInformation_backgroundItem_0_sizeItem_1_widthItem_2)); + jobject brandingInformation_backgroundItem_0_sizeItem_1_heightItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_backgroundItem_0_sizeItem_1, "height", + "Ljava/lang/Double;", + brandingInformation_backgroundItem_0_sizeItem_1_heightItem_2); + request.brandingInformation.background.size.height = + static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(brandingInformation_backgroundItem_0_sizeItem_1_heightItem_2)); + jobject brandingInformation_backgroundItem_0_sizeItem_1_metricItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_backgroundItem_0_sizeItem_1, "metric", + "Ljava/lang/Integer;", + brandingInformation_backgroundItem_0_sizeItem_1_metricItem_2); + request.brandingInformation.background.size.metric = + static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(brandingInformation_backgroundItem_0_sizeItem_1_metricItem_2)); + jobject brandingInformation_logoItem_0; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation, "logo", + "Lchip/devicecontroller/ChipStructs$ContentLauncherClusterStyleInformation;", + brandingInformation_logoItem_0); + jobject brandingInformation_logoItem_0_imageUrlItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_logoItem_0, "imageUrl", "Ljava/lang/String;", + brandingInformation_logoItem_0_imageUrlItem_1); + auto brandingInformation_logoItem_0_imageUrlItem_1Jni = + chip::Platform::New(env, static_cast(brandingInformation_logoItem_0_imageUrlItem_1)); + cleanupStrings.push_back(brandingInformation_logoItem_0_imageUrlItem_1Jni); + request.brandingInformation.logo.imageUrl = brandingInformation_logoItem_0_imageUrlItem_1Jni->charSpan(); + jobject brandingInformation_logoItem_0_colorItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_logoItem_0, "color", "Ljava/lang/String;", + brandingInformation_logoItem_0_colorItem_1); + auto brandingInformation_logoItem_0_colorItem_1Jni = + chip::Platform::New(env, static_cast(brandingInformation_logoItem_0_colorItem_1)); + cleanupStrings.push_back(brandingInformation_logoItem_0_colorItem_1Jni); + request.brandingInformation.logo.color = brandingInformation_logoItem_0_colorItem_1Jni->charSpan(); + jobject brandingInformation_logoItem_0_sizeItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_logoItem_0, "size", + "Lchip/devicecontroller/ChipStructs$ContentLauncherClusterDimension;", + brandingInformation_logoItem_0_sizeItem_1); + jobject brandingInformation_logoItem_0_sizeItem_1_widthItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_logoItem_0_sizeItem_1, "width", "Ljava/lang/Double;", + brandingInformation_logoItem_0_sizeItem_1_widthItem_2); + request.brandingInformation.logo.size.width = + static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(brandingInformation_logoItem_0_sizeItem_1_widthItem_2)); + jobject brandingInformation_logoItem_0_sizeItem_1_heightItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_logoItem_0_sizeItem_1, "height", "Ljava/lang/Double;", + brandingInformation_logoItem_0_sizeItem_1_heightItem_2); + request.brandingInformation.logo.size.height = + static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(brandingInformation_logoItem_0_sizeItem_1_heightItem_2)); + jobject brandingInformation_logoItem_0_sizeItem_1_metricItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_logoItem_0_sizeItem_1, "metric", "Ljava/lang/Integer;", + brandingInformation_logoItem_0_sizeItem_1_metricItem_2); + request.brandingInformation.logo.size.metric = + static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(brandingInformation_logoItem_0_sizeItem_1_metricItem_2)); + jobject brandingInformation_progressBarItem_0; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation, "progressBar", + "Lchip/devicecontroller/ChipStructs$ContentLauncherClusterStyleInformation;", + brandingInformation_progressBarItem_0); + jobject brandingInformation_progressBarItem_0_imageUrlItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_progressBarItem_0, "imageUrl", "Ljava/lang/String;", + brandingInformation_progressBarItem_0_imageUrlItem_1); + auto brandingInformation_progressBarItem_0_imageUrlItem_1Jni = + chip::Platform::New(env, static_cast(brandingInformation_progressBarItem_0_imageUrlItem_1)); + cleanupStrings.push_back(brandingInformation_progressBarItem_0_imageUrlItem_1Jni); + request.brandingInformation.progressBar.imageUrl = brandingInformation_progressBarItem_0_imageUrlItem_1Jni->charSpan(); + jobject brandingInformation_progressBarItem_0_colorItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_progressBarItem_0, "color", "Ljava/lang/String;", + brandingInformation_progressBarItem_0_colorItem_1); + auto brandingInformation_progressBarItem_0_colorItem_1Jni = + chip::Platform::New(env, static_cast(brandingInformation_progressBarItem_0_colorItem_1)); + cleanupStrings.push_back(brandingInformation_progressBarItem_0_colorItem_1Jni); + request.brandingInformation.progressBar.color = brandingInformation_progressBarItem_0_colorItem_1Jni->charSpan(); + jobject brandingInformation_progressBarItem_0_sizeItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_progressBarItem_0, "size", + "Lchip/devicecontroller/ChipStructs$ContentLauncherClusterDimension;", + brandingInformation_progressBarItem_0_sizeItem_1); + jobject brandingInformation_progressBarItem_0_sizeItem_1_widthItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_progressBarItem_0_sizeItem_1, "width", + "Ljava/lang/Double;", + brandingInformation_progressBarItem_0_sizeItem_1_widthItem_2); + request.brandingInformation.progressBar.size.width = + static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(brandingInformation_progressBarItem_0_sizeItem_1_widthItem_2)); + jobject brandingInformation_progressBarItem_0_sizeItem_1_heightItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_progressBarItem_0_sizeItem_1, "height", + "Ljava/lang/Double;", + brandingInformation_progressBarItem_0_sizeItem_1_heightItem_2); + request.brandingInformation.progressBar.size.height = + static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(brandingInformation_progressBarItem_0_sizeItem_1_heightItem_2)); + jobject brandingInformation_progressBarItem_0_sizeItem_1_metricItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_progressBarItem_0_sizeItem_1, "metric", + "Ljava/lang/Integer;", + brandingInformation_progressBarItem_0_sizeItem_1_metricItem_2); + request.brandingInformation.progressBar.size.metric = + static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(brandingInformation_progressBarItem_0_sizeItem_1_metricItem_2)); + jobject brandingInformation_splashItem_0; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation, "splash", + "Lchip/devicecontroller/ChipStructs$ContentLauncherClusterStyleInformation;", + brandingInformation_splashItem_0); + jobject brandingInformation_splashItem_0_imageUrlItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_splashItem_0, "imageUrl", "Ljava/lang/String;", + brandingInformation_splashItem_0_imageUrlItem_1); + auto brandingInformation_splashItem_0_imageUrlItem_1Jni = + chip::Platform::New(env, static_cast(brandingInformation_splashItem_0_imageUrlItem_1)); + cleanupStrings.push_back(brandingInformation_splashItem_0_imageUrlItem_1Jni); + request.brandingInformation.splash.imageUrl = brandingInformation_splashItem_0_imageUrlItem_1Jni->charSpan(); + jobject brandingInformation_splashItem_0_colorItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_splashItem_0, "color", "Ljava/lang/String;", + brandingInformation_splashItem_0_colorItem_1); + auto brandingInformation_splashItem_0_colorItem_1Jni = + chip::Platform::New(env, static_cast(brandingInformation_splashItem_0_colorItem_1)); + cleanupStrings.push_back(brandingInformation_splashItem_0_colorItem_1Jni); + request.brandingInformation.splash.color = brandingInformation_splashItem_0_colorItem_1Jni->charSpan(); + jobject brandingInformation_splashItem_0_sizeItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_splashItem_0, "size", + "Lchip/devicecontroller/ChipStructs$ContentLauncherClusterDimension;", + brandingInformation_splashItem_0_sizeItem_1); + jobject brandingInformation_splashItem_0_sizeItem_1_widthItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_splashItem_0_sizeItem_1, "width", "Ljava/lang/Double;", + brandingInformation_splashItem_0_sizeItem_1_widthItem_2); + request.brandingInformation.splash.size.width = + static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(brandingInformation_splashItem_0_sizeItem_1_widthItem_2)); + jobject brandingInformation_splashItem_0_sizeItem_1_heightItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_splashItem_0_sizeItem_1, "height", "Ljava/lang/Double;", + brandingInformation_splashItem_0_sizeItem_1_heightItem_2); + request.brandingInformation.splash.size.height = + static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(brandingInformation_splashItem_0_sizeItem_1_heightItem_2)); + jobject brandingInformation_splashItem_0_sizeItem_1_metricItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_splashItem_0_sizeItem_1, "metric", "Ljava/lang/Integer;", + brandingInformation_splashItem_0_sizeItem_1_metricItem_2); + request.brandingInformation.splash.size.metric = + static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(brandingInformation_splashItem_0_sizeItem_1_metricItem_2)); + jobject brandingInformation_waterMarkItem_0; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation, "waterMark", + "Lchip/devicecontroller/ChipStructs$ContentLauncherClusterStyleInformation;", + brandingInformation_waterMarkItem_0); + jobject brandingInformation_waterMarkItem_0_imageUrlItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_waterMarkItem_0, "imageUrl", "Ljava/lang/String;", + brandingInformation_waterMarkItem_0_imageUrlItem_1); + auto brandingInformation_waterMarkItem_0_imageUrlItem_1Jni = + chip::Platform::New(env, static_cast(brandingInformation_waterMarkItem_0_imageUrlItem_1)); + cleanupStrings.push_back(brandingInformation_waterMarkItem_0_imageUrlItem_1Jni); + request.brandingInformation.waterMark.imageUrl = brandingInformation_waterMarkItem_0_imageUrlItem_1Jni->charSpan(); + jobject brandingInformation_waterMarkItem_0_colorItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_waterMarkItem_0, "color", "Ljava/lang/String;", + brandingInformation_waterMarkItem_0_colorItem_1); + auto brandingInformation_waterMarkItem_0_colorItem_1Jni = + chip::Platform::New(env, static_cast(brandingInformation_waterMarkItem_0_colorItem_1)); + cleanupStrings.push_back(brandingInformation_waterMarkItem_0_colorItem_1Jni); + request.brandingInformation.waterMark.color = brandingInformation_waterMarkItem_0_colorItem_1Jni->charSpan(); + jobject brandingInformation_waterMarkItem_0_sizeItem_1; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_waterMarkItem_0, "size", + "Lchip/devicecontroller/ChipStructs$ContentLauncherClusterDimension;", + brandingInformation_waterMarkItem_0_sizeItem_1); + jobject brandingInformation_waterMarkItem_0_sizeItem_1_widthItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_waterMarkItem_0_sizeItem_1, "width", "Ljava/lang/Double;", + brandingInformation_waterMarkItem_0_sizeItem_1_widthItem_2); + request.brandingInformation.waterMark.size.width = + static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(brandingInformation_waterMarkItem_0_sizeItem_1_widthItem_2)); + jobject brandingInformation_waterMarkItem_0_sizeItem_1_heightItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_waterMarkItem_0_sizeItem_1, "height", + "Ljava/lang/Double;", + brandingInformation_waterMarkItem_0_sizeItem_1_heightItem_2); + request.brandingInformation.waterMark.size.height = + static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(brandingInformation_waterMarkItem_0_sizeItem_1_heightItem_2)); + jobject brandingInformation_waterMarkItem_0_sizeItem_1_metricItem_2; + chip::JniReferences::GetInstance().GetObjectField(brandingInformation_waterMarkItem_0_sizeItem_1, "metric", + "Ljava/lang/Integer;", + brandingInformation_waterMarkItem_0_sizeItem_1_metricItem_2); + request.brandingInformation.waterMark.size.metric = + static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(brandingInformation_waterMarkItem_0_sizeItem_1_metricItem_2)); std::unique_ptr onSuccess(Platform::New(callback), @@ -6705,6 +8492,50 @@ JNI_METHOD(void, ContentLauncherCluster, launchURLRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, ContentLauncherCluster, subscribeAcceptHeaderListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ContentLauncherCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ContentLauncher::Attributes::AcceptHeaderList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPContentLauncherAcceptHeaderListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + onSuccess.release(); onFailure.release(); } @@ -6746,6 +8577,45 @@ JNI_METHOD(void, ContentLauncherCluster, subscribeSupportedStreamingProtocolsAtt onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, ContentLauncherCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ContentLauncherCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ContentLauncher::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPContentLauncherAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, ContentLauncherCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -6792,12 +8662,13 @@ JNI_METHOD(jlong, DescriptorCluster, initWithDevice)(JNIEnv * env, jobject self, return reinterpret_cast(cppCluster); } -JNI_METHOD(void, DescriptorCluster, subscribeClusterRevisionAttribute) +JNI_METHOD(void, DescriptorCluster, subscribeDeviceListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -6814,14 +8685,14 @@ JNI_METHOD(void, DescriptorCluster, subscribeClusterRevisionAttribute) chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::Descriptor::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = chip::app::Clusters::Descriptor::Attributes::DeviceList::TypeInfo; auto successFn = - chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), static_cast(maxInterval), - CHIPInt16uAttributeCallback::OnSubscriptionEstablished); + CHIPDescriptorDeviceListAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -6829,88 +8700,337 @@ JNI_METHOD(void, DescriptorCluster, subscribeClusterRevisionAttribute) onSuccess.release(); onFailure.release(); } -JNI_METHOD(jlong, DiagnosticLogsCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) -{ - chip::DeviceLayer::StackLock lock; - DiagnosticLogsCluster * cppCluster = new DiagnosticLogsCluster(); - - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); - return reinterpret_cast(cppCluster); -} - -JNI_METHOD(void, DiagnosticLogsCluster, retrieveLogsRequest) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject intent, jobject requestedProtocol, - jbyteArray transferFileDesignator, jobject timedInvokeTimeoutMs) +JNI_METHOD(void, DescriptorCluster, subscribeServerListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - CHIP_ERROR err = CHIP_NO_ERROR; - DiagnosticLogsCluster * cppCluster; - - chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Type request; - - request.intent = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(intent)); - request.requestedProtocol = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(requestedProtocol)); - request.transferFileDesignator = chip::JniByteArray(env, static_cast(transferFileDesignator)).byteSpan(); + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); - std::unique_ptr - onSuccess(Platform::New(callback), - Platform::Delete); std::unique_ptr onFailure( - Platform::New(callback), Platform::Delete); - VerifyOrReturn(onSuccess.get() != nullptr, - AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( - env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + Platform::New(callback), chip::Platform::Delete); VerifyOrReturn(onFailure.get() != nullptr, - AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( - env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); - cppCluster = reinterpret_cast(clusterPtr); + CHIP_ERROR err = CHIP_NO_ERROR; + DescriptorCluster * cppCluster = reinterpret_cast(clusterPtr); VerifyOrReturn(cppCluster != nullptr, - AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( - env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE)); + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + using TypeInfo = chip::app::Clusters::Descriptor::Attributes::ServerList::TypeInfo; auto successFn = - chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); - if (timedInvokeTimeoutMs == nullptr) - { - err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall); - } - else - { - err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall, - chip::JniReferences::GetInstance().IntegerToPrimitive(timedInvokeTimeoutMs)); - } + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPDescriptorServerListAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, - AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", - CHIP_ERROR_INCORRECT_STATE)); + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); onSuccess.release(); onFailure.release(); } -JNI_METHOD(jlong, DoorLockCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) +JNI_METHOD(void, DescriptorCluster, subscribeClientListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - DoorLockCluster * cppCluster = new DoorLockCluster(); - - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); - return reinterpret_cast(cppCluster); -} + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + DescriptorCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::Descriptor::Attributes::ClientList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPDescriptorClientListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, DescriptorCluster, subscribePartsListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + DescriptorCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::Descriptor::Attributes::PartsList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPDescriptorPartsListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, DescriptorCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + DescriptorCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::Descriptor::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPDescriptorAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, DescriptorCluster, subscribeClusterRevisionAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + DescriptorCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::Descriptor::Attributes::ClusterRevision::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt16uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(jlong, DiagnosticLogsCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) +{ + chip::DeviceLayer::StackLock lock; + DiagnosticLogsCluster * cppCluster = new DiagnosticLogsCluster(); + + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + return reinterpret_cast(cppCluster); +} + +JNI_METHOD(void, DiagnosticLogsCluster, retrieveLogsRequest) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject intent, jobject requestedProtocol, + jbyteArray transferFileDesignator, jobject timedInvokeTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + CHIP_ERROR err = CHIP_NO_ERROR; + DiagnosticLogsCluster * cppCluster; + + ListFreer listFreer; + chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Type request; + + std::list cleanupByteArrays; + std::list cleanupStrings; + request.intent = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(intent)); + request.requestedProtocol = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(requestedProtocol)); + auto transferFileDesignatorJni = chip::Platform::New(env, static_cast(transferFileDesignator)); + cleanupByteArrays.push_back(transferFileDesignatorJni); + request.transferFileDesignator = transferFileDesignatorJni->byteSpan(); + + std::unique_ptr + onSuccess(Platform::New(callback), + Platform::Delete); + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + VerifyOrReturn(onFailure.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + + cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedInvokeTimeoutMs == nullptr) + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedInvokeTimeoutMs)); + } + VerifyOrReturn(err == CHIP_NO_ERROR, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, DiagnosticLogsCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + DiagnosticLogsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::DiagnosticLogs::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPDiagnosticLogsAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(jlong, DoorLockCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) +{ + chip::DeviceLayer::StackLock lock; + DoorLockCluster * cppCluster = new DoorLockCluster(); + + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + return reinterpret_cast(cppCluster); +} JNI_METHOD(void, DoorLockCluster, clearCredential) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject credentialType, jobject credentialIndex, - jobject timedInvokeTimeoutMs) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject credential, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; DoorLockCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::ClearCredential::Type request; - request.credential = chip::app::Clusters::DoorLock::Structs::DlCredential::Type(); + std::list cleanupByteArrays; + std::list cleanupStrings; + jobject credential_credentialTypeItem_0; + chip::JniReferences::GetInstance().GetObjectField(credential, "credentialType", "Ljava/lang/Integer;", + credential_credentialTypeItem_0); + request.credential.credentialType = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(credential_credentialTypeItem_0)); + jobject credential_credentialIndexItem_0; + chip::JniReferences::GetInstance().GetObjectField(credential, "credentialIndex", "Ljava/lang/Integer;", + credential_credentialIndexItem_0); + request.credential.credentialIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(credential_credentialIndexItem_0)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -6944,6 +9064,11 @@ JNI_METHOD(void, DoorLockCluster, clearCredential) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -6954,9 +9079,13 @@ JNI_METHOD(void, DoorLockCluster, clearUser) CHIP_ERROR err = CHIP_NO_ERROR; DoorLockCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::ClearUser::Type request; - request.userIndex = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(userIndex)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.userIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(userIndex)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -6990,20 +9119,36 @@ JNI_METHOD(void, DoorLockCluster, clearUser) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } JNI_METHOD(void, DoorLockCluster, getCredentialStatus) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject credentialType, jobject credentialIndex, - jobject timedInvokeTimeoutMs) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject credential, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; DoorLockCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type request; - request.credential = chip::app::Clusters::DoorLock::Structs::DlCredential::Type(); + std::list cleanupByteArrays; + std::list cleanupStrings; + jobject credential_credentialTypeItem_0; + chip::JniReferences::GetInstance().GetObjectField(credential, "credentialType", "Ljava/lang/Integer;", + credential_credentialTypeItem_0); + request.credential.credentialType = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(credential_credentialTypeItem_0)); + jobject credential_credentialIndexItem_0; + chip::JniReferences::GetInstance().GetObjectField(credential, "credentialIndex", "Ljava/lang/Integer;", + credential_credentialIndexItem_0); + request.credential.credentialIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(credential_credentialIndexItem_0)); std::unique_ptr @@ -7040,6 +9185,11 @@ JNI_METHOD(void, DoorLockCluster, getCredentialStatus) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -7050,9 +9200,13 @@ JNI_METHOD(void, DoorLockCluster, getUser) CHIP_ERROR err = CHIP_NO_ERROR; DoorLockCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::GetUser::Type request; - request.userIndex = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(userIndex)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.userIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(userIndex)); std::unique_ptr onSuccess( Platform::New(callback), @@ -7087,6 +9241,11 @@ JNI_METHOD(void, DoorLockCluster, getUser) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -7097,10 +9256,20 @@ JNI_METHOD(void, DoorLockCluster, lockDoor) CHIP_ERROR err = CHIP_NO_ERROR; DoorLockCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::LockDoor::Type request; - chip::JniReferences::GetInstance().GetOptionalValue(pinCode, pinCode); - request.pinCode = chip::Optional(chip::JniByteArray(env, static_cast(pinCode)).byteSpan()); + std::list cleanupByteArrays; + std::list cleanupStrings; + if (pinCode != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(pinCode, optionalValue_0); + auto & definedValue_0 = request.pinCode.Emplace(); + auto optionalValue_0Jni = chip::Platform::New(env, static_cast(optionalValue_0)); + cleanupByteArrays.push_back(optionalValue_0Jni); + definedValue_0 = optionalValue_0Jni->byteSpan(); + } std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -7134,26 +9303,46 @@ JNI_METHOD(void, DoorLockCluster, lockDoor) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } JNI_METHOD(void, DoorLockCluster, setCredential) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject operationType, jobject credentialType, - jobject credentialIndex, jbyteArray credentialData, jobject userIndex, jobject userStatus, jobject timedInvokeTimeoutMs) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject operationType, jobject credential, + jbyteArray credentialData, jobject userIndex, jobject userStatus, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; DoorLockCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::SetCredential::Type request; - request.operationType = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(operationType)); - request.credential = chip::app::Clusters::DoorLock::Structs::DlCredential::Type(); - request.credentialData = chip::JniByteArray(env, static_cast(credentialData)).byteSpan(); - request.userIndex = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(userIndex)); - request.userStatus = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(userStatus)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.operationType = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(operationType)); + jobject credential_credentialTypeItem_0; + chip::JniReferences::GetInstance().GetObjectField(credential, "credentialType", "Ljava/lang/Integer;", + credential_credentialTypeItem_0); + request.credential.credentialType = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(credential_credentialTypeItem_0)); + jobject credential_credentialIndexItem_0; + chip::JniReferences::GetInstance().GetObjectField(credential, "credentialIndex", "Ljava/lang/Integer;", + credential_credentialIndexItem_0); + request.credential.credentialIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(credential_credentialIndexItem_0)); + auto credentialDataJni = chip::Platform::New(env, static_cast(credentialData)); + cleanupByteArrays.push_back(credentialDataJni); + request.credentialData = credentialDataJni->byteSpan(); + request.userIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(userIndex)); + request.userStatus = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(userStatus)); std::unique_ptr onSuccess(Platform::New(callback), @@ -7189,6 +9378,11 @@ JNI_METHOD(void, DoorLockCluster, setCredential) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -7200,30 +9394,42 @@ JNI_METHOD(void, DoorLockCluster, setUser) CHIP_ERROR err = CHIP_NO_ERROR; DoorLockCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::SetUser::Type request; - request.operationType = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(operationType)); - request.userIndex = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(userIndex)); - chip::CharSpan userNameValue; - if (userName != nullptr) + std::list cleanupByteArrays; + std::list cleanupStrings; + request.operationType = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(operationType)); + request.userIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(userIndex)); + if (userName == nullptr) + { + request.userName.SetNull(); + } + else + { + auto & nonNullValue_0 = request.userName.SetNonNull(); + auto userNameJni = chip::Platform::New(env, static_cast(userName)); + cleanupStrings.push_back(userNameJni); + nonNullValue_0 = userNameJni->charSpan(); + } + if (userUniqueId == nullptr) { - userNameValue = chip::JniUtfString(env, static_cast(userName)).charSpan(); + request.userUniqueId.SetNull(); } - request.userName = userName == nullptr ? chip::app::DataModel::Nullable() - : chip::app::DataModel::Nullable(userNameValue); - uint32_t userUniqueIdValue; - if (userUniqueId != nullptr) + else { - userUniqueIdValue = chip::JniReferences::GetInstance().LongToPrimitive(userUniqueId); + auto & nonNullValue_0 = request.userUniqueId.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(userUniqueId)); } - request.userUniqueId = userUniqueId == nullptr ? chip::app::DataModel::Nullable() - : chip::app::DataModel::Nullable(userUniqueIdValue); - request.userStatus = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(userStatus)); - request.userType = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(userType)); - request.credentialRule = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(credentialRule)); + request.userStatus = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(userStatus)); + request.userType = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(userType)); + request.credentialRule = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(credentialRule)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -7257,6 +9463,11 @@ JNI_METHOD(void, DoorLockCluster, setUser) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -7267,10 +9478,20 @@ JNI_METHOD(void, DoorLockCluster, unlockDoor) CHIP_ERROR err = CHIP_NO_ERROR; DoorLockCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type request; - chip::JniReferences::GetInstance().GetOptionalValue(pinCode, pinCode); - request.pinCode = chip::Optional(chip::JniByteArray(env, static_cast(pinCode)).byteSpan()); + std::list cleanupByteArrays; + std::list cleanupStrings; + if (pinCode != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(pinCode, optionalValue_0); + auto & definedValue_0 = request.pinCode.Emplace(); + auto optionalValue_0Jni = chip::Platform::New(env, static_cast(optionalValue_0)); + cleanupByteArrays.push_back(optionalValue_0Jni); + definedValue_0 = optionalValue_0Jni->byteSpan(); + } std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -7304,6 +9525,11 @@ JNI_METHOD(void, DoorLockCluster, unlockDoor) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -7901,12 +10127,13 @@ JNI_METHOD(void, DoorLockCluster, subscribeWrongCodeEntryLimitAttribute) onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, DoorLockCluster, subscribeClusterRevisionAttribute) +JNI_METHOD(void, DoorLockCluster, subscribeAttributeListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -7923,14 +10150,14 @@ JNI_METHOD(void, DoorLockCluster, subscribeClusterRevisionAttribute) chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::DoorLock::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = chip::app::Clusters::DoorLock::Attributes::AttributeList::TypeInfo; auto successFn = - chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), static_cast(maxInterval), - CHIPInt16uAttributeCallback::OnSubscriptionEstablished); + CHIPDoorLockAttributeListAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -7938,10 +10165,47 @@ JNI_METHOD(void, DoorLockCluster, subscribeClusterRevisionAttribute) onSuccess.release(); onFailure.release(); } -JNI_METHOD(jlong, ElectricalMeasurementCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) +JNI_METHOD(void, DoorLockCluster, subscribeClusterRevisionAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - ElectricalMeasurementCluster * cppCluster = new ElectricalMeasurementCluster(); + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + DoorLockCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::DoorLock::Attributes::ClusterRevision::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt16uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(jlong, ElectricalMeasurementCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) +{ + chip::DeviceLayer::StackLock lock; + ElectricalMeasurementCluster * cppCluster = new ElectricalMeasurementCluster(); cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); @@ -8355,6 +10619,45 @@ JNI_METHOD(void, ElectricalMeasurementCluster, subscribeActivePowerMaxAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, ElectricalMeasurementCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ElectricalMeasurementCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ElectricalMeasurement::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPElectricalMeasurementAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, ElectricalMeasurementCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -8408,8 +10711,12 @@ JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, resetCounts) CHIP_ERROR err = CHIP_NO_ERROR; EthernetNetworkDiagnosticsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::EthernetNetworkDiagnostics::Commands::ResetCounts::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -8442,6 +10749,11 @@ JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, resetCounts) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -8784,6 +11096,47 @@ JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, subscribeTimeSinceResetAttri onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + EthernetNetworkDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPEthernetNetworkDiagnosticsAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, subscribeFeatureMapAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -8868,6 +11221,82 @@ JNI_METHOD(jlong, FixedLabelCluster, initWithDevice)(JNIEnv * env, jobject self, return reinterpret_cast(cppCluster); } +JNI_METHOD(void, FixedLabelCluster, subscribeLabelListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + FixedLabelCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::FixedLabel::Attributes::LabelList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPFixedLabelLabelListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, FixedLabelCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + FixedLabelCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::FixedLabel::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPFixedLabelAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, FixedLabelCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -9062,6 +11491,45 @@ JNI_METHOD(void, FlowMeasurementCluster, subscribeToleranceAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, FlowMeasurementCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + FlowMeasurementCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::FlowMeasurement::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPFlowMeasurementAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, FlowMeasurementCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -9116,12 +11584,17 @@ JNI_METHOD(void, GeneralCommissioningCluster, armFailSafe) CHIP_ERROR err = CHIP_NO_ERROR; GeneralCommissioningCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type request; - request.expiryLengthSeconds = static_cast( + std::list cleanupByteArrays; + std::list cleanupStrings; + request.expiryLengthSeconds = static_cast>( chip::JniReferences::GetInstance().IntegerToPrimitive(expiryLengthSeconds)); - request.breadcrumb = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); - request.timeoutMs = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(timeoutMs)); + request.breadcrumb = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); + request.timeoutMs = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(timeoutMs)); std::unique_ptr @@ -9158,6 +11631,11 @@ JNI_METHOD(void, GeneralCommissioningCluster, armFailSafe) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -9168,8 +11646,12 @@ JNI_METHOD(void, GeneralCommissioningCluster, commissioningComplete) CHIP_ERROR err = CHIP_NO_ERROR; GeneralCommissioningCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::GeneralCommissioning::Commands::CommissioningComplete::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess(Platform::New(callback), @@ -9206,6 +11688,11 @@ JNI_METHOD(void, GeneralCommissioningCluster, commissioningComplete) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -9217,12 +11704,20 @@ JNI_METHOD(void, GeneralCommissioningCluster, setRegulatoryConfig) CHIP_ERROR err = CHIP_NO_ERROR; GeneralCommissioningCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfig::Type request; - request.location = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(location)); - request.countryCode = chip::JniUtfString(env, static_cast(countryCode)).charSpan(); - request.breadcrumb = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); - request.timeoutMs = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(timeoutMs)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.location = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(location)); + auto countryCodeJni = chip::Platform::New(env, static_cast(countryCode)); + cleanupStrings.push_back(countryCodeJni); + request.countryCode = countryCodeJni->charSpan(); + request.breadcrumb = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); + request.timeoutMs = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(timeoutMs)); std::unique_ptr @@ -9260,6 +11755,11 @@ JNI_METHOD(void, GeneralCommissioningCluster, setRegulatoryConfig) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -9300,6 +11800,47 @@ JNI_METHOD(void, GeneralCommissioningCluster, subscribeBreadcrumbAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, GeneralCommissioningCluster, subscribeBasicCommissioningInfoListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + GeneralCommissioningCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::GeneralCommissioning::Attributes::BasicCommissioningInfoList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPGeneralCommissioningBasicCommissioningInfoListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, GeneralCommissioningCluster, subscribeRegulatoryConfigAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -9375,12 +11916,14 @@ JNI_METHOD(void, GeneralCommissioningCluster, subscribeLocationCapabilityAttribu onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, GeneralCommissioningCluster, subscribeClusterRevisionAttribute) +JNI_METHOD(void, GeneralCommissioningCluster, subscribeAttributeListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -9397,14 +11940,14 @@ JNI_METHOD(void, GeneralCommissioningCluster, subscribeClusterRevisionAttribute) chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::GeneralCommissioning::Attributes::ClusterRevision::TypeInfo; - auto successFn = chip::Callback::Callback::FromCancelable( + using TypeInfo = chip::app::Clusters::GeneralCommissioning::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); - err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, - static_cast(minInterval), static_cast(maxInterval), - CHIPInt16uAttributeCallback::OnSubscriptionEstablished); + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPGeneralCommissioningAttributeListAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -9412,16 +11955,7 @@ JNI_METHOD(void, GeneralCommissioningCluster, subscribeClusterRevisionAttribute) onSuccess.release(); onFailure.release(); } -JNI_METHOD(jlong, GeneralDiagnosticsCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) -{ - chip::DeviceLayer::StackLock lock; - GeneralDiagnosticsCluster * cppCluster = new GeneralDiagnosticsCluster(); - - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); - return reinterpret_cast(cppCluster); -} - -JNI_METHOD(void, GeneralDiagnosticsCluster, subscribeRebootCountAttribute) +JNI_METHOD(void, GeneralCommissioningCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; @@ -9437,15 +11971,100 @@ JNI_METHOD(void, GeneralDiagnosticsCluster, subscribeRebootCountAttribute) chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); - CHIP_ERROR err = CHIP_NO_ERROR; - GeneralDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + CHIP_ERROR err = CHIP_NO_ERROR; + GeneralCommissioningCluster * cppCluster = reinterpret_cast(clusterPtr); VerifyOrReturn(cppCluster != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::RebootCount::TypeInfo; - auto successFn = chip::Callback::Callback::FromCancelable( - onSuccess->Cancel()); + using TypeInfo = chip::app::Clusters::GeneralCommissioning::Attributes::ClusterRevision::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt16uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(jlong, GeneralDiagnosticsCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) +{ + chip::DeviceLayer::StackLock lock; + GeneralDiagnosticsCluster * cppCluster = new GeneralDiagnosticsCluster(); + + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + return reinterpret_cast(cppCluster); +} + +JNI_METHOD(void, GeneralDiagnosticsCluster, subscribeNetworkInterfacesAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + GeneralDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::NetworkInterfaces::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPGeneralDiagnosticsNetworkInterfacesAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, GeneralDiagnosticsCluster, subscribeRebootCountAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + GeneralDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::RebootCount::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, @@ -9570,6 +12189,164 @@ JNI_METHOD(void, GeneralDiagnosticsCluster, subscribeBootReasonsAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, GeneralDiagnosticsCluster, subscribeActiveHardwareFaultsAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + GeneralDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveHardwareFaults::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPGeneralDiagnosticsActiveHardwareFaultsAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, GeneralDiagnosticsCluster, subscribeActiveRadioFaultsAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + GeneralDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveRadioFaults::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPGeneralDiagnosticsActiveRadioFaultsAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, GeneralDiagnosticsCluster, subscribeActiveNetworkFaultsAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + GeneralDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveNetworkFaults::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPGeneralDiagnosticsActiveNetworkFaultsAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, GeneralDiagnosticsCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + GeneralDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::GeneralDiagnostics::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPGeneralDiagnosticsAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, GeneralDiagnosticsCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -9623,10 +12400,13 @@ JNI_METHOD(void, GroupKeyManagementCluster, keySetRead) CHIP_ERROR err = CHIP_NO_ERROR; GroupKeyManagementCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type request; - request.groupKeySetID = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupKeySetID)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.groupKeySetID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupKeySetID)); std::unique_ptr @@ -9663,6 +12443,11 @@ JNI_METHOD(void, GroupKeyManagementCluster, keySetRead) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -9673,9 +12458,35 @@ JNI_METHOD(void, GroupKeyManagementCluster, keySetReadAllIndices) CHIP_ERROR err = CHIP_NO_ERROR; GroupKeyManagementCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndices::Type request; - request.groupKeySetIDs = chip::app::DataModel::List(); + std::list cleanupByteArrays; + std::list cleanupStrings; + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint groupKeySetIDsSize; + chip::JniReferences::GetInstance().GetArrayListSize(groupKeySetIDs, groupKeySetIDsSize); + if (groupKeySetIDsSize != 0) + { + auto * listHolder_0 = new ListHolder(groupKeySetIDsSize); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(groupKeySetIDsSize); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(groupKeySetIDs, i_0, element_0); + listHolder_0->mList[i_0] = static_castmList[i_0])>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0)); + } + request.groupKeySetIDs = ListType_0(listHolder_0->mList, groupKeySetIDsSize); + } + else + { + request.groupKeySetIDs = ListType_0(); + } + } std::unique_ptr @@ -9713,6 +12524,11 @@ JNI_METHOD(void, GroupKeyManagementCluster, keySetReadAllIndices) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -9723,10 +12539,13 @@ JNI_METHOD(void, GroupKeyManagementCluster, keySetRemove) CHIP_ERROR err = CHIP_NO_ERROR; GroupKeyManagementCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type request; - request.groupKeySetID = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupKeySetID)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.groupKeySetID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupKeySetID)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -9760,21 +12579,69 @@ JNI_METHOD(void, GroupKeyManagementCluster, keySetRemove) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } JNI_METHOD(void, GroupKeyManagementCluster, keySetWrite) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject groupKeySetID, jobject securityPolicy, - jbyteArray epochKey0, jobject epochStartTime0, jbyteArray epochKey1, jobject epochStartTime1, jbyteArray epochKey2, - jobject epochStartTime2, jobject timedInvokeTimeoutMs) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject groupKeySet, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; GroupKeyManagementCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type request; - request.groupKeySet = chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySet::Type(); + std::list cleanupByteArrays; + std::list cleanupStrings; + jobject groupKeySet_groupKeySetIDItem_0; + chip::JniReferences::GetInstance().GetObjectField(groupKeySet, "groupKeySetID", "Ljava/lang/Integer;", + groupKeySet_groupKeySetIDItem_0); + request.groupKeySet.groupKeySetID = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupKeySet_groupKeySetIDItem_0)); + jobject groupKeySet_securityPolicyItem_0; + chip::JniReferences::GetInstance().GetObjectField(groupKeySet, "securityPolicy", "Ljava/lang/Integer;", + groupKeySet_securityPolicyItem_0); + request.groupKeySet.securityPolicy = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupKeySet_securityPolicyItem_0)); + jobject groupKeySet_epochKey0Item_0; + chip::JniReferences::GetInstance().GetObjectField(groupKeySet, "epochKey0", "[B", groupKeySet_epochKey0Item_0); + auto groupKeySet_epochKey0Item_0Jni = + chip::Platform::New(env, static_cast(groupKeySet_epochKey0Item_0)); + cleanupByteArrays.push_back(groupKeySet_epochKey0Item_0Jni); + request.groupKeySet.epochKey0 = groupKeySet_epochKey0Item_0Jni->byteSpan(); + jobject groupKeySet_epochStartTime0Item_0; + chip::JniReferences::GetInstance().GetObjectField(groupKeySet, "epochStartTime0", "Ljava/lang/Long;", + groupKeySet_epochStartTime0Item_0); + request.groupKeySet.epochStartTime0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(groupKeySet_epochStartTime0Item_0)); + jobject groupKeySet_epochKey1Item_0; + chip::JniReferences::GetInstance().GetObjectField(groupKeySet, "epochKey1", "[B", groupKeySet_epochKey1Item_0); + auto groupKeySet_epochKey1Item_0Jni = + chip::Platform::New(env, static_cast(groupKeySet_epochKey1Item_0)); + cleanupByteArrays.push_back(groupKeySet_epochKey1Item_0Jni); + request.groupKeySet.epochKey1 = groupKeySet_epochKey1Item_0Jni->byteSpan(); + jobject groupKeySet_epochStartTime1Item_0; + chip::JniReferences::GetInstance().GetObjectField(groupKeySet, "epochStartTime1", "Ljava/lang/Long;", + groupKeySet_epochStartTime1Item_0); + request.groupKeySet.epochStartTime1 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(groupKeySet_epochStartTime1Item_0)); + jobject groupKeySet_epochKey2Item_0; + chip::JniReferences::GetInstance().GetObjectField(groupKeySet, "epochKey2", "[B", groupKeySet_epochKey2Item_0); + auto groupKeySet_epochKey2Item_0Jni = + chip::Platform::New(env, static_cast(groupKeySet_epochKey2Item_0)); + cleanupByteArrays.push_back(groupKeySet_epochKey2Item_0Jni); + request.groupKeySet.epochKey2 = groupKeySet_epochKey2Item_0Jni->byteSpan(); + jobject groupKeySet_epochStartTime2Item_0; + chip::JniReferences::GetInstance().GetObjectField(groupKeySet, "epochStartTime2", "Ljava/lang/Long;", + groupKeySet_epochStartTime2Item_0); + request.groupKeySet.epochStartTime2 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(groupKeySet_epochStartTime2Item_0)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -9808,6 +12675,89 @@ JNI_METHOD(void, GroupKeyManagementCluster, keySetWrite) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, GroupKeyManagementCluster, subscribeGroupKeyMapAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + GroupKeyManagementCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::GroupKeyManagement::Attributes::GroupKeyMap::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPGroupKeyManagementGroupKeyMapAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, GroupKeyManagementCluster, subscribeGroupTableAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + GroupKeyManagementCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::GroupKeyManagement::Attributes::GroupTable::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPGroupKeyManagementGroupTableAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + onSuccess.release(); onFailure.release(); } @@ -9886,6 +12836,45 @@ JNI_METHOD(void, GroupKeyManagementCluster, subscribeMaxGroupKeysPerFabricAttrib onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, GroupKeyManagementCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + GroupKeyManagementCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::GroupKeyManagement::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPGroupKeyManagementAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, GroupKeyManagementCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -9939,10 +12928,16 @@ JNI_METHOD(void, GroupsCluster, addGroup) CHIP_ERROR err = CHIP_NO_ERROR; GroupsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Groups::Commands::AddGroup::Type request; - request.groupId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); - request.groupName = chip::JniUtfString(env, static_cast(groupName)).charSpan(); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.groupId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); + auto groupNameJni = chip::Platform::New(env, static_cast(groupName)); + cleanupStrings.push_back(groupNameJni); + request.groupName = groupNameJni->charSpan(); std::unique_ptr onSuccess( Platform::New(callback), @@ -9977,6 +12972,11 @@ JNI_METHOD(void, GroupsCluster, addGroup) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -9987,10 +12987,16 @@ JNI_METHOD(void, GroupsCluster, addGroupIfIdentifying) CHIP_ERROR err = CHIP_NO_ERROR; GroupsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Groups::Commands::AddGroupIfIdentifying::Type request; - request.groupId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); - request.groupName = chip::JniUtfString(env, static_cast(groupName)).charSpan(); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.groupId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); + auto groupNameJni = chip::Platform::New(env, static_cast(groupName)); + cleanupStrings.push_back(groupNameJni); + request.groupName = groupNameJni->charSpan(); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -10024,6 +13030,11 @@ JNI_METHOD(void, GroupsCluster, addGroupIfIdentifying) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -10034,9 +13045,35 @@ JNI_METHOD(void, GroupsCluster, getGroupMembership) CHIP_ERROR err = CHIP_NO_ERROR; GroupsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Groups::Commands::GetGroupMembership::Type request; - request.groupList = chip::app::DataModel::List(); + std::list cleanupByteArrays; + std::list cleanupStrings; + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint groupListSize; + chip::JniReferences::GetInstance().GetArrayListSize(groupList, groupListSize); + if (groupListSize != 0) + { + auto * listHolder_0 = new ListHolder(groupListSize); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(groupListSize); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(groupList, i_0, element_0); + listHolder_0->mList[i_0] = static_castmList[i_0])>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0)); + } + request.groupList = ListType_0(listHolder_0->mList, groupListSize); + } + else + { + request.groupList = ListType_0(); + } + } std::unique_ptr @@ -10073,6 +13110,11 @@ JNI_METHOD(void, GroupsCluster, getGroupMembership) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -10083,8 +13125,12 @@ JNI_METHOD(void, GroupsCluster, removeAllGroups) CHIP_ERROR err = CHIP_NO_ERROR; GroupsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Groups::Commands::RemoveAllGroups::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -10117,6 +13163,11 @@ JNI_METHOD(void, GroupsCluster, removeAllGroups) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -10127,9 +13178,13 @@ JNI_METHOD(void, GroupsCluster, removeGroup) CHIP_ERROR err = CHIP_NO_ERROR; GroupsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Groups::Commands::RemoveGroup::Type request; - request.groupId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.groupId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); std::unique_ptr onSuccess(Platform::New(callback), @@ -10165,6 +13220,11 @@ JNI_METHOD(void, GroupsCluster, removeGroup) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -10175,9 +13235,13 @@ JNI_METHOD(void, GroupsCluster, viewGroup) CHIP_ERROR err = CHIP_NO_ERROR; GroupsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Groups::Commands::ViewGroup::Type request; - request.groupId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.groupId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); std::unique_ptr onSuccess( Platform::New(callback), @@ -10209,18 +13273,61 @@ JNI_METHOD(void, GroupsCluster, viewGroup) chip::JniReferences::GetInstance().IntegerToPrimitive(timedInvokeTimeoutMs)); } VerifyOrReturn(err == CHIP_NO_ERROR, - AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", - CHIP_ERROR_INCORRECT_STATE)); + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, GroupsCluster, subscribeNameSupportAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + GroupsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::Groups::Attributes::NameSupport::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt8uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, GroupsCluster, subscribeNameSupportAttribute) +JNI_METHOD(void, GroupsCluster, subscribeAttributeListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -10237,14 +13344,14 @@ JNI_METHOD(void, GroupsCluster, subscribeNameSupportAttribute) chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::Groups::Attributes::NameSupport::TypeInfo; + using TypeInfo = chip::app::Clusters::Groups::Attributes::AttributeList::TypeInfo; auto successFn = - chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), static_cast(maxInterval), - CHIPInt8uAttributeCallback::OnSubscriptionEstablished); + CHIPGroupsAttributeListAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -10305,10 +13412,13 @@ JNI_METHOD(void, IdentifyCluster, identify) CHIP_ERROR err = CHIP_NO_ERROR; IdentifyCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Identify::Commands::Identify::Type request; - request.identifyTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(identifyTime)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.identifyTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(identifyTime)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -10342,6 +13452,11 @@ JNI_METHOD(void, IdentifyCluster, identify) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -10352,8 +13467,12 @@ JNI_METHOD(void, IdentifyCluster, identifyQuery) CHIP_ERROR err = CHIP_NO_ERROR; IdentifyCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Identify::Commands::IdentifyQuery::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess(Platform::New(callback), Platform::Delete); @@ -10388,6 +13507,11 @@ JNI_METHOD(void, IdentifyCluster, identifyQuery) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -10399,12 +13523,15 @@ JNI_METHOD(void, IdentifyCluster, triggerEffect) CHIP_ERROR err = CHIP_NO_ERROR; IdentifyCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Identify::Commands::TriggerEffect::Type request; - request.effectIdentifier = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(effectIdentifier)); - request.effectVariant = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(effectVariant)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.effectIdentifier = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(effectIdentifier)); + request.effectVariant = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(effectVariant)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -10438,6 +13565,11 @@ JNI_METHOD(void, IdentifyCluster, triggerEffect) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -10515,6 +13647,44 @@ JNI_METHOD(void, IdentifyCluster, subscribeIdentifyTypeAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, IdentifyCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + IdentifyCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::Identify::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPIdentifyAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, IdentifyCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -10757,6 +13927,45 @@ JNI_METHOD(void, IlluminanceMeasurementCluster, subscribeLightSensorTypeAttribut onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, IlluminanceMeasurementCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + IlluminanceMeasurementCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::IlluminanceMeasurement::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPIlluminanceMeasurementAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, IlluminanceMeasurementCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -10811,9 +14020,13 @@ JNI_METHOD(void, KeypadInputCluster, sendKeyRequest) CHIP_ERROR err = CHIP_NO_ERROR; KeypadInputCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::KeypadInput::Commands::SendKeyRequest::Type request; - request.keyCode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(keyCode)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.keyCode = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(keyCode)); std::unique_ptr onSuccess(Platform::New(callback), @@ -10849,6 +14062,49 @@ JNI_METHOD(void, KeypadInputCluster, sendKeyRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, KeypadInputCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + KeypadInputCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::KeypadInput::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPKeypadInputAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + onSuccess.release(); onFailure.release(); } @@ -10906,14 +14162,19 @@ JNI_METHOD(void, LevelControlCluster, move) CHIP_ERROR err = CHIP_NO_ERROR; LevelControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::LevelControl::Commands::Move::Type request; - request.moveMode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(moveMode)); - request.rate = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(rate)); - request.optionMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionMask)); - request.optionOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.moveMode = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(moveMode)); + request.rate = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(rate)); + request.optionMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionMask)); + request.optionOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -10947,6 +14208,11 @@ JNI_METHOD(void, LevelControlCluster, move) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -10958,15 +14224,19 @@ JNI_METHOD(void, LevelControlCluster, moveToLevel) CHIP_ERROR err = CHIP_NO_ERROR; LevelControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; - request.level = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(level)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.optionMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionMask)); - request.optionOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.level = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(level)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + request.optionMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionMask)); + request.optionOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -11000,6 +14270,11 @@ JNI_METHOD(void, LevelControlCluster, moveToLevel) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -11011,11 +14286,15 @@ JNI_METHOD(void, LevelControlCluster, moveToLevelWithOnOff) CHIP_ERROR err = CHIP_NO_ERROR; LevelControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::LevelControl::Commands::MoveToLevelWithOnOff::Type request; - request.level = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(level)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.level = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(level)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -11049,6 +14328,11 @@ JNI_METHOD(void, LevelControlCluster, moveToLevelWithOnOff) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -11059,10 +14343,15 @@ JNI_METHOD(void, LevelControlCluster, moveWithOnOff) CHIP_ERROR err = CHIP_NO_ERROR; LevelControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::LevelControl::Commands::MoveWithOnOff::Type request; - request.moveMode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(moveMode)); - request.rate = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(rate)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.moveMode = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(moveMode)); + request.rate = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(rate)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -11096,6 +14385,11 @@ JNI_METHOD(void, LevelControlCluster, moveWithOnOff) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -11107,16 +14401,21 @@ JNI_METHOD(void, LevelControlCluster, step) CHIP_ERROR err = CHIP_NO_ERROR; LevelControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::LevelControl::Commands::Step::Type request; - request.stepMode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(stepMode)); - request.stepSize = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(stepSize)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.optionMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionMask)); - request.optionOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.stepMode = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(stepMode)); + request.stepSize = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(stepSize)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + request.optionMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionMask)); + request.optionOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -11150,6 +14449,11 @@ JNI_METHOD(void, LevelControlCluster, step) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -11161,12 +14465,17 @@ JNI_METHOD(void, LevelControlCluster, stepWithOnOff) CHIP_ERROR err = CHIP_NO_ERROR; LevelControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::LevelControl::Commands::StepWithOnOff::Type request; - request.stepMode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(stepMode)); - request.stepSize = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(stepSize)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.stepMode = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(stepMode)); + request.stepSize = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(stepSize)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -11200,6 +14509,11 @@ JNI_METHOD(void, LevelControlCluster, stepWithOnOff) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -11211,12 +14525,15 @@ JNI_METHOD(void, LevelControlCluster, stop) CHIP_ERROR err = CHIP_NO_ERROR; LevelControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::LevelControl::Commands::Stop::Type request; - request.optionMask = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionMask)); - request.optionOverride = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(optionOverride)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.optionMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionMask)); + request.optionOverride = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionOverride)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -11250,6 +14567,11 @@ JNI_METHOD(void, LevelControlCluster, stop) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -11260,8 +14582,12 @@ JNI_METHOD(void, LevelControlCluster, stopWithOnOff) CHIP_ERROR err = CHIP_NO_ERROR; LevelControlCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::LevelControl::Commands::StopWithOnOff::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -11294,6 +14620,11 @@ JNI_METHOD(void, LevelControlCluster, stopWithOnOff) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -11823,6 +15154,44 @@ JNI_METHOD(void, LevelControlCluster, subscribeStartUpCurrentLevelAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, LevelControlCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + LevelControlCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::LevelControl::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPLevelControlAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, LevelControlCluster, subscribeFeatureMapAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -11944,6 +15313,47 @@ JNI_METHOD(void, LocalizationConfigurationCluster, subscribeActiveLocaleAttribut onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, LocalizationConfigurationCluster, subscribeSupportedLocalesAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + LocalizationConfigurationCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::LocalizationConfiguration::Attributes::SupportedLocales::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPLocalizationConfigurationSupportedLocalesAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(jlong, LowPowerCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) { chip::DeviceLayer::StackLock lock; @@ -11960,8 +15370,12 @@ JNI_METHOD(void, LowPowerCluster, sleep) CHIP_ERROR err = CHIP_NO_ERROR; LowPowerCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::LowPower::Commands::Sleep::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -11994,6 +15408,49 @@ JNI_METHOD(void, LowPowerCluster, sleep) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, LowPowerCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + LowPowerCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::LowPower::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPLowPowerAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + onSuccess.release(); onFailure.release(); } @@ -12050,8 +15507,12 @@ JNI_METHOD(void, MediaInputCluster, hideInputStatusRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaInputCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaInput::Commands::HideInputStatusRequest::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -12084,6 +15545,11 @@ JNI_METHOD(void, MediaInputCluster, hideInputStatusRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -12094,10 +15560,16 @@ JNI_METHOD(void, MediaInputCluster, renameInputRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaInputCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaInput::Commands::RenameInputRequest::Type request; - request.index = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(index)); - request.name = chip::JniUtfString(env, static_cast(name)).charSpan(); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.index = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(index)); + auto nameJni = chip::Platform::New(env, static_cast(name)); + cleanupStrings.push_back(nameJni); + request.name = nameJni->charSpan(); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -12131,6 +15603,11 @@ JNI_METHOD(void, MediaInputCluster, renameInputRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -12141,9 +15618,13 @@ JNI_METHOD(void, MediaInputCluster, selectInputRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaInputCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaInput::Commands::SelectInputRequest::Type request; - request.index = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(index)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.index = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(index)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -12177,6 +15658,11 @@ JNI_METHOD(void, MediaInputCluster, selectInputRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -12187,8 +15673,12 @@ JNI_METHOD(void, MediaInputCluster, showInputStatusRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaInputCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaInput::Commands::ShowInputStatusRequest::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -12218,8 +15708,51 @@ JNI_METHOD(void, MediaInputCluster, showInputStatusRequest) chip::JniReferences::GetInstance().IntegerToPrimitive(timedInvokeTimeoutMs)); } VerifyOrReturn(err == CHIP_NO_ERROR, - AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", - CHIP_ERROR_INCORRECT_STATE)); + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, MediaInputCluster, subscribeMediaInputListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + MediaInputCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::MediaInput::Attributes::MediaInputList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPMediaInputMediaInputListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); onSuccess.release(); onFailure.release(); @@ -12261,6 +15794,44 @@ JNI_METHOD(void, MediaInputCluster, subscribeCurrentMediaInputAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, MediaInputCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + MediaInputCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::MediaInput::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPMediaInputAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, MediaInputCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -12314,8 +15885,12 @@ JNI_METHOD(void, MediaPlaybackCluster, fastForwardRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaPlaybackCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaPlayback::Commands::FastForwardRequest::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess(Platform::New(callback), Platform::Delete); @@ -12350,6 +15925,11 @@ JNI_METHOD(void, MediaPlaybackCluster, fastForwardRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -12360,8 +15940,12 @@ JNI_METHOD(void, MediaPlaybackCluster, nextRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaPlaybackCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaPlayback::Commands::NextRequest::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess(Platform::New(callback), Platform::Delete); @@ -12396,6 +15980,11 @@ JNI_METHOD(void, MediaPlaybackCluster, nextRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -12406,8 +15995,12 @@ JNI_METHOD(void, MediaPlaybackCluster, pauseRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaPlaybackCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaPlayback::Commands::PauseRequest::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess(Platform::New(callback), Platform::Delete); @@ -12442,6 +16035,11 @@ JNI_METHOD(void, MediaPlaybackCluster, pauseRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -12452,8 +16050,12 @@ JNI_METHOD(void, MediaPlaybackCluster, playRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaPlaybackCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaPlayback::Commands::PlayRequest::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess(Platform::New(callback), Platform::Delete); @@ -12488,6 +16090,11 @@ JNI_METHOD(void, MediaPlaybackCluster, playRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -12498,8 +16105,12 @@ JNI_METHOD(void, MediaPlaybackCluster, previousRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaPlaybackCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaPlayback::Commands::PreviousRequest::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess(Platform::New(callback), Platform::Delete); @@ -12534,6 +16145,11 @@ JNI_METHOD(void, MediaPlaybackCluster, previousRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -12544,8 +16160,12 @@ JNI_METHOD(void, MediaPlaybackCluster, rewindRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaPlaybackCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaPlayback::Commands::RewindRequest::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess(Platform::New(callback), Platform::Delete); @@ -12580,6 +16200,11 @@ JNI_METHOD(void, MediaPlaybackCluster, rewindRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -12590,9 +16215,13 @@ JNI_METHOD(void, MediaPlaybackCluster, seekRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaPlaybackCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaPlayback::Commands::SeekRequest::Type request; - request.position = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(position)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.position = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(position)); std::unique_ptr onSuccess(Platform::New(callback), @@ -12628,6 +16257,11 @@ JNI_METHOD(void, MediaPlaybackCluster, seekRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -12638,9 +16272,12 @@ JNI_METHOD(void, MediaPlaybackCluster, skipBackwardRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaPlaybackCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaPlayback::Commands::SkipBackwardRequest::Type request; - request.deltaPositionMilliseconds = static_cast( + std::list cleanupByteArrays; + std::list cleanupStrings; + request.deltaPositionMilliseconds = static_cast>( chip::JniReferences::GetInstance().LongToPrimitive(deltaPositionMilliseconds)); std::unique_ptr @@ -12677,6 +16314,11 @@ JNI_METHOD(void, MediaPlaybackCluster, skipBackwardRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -12687,9 +16329,12 @@ JNI_METHOD(void, MediaPlaybackCluster, skipForwardRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaPlaybackCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaPlayback::Commands::SkipForwardRequest::Type request; - request.deltaPositionMilliseconds = static_cast( + std::list cleanupByteArrays; + std::list cleanupStrings; + request.deltaPositionMilliseconds = static_cast>( chip::JniReferences::GetInstance().LongToPrimitive(deltaPositionMilliseconds)); std::unique_ptr @@ -12726,6 +16371,11 @@ JNI_METHOD(void, MediaPlaybackCluster, skipForwardRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -12736,8 +16386,12 @@ JNI_METHOD(void, MediaPlaybackCluster, startOverRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaPlaybackCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaPlayback::Commands::StartOverRequest::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess(Platform::New(callback), Platform::Delete); @@ -12772,6 +16426,11 @@ JNI_METHOD(void, MediaPlaybackCluster, startOverRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -12782,8 +16441,12 @@ JNI_METHOD(void, MediaPlaybackCluster, stopRequest) CHIP_ERROR err = CHIP_NO_ERROR; MediaPlaybackCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::MediaPlayback::Commands::StopRequest::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess(Platform::New(callback), Platform::Delete); @@ -12818,6 +16481,11 @@ JNI_METHOD(void, MediaPlaybackCluster, stopRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -13043,6 +16711,44 @@ JNI_METHOD(void, MediaPlaybackCluster, subscribeSeekRangeStartAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, MediaPlaybackCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + MediaPlaybackCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::MediaPlayback::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPMediaPlaybackAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, MediaPlaybackCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -13096,9 +16802,13 @@ JNI_METHOD(void, ModeSelectCluster, changeToMode) CHIP_ERROR err = CHIP_NO_ERROR; ModeSelectCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type request; - request.newMode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(newMode)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.newMode = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(newMode)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -13132,6 +16842,11 @@ JNI_METHOD(void, ModeSelectCluster, changeToMode) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -13172,6 +16887,44 @@ JNI_METHOD(void, ModeSelectCluster, subscribeCurrentModeAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, ModeSelectCluster, subscribeSupportedModesAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ModeSelectCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ModeSelect::Attributes::SupportedModes::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPModeSelectSupportedModesAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, ModeSelectCluster, subscribeOnModeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -13283,6 +17036,44 @@ JNI_METHOD(void, ModeSelectCluster, subscribeDescriptionAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, ModeSelectCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ModeSelectCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ModeSelect::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPModeSelectAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, ModeSelectCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -13337,10 +17128,16 @@ JNI_METHOD(void, NetworkCommissioningCluster, addOrUpdateThreadNetwork) CHIP_ERROR err = CHIP_NO_ERROR; NetworkCommissioningCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateThreadNetwork::Type request; - request.operationalDataset = chip::JniByteArray(env, static_cast(operationalDataset)).byteSpan(); - request.breadcrumb = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto operationalDatasetJni = chip::Platform::New(env, static_cast(operationalDataset)); + cleanupByteArrays.push_back(operationalDatasetJni); + request.operationalDataset = operationalDatasetJni->byteSpan(); + request.breadcrumb = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); std::unique_ptr @@ -13377,6 +17174,11 @@ JNI_METHOD(void, NetworkCommissioningCluster, addOrUpdateThreadNetwork) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -13388,11 +17190,19 @@ JNI_METHOD(void, NetworkCommissioningCluster, addOrUpdateWiFiNetwork) CHIP_ERROR err = CHIP_NO_ERROR; NetworkCommissioningCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateWiFiNetwork::Type request; - request.ssid = chip::JniByteArray(env, static_cast(ssid)).byteSpan(); - request.credentials = chip::JniByteArray(env, static_cast(credentials)).byteSpan(); - request.breadcrumb = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto ssidJni = chip::Platform::New(env, static_cast(ssid)); + cleanupByteArrays.push_back(ssidJni); + request.ssid = ssidJni->byteSpan(); + auto credentialsJni = chip::Platform::New(env, static_cast(credentials)); + cleanupByteArrays.push_back(credentialsJni); + request.credentials = credentialsJni->byteSpan(); + request.breadcrumb = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); std::unique_ptr @@ -13429,6 +17239,11 @@ JNI_METHOD(void, NetworkCommissioningCluster, addOrUpdateWiFiNetwork) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -13440,10 +17255,16 @@ JNI_METHOD(void, NetworkCommissioningCluster, connectNetwork) CHIP_ERROR err = CHIP_NO_ERROR; NetworkCommissioningCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::NetworkCommissioning::Commands::ConnectNetwork::Type request; - request.networkID = chip::JniByteArray(env, static_cast(networkID)).byteSpan(); - request.breadcrumb = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto networkIDJni = chip::Platform::New(env, static_cast(networkID)); + cleanupByteArrays.push_back(networkIDJni); + request.networkID = networkIDJni->byteSpan(); + request.breadcrumb = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); std::unique_ptr @@ -13480,6 +17301,11 @@ JNI_METHOD(void, NetworkCommissioningCluster, connectNetwork) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -13491,10 +17317,16 @@ JNI_METHOD(void, NetworkCommissioningCluster, removeNetwork) CHIP_ERROR err = CHIP_NO_ERROR; NetworkCommissioningCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::NetworkCommissioning::Commands::RemoveNetwork::Type request; - request.networkID = chip::JniByteArray(env, static_cast(networkID)).byteSpan(); - request.breadcrumb = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto networkIDJni = chip::Platform::New(env, static_cast(networkID)); + cleanupByteArrays.push_back(networkIDJni); + request.networkID = networkIDJni->byteSpan(); + request.breadcrumb = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); std::unique_ptr @@ -13531,6 +17363,11 @@ JNI_METHOD(void, NetworkCommissioningCluster, removeNetwork) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -13542,12 +17379,18 @@ JNI_METHOD(void, NetworkCommissioningCluster, reorderNetwork) CHIP_ERROR err = CHIP_NO_ERROR; NetworkCommissioningCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::NetworkCommissioning::Commands::ReorderNetwork::Type request; - request.networkID = chip::JniByteArray(env, static_cast(networkID)).byteSpan(); - request.networkIndex = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(networkIndex)); - request.breadcrumb = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto networkIDJni = chip::Platform::New(env, static_cast(networkID)); + cleanupByteArrays.push_back(networkIDJni); + request.networkID = networkIDJni->byteSpan(); + request.networkIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(networkIndex)); + request.breadcrumb = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); std::unique_ptr @@ -13584,6 +17427,11 @@ JNI_METHOD(void, NetworkCommissioningCluster, reorderNetwork) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -13594,10 +17442,16 @@ JNI_METHOD(void, NetworkCommissioningCluster, scanNetworks) CHIP_ERROR err = CHIP_NO_ERROR; NetworkCommissioningCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworks::Type request; - request.ssid = chip::JniByteArray(env, static_cast(ssid)).byteSpan(); - request.breadcrumb = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto ssidJni = chip::Platform::New(env, static_cast(ssid)); + cleanupByteArrays.push_back(ssidJni); + request.ssid = ssidJni->byteSpan(); + request.breadcrumb = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(breadcrumb)); std::unique_ptr @@ -13634,6 +17488,11 @@ JNI_METHOD(void, NetworkCommissioningCluster, scanNetworks) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -13674,6 +17533,45 @@ JNI_METHOD(void, NetworkCommissioningCluster, subscribeMaxNetworksAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, NetworkCommissioningCluster, subscribeNetworksAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + NetworkCommissioningCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::NetworkCommissioning::Attributes::Networks::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPNetworkCommissioningNetworksAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, NetworkCommissioningCluster, subscribeScanMaxTimeSecondsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -13991,10 +17889,16 @@ JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, applyUpdateRequest) CHIP_ERROR err = CHIP_NO_ERROR; OtaSoftwareUpdateProviderCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::Type request; - request.updateToken = chip::JniByteArray(env, static_cast(updateToken)).byteSpan(); - request.newVersion = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(newVersion)); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto updateTokenJni = chip::Platform::New(env, static_cast(updateToken)); + cleanupByteArrays.push_back(updateTokenJni); + request.updateToken = updateTokenJni->byteSpan(); + request.newVersion = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(newVersion)); std::unique_ptr @@ -14031,6 +17935,11 @@ JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, applyUpdateRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -14042,11 +17951,16 @@ JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, notifyUpdateApplied) CHIP_ERROR err = CHIP_NO_ERROR; OtaSoftwareUpdateProviderCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::Type request; - request.updateToken = chip::JniByteArray(env, static_cast(updateToken)).byteSpan(); - request.softwareVersion = - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(softwareVersion)); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto updateTokenJni = chip::Platform::New(env, static_cast(updateToken)); + cleanupByteArrays.push_back(updateTokenJni); + request.updateToken = updateTokenJni->byteSpan(); + request.softwareVersion = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(softwareVersion)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -14080,6 +17994,11 @@ JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, notifyUpdateApplied) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -14092,25 +18011,75 @@ JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, queryImage) CHIP_ERROR err = CHIP_NO_ERROR; OtaSoftwareUpdateProviderCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::Type request; - request.vendorId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(vendorId)); - request.productId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(productId)); - request.softwareVersion = - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(softwareVersion)); - request.protocolsSupported = - chip::app::DataModel::List(); - chip::JniReferences::GetInstance().GetOptionalValue(hardwareVersion, hardwareVersion); - request.hardwareVersion = chip::Optional( - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(hardwareVersion))); - chip::JniReferences::GetInstance().GetOptionalValue(location, location); - request.location = chip::Optional(chip::JniUtfString(env, static_cast(location)).charSpan()); - chip::JniReferences::GetInstance().GetOptionalValue(requestorCanConsent, requestorCanConsent); - request.requestorCanConsent = chip::Optional(static_cast( - chip::JniReferences::GetInstance().BooleanToPrimitive(requestorCanConsent))); - chip::JniReferences::GetInstance().GetOptionalValue(metadataForProvider, metadataForProvider); - request.metadataForProvider = - chip::Optional(chip::JniByteArray(env, static_cast(metadataForProvider)).byteSpan()); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.vendorId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(vendorId)); + request.productId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(productId)); + request.softwareVersion = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(softwareVersion)); + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint protocolsSupportedSize; + chip::JniReferences::GetInstance().GetArrayListSize(protocolsSupported, protocolsSupportedSize); + if (protocolsSupportedSize != 0) + { + auto * listHolder_0 = new ListHolder(protocolsSupportedSize); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(protocolsSupportedSize); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(protocolsSupported, i_0, element_0); + listHolder_0->mList[i_0] = static_castmList[i_0])>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0)); + } + request.protocolsSupported = ListType_0(listHolder_0->mList, protocolsSupportedSize); + } + else + { + request.protocolsSupported = ListType_0(); + } + } + if (hardwareVersion != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(hardwareVersion, optionalValue_0); + auto & definedValue_0 = request.hardwareVersion.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionalValue_0)); + } + if (location != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(location, optionalValue_0); + auto & definedValue_0 = request.location.Emplace(); + auto optionalValue_0Jni = chip::Platform::New(env, static_cast(optionalValue_0)); + cleanupStrings.push_back(optionalValue_0Jni); + definedValue_0 = optionalValue_0Jni->charSpan(); + } + if (requestorCanConsent != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(requestorCanConsent, optionalValue_0); + auto & definedValue_0 = request.requestorCanConsent.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().BooleanToPrimitive(optionalValue_0)); + } + if (metadataForProvider != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(metadataForProvider, optionalValue_0); + auto & definedValue_0 = request.metadataForProvider.Emplace(); + auto optionalValue_0Jni = chip::Platform::New(env, static_cast(optionalValue_0)); + cleanupByteArrays.push_back(optionalValue_0Jni); + definedValue_0 = optionalValue_0Jni->byteSpan(); + } std::unique_ptr @@ -14147,6 +18116,51 @@ JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, queryImage) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + OtaSoftwareUpdateProviderCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPOtaSoftwareUpdateProviderAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + onSuccess.release(); onFailure.release(); } @@ -14205,17 +18219,28 @@ JNI_METHOD(void, OtaSoftwareUpdateRequestorCluster, announceOtaProvider) CHIP_ERROR err = CHIP_NO_ERROR; OtaSoftwareUpdateRequestorCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OtaSoftwareUpdateRequestor::Commands::AnnounceOtaProvider::Type request; - request.providerNodeId = - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(providerNodeId)); - request.vendorId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(vendorId)); - request.announcementReason = static_cast( + std::list cleanupByteArrays; + std::list cleanupStrings; + request.providerNodeId = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(providerNodeId)); + request.vendorId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(vendorId)); + request.announcementReason = static_cast>( chip::JniReferences::GetInstance().IntegerToPrimitive(announcementReason)); - chip::JniReferences::GetInstance().GetOptionalValue(metadataForNode, metadataForNode); - request.metadataForNode = - chip::Optional(chip::JniByteArray(env, static_cast(metadataForNode)).byteSpan()); - request.endpoint = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(endpoint)); + if (metadataForNode != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(metadataForNode, optionalValue_0); + auto & definedValue_0 = request.metadataForNode.Emplace(); + auto optionalValue_0Jni = chip::Platform::New(env, static_cast(optionalValue_0)); + cleanupByteArrays.push_back(optionalValue_0Jni); + definedValue_0 = optionalValue_0Jni->byteSpan(); + } + request.endpoint = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(endpoint)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -14246,8 +18271,54 @@ JNI_METHOD(void, OtaSoftwareUpdateRequestorCluster, announceOtaProvider) chip::JniReferences::GetInstance().IntegerToPrimitive(timedInvokeTimeoutMs)); } VerifyOrReturn(err == CHIP_NO_ERROR, - AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", - CHIP_ERROR_INCORRECT_STATE)); + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, OtaSoftwareUpdateRequestorCluster, subscribeDefaultOtaProvidersAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + OtaSoftwareUpdateRequestorCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::DefaultOtaProviders::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPOtaSoftwareUpdateRequestorDefaultOtaProvidersAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); onSuccess.release(); onFailure.release(); @@ -14369,6 +18440,47 @@ JNI_METHOD(void, OtaSoftwareUpdateRequestorCluster, subscribeUpdateStateProgress onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, OtaSoftwareUpdateRequestorCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + OtaSoftwareUpdateRequestorCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPOtaSoftwareUpdateRequestorAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, OtaSoftwareUpdateRequestorCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -14528,6 +18640,45 @@ JNI_METHOD(void, OccupancySensingCluster, subscribeOccupancySensorTypeBitmapAttr onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, OccupancySensingCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + OccupancySensingCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::OccupancySensing::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPOccupancySensingAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, OccupancySensingCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -14580,8 +18731,12 @@ JNI_METHOD(void, OnOffCluster, off)(JNIEnv * env, jobject self, jlong clusterPtr CHIP_ERROR err = CHIP_NO_ERROR; OnOffCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OnOff::Commands::Off::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -14614,6 +18769,11 @@ JNI_METHOD(void, OnOffCluster, off)(JNIEnv * env, jobject self, jlong clusterPtr AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -14625,11 +18785,15 @@ JNI_METHOD(void, OnOffCluster, offWithEffect) CHIP_ERROR err = CHIP_NO_ERROR; OnOffCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OnOff::Commands::OffWithEffect::Type request; - request.effectId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(effectId)); - request.effectVariant = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(effectVariant)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.effectId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(effectId)); + request.effectVariant = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(effectVariant)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -14663,6 +18827,11 @@ JNI_METHOD(void, OnOffCluster, offWithEffect) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -14672,8 +18841,12 @@ JNI_METHOD(void, OnOffCluster, on)(JNIEnv * env, jobject self, jlong clusterPtr, CHIP_ERROR err = CHIP_NO_ERROR; OnOffCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OnOff::Commands::On::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -14706,6 +18879,11 @@ JNI_METHOD(void, OnOffCluster, on)(JNIEnv * env, jobject self, jlong clusterPtr, AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -14716,8 +18894,12 @@ JNI_METHOD(void, OnOffCluster, onWithRecallGlobalScene) CHIP_ERROR err = CHIP_NO_ERROR; OnOffCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OnOff::Commands::OnWithRecallGlobalScene::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -14750,6 +18932,11 @@ JNI_METHOD(void, OnOffCluster, onWithRecallGlobalScene) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -14761,13 +18948,17 @@ JNI_METHOD(void, OnOffCluster, onWithTimedOff) CHIP_ERROR err = CHIP_NO_ERROR; OnOffCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type request; - request.onOffControl = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(onOffControl)); - request.onTime = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(onTime)); - request.offWaitTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(offWaitTime)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.onOffControl = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(onOffControl)); + request.onTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(onTime)); + request.offWaitTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(offWaitTime)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -14801,6 +18992,11 @@ JNI_METHOD(void, OnOffCluster, onWithTimedOff) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -14810,8 +19006,12 @@ JNI_METHOD(void, OnOffCluster, toggle)(JNIEnv * env, jobject self, jlong cluster CHIP_ERROR err = CHIP_NO_ERROR; OnOffCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OnOff::Commands::Toggle::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -14844,6 +19044,11 @@ JNI_METHOD(void, OnOffCluster, toggle)(JNIEnv * env, jobject self, jlong cluster AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -15030,6 +19235,44 @@ JNI_METHOD(void, OnOffCluster, subscribeStartUpOnOffAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, OnOffCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + OnOffCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::OnOff::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPOnOffAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, OnOffCluster, subscribeFeatureMapAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -15187,6 +19430,46 @@ JNI_METHOD(void, OnOffSwitchConfigurationCluster, subscribeSwitchActionsAttribut onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, OnOffSwitchConfigurationCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + OnOffSwitchConfigurationCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::OnOffSwitchConfiguration::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPOnOffSwitchConfigurationAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, OnOffSwitchConfigurationCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -15242,16 +19525,30 @@ JNI_METHOD(void, OperationalCredentialsCluster, addNOC) CHIP_ERROR err = CHIP_NO_ERROR; OperationalCredentialsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OperationalCredentials::Commands::AddNOC::Type request; - request.NOCValue = chip::JniByteArray(env, static_cast(NOCValue)).byteSpan(); - chip::JniReferences::GetInstance().GetOptionalValue(ICACValue, ICACValue); - request.ICACValue = chip::Optional(chip::JniByteArray(env, static_cast(ICACValue)).byteSpan()); - request.IPKValue = chip::JniByteArray(env, static_cast(IPKValue)).byteSpan(); - request.caseAdminNode = - static_cast(chip::JniReferences::GetInstance().LongToPrimitive(caseAdminNode)); - request.adminVendorId = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(adminVendorId)); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto NOCValueJni = chip::Platform::New(env, static_cast(NOCValue)); + cleanupByteArrays.push_back(NOCValueJni); + request.NOCValue = NOCValueJni->byteSpan(); + if (ICACValue != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(ICACValue, optionalValue_0); + auto & definedValue_0 = request.ICACValue.Emplace(); + auto optionalValue_0Jni = chip::Platform::New(env, static_cast(optionalValue_0)); + cleanupByteArrays.push_back(optionalValue_0Jni); + definedValue_0 = optionalValue_0Jni->byteSpan(); + } + auto IPKValueJni = chip::Platform::New(env, static_cast(IPKValue)); + cleanupByteArrays.push_back(IPKValueJni); + request.IPKValue = IPKValueJni->byteSpan(); + request.caseAdminNode = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(caseAdminNode)); + request.adminVendorId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(adminVendorId)); std::unique_ptr @@ -15288,6 +19585,11 @@ JNI_METHOD(void, OperationalCredentialsCluster, addNOC) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -15298,9 +19600,14 @@ JNI_METHOD(void, OperationalCredentialsCluster, addTrustedRootCertificate) CHIP_ERROR err = CHIP_NO_ERROR; OperationalCredentialsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OperationalCredentials::Commands::AddTrustedRootCertificate::Type request; - request.rootCertificate = chip::JniByteArray(env, static_cast(rootCertificate)).byteSpan(); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto rootCertificateJni = chip::Platform::New(env, static_cast(rootCertificate)); + cleanupByteArrays.push_back(rootCertificateJni); + request.rootCertificate = rootCertificateJni->byteSpan(); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -15334,6 +19641,11 @@ JNI_METHOD(void, OperationalCredentialsCluster, addTrustedRootCertificate) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -15344,9 +19656,14 @@ JNI_METHOD(void, OperationalCredentialsCluster, attestationRequest) CHIP_ERROR err = CHIP_NO_ERROR; OperationalCredentialsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OperationalCredentials::Commands::AttestationRequest::Type request; - request.attestationNonce = chip::JniByteArray(env, static_cast(attestationNonce)).byteSpan(); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto attestationNonceJni = chip::Platform::New(env, static_cast(attestationNonce)); + cleanupByteArrays.push_back(attestationNonceJni); + request.attestationNonce = attestationNonceJni->byteSpan(); std::unique_ptr @@ -15383,6 +19700,11 @@ JNI_METHOD(void, OperationalCredentialsCluster, attestationRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -15393,10 +19715,13 @@ JNI_METHOD(void, OperationalCredentialsCluster, certificateChainRequest) CHIP_ERROR err = CHIP_NO_ERROR; OperationalCredentialsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OperationalCredentials::Commands::CertificateChainRequest::Type request; - request.certificateType = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(certificateType)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.certificateType = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(certificateType)); std::unique_ptr @@ -15434,6 +19759,11 @@ JNI_METHOD(void, OperationalCredentialsCluster, certificateChainRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -15444,9 +19774,14 @@ JNI_METHOD(void, OperationalCredentialsCluster, opCSRRequest) CHIP_ERROR err = CHIP_NO_ERROR; OperationalCredentialsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OperationalCredentials::Commands::OpCSRRequest::Type request; - request.CSRNonce = chip::JniByteArray(env, static_cast(CSRNonce)).byteSpan(); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto CSRNonceJni = chip::Platform::New(env, static_cast(CSRNonce)); + cleanupByteArrays.push_back(CSRNonceJni); + request.CSRNonce = CSRNonceJni->byteSpan(); std::unique_ptr @@ -15483,6 +19818,11 @@ JNI_METHOD(void, OperationalCredentialsCluster, opCSRRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -15493,10 +19833,13 @@ JNI_METHOD(void, OperationalCredentialsCluster, removeFabric) CHIP_ERROR err = CHIP_NO_ERROR; OperationalCredentialsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type request; - request.fabricIndex = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(fabricIndex)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.fabricIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(fabricIndex)); std::unique_ptr @@ -15533,6 +19876,11 @@ JNI_METHOD(void, OperationalCredentialsCluster, removeFabric) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -15543,9 +19891,14 @@ JNI_METHOD(void, OperationalCredentialsCluster, removeTrustedRootCertificate) CHIP_ERROR err = CHIP_NO_ERROR; OperationalCredentialsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OperationalCredentials::Commands::RemoveTrustedRootCertificate::Type request; - request.trustedRootIdentifier = chip::JniByteArray(env, static_cast(trustedRootIdentifier)).byteSpan(); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto trustedRootIdentifierJni = chip::Platform::New(env, static_cast(trustedRootIdentifier)); + cleanupByteArrays.push_back(trustedRootIdentifierJni); + request.trustedRootIdentifier = trustedRootIdentifierJni->byteSpan(); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -15579,6 +19932,11 @@ JNI_METHOD(void, OperationalCredentialsCluster, removeTrustedRootCertificate) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -15589,9 +19947,14 @@ JNI_METHOD(void, OperationalCredentialsCluster, updateFabricLabel) CHIP_ERROR err = CHIP_NO_ERROR; OperationalCredentialsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Type request; - request.label = chip::JniUtfString(env, static_cast(label)).charSpan(); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto labelJni = chip::Platform::New(env, static_cast(label)); + cleanupStrings.push_back(labelJni); + request.label = labelJni->charSpan(); std::unique_ptr @@ -15628,6 +19991,11 @@ JNI_METHOD(void, OperationalCredentialsCluster, updateFabricLabel) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -15639,11 +20007,23 @@ JNI_METHOD(void, OperationalCredentialsCluster, updateNOC) CHIP_ERROR err = CHIP_NO_ERROR; OperationalCredentialsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::OperationalCredentials::Commands::UpdateNOC::Type request; - request.NOCValue = chip::JniByteArray(env, static_cast(NOCValue)).byteSpan(); - chip::JniReferences::GetInstance().GetOptionalValue(ICACValue, ICACValue); - request.ICACValue = chip::Optional(chip::JniByteArray(env, static_cast(ICACValue)).byteSpan()); + std::list cleanupByteArrays; + std::list cleanupStrings; + auto NOCValueJni = chip::Platform::New(env, static_cast(NOCValue)); + cleanupByteArrays.push_back(NOCValueJni); + request.NOCValue = NOCValueJni->byteSpan(); + if (ICACValue != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(ICACValue, optionalValue_0); + auto & definedValue_0 = request.ICACValue.Emplace(); + auto optionalValue_0Jni = chip::Platform::New(env, static_cast(optionalValue_0)); + cleanupByteArrays.push_back(optionalValue_0Jni); + definedValue_0 = optionalValue_0Jni->byteSpan(); + } std::unique_ptr @@ -15680,6 +20060,50 @@ JNI_METHOD(void, OperationalCredentialsCluster, updateNOC) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, OperationalCredentialsCluster, subscribeFabricsListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + OperationalCredentialsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::OperationalCredentials::Attributes::FabricsList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPOperationalCredentialsFabricsListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + onSuccess.release(); onFailure.release(); } @@ -15721,12 +20145,93 @@ JNI_METHOD(void, OperationalCredentialsCluster, subscribeSupportedFabricsAttribu onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, OperationalCredentialsCluster, subscribeCommissionedFabricsAttribute) +JNI_METHOD(void, OperationalCredentialsCluster, subscribeCommissionedFabricsAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + OperationalCredentialsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::OperationalCredentials::Attributes::CommissionedFabrics::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt8uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, OperationalCredentialsCluster, subscribeTrustedRootCertificatesAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + OperationalCredentialsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::OperationalCredentials::Attributes::TrustedRootCertificates::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, OperationalCredentialsCluster, subscribeCurrentFabricIndexAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -15743,15 +20248,16 @@ JNI_METHOD(void, OperationalCredentialsCluster, subscribeCommissionedFabricsAttr chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::OperationalCredentials::Attributes::CommissionedFabrics::TypeInfo; + using TypeInfo = chip::app::Clusters::OperationalCredentials::Attributes::CurrentFabricIndex::TypeInfo; auto successFn = - chip::Callback::Callback::FromCancelable( + chip::Callback::Callback::FromCancelable( onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); - err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, - static_cast(minInterval), static_cast(maxInterval), - CHIPInt8uAttributeCallback::OnSubscriptionEstablished); + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPOperationalCredentialsCurrentFabricIndexAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -15759,14 +20265,14 @@ JNI_METHOD(void, OperationalCredentialsCluster, subscribeCommissionedFabricsAttr onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, OperationalCredentialsCluster, subscribeCurrentFabricIndexAttribute) +JNI_METHOD(void, OperationalCredentialsCluster, subscribeAttributeListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr - onSuccess(Platform::New(callback, true), - chip::Platform::Delete); + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -15783,16 +20289,14 @@ JNI_METHOD(void, OperationalCredentialsCluster, subscribeCurrentFabricIndexAttri chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::OperationalCredentials::Attributes::CurrentFabricIndex::TypeInfo; - auto successFn = - chip::Callback::Callback::FromCancelable( - onSuccess->Cancel()); + using TypeInfo = chip::app::Clusters::OperationalCredentials::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); err = cppCluster->SubscribeAttribute( onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), - static_cast(maxInterval), - CHIPOperationalCredentialsCurrentFabricIndexAttributeCallback::OnSubscriptionEstablished); + static_cast(maxInterval), CHIPOperationalCredentialsAttributeListAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -16106,6 +20610,45 @@ JNI_METHOD(void, PowerSourceCluster, subscribeBatteryChargeLevelAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, PowerSourceCluster, subscribeActiveBatteryFaultsAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + PowerSourceCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::PowerSource::Attributes::ActiveBatteryFaults::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPPowerSourceActiveBatteryFaultsAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, PowerSourceCluster, subscribeBatteryChargeStateAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -16143,6 +20686,44 @@ JNI_METHOD(void, PowerSourceCluster, subscribeBatteryChargeStateAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, PowerSourceCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + PowerSourceCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::PowerSource::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPPowerSourceAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, PowerSourceCluster, subscribeFeatureMapAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -16226,6 +20807,85 @@ JNI_METHOD(jlong, PowerSourceConfigurationCluster, initWithDevice)(JNIEnv * env, return reinterpret_cast(cppCluster); } +JNI_METHOD(void, PowerSourceConfigurationCluster, subscribeSourcesAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + PowerSourceConfigurationCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::PowerSourceConfiguration::Attributes::Sources::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPPowerSourceConfigurationSourcesAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, PowerSourceConfigurationCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + PowerSourceConfigurationCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::PowerSourceConfiguration::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPPowerSourceConfigurationAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, PowerSourceConfigurationCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -16384,6 +21044,45 @@ JNI_METHOD(void, PressureMeasurementCluster, subscribeMaxMeasuredValueAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, PressureMeasurementCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + PressureMeasurementCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::PressureMeasurement::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPPressureMeasurementAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, PressureMeasurementCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -17342,6 +22041,47 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, subscribeAlarmMaskAttribute onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, PumpConfigurationAndControlCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + PumpConfigurationAndControlCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPPumpConfigurationAndControlAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, PumpConfigurationAndControlCluster, subscribeFeatureMapAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -17541,12 +22281,51 @@ JNI_METHOD(void, RelativeHumidityMeasurementCluster, subscribeMaxMeasuredValueAt onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, RelativeHumidityMeasurementCluster, subscribeToleranceAttribute) +JNI_METHOD(void, RelativeHumidityMeasurementCluster, subscribeToleranceAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + RelativeHumidityMeasurementCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::Tolerance::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt16uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, RelativeHumidityMeasurementCluster, subscribeAttributeListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -17563,14 +22342,16 @@ JNI_METHOD(void, RelativeHumidityMeasurementCluster, subscribeToleranceAttribute chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::Tolerance::TypeInfo; - auto successFn = chip::Callback::Callback::FromCancelable( - onSuccess->Cancel()); + using TypeInfo = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); - err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, - static_cast(minInterval), static_cast(maxInterval), - CHIPInt16uAttributeCallback::OnSubscriptionEstablished); + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPRelativeHumidityMeasurementAttributeListAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -17627,21 +22408,63 @@ JNI_METHOD(jlong, ScenesCluster, initWithDevice)(JNIEnv * env, jobject self, jlo JNI_METHOD(void, ScenesCluster, addScene) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject groupId, jobject sceneId, jobject transitionTime, - jstring sceneName, jobject clusterId, jobject length, jobject value, jobject timedInvokeTimeoutMs) + jstring sceneName, jobject extensionFieldSets, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; ScenesCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Scenes::Commands::AddScene::Type request; - request.groupId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); - request.sceneId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(sceneId)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); - request.sceneName = chip::JniUtfString(env, static_cast(sceneName)).charSpan(); - request.extensionFieldSets = - chip::app::DataModel::List(); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.groupId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); + request.sceneId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(sceneId)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + auto sceneNameJni = chip::Platform::New(env, static_cast(sceneName)); + cleanupStrings.push_back(sceneNameJni); + request.sceneName = sceneNameJni->charSpan(); + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint extensionFieldSetsSize; + chip::JniReferences::GetInstance().GetArrayListSize(extensionFieldSets, extensionFieldSetsSize); + if (extensionFieldSetsSize != 0) + { + auto * listHolder_0 = new ListHolder(extensionFieldSetsSize); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(extensionFieldSetsSize); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(extensionFieldSets, i_0, element_0); + jobject element_0_clusterIdItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "clusterId", "Ljava/lang/Long;", + element_0_clusterIdItem_1); + listHolder_0->mList[i_0].clusterId = + static_castmList[i_0].clusterId)>>( + chip::JniReferences::GetInstance().LongToPrimitive(element_0_clusterIdItem_1)); + jobject element_0_lengthItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "length", "Ljava/lang/Integer;", + element_0_lengthItem_1); + listHolder_0->mList[i_0].length = static_castmList[i_0].length)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_lengthItem_1)); + jobject element_0_valueItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "value", "Ljava/lang/Integer;", element_0_valueItem_1); + listHolder_0->mList[i_0].value = static_castmList[i_0].value)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_valueItem_1)); + } + request.extensionFieldSets = ListType_0(listHolder_0->mList, extensionFieldSetsSize); + } + else + { + request.extensionFieldSets = ListType_0(); + } + } std::unique_ptr onSuccess( Platform::New(callback), @@ -17676,6 +22499,11 @@ JNI_METHOD(void, ScenesCluster, addScene) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -17686,9 +22514,13 @@ JNI_METHOD(void, ScenesCluster, getSceneMembership) CHIP_ERROR err = CHIP_NO_ERROR; ScenesCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Scenes::Commands::GetSceneMembership::Type request; - request.groupId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.groupId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); std::unique_ptr @@ -17725,6 +22557,11 @@ JNI_METHOD(void, ScenesCluster, getSceneMembership) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -17736,12 +22573,17 @@ JNI_METHOD(void, ScenesCluster, recallScene) CHIP_ERROR err = CHIP_NO_ERROR; ScenesCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Scenes::Commands::RecallScene::Type request; - request.groupId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); - request.sceneId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(sceneId)); - request.transitionTime = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.groupId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); + request.sceneId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(sceneId)); + request.transitionTime = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(transitionTime)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -17775,6 +22617,11 @@ JNI_METHOD(void, ScenesCluster, recallScene) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -17785,9 +22632,13 @@ JNI_METHOD(void, ScenesCluster, removeAllScenes) CHIP_ERROR err = CHIP_NO_ERROR; ScenesCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Scenes::Commands::RemoveAllScenes::Type request; - request.groupId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.groupId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); std::unique_ptr onSuccess(Platform::New(callback), @@ -17823,6 +22674,11 @@ JNI_METHOD(void, ScenesCluster, removeAllScenes) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -17833,10 +22689,15 @@ JNI_METHOD(void, ScenesCluster, removeScene) CHIP_ERROR err = CHIP_NO_ERROR; ScenesCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Scenes::Commands::RemoveScene::Type request; - request.groupId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); - request.sceneId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(sceneId)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.groupId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); + request.sceneId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(sceneId)); std::unique_ptr onSuccess(Platform::New(callback), @@ -17872,6 +22733,11 @@ JNI_METHOD(void, ScenesCluster, removeScene) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -17882,10 +22748,15 @@ JNI_METHOD(void, ScenesCluster, storeScene) CHIP_ERROR err = CHIP_NO_ERROR; ScenesCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Scenes::Commands::StoreScene::Type request; - request.groupId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); - request.sceneId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(sceneId)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.groupId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); + request.sceneId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(sceneId)); std::unique_ptr onSuccess( Platform::New(callback), @@ -17920,6 +22791,11 @@ JNI_METHOD(void, ScenesCluster, storeScene) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -17930,10 +22806,15 @@ JNI_METHOD(void, ScenesCluster, viewScene) CHIP_ERROR err = CHIP_NO_ERROR; ScenesCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Scenes::Commands::ViewScene::Type request; - request.groupId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); - request.sceneId = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(sceneId)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.groupId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(groupId)); + request.sceneId = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(sceneId)); std::unique_ptr onSuccess( Platform::New(callback), @@ -17968,6 +22849,11 @@ JNI_METHOD(void, ScenesCluster, viewScene) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -18156,6 +23042,44 @@ JNI_METHOD(void, ScenesCluster, subscribeNameSupportAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, ScenesCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ScenesCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::Scenes::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPScenesAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, ScenesCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -18209,8 +23133,12 @@ JNI_METHOD(void, SoftwareDiagnosticsCluster, resetWatermarks) CHIP_ERROR err = CHIP_NO_ERROR; SoftwareDiagnosticsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::SoftwareDiagnostics::Commands::ResetWatermarks::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -18243,6 +23171,50 @@ JNI_METHOD(void, SoftwareDiagnosticsCluster, resetWatermarks) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, SoftwareDiagnosticsCluster, subscribeThreadMetricsAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + SoftwareDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::SoftwareDiagnostics::Attributes::ThreadMetrics::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPSoftwareDiagnosticsThreadMetricsAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + onSuccess.release(); onFailure.release(); } @@ -18358,6 +23330,45 @@ JNI_METHOD(void, SoftwareDiagnosticsCluster, subscribeCurrentHeapHighWatermarkAt onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, SoftwareDiagnosticsCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + SoftwareDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::SoftwareDiagnostics::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPSoftwareDiagnosticsAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, SoftwareDiagnosticsCluster, subscribeFeatureMapAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -18552,6 +23563,44 @@ JNI_METHOD(void, SwitchCluster, subscribeMultiPressMaxAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, SwitchCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + SwitchCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::Switch::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPSwitchAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, SwitchCluster, subscribeFeatureMapAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -18642,10 +23691,16 @@ JNI_METHOD(void, TargetNavigatorCluster, navigateTargetRequest) CHIP_ERROR err = CHIP_NO_ERROR; TargetNavigatorCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TargetNavigator::Commands::NavigateTargetRequest::Type request; - request.target = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(target)); - request.data = chip::JniUtfString(env, static_cast(data)).charSpan(); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.target = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(target)); + auto dataJni = chip::Platform::New(env, static_cast(data)); + cleanupStrings.push_back(dataJni); + request.data = dataJni->charSpan(); std::unique_ptr @@ -18682,6 +23737,50 @@ JNI_METHOD(void, TargetNavigatorCluster, navigateTargetRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, TargetNavigatorCluster, subscribeTargetNavigatorListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TargetNavigatorCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::TargetNavigator::Attributes::TargetNavigatorList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPTargetNavigatorTargetNavigatorListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + onSuccess.release(); onFailure.release(); } @@ -18723,6 +23822,45 @@ JNI_METHOD(void, TargetNavigatorCluster, subscribeCurrentNavigatorTargetAttribut onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, TargetNavigatorCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TargetNavigatorCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::TargetNavigator::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPTargetNavigatorAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, TargetNavigatorCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -18919,6 +24057,45 @@ JNI_METHOD(void, TemperatureMeasurementCluster, subscribeToleranceAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, TemperatureMeasurementCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TemperatureMeasurementCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::TemperatureMeasurement::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPTemperatureMeasurementAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, TemperatureMeasurementCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -18967,16 +24144,51 @@ JNI_METHOD(jlong, TestClusterCluster, initWithDevice)(JNIEnv * env, jobject self } JNI_METHOD(void, TestClusterCluster, simpleStructEchoRequest) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject a, jobject b, jobject c, jbyteArray d, jstring e, - jobject f, jobject g, jobject h, jobject timedInvokeTimeoutMs) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject arg1, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::SimpleStructEchoRequest::Type request; - request.arg1 = chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type(); + std::list cleanupByteArrays; + std::list cleanupStrings; + jobject arg1_aItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "a", "Ljava/lang/Integer;", arg1_aItem_0); + request.arg1.a = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(arg1_aItem_0)); + jobject arg1_bItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "b", "Ljava/lang/Boolean;", arg1_bItem_0); + request.arg1.b = static_cast>( + chip::JniReferences::GetInstance().BooleanToPrimitive(arg1_bItem_0)); + jobject arg1_cItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "c", "Ljava/lang/Integer;", arg1_cItem_0); + request.arg1.c = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(arg1_cItem_0)); + jobject arg1_dItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "d", "[B", arg1_dItem_0); + auto arg1_dItem_0Jni = chip::Platform::New(env, static_cast(arg1_dItem_0)); + cleanupByteArrays.push_back(arg1_dItem_0Jni); + request.arg1.d = arg1_dItem_0Jni->byteSpan(); + jobject arg1_eItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "e", "Ljava/lang/String;", arg1_eItem_0); + auto arg1_eItem_0Jni = chip::Platform::New(env, static_cast(arg1_eItem_0)); + cleanupStrings.push_back(arg1_eItem_0Jni); + request.arg1.e = arg1_eItem_0Jni->charSpan(); + jobject arg1_fItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "f", "Ljava/lang/Integer;", arg1_fItem_0); + request.arg1.f = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(arg1_fItem_0)); + jobject arg1_gItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "g", "Ljava/lang/Float;", arg1_gItem_0); + request.arg1.g = static_cast>( + chip::JniReferences::GetInstance().FloatToPrimitive(arg1_gItem_0)); + jobject arg1_hItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "h", "Ljava/lang/Double;", arg1_hItem_0); + request.arg1.h = static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(arg1_hItem_0)); std::unique_ptr @@ -19013,6 +24225,11 @@ JNI_METHOD(void, TestClusterCluster, simpleStructEchoRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -19023,8 +24240,12 @@ JNI_METHOD(void, TestClusterCluster, test) CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::Test::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -19057,6 +24278,11 @@ JNI_METHOD(void, TestClusterCluster, test) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -19067,10 +24293,15 @@ JNI_METHOD(void, TestClusterCluster, testAddArguments) CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type request; - request.arg1 = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(arg1)); - request.arg2 = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(arg2)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.arg1 = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(arg1)); + request.arg2 = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(arg2)); std::unique_ptr @@ -19107,6 +24338,11 @@ JNI_METHOD(void, TestClusterCluster, testAddArguments) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -19118,11 +24354,17 @@ JNI_METHOD(void, TestClusterCluster, testEmitTestEventRequest) CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestEmitTestEventRequest::Type request; - request.arg1 = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(arg1)); - request.arg2 = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(arg2)); - request.arg3 = static_cast(chip::JniReferences::GetInstance().BooleanToPrimitive(arg3)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.arg1 = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(arg1)); + request.arg2 = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(arg2)); + request.arg3 = + static_cast>(chip::JniReferences::GetInstance().BooleanToPrimitive(arg3)); std::unique_ptr @@ -19159,6 +24401,11 @@ JNI_METHOD(void, TestClusterCluster, testEmitTestEventRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -19169,10 +24416,15 @@ JNI_METHOD(void, TestClusterCluster, testEnumsRequest) CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestEnumsRequest::Type request; - request.arg1 = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(arg1)); - request.arg2 = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(arg2)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.arg1 = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(arg1)); + request.arg2 = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(arg2)); std::unique_ptr onSuccess(Platform::New(callback), @@ -19208,6 +24460,11 @@ JNI_METHOD(void, TestClusterCluster, testEnumsRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -19218,9 +24475,35 @@ JNI_METHOD(void, TestClusterCluster, testListInt8UArgumentRequest) CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestListInt8UArgumentRequest::Type request; - request.arg1 = chip::app::DataModel::List(); + std::list cleanupByteArrays; + std::list cleanupStrings; + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint arg1Size; + chip::JniReferences::GetInstance().GetArrayListSize(arg1, arg1Size); + if (arg1Size != 0) + { + auto * listHolder_0 = new ListHolder(arg1Size); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(arg1Size); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(arg1, i_0, element_0); + listHolder_0->mList[i_0] = static_castmList[i_0])>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0)); + } + request.arg1 = ListType_0(listHolder_0->mList, arg1Size); + } + else + { + request.arg1 = ListType_0(); + } + } std::unique_ptr onSuccess(Platform::New(callback), @@ -19256,6 +24539,11 @@ JNI_METHOD(void, TestClusterCluster, testListInt8UArgumentRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -19266,9 +24554,35 @@ JNI_METHOD(void, TestClusterCluster, testListInt8UReverseRequest) CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseRequest::Type request; - request.arg1 = chip::app::DataModel::List(); + std::list cleanupByteArrays; + std::list cleanupStrings; + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint arg1Size; + chip::JniReferences::GetInstance().GetArrayListSize(arg1, arg1Size); + if (arg1Size != 0) + { + auto * listHolder_0 = new ListHolder(arg1Size); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(arg1Size); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(arg1, i_0, element_0); + listHolder_0->mList[i_0] = static_castmList[i_0])>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0)); + } + request.arg1 = ListType_0(listHolder_0->mList, arg1Size); + } + else + { + request.arg1 = ListType_0(); + } + } std::unique_ptr @@ -19305,20 +24619,248 @@ JNI_METHOD(void, TestClusterCluster, testListInt8UReverseRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } JNI_METHOD(void, TestClusterCluster, testListNestedStructListArgumentRequest) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject a, jobject b, jobject c, jobject d, jobject e, - jbyteArray f, jobject g, jobject timedInvokeTimeoutMs) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject arg1, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestListNestedStructListArgumentRequest::Type request; - request.arg1 = chip::app::DataModel::List(); + std::list cleanupByteArrays; + std::list cleanupStrings; + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint arg1Size; + chip::JniReferences::GetInstance().GetArrayListSize(arg1, arg1Size); + if (arg1Size != 0) + { + auto * listHolder_0 = new ListHolder(arg1Size); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(arg1Size); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(arg1, i_0, element_0); + jobject element_0_aItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "a", "Ljava/lang/Integer;", element_0_aItem_1); + listHolder_0->mList[i_0].a = static_castmList[i_0].a)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_aItem_1)); + jobject element_0_bItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "b", "Ljava/lang/Boolean;", element_0_bItem_1); + listHolder_0->mList[i_0].b = static_castmList[i_0].b)>>( + chip::JniReferences::GetInstance().BooleanToPrimitive(element_0_bItem_1)); + jobject element_0_cItem_1; + chip::JniReferences::GetInstance().GetObjectField( + element_0, "c", "Lchip/devicecontroller/ChipStructs$TestClusterClusterSimpleStruct;", element_0_cItem_1); + jobject element_0_cItem_1_aItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_0_cItem_1, "a", "Ljava/lang/Integer;", + element_0_cItem_1_aItem_2); + listHolder_0->mList[i_0].c.a = static_castmList[i_0].c.a)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_cItem_1_aItem_2)); + jobject element_0_cItem_1_bItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_0_cItem_1, "b", "Ljava/lang/Boolean;", + element_0_cItem_1_bItem_2); + listHolder_0->mList[i_0].c.b = static_castmList[i_0].c.b)>>( + chip::JniReferences::GetInstance().BooleanToPrimitive(element_0_cItem_1_bItem_2)); + jobject element_0_cItem_1_cItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_0_cItem_1, "c", "Ljava/lang/Integer;", + element_0_cItem_1_cItem_2); + listHolder_0->mList[i_0].c.c = static_castmList[i_0].c.c)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_cItem_1_cItem_2)); + jobject element_0_cItem_1_dItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_0_cItem_1, "d", "[B", element_0_cItem_1_dItem_2); + auto element_0_cItem_1_dItem_2Jni = + chip::Platform::New(env, static_cast(element_0_cItem_1_dItem_2)); + cleanupByteArrays.push_back(element_0_cItem_1_dItem_2Jni); + listHolder_0->mList[i_0].c.d = element_0_cItem_1_dItem_2Jni->byteSpan(); + jobject element_0_cItem_1_eItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_0_cItem_1, "e", "Ljava/lang/String;", + element_0_cItem_1_eItem_2); + auto element_0_cItem_1_eItem_2Jni = + chip::Platform::New(env, static_cast(element_0_cItem_1_eItem_2)); + cleanupStrings.push_back(element_0_cItem_1_eItem_2Jni); + listHolder_0->mList[i_0].c.e = element_0_cItem_1_eItem_2Jni->charSpan(); + jobject element_0_cItem_1_fItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_0_cItem_1, "f", "Ljava/lang/Integer;", + element_0_cItem_1_fItem_2); + listHolder_0->mList[i_0].c.f = static_castmList[i_0].c.f)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_cItem_1_fItem_2)); + jobject element_0_cItem_1_gItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_0_cItem_1, "g", "Ljava/lang/Float;", + element_0_cItem_1_gItem_2); + listHolder_0->mList[i_0].c.g = static_castmList[i_0].c.g)>>( + chip::JniReferences::GetInstance().FloatToPrimitive(element_0_cItem_1_gItem_2)); + jobject element_0_cItem_1_hItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_0_cItem_1, "h", "Ljava/lang/Double;", + element_0_cItem_1_hItem_2); + listHolder_0->mList[i_0].c.h = static_castmList[i_0].c.h)>>( + chip::JniReferences::GetInstance().DoubleToPrimitive(element_0_cItem_1_hItem_2)); + jobject element_0_dItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "d", "Ljava/util/ArrayList;", element_0_dItem_1); + { + using ListType_2 = std::remove_reference_tmList[i_0].d)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + jint element_0_dItem_1Size; + chip::JniReferences::GetInstance().GetArrayListSize(element_0_dItem_1, element_0_dItem_1Size); + if (element_0_dItem_1Size != 0) + { + auto * listHolder_2 = new ListHolder(element_0_dItem_1Size); + listFreer.add(listHolder_2); + + for (size_t i_2 = 0; i_2 < static_cast(element_0_dItem_1Size); ++i_2) + { + jobject element_2; + chip::JniReferences::GetInstance().GetArrayListItem(element_0_dItem_1, i_2, element_2); + jobject element_2_aItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_2, "a", "Ljava/lang/Integer;", + element_2_aItem_3); + listHolder_2->mList[i_2].a = static_castmList[i_2].a)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_2_aItem_3)); + jobject element_2_bItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_2, "b", "Ljava/lang/Boolean;", + element_2_bItem_3); + listHolder_2->mList[i_2].b = static_castmList[i_2].b)>>( + chip::JniReferences::GetInstance().BooleanToPrimitive(element_2_bItem_3)); + jobject element_2_cItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_2, "c", "Ljava/lang/Integer;", + element_2_cItem_3); + listHolder_2->mList[i_2].c = static_castmList[i_2].c)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_2_cItem_3)); + jobject element_2_dItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_2, "d", "[B", element_2_dItem_3); + auto element_2_dItem_3Jni = + chip::Platform::New(env, static_cast(element_2_dItem_3)); + cleanupByteArrays.push_back(element_2_dItem_3Jni); + listHolder_2->mList[i_2].d = element_2_dItem_3Jni->byteSpan(); + jobject element_2_eItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_2, "e", "Ljava/lang/String;", + element_2_eItem_3); + auto element_2_eItem_3Jni = + chip::Platform::New(env, static_cast(element_2_eItem_3)); + cleanupStrings.push_back(element_2_eItem_3Jni); + listHolder_2->mList[i_2].e = element_2_eItem_3Jni->charSpan(); + jobject element_2_fItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_2, "f", "Ljava/lang/Integer;", + element_2_fItem_3); + listHolder_2->mList[i_2].f = static_castmList[i_2].f)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_2_fItem_3)); + jobject element_2_gItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_2, "g", "Ljava/lang/Float;", + element_2_gItem_3); + listHolder_2->mList[i_2].g = static_castmList[i_2].g)>>( + chip::JniReferences::GetInstance().FloatToPrimitive(element_2_gItem_3)); + jobject element_2_hItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_2, "h", "Ljava/lang/Double;", + element_2_hItem_3); + listHolder_2->mList[i_2].h = static_castmList[i_2].h)>>( + chip::JniReferences::GetInstance().DoubleToPrimitive(element_2_hItem_3)); + } + listHolder_0->mList[i_0].d = ListType_2(listHolder_2->mList, element_0_dItem_1Size); + } + else + { + listHolder_0->mList[i_0].d = ListType_2(); + } + } + jobject element_0_eItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "e", "Ljava/util/ArrayList;", element_0_eItem_1); + { + using ListType_2 = std::remove_reference_tmList[i_0].e)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + jint element_0_eItem_1Size; + chip::JniReferences::GetInstance().GetArrayListSize(element_0_eItem_1, element_0_eItem_1Size); + if (element_0_eItem_1Size != 0) + { + auto * listHolder_2 = new ListHolder(element_0_eItem_1Size); + listFreer.add(listHolder_2); + + for (size_t i_2 = 0; i_2 < static_cast(element_0_eItem_1Size); ++i_2) + { + jobject element_2; + chip::JniReferences::GetInstance().GetArrayListItem(element_0_eItem_1, i_2, element_2); + listHolder_2->mList[i_2] = static_castmList[i_2])>>( + chip::JniReferences::GetInstance().LongToPrimitive(element_2)); + } + listHolder_0->mList[i_0].e = ListType_2(listHolder_2->mList, element_0_eItem_1Size); + } + else + { + listHolder_0->mList[i_0].e = ListType_2(); + } + } + jobject element_0_fItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "f", "Ljava/util/ArrayList;", element_0_fItem_1); + { + using ListType_2 = std::remove_reference_tmList[i_0].f)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + jint element_0_fItem_1Size; + chip::JniReferences::GetInstance().GetArrayListSize(element_0_fItem_1, element_0_fItem_1Size); + if (element_0_fItem_1Size != 0) + { + auto * listHolder_2 = new ListHolder(element_0_fItem_1Size); + listFreer.add(listHolder_2); + + for (size_t i_2 = 0; i_2 < static_cast(element_0_fItem_1Size); ++i_2) + { + jobject element_2; + chip::JniReferences::GetInstance().GetArrayListItem(element_0_fItem_1, i_2, element_2); + auto element_2Jni = chip::Platform::New(env, static_cast(element_2)); + cleanupByteArrays.push_back(element_2Jni); + listHolder_2->mList[i_2] = element_2Jni->byteSpan(); + } + listHolder_0->mList[i_0].f = ListType_2(listHolder_2->mList, element_0_fItem_1Size); + } + else + { + listHolder_0->mList[i_0].f = ListType_2(); + } + } + jobject element_0_gItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "g", "Ljava/util/ArrayList;", element_0_gItem_1); + { + using ListType_2 = std::remove_reference_tmList[i_0].g)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + jint element_0_gItem_1Size; + chip::JniReferences::GetInstance().GetArrayListSize(element_0_gItem_1, element_0_gItem_1Size); + if (element_0_gItem_1Size != 0) + { + auto * listHolder_2 = new ListHolder(element_0_gItem_1Size); + listFreer.add(listHolder_2); + + for (size_t i_2 = 0; i_2 < static_cast(element_0_gItem_1Size); ++i_2) + { + jobject element_2; + chip::JniReferences::GetInstance().GetArrayListItem(element_0_gItem_1, i_2, element_2); + listHolder_2->mList[i_2] = static_castmList[i_2])>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_2)); + } + listHolder_0->mList[i_0].g = ListType_2(listHolder_2->mList, element_0_gItem_1Size); + } + else + { + listHolder_0->mList[i_0].g = ListType_2(); + } + } + } + request.arg1 = ListType_0(listHolder_0->mList, arg1Size); + } + else + { + request.arg1 = ListType_0(); + } + } std::unique_ptr onSuccess(Platform::New(callback), @@ -19354,20 +24896,83 @@ JNI_METHOD(void, TestClusterCluster, testListNestedStructListArgumentRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } JNI_METHOD(void, TestClusterCluster, testListStructArgumentRequest) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject a, jobject b, jobject c, jbyteArray d, jstring e, - jobject f, jobject g, jobject h, jobject timedInvokeTimeoutMs) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject arg1, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestListStructArgumentRequest::Type request; - request.arg1 = chip::app::DataModel::List(); + std::list cleanupByteArrays; + std::list cleanupStrings; + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint arg1Size; + chip::JniReferences::GetInstance().GetArrayListSize(arg1, arg1Size); + if (arg1Size != 0) + { + auto * listHolder_0 = new ListHolder(arg1Size); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(arg1Size); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(arg1, i_0, element_0); + jobject element_0_aItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "a", "Ljava/lang/Integer;", element_0_aItem_1); + listHolder_0->mList[i_0].a = static_castmList[i_0].a)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_aItem_1)); + jobject element_0_bItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "b", "Ljava/lang/Boolean;", element_0_bItem_1); + listHolder_0->mList[i_0].b = static_castmList[i_0].b)>>( + chip::JniReferences::GetInstance().BooleanToPrimitive(element_0_bItem_1)); + jobject element_0_cItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "c", "Ljava/lang/Integer;", element_0_cItem_1); + listHolder_0->mList[i_0].c = static_castmList[i_0].c)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_cItem_1)); + jobject element_0_dItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "d", "[B", element_0_dItem_1); + auto element_0_dItem_1Jni = + chip::Platform::New(env, static_cast(element_0_dItem_1)); + cleanupByteArrays.push_back(element_0_dItem_1Jni); + listHolder_0->mList[i_0].d = element_0_dItem_1Jni->byteSpan(); + jobject element_0_eItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "e", "Ljava/lang/String;", element_0_eItem_1); + auto element_0_eItem_1Jni = chip::Platform::New(env, static_cast(element_0_eItem_1)); + cleanupStrings.push_back(element_0_eItem_1Jni); + listHolder_0->mList[i_0].e = element_0_eItem_1Jni->charSpan(); + jobject element_0_fItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "f", "Ljava/lang/Integer;", element_0_fItem_1); + listHolder_0->mList[i_0].f = static_castmList[i_0].f)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_fItem_1)); + jobject element_0_gItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "g", "Ljava/lang/Float;", element_0_gItem_1); + listHolder_0->mList[i_0].g = static_castmList[i_0].g)>>( + chip::JniReferences::GetInstance().FloatToPrimitive(element_0_gItem_1)); + jobject element_0_hItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "h", "Ljava/lang/Double;", element_0_hItem_1); + listHolder_0->mList[i_0].h = static_castmList[i_0].h)>>( + chip::JniReferences::GetInstance().DoubleToPrimitive(element_0_hItem_1)); + } + request.arg1 = ListType_0(listHolder_0->mList, arg1Size); + } + else + { + request.arg1 = ListType_0(); + } + } std::unique_ptr onSuccess(Platform::New(callback), @@ -19403,19 +25008,71 @@ JNI_METHOD(void, TestClusterCluster, testListStructArgumentRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } JNI_METHOD(void, TestClusterCluster, testNestedStructArgumentRequest) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject a, jobject b, jobject c, jobject timedInvokeTimeoutMs) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject arg1, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestNestedStructArgumentRequest::Type request; - request.arg1 = chip::app::Clusters::TestCluster::Structs::NestedStruct::Type(); + std::list cleanupByteArrays; + std::list cleanupStrings; + jobject arg1_aItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "a", "Ljava/lang/Integer;", arg1_aItem_0); + request.arg1.a = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(arg1_aItem_0)); + jobject arg1_bItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "b", "Ljava/lang/Boolean;", arg1_bItem_0); + request.arg1.b = static_cast>( + chip::JniReferences::GetInstance().BooleanToPrimitive(arg1_bItem_0)); + jobject arg1_cItem_0; + chip::JniReferences::GetInstance().GetObjectField( + arg1, "c", "Lchip/devicecontroller/ChipStructs$TestClusterClusterSimpleStruct;", arg1_cItem_0); + jobject arg1_cItem_0_aItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "a", "Ljava/lang/Integer;", arg1_cItem_0_aItem_1); + request.arg1.c.a = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(arg1_cItem_0_aItem_1)); + jobject arg1_cItem_0_bItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "b", "Ljava/lang/Boolean;", arg1_cItem_0_bItem_1); + request.arg1.c.b = static_cast>( + chip::JniReferences::GetInstance().BooleanToPrimitive(arg1_cItem_0_bItem_1)); + jobject arg1_cItem_0_cItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "c", "Ljava/lang/Integer;", arg1_cItem_0_cItem_1); + request.arg1.c.c = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(arg1_cItem_0_cItem_1)); + jobject arg1_cItem_0_dItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "d", "[B", arg1_cItem_0_dItem_1); + auto arg1_cItem_0_dItem_1Jni = chip::Platform::New(env, static_cast(arg1_cItem_0_dItem_1)); + cleanupByteArrays.push_back(arg1_cItem_0_dItem_1Jni); + request.arg1.c.d = arg1_cItem_0_dItem_1Jni->byteSpan(); + jobject arg1_cItem_0_eItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "e", "Ljava/lang/String;", arg1_cItem_0_eItem_1); + auto arg1_cItem_0_eItem_1Jni = chip::Platform::New(env, static_cast(arg1_cItem_0_eItem_1)); + cleanupStrings.push_back(arg1_cItem_0_eItem_1Jni); + request.arg1.c.e = arg1_cItem_0_eItem_1Jni->charSpan(); + jobject arg1_cItem_0_fItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "f", "Ljava/lang/Integer;", arg1_cItem_0_fItem_1); + request.arg1.c.f = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(arg1_cItem_0_fItem_1)); + jobject arg1_cItem_0_gItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "g", "Ljava/lang/Float;", arg1_cItem_0_gItem_1); + request.arg1.c.g = static_cast>( + chip::JniReferences::GetInstance().FloatToPrimitive(arg1_cItem_0_gItem_1)); + jobject arg1_cItem_0_hItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "h", "Ljava/lang/Double;", arg1_cItem_0_hItem_1); + request.arg1.c.h = static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(arg1_cItem_0_hItem_1)); std::unique_ptr onSuccess(Platform::New(callback), @@ -19451,20 +25108,209 @@ JNI_METHOD(void, TestClusterCluster, testNestedStructArgumentRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } JNI_METHOD(void, TestClusterCluster, testNestedStructListArgumentRequest) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject a, jobject b, jobject c, jobject d, jobject e, - jbyteArray f, jobject g, jobject timedInvokeTimeoutMs) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject arg1, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestNestedStructListArgumentRequest::Type request; - request.arg1 = chip::app::Clusters::TestCluster::Structs::NestedStructList::Type(); + std::list cleanupByteArrays; + std::list cleanupStrings; + jobject arg1_aItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "a", "Ljava/lang/Integer;", arg1_aItem_0); + request.arg1.a = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(arg1_aItem_0)); + jobject arg1_bItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "b", "Ljava/lang/Boolean;", arg1_bItem_0); + request.arg1.b = static_cast>( + chip::JniReferences::GetInstance().BooleanToPrimitive(arg1_bItem_0)); + jobject arg1_cItem_0; + chip::JniReferences::GetInstance().GetObjectField( + arg1, "c", "Lchip/devicecontroller/ChipStructs$TestClusterClusterSimpleStruct;", arg1_cItem_0); + jobject arg1_cItem_0_aItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "a", "Ljava/lang/Integer;", arg1_cItem_0_aItem_1); + request.arg1.c.a = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(arg1_cItem_0_aItem_1)); + jobject arg1_cItem_0_bItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "b", "Ljava/lang/Boolean;", arg1_cItem_0_bItem_1); + request.arg1.c.b = static_cast>( + chip::JniReferences::GetInstance().BooleanToPrimitive(arg1_cItem_0_bItem_1)); + jobject arg1_cItem_0_cItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "c", "Ljava/lang/Integer;", arg1_cItem_0_cItem_1); + request.arg1.c.c = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(arg1_cItem_0_cItem_1)); + jobject arg1_cItem_0_dItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "d", "[B", arg1_cItem_0_dItem_1); + auto arg1_cItem_0_dItem_1Jni = chip::Platform::New(env, static_cast(arg1_cItem_0_dItem_1)); + cleanupByteArrays.push_back(arg1_cItem_0_dItem_1Jni); + request.arg1.c.d = arg1_cItem_0_dItem_1Jni->byteSpan(); + jobject arg1_cItem_0_eItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "e", "Ljava/lang/String;", arg1_cItem_0_eItem_1); + auto arg1_cItem_0_eItem_1Jni = chip::Platform::New(env, static_cast(arg1_cItem_0_eItem_1)); + cleanupStrings.push_back(arg1_cItem_0_eItem_1Jni); + request.arg1.c.e = arg1_cItem_0_eItem_1Jni->charSpan(); + jobject arg1_cItem_0_fItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "f", "Ljava/lang/Integer;", arg1_cItem_0_fItem_1); + request.arg1.c.f = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(arg1_cItem_0_fItem_1)); + jobject arg1_cItem_0_gItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "g", "Ljava/lang/Float;", arg1_cItem_0_gItem_1); + request.arg1.c.g = static_cast>( + chip::JniReferences::GetInstance().FloatToPrimitive(arg1_cItem_0_gItem_1)); + jobject arg1_cItem_0_hItem_1; + chip::JniReferences::GetInstance().GetObjectField(arg1_cItem_0, "h", "Ljava/lang/Double;", arg1_cItem_0_hItem_1); + request.arg1.c.h = static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(arg1_cItem_0_hItem_1)); + jobject arg1_dItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "d", "Ljava/util/ArrayList;", arg1_dItem_0); + { + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + jint arg1_dItem_0Size; + chip::JniReferences::GetInstance().GetArrayListSize(arg1_dItem_0, arg1_dItem_0Size); + if (arg1_dItem_0Size != 0) + { + auto * listHolder_1 = new ListHolder(arg1_dItem_0Size); + listFreer.add(listHolder_1); + + for (size_t i_1 = 0; i_1 < static_cast(arg1_dItem_0Size); ++i_1) + { + jobject element_1; + chip::JniReferences::GetInstance().GetArrayListItem(arg1_dItem_0, i_1, element_1); + jobject element_1_aItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_1, "a", "Ljava/lang/Integer;", element_1_aItem_2); + listHolder_1->mList[i_1].a = static_castmList[i_1].a)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_1_aItem_2)); + jobject element_1_bItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_1, "b", "Ljava/lang/Boolean;", element_1_bItem_2); + listHolder_1->mList[i_1].b = static_castmList[i_1].b)>>( + chip::JniReferences::GetInstance().BooleanToPrimitive(element_1_bItem_2)); + jobject element_1_cItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_1, "c", "Ljava/lang/Integer;", element_1_cItem_2); + listHolder_1->mList[i_1].c = static_castmList[i_1].c)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_1_cItem_2)); + jobject element_1_dItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_1, "d", "[B", element_1_dItem_2); + auto element_1_dItem_2Jni = + chip::Platform::New(env, static_cast(element_1_dItem_2)); + cleanupByteArrays.push_back(element_1_dItem_2Jni); + listHolder_1->mList[i_1].d = element_1_dItem_2Jni->byteSpan(); + jobject element_1_eItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_1, "e", "Ljava/lang/String;", element_1_eItem_2); + auto element_1_eItem_2Jni = chip::Platform::New(env, static_cast(element_1_eItem_2)); + cleanupStrings.push_back(element_1_eItem_2Jni); + listHolder_1->mList[i_1].e = element_1_eItem_2Jni->charSpan(); + jobject element_1_fItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_1, "f", "Ljava/lang/Integer;", element_1_fItem_2); + listHolder_1->mList[i_1].f = static_castmList[i_1].f)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_1_fItem_2)); + jobject element_1_gItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_1, "g", "Ljava/lang/Float;", element_1_gItem_2); + listHolder_1->mList[i_1].g = static_castmList[i_1].g)>>( + chip::JniReferences::GetInstance().FloatToPrimitive(element_1_gItem_2)); + jobject element_1_hItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_1, "h", "Ljava/lang/Double;", element_1_hItem_2); + listHolder_1->mList[i_1].h = static_castmList[i_1].h)>>( + chip::JniReferences::GetInstance().DoubleToPrimitive(element_1_hItem_2)); + } + request.arg1.d = ListType_1(listHolder_1->mList, arg1_dItem_0Size); + } + else + { + request.arg1.d = ListType_1(); + } + } + jobject arg1_eItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "e", "Ljava/util/ArrayList;", arg1_eItem_0); + { + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + jint arg1_eItem_0Size; + chip::JniReferences::GetInstance().GetArrayListSize(arg1_eItem_0, arg1_eItem_0Size); + if (arg1_eItem_0Size != 0) + { + auto * listHolder_1 = new ListHolder(arg1_eItem_0Size); + listFreer.add(listHolder_1); + + for (size_t i_1 = 0; i_1 < static_cast(arg1_eItem_0Size); ++i_1) + { + jobject element_1; + chip::JniReferences::GetInstance().GetArrayListItem(arg1_eItem_0, i_1, element_1); + listHolder_1->mList[i_1] = static_castmList[i_1])>>( + chip::JniReferences::GetInstance().LongToPrimitive(element_1)); + } + request.arg1.e = ListType_1(listHolder_1->mList, arg1_eItem_0Size); + } + else + { + request.arg1.e = ListType_1(); + } + } + jobject arg1_fItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "f", "Ljava/util/ArrayList;", arg1_fItem_0); + { + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + jint arg1_fItem_0Size; + chip::JniReferences::GetInstance().GetArrayListSize(arg1_fItem_0, arg1_fItem_0Size); + if (arg1_fItem_0Size != 0) + { + auto * listHolder_1 = new ListHolder(arg1_fItem_0Size); + listFreer.add(listHolder_1); + + for (size_t i_1 = 0; i_1 < static_cast(arg1_fItem_0Size); ++i_1) + { + jobject element_1; + chip::JniReferences::GetInstance().GetArrayListItem(arg1_fItem_0, i_1, element_1); + auto element_1Jni = chip::Platform::New(env, static_cast(element_1)); + cleanupByteArrays.push_back(element_1Jni); + listHolder_1->mList[i_1] = element_1Jni->byteSpan(); + } + request.arg1.f = ListType_1(listHolder_1->mList, arg1_fItem_0Size); + } + else + { + request.arg1.f = ListType_1(); + } + } + jobject arg1_gItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "g", "Ljava/util/ArrayList;", arg1_gItem_0); + { + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + jint arg1_gItem_0Size; + chip::JniReferences::GetInstance().GetArrayListSize(arg1_gItem_0, arg1_gItem_0Size); + if (arg1_gItem_0Size != 0) + { + auto * listHolder_1 = new ListHolder(arg1_gItem_0Size); + listFreer.add(listHolder_1); + + for (size_t i_1 = 0; i_1 < static_cast(arg1_gItem_0Size); ++i_1) + { + jobject element_1; + chip::JniReferences::GetInstance().GetArrayListItem(arg1_gItem_0, i_1, element_1); + listHolder_1->mList[i_1] = static_castmList[i_1])>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_1)); + } + request.arg1.g = ListType_1(listHolder_1->mList, arg1_gItem_0Size); + } + else + { + request.arg1.g = ListType_1(); + } + } std::unique_ptr onSuccess(Platform::New(callback), @@ -19500,6 +25346,11 @@ JNI_METHOD(void, TestClusterCluster, testNestedStructListArgumentRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -19510,8 +25361,12 @@ JNI_METHOD(void, TestClusterCluster, testNotHandled) CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestNotHandled::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -19544,6 +25399,11 @@ JNI_METHOD(void, TestClusterCluster, testNotHandled) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -19554,16 +25414,27 @@ JNI_METHOD(void, TestClusterCluster, testNullableOptionalRequest) CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type request; - chip::JniReferences::GetInstance().GetOptionalValue(arg1, arg1); - uint8_t arg1Value; + std::list cleanupByteArrays; + std::list cleanupStrings; if (arg1 != nullptr) { - arg1Value = chip::JniReferences::GetInstance().IntegerToPrimitive(arg1); + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(arg1, optionalValue_0); + auto & definedValue_0 = request.arg1.Emplace(); + if (optionalValue_0 == nullptr) + { + definedValue_0.SetNull(); + } + else + { + auto & nonNullValue_1 = definedValue_0.SetNonNull(); + nonNullValue_1 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionalValue_0)); + } } - request.arg1 = chip::Optional>( - arg1 == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(arg1Value)); std::unique_ptr @@ -19600,6 +25471,11 @@ JNI_METHOD(void, TestClusterCluster, testNullableOptionalRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -19610,11 +25486,19 @@ JNI_METHOD(void, TestClusterCluster, testSimpleOptionalArgumentRequest) CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestSimpleOptionalArgumentRequest::Type request; - chip::JniReferences::GetInstance().GetOptionalValue(arg1, arg1); - request.arg1 = - chip::Optional(static_cast(chip::JniReferences::GetInstance().BooleanToPrimitive(arg1))); + std::list cleanupByteArrays; + std::list cleanupStrings; + if (arg1 != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(arg1, optionalValue_0); + auto & definedValue_0 = request.arg1.Emplace(); + definedValue_0 = static_cast>( + chip::JniReferences::GetInstance().BooleanToPrimitive(optionalValue_0)); + } std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -19648,6 +25532,11 @@ JNI_METHOD(void, TestClusterCluster, testSimpleOptionalArgumentRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -19658,8 +25547,12 @@ JNI_METHOD(void, TestClusterCluster, testSpecific) CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestSpecific::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess(Platform::New(callback), @@ -19695,20 +25588,60 @@ JNI_METHOD(void, TestClusterCluster, testSpecific) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } JNI_METHOD(void, TestClusterCluster, testStructArgumentRequest) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject a, jobject b, jobject c, jbyteArray d, jstring e, - jobject f, jobject g, jobject h, jobject timedInvokeTimeoutMs) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject arg1, jobject timedInvokeTimeoutMs) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestStructArgumentRequest::Type request; - request.arg1 = chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type(); + std::list cleanupByteArrays; + std::list cleanupStrings; + jobject arg1_aItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "a", "Ljava/lang/Integer;", arg1_aItem_0); + request.arg1.a = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(arg1_aItem_0)); + jobject arg1_bItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "b", "Ljava/lang/Boolean;", arg1_bItem_0); + request.arg1.b = static_cast>( + chip::JniReferences::GetInstance().BooleanToPrimitive(arg1_bItem_0)); + jobject arg1_cItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "c", "Ljava/lang/Integer;", arg1_cItem_0); + request.arg1.c = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(arg1_cItem_0)); + jobject arg1_dItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "d", "[B", arg1_dItem_0); + auto arg1_dItem_0Jni = chip::Platform::New(env, static_cast(arg1_dItem_0)); + cleanupByteArrays.push_back(arg1_dItem_0Jni); + request.arg1.d = arg1_dItem_0Jni->byteSpan(); + jobject arg1_eItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "e", "Ljava/lang/String;", arg1_eItem_0); + auto arg1_eItem_0Jni = chip::Platform::New(env, static_cast(arg1_eItem_0)); + cleanupStrings.push_back(arg1_eItem_0Jni); + request.arg1.e = arg1_eItem_0Jni->charSpan(); + jobject arg1_fItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "f", "Ljava/lang/Integer;", arg1_fItem_0); + request.arg1.f = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(arg1_fItem_0)); + jobject arg1_gItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "g", "Ljava/lang/Float;", arg1_gItem_0); + request.arg1.g = static_cast>( + chip::JniReferences::GetInstance().FloatToPrimitive(arg1_gItem_0)); + jobject arg1_hItem_0; + chip::JniReferences::GetInstance().GetObjectField(arg1, "h", "Ljava/lang/Double;", arg1_hItem_0); + request.arg1.h = static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(arg1_hItem_0)); std::unique_ptr onSuccess(Platform::New(callback), @@ -19744,6 +25677,11 @@ JNI_METHOD(void, TestClusterCluster, testStructArgumentRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -19754,8 +25692,12 @@ JNI_METHOD(void, TestClusterCluster, testUnknownCommand) CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TestUnknownCommand::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -19788,6 +25730,11 @@ JNI_METHOD(void, TestClusterCluster, testUnknownCommand) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -19798,8 +25745,12 @@ JNI_METHOD(void, TestClusterCluster, timedInvokeRequest) CHIP_ERROR err = CHIP_NO_ERROR; TestClusterCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::TestCluster::Commands::TimedInvokeRequest::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -19825,6 +25776,11 @@ JNI_METHOD(void, TestClusterCluster, timedInvokeRequest) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -20790,6 +26746,121 @@ JNI_METHOD(void, TestClusterCluster, subscribeOctetStringAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, TestClusterCluster, subscribeListInt8uAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ListInt8u::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPTestClusterListInt8uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, TestClusterCluster, subscribeListOctetStringAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ListOctetString::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPTestClusterListOctetStringAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, TestClusterCluster, subscribeListStructOctetStringAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ListStructOctetString::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPTestClusterListStructOctetStringAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, TestClusterCluster, subscribeLongOctetStringAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -21013,6 +27084,47 @@ JNI_METHOD(void, TestClusterCluster, subscribeVendorIdAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, TestClusterCluster, subscribeListNullablesAndOptionalsStructAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ListNullablesAndOptionalsStruct::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPTestClusterListNullablesAndOptionalsStructAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, TestClusterCluster, subscribeEnumAttrAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -21198,6 +27310,45 @@ JNI_METHOD(void, TestClusterCluster, subscribeRangeRestrictedInt16sAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, TestClusterCluster, subscribeListLongOctetStringAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ListLongOctetString::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPTestClusterListLongOctetStringAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, TestClusterCluster, subscribeTimedWriteBooleanAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -22504,6 +28655,44 @@ JNI_METHOD(void, TestClusterCluster, subscribeNullableRangeRestrictedInt16sAttri onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, TestClusterCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPTestClusterAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, TestClusterCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -22557,8 +28746,12 @@ JNI_METHOD(void, ThermostatCluster, clearWeeklySchedule) CHIP_ERROR err = CHIP_NO_ERROR; ThermostatCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Thermostat::Commands::ClearWeeklySchedule::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -22591,6 +28784,11 @@ JNI_METHOD(void, ThermostatCluster, clearWeeklySchedule) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -22601,8 +28799,12 @@ JNI_METHOD(void, ThermostatCluster, getRelayStatusLog) CHIP_ERROR err = CHIP_NO_ERROR; ThermostatCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Thermostat::Commands::GetRelayStatusLog::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess(Platform::New(callback), @@ -22638,6 +28840,11 @@ JNI_METHOD(void, ThermostatCluster, getRelayStatusLog) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -22649,12 +28856,15 @@ JNI_METHOD(void, ThermostatCluster, getWeeklySchedule) CHIP_ERROR err = CHIP_NO_ERROR; ThermostatCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Thermostat::Commands::GetWeeklySchedule::Type request; - request.daysToReturn = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(daysToReturn)); - request.modeToReturn = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(modeToReturn)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.daysToReturn = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(daysToReturn)); + request.modeToReturn = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(modeToReturn)); std::unique_ptr @@ -22691,6 +28901,11 @@ JNI_METHOD(void, ThermostatCluster, getWeeklySchedule) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -22702,15 +28917,41 @@ JNI_METHOD(void, ThermostatCluster, setWeeklySchedule) CHIP_ERROR err = CHIP_NO_ERROR; ThermostatCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Thermostat::Commands::SetWeeklySchedule::Type request; - request.numberOfTransitionsForSequence = static_cast( + std::list cleanupByteArrays; + std::list cleanupStrings; + request.numberOfTransitionsForSequence = static_cast>( chip::JniReferences::GetInstance().IntegerToPrimitive(numberOfTransitionsForSequence)); - request.dayOfWeekForSequence = static_cast( + request.dayOfWeekForSequence = static_cast>( chip::JniReferences::GetInstance().IntegerToPrimitive(dayOfWeekForSequence)); - request.modeForSequence = - static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(modeForSequence)); - request.payload = chip::app::DataModel::List(); + request.modeForSequence = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(modeForSequence)); + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint payloadSize; + chip::JniReferences::GetInstance().GetArrayListSize(payload, payloadSize); + if (payloadSize != 0) + { + auto * listHolder_0 = new ListHolder(payloadSize); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(payloadSize); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(payload, i_0, element_0); + listHolder_0->mList[i_0] = static_castmList[i_0])>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0)); + } + request.payload = ListType_0(listHolder_0->mList, payloadSize); + } + else + { + request.payload = ListType_0(); + } + } std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -22744,6 +28985,11 @@ JNI_METHOD(void, ThermostatCluster, setWeeklySchedule) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -22754,10 +29000,15 @@ JNI_METHOD(void, ThermostatCluster, setpointRaiseLower) CHIP_ERROR err = CHIP_NO_ERROR; ThermostatCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::Thermostat::Commands::SetpointRaiseLower::Type request; - request.mode = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(mode)); - request.amount = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(amount)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.mode = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(mode)); + request.amount = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(amount)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -22791,6 +29042,11 @@ JNI_METHOD(void, ThermostatCluster, setpointRaiseLower) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -23415,7 +29671,45 @@ JNI_METHOD(void, ThermostatCluster, subscribeNumberOfDailyTransitionsAttribute) err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), static_cast(maxInterval), - CHIPInt8uAttributeCallback::OnSubscriptionEstablished); + CHIPInt8uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, ThermostatCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ThermostatCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::Thermostat::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPThermostatAttributeListAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -23624,6 +29918,48 @@ JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, subscribeScheduleP onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ThermostatUserInterfaceConfigurationCluster * cppCluster = + reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -23678,8 +30014,12 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, resetCounts) CHIP_ERROR err = CHIP_NO_ERROR; ThreadNetworkDiagnosticsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::ThreadNetworkDiagnostics::Commands::ResetCounts::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -23712,6 +30052,11 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, resetCounts) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -23976,6 +30321,87 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeOverrunCountAttribute onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeNeighborTableListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ThreadNetworkDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::NeighborTableList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPThreadNetworkDiagnosticsNeighborTableListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRouteTableListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ThreadNetworkDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RouteTableList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPThreadNetworkDiagnosticsRouteTableListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribePartitionIdAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -25469,7 +31895,159 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxDestAddrFilteredCou using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDestAddrFilteredCount::TypeInfo; auto successFn = - chip::Callback::Callback::FromCancelable( + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt32uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxDuplicatedCountAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ThreadNetworkDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDuplicatedCount::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt32uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrNoFrameCountAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ThreadNetworkDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrNoFrameCount::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt32uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrUnknownNeighborCountAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ThreadNetworkDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrUnknownNeighborCount::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt32uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrInvalidSrcAddrCountAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ThreadNetworkDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrInvalidSrcAddrCount::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); @@ -25483,7 +32061,7 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxDestAddrFilteredCou onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxDuplicatedCountAttribute) +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrSecCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; @@ -25505,9 +32083,9 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxDuplicatedCountAttr chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDuplicatedCount::TypeInfo; + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrSecCount::TypeInfo; auto successFn = - chip::Callback::Callback::FromCancelable( + chip::Callback::Callback::FromCancelable( onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); @@ -25521,7 +32099,7 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxDuplicatedCountAttr onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrNoFrameCountAttribute) +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrFcsCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; @@ -25543,9 +32121,9 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrNoFrameCountAttr chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrNoFrameCount::TypeInfo; + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrFcsCount::TypeInfo; auto successFn = - chip::Callback::Callback::FromCancelable( + chip::Callback::Callback::FromCancelable( onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); @@ -25559,7 +32137,7 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrNoFrameCountAttr onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrUnknownNeighborCountAttribute) +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrOtherCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; @@ -25581,9 +32159,9 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrUnknownNeighborC chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrUnknownNeighborCount::TypeInfo; + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrOtherCount::TypeInfo; auto successFn = - chip::Callback::Callback::FromCancelable( + chip::Callback::Callback::FromCancelable( onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); @@ -25597,12 +32175,12 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrUnknownNeighborC onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrInvalidSrcAddrCountAttribute) +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeActiveTimestampAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -25619,15 +32197,15 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrInvalidSrcAddrCo chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrInvalidSrcAddrCount::TypeInfo; + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::TypeInfo; auto successFn = - chip::Callback::Callback::FromCancelable( + chip::Callback::Callback::FromCancelable( onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), static_cast(maxInterval), - CHIPInt32uAttributeCallback::OnSubscriptionEstablished); + CHIPInt64uAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -25635,12 +32213,12 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrInvalidSrcAddrCo onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrSecCountAttribute) +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribePendingTimestampAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -25657,15 +32235,15 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrSecCountAttribut chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrSecCount::TypeInfo; + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PendingTimestamp::TypeInfo; auto successFn = - chip::Callback::Callback::FromCancelable( + chip::Callback::Callback::FromCancelable( onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), static_cast(maxInterval), - CHIPInt32uAttributeCallback::OnSubscriptionEstablished); + CHIPInt64uAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -25673,7 +32251,7 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrSecCountAttribut onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrFcsCountAttribute) +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeDelayAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; @@ -25695,10 +32273,9 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrFcsCountAttribut chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrFcsCount::TypeInfo; - auto successFn = - chip::Callback::Callback::FromCancelable( - onSuccess->Cancel()); + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Delay::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, @@ -25711,12 +32288,14 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrFcsCountAttribut onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrOtherCountAttribute) +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeSecurityPolicyAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -25733,15 +32312,15 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrOtherCountAttrib chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrOtherCount::TypeInfo; + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::SecurityPolicy::TypeInfo; auto successFn = - chip::Callback::Callback::FromCancelable( + chip::Callback::Callback::FromCancelable( onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); - err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, - static_cast(minInterval), static_cast(maxInterval), - CHIPInt32uAttributeCallback::OnSubscriptionEstablished); + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPThreadNetworkDiagnosticsSecurityPolicyAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -25749,12 +32328,12 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeRxErrOtherCountAttrib onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeActiveTimestampAttribute) +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeChannelMaskAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -25771,15 +32350,14 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeActiveTimestampAttrib chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::TypeInfo; - auto successFn = - chip::Callback::Callback::FromCancelable( - onSuccess->Cancel()); + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ChannelMask::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), static_cast(maxInterval), - CHIPInt64uAttributeCallback::OnSubscriptionEstablished); + CHIPOctetStringAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -25787,12 +32365,14 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeActiveTimestampAttrib onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribePendingTimestampAttribute) +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeOperationalDatasetComponentsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -25809,15 +32389,15 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribePendingTimestampAttri chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PendingTimestamp::TypeInfo; - auto successFn = - chip::Callback::Callback::FromCancelable( - onSuccess->Cancel()); + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::OperationalDatasetComponents::TypeInfo; + auto successFn = chip::Callback::Callback< + CHIPThreadNetworkDiagnosticsClusterOperationalDatasetComponentsAttributeCallbackType>::FromCancelable(onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); - err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, - static_cast(minInterval), static_cast(maxInterval), - CHIPInt64uAttributeCallback::OnSubscriptionEstablished); + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPThreadNetworkDiagnosticsOperationalDatasetComponentsAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -25825,12 +32405,14 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribePendingTimestampAttri onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeDelayAttribute) +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeActiveNetworkFaultsListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -25847,14 +32429,16 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeDelayAttribute) chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Delay::TypeInfo; - auto successFn = chip::Callback::Callback::FromCancelable( - onSuccess->Cancel()); + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveNetworkFaultsList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); - err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, - static_cast(minInterval), static_cast(maxInterval), - CHIPInt32uAttributeCallback::OnSubscriptionEstablished); + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), + CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -25862,12 +32446,14 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeDelayAttribute) onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeChannelMaskAttribute) +JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeAttributeListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { chip::DeviceLayer::StackLock lock; - std::unique_ptr onSuccess( - Platform::New(callback, true), chip::Platform::Delete); + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -25884,14 +32470,15 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, subscribeChannelMaskAttribute) chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ChannelMask::TypeInfo; - auto successFn = chip::Callback::Callback::FromCancelable( - onSuccess->Cancel()); + using TypeInfo = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); - err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, - static_cast(minInterval), static_cast(maxInterval), - CHIPOctetStringAttributeCallback::OnSubscriptionEstablished); + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPThreadNetworkDiagnosticsAttributeListAttributeCallback::OnSubscriptionEstablished); VerifyOrReturn(err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error subscribing to attribute", err)); @@ -25983,6 +32570,44 @@ JNI_METHOD(jlong, UserLabelCluster, initWithDevice)(JNIEnv * env, jobject self, return reinterpret_cast(cppCluster); } +JNI_METHOD(void, UserLabelCluster, subscribeLabelListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + UserLabelCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::UserLabel::Attributes::LabelList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPUserLabelLabelListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, UserLabelCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -26066,6 +32691,44 @@ JNI_METHOD(void, WakeOnLanCluster, subscribeWakeOnLanMacAddressAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, WakeOnLanCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + WakeOnLanCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::WakeOnLan::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPWakeOnLanAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, WakeOnLanCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -26119,8 +32782,12 @@ JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, resetCounts) CHIP_ERROR err = CHIP_NO_ERROR; WiFiNetworkDiagnosticsCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::WiFiNetworkDiagnostics::Commands::ResetCounts::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -26153,6 +32820,11 @@ JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, resetCounts) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -26642,6 +33314,45 @@ JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, subscribeOverrunCountAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + WiFiNetworkDiagnosticsCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::AttributeList::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute( + onSuccess->mContext, successFn->mCall, failureFn->mCall, static_cast(minInterval), + static_cast(maxInterval), CHIPWiFiNetworkDiagnosticsAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, subscribeFeatureMapAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -26733,8 +33444,12 @@ JNI_METHOD(void, WindowCoveringCluster, downOrClose) CHIP_ERROR err = CHIP_NO_ERROR; WindowCoveringCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -26767,6 +33482,11 @@ JNI_METHOD(void, WindowCoveringCluster, downOrClose) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -26778,11 +33498,14 @@ JNI_METHOD(void, WindowCoveringCluster, goToLiftPercentage) CHIP_ERROR err = CHIP_NO_ERROR; WindowCoveringCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type request; - request.liftPercentageValue = static_cast( + std::list cleanupByteArrays; + std::list cleanupStrings; + request.liftPercentageValue = static_cast>( chip::JniReferences::GetInstance().IntegerToPrimitive(liftPercentageValue)); - request.liftPercent100thsValue = static_cast( + request.liftPercent100thsValue = static_cast>( chip::JniReferences::GetInstance().IntegerToPrimitive(liftPercent100thsValue)); std::unique_ptr onSuccess( @@ -26817,6 +33540,11 @@ JNI_METHOD(void, WindowCoveringCluster, goToLiftPercentage) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -26827,9 +33555,13 @@ JNI_METHOD(void, WindowCoveringCluster, goToLiftValue) CHIP_ERROR err = CHIP_NO_ERROR; WindowCoveringCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::WindowCovering::Commands::GoToLiftValue::Type request; - request.liftValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(liftValue)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.liftValue = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(liftValue)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -26863,6 +33595,11 @@ JNI_METHOD(void, WindowCoveringCluster, goToLiftValue) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -26874,11 +33611,14 @@ JNI_METHOD(void, WindowCoveringCluster, goToTiltPercentage) CHIP_ERROR err = CHIP_NO_ERROR; WindowCoveringCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type request; - request.tiltPercentageValue = static_cast( + std::list cleanupByteArrays; + std::list cleanupStrings; + request.tiltPercentageValue = static_cast>( chip::JniReferences::GetInstance().IntegerToPrimitive(tiltPercentageValue)); - request.tiltPercent100thsValue = static_cast( + request.tiltPercent100thsValue = static_cast>( chip::JniReferences::GetInstance().IntegerToPrimitive(tiltPercent100thsValue)); std::unique_ptr onSuccess( @@ -26913,6 +33653,11 @@ JNI_METHOD(void, WindowCoveringCluster, goToTiltPercentage) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -26923,9 +33668,13 @@ JNI_METHOD(void, WindowCoveringCluster, goToTiltValue) CHIP_ERROR err = CHIP_NO_ERROR; WindowCoveringCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::WindowCovering::Commands::GoToTiltValue::Type request; - request.tiltValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(tiltValue)); + std::list cleanupByteArrays; + std::list cleanupStrings; + request.tiltValue = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(tiltValue)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -26959,6 +33708,11 @@ JNI_METHOD(void, WindowCoveringCluster, goToTiltValue) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -26969,8 +33723,12 @@ JNI_METHOD(void, WindowCoveringCluster, stopMotion) CHIP_ERROR err = CHIP_NO_ERROR; WindowCoveringCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::WindowCovering::Commands::StopMotion::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -27003,6 +33761,11 @@ JNI_METHOD(void, WindowCoveringCluster, stopMotion) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -27013,8 +33776,12 @@ JNI_METHOD(void, WindowCoveringCluster, upOrOpen) CHIP_ERROR err = CHIP_NO_ERROR; WindowCoveringCluster * cppCluster; + ListFreer listFreer; chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type request; + std::list cleanupByteArrays; + std::list cleanupStrings; + std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); std::unique_ptr onFailure( @@ -27047,6 +33814,11 @@ JNI_METHOD(void, WindowCoveringCluster, upOrOpen) AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", CHIP_ERROR_INCORRECT_STATE)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -27746,6 +34518,44 @@ JNI_METHOD(void, WindowCoveringCluster, subscribeSafetyStatusAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, WindowCoveringCluster, subscribeAttributeListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr + onSuccess(Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + WindowCoveringCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::AttributeList::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPWindowCoveringAttributeListAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, WindowCoveringCluster, subscribeFeatureMapAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { diff --git a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp index 02ecd6767dffd4..816a65dcda882c 100644 --- a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -40,14 +41,311 @@ using namespace chip; using namespace chip::Controller; +JNI_METHOD(void, AccessControlCluster, writeAclAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::AccessControl::Attributes::Acl::TypeInfo; + TypeInfo::Type cppValue; + + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint valueSize; + chip::JniReferences::GetInstance().GetArrayListSize(value, valueSize); + if (valueSize != 0) + { + auto * listHolder_0 = new ListHolder(valueSize); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(valueSize); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(value, i_0, element_0); + jobject element_0_fabricIndexItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "fabricIndex", "Ljava/lang/Integer;", + element_0_fabricIndexItem_1); + listHolder_0->mList[i_0].fabricIndex = + static_castmList[i_0].fabricIndex)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_fabricIndexItem_1)); + jobject element_0_privilegeItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "privilege", "Ljava/lang/Integer;", + element_0_privilegeItem_1); + listHolder_0->mList[i_0].privilege = + static_castmList[i_0].privilege)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_privilegeItem_1)); + jobject element_0_authModeItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "authMode", "Ljava/lang/Integer;", + element_0_authModeItem_1); + listHolder_0->mList[i_0].authMode = + static_castmList[i_0].authMode)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_authModeItem_1)); + jobject element_0_subjectsItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "subjects", "Ljava/util/ArrayList;", + element_0_subjectsItem_1); + if (element_0_subjectsItem_1 == nullptr) + { + listHolder_0->mList[i_0].subjects.SetNull(); + } + else + { + auto & nonNullValue_2 = listHolder_0->mList[i_0].subjects.SetNonNull(); + { + using ListType_3 = std::remove_reference_t; + using ListMemberType_3 = ListMemberTypeGetter::Type; + jint element_0_subjectsItem_1Size; + chip::JniReferences::GetInstance().GetArrayListSize(element_0_subjectsItem_1, element_0_subjectsItem_1Size); + if (element_0_subjectsItem_1Size != 0) + { + auto * listHolder_3 = new ListHolder(element_0_subjectsItem_1Size); + listFreer.add(listHolder_3); + + for (size_t i_3 = 0; i_3 < static_cast(element_0_subjectsItem_1Size); ++i_3) + { + jobject element_3; + chip::JniReferences::GetInstance().GetArrayListItem(element_0_subjectsItem_1, i_3, element_3); + listHolder_3->mList[i_3] = static_castmList[i_3])>>( + chip::JniReferences::GetInstance().LongToPrimitive(element_3)); + } + nonNullValue_2 = ListType_3(listHolder_3->mList, element_0_subjectsItem_1Size); + } + else + { + nonNullValue_2 = ListType_3(); + } + } + } + jobject element_0_targetsItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "targets", "Ljava/util/ArrayList;", + element_0_targetsItem_1); + if (element_0_targetsItem_1 == nullptr) + { + listHolder_0->mList[i_0].targets.SetNull(); + } + else + { + auto & nonNullValue_2 = listHolder_0->mList[i_0].targets.SetNonNull(); + { + using ListType_3 = std::remove_reference_t; + using ListMemberType_3 = ListMemberTypeGetter::Type; + jint element_0_targetsItem_1Size; + chip::JniReferences::GetInstance().GetArrayListSize(element_0_targetsItem_1, element_0_targetsItem_1Size); + if (element_0_targetsItem_1Size != 0) + { + auto * listHolder_3 = new ListHolder(element_0_targetsItem_1Size); + listFreer.add(listHolder_3); + + for (size_t i_3 = 0; i_3 < static_cast(element_0_targetsItem_1Size); ++i_3) + { + jobject element_3; + chip::JniReferences::GetInstance().GetArrayListItem(element_0_targetsItem_1, i_3, element_3); + jobject element_3_clusterItem_4; + chip::JniReferences::GetInstance().GetObjectField(element_3, "cluster", "Ljava/lang/Long;", + element_3_clusterItem_4); + if (element_3_clusterItem_4 == nullptr) + { + listHolder_3->mList[i_3].cluster.SetNull(); + } + else + { + auto & nonNullValue_5 = listHolder_3->mList[i_3].cluster.SetNonNull(); + nonNullValue_5 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(element_3_clusterItem_4)); + } + jobject element_3_endpointItem_4; + chip::JniReferences::GetInstance().GetObjectField(element_3, "endpoint", "Ljava/lang/Integer;", + element_3_endpointItem_4); + if (element_3_endpointItem_4 == nullptr) + { + listHolder_3->mList[i_3].endpoint.SetNull(); + } + else + { + auto & nonNullValue_5 = listHolder_3->mList[i_3].endpoint.SetNonNull(); + nonNullValue_5 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_3_endpointItem_4)); + } + jobject element_3_deviceTypeItem_4; + chip::JniReferences::GetInstance().GetObjectField(element_3, "deviceType", "Ljava/lang/Long;", + element_3_deviceTypeItem_4); + if (element_3_deviceTypeItem_4 == nullptr) + { + listHolder_3->mList[i_3].deviceType.SetNull(); + } + else + { + auto & nonNullValue_5 = listHolder_3->mList[i_3].deviceType.SetNonNull(); + nonNullValue_5 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(element_3_deviceTypeItem_4)); + } + } + nonNullValue_2 = ListType_3(listHolder_3->mList, element_0_targetsItem_1Size); + } + else + { + nonNullValue_2 = ListType_3(); + } + } + } + } + cppValue = ListType_0(listHolder_0->mList, valueSize); + } + else + { + cppValue = ListType_0(); + } + } + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + AccessControlCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedWriteTimeoutMs == nullptr) + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedWriteTimeoutMs)); + } + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, AccessControlCluster, writeExtensionAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::AccessControl::Attributes::Extension::TypeInfo; + TypeInfo::Type cppValue; + + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint valueSize; + chip::JniReferences::GetInstance().GetArrayListSize(value, valueSize); + if (valueSize != 0) + { + auto * listHolder_0 = new ListHolder(valueSize); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(valueSize); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(value, i_0, element_0); + jobject element_0_fabricIndexItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "fabricIndex", "Ljava/lang/Integer;", + element_0_fabricIndexItem_1); + listHolder_0->mList[i_0].fabricIndex = + static_castmList[i_0].fabricIndex)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_fabricIndexItem_1)); + jobject element_0_dataItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "data", "[B", element_0_dataItem_1); + auto element_0_dataItem_1Jni = + chip::Platform::New(env, static_cast(element_0_dataItem_1)); + cleanupByteArrays.push_back(element_0_dataItem_1Jni); + listHolder_0->mList[i_0].data = element_0_dataItem_1Jni->byteSpan(); + } + cppValue = ListType_0(listHolder_0->mList, valueSize); + } + else + { + cppValue = ListType_0(); + } + } + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + AccessControlCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedWriteTimeoutMs == nullptr) + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedWriteTimeoutMs)); + } + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} + JNI_METHOD(void, BasicCluster, writeNodeLabelAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jstring value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::Basic::Attributes::NodeLabel::TypeInfo; TypeInfo::Type cppValue; - cppValue = chip::JniUtfString(env, static_cast(value)).charSpan(); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + auto valueJni = chip::Platform::New(env, static_cast(value)); + cleanupStrings.push_back(valueJni); + cppValue = valueJni->charSpan(); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -83,6 +381,11 @@ JNI_METHOD(void, BasicCluster, writeNodeLabelAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -91,10 +394,16 @@ JNI_METHOD(void, BasicCluster, writeLocationAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jstring value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::Basic::Attributes::Location::TypeInfo; TypeInfo::Type cppValue; - cppValue = chip::JniUtfString(env, static_cast(value)).charSpan(); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + auto valueJni = chip::Platform::New(env, static_cast(value)); + cleanupStrings.push_back(valueJni); + cppValue = valueJni->charSpan(); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -130,6 +439,11 @@ JNI_METHOD(void, BasicCluster, writeLocationAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -138,10 +452,15 @@ JNI_METHOD(void, BasicCluster, writeLocalConfigDisabledAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::Basic::Attributes::LocalConfigDisabled::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -177,6 +496,11 @@ JNI_METHOD(void, BasicCluster, writeLocalConfigDisabledAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -185,10 +509,15 @@ JNI_METHOD(void, BinaryInputBasicCluster, writeOutOfServiceAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::BinaryInputBasic::Attributes::OutOfService::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -224,6 +553,11 @@ JNI_METHOD(void, BinaryInputBasicCluster, writeOutOfServiceAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -232,10 +566,15 @@ JNI_METHOD(void, BinaryInputBasicCluster, writePresentValueAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::BinaryInputBasic::Attributes::PresentValue::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -271,6 +610,11 @@ JNI_METHOD(void, BinaryInputBasicCluster, writePresentValueAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -279,10 +623,15 @@ JNI_METHOD(void, ColorControlCluster, writeColorControlOptionsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorControlOptions::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -318,6 +667,11 @@ JNI_METHOD(void, ColorControlCluster, writeColorControlOptionsAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -326,10 +680,15 @@ JNI_METHOD(void, ColorControlCluster, writeWhitePointXAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ColorControl::Attributes::WhitePointX::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -365,6 +724,11 @@ JNI_METHOD(void, ColorControlCluster, writeWhitePointXAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -373,10 +737,15 @@ JNI_METHOD(void, ColorControlCluster, writeWhitePointYAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ColorControl::Attributes::WhitePointY::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -412,6 +781,11 @@ JNI_METHOD(void, ColorControlCluster, writeWhitePointYAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -420,10 +794,15 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointRXAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointRX::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -459,6 +838,11 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointRXAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -467,10 +851,15 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointRYAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointRY::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -506,6 +895,11 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointRYAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -514,10 +908,15 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointRIntensityAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointRIntensity::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -553,6 +952,11 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointRIntensityAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -561,10 +965,15 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointGXAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointGX::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -600,6 +1009,11 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointGXAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -608,10 +1022,15 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointGYAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointGY::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -647,6 +1066,11 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointGYAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -655,10 +1079,15 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointGIntensityAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointGIntensity::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -694,6 +1123,11 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointGIntensityAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -702,10 +1136,15 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointBXAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointBX::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -741,6 +1180,11 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointBXAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -749,10 +1193,15 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointBYAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointBY::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -788,6 +1237,11 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointBYAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -796,10 +1250,15 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointBIntensityAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ColorControl::Attributes::ColorPointBIntensity::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -835,6 +1294,11 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointBIntensityAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -843,10 +1307,15 @@ JNI_METHOD(void, ColorControlCluster, writeStartUpColorTemperatureMiredsAttribut (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ColorControl::Attributes::StartUpColorTemperatureMireds::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -882,6 +1351,11 @@ JNI_METHOD(void, ColorControlCluster, writeStartUpColorTemperatureMiredsAttribut err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -890,10 +1364,14 @@ JNI_METHOD(void, ContentLauncherCluster, writeSupportedStreamingProtocolsAttribu (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -929,6 +1407,11 @@ JNI_METHOD(void, ContentLauncherCluster, writeSupportedStreamingProtocolsAttribu err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -937,10 +1420,16 @@ JNI_METHOD(void, DoorLockCluster, writeLanguageAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jstring value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::DoorLock::Attributes::Language::TypeInfo; TypeInfo::Type cppValue; - cppValue = chip::JniUtfString(env, static_cast(value)).charSpan(); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + auto valueJni = chip::Platform::New(env, static_cast(value)); + cleanupStrings.push_back(valueJni); + cppValue = valueJni->charSpan(); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -976,6 +1465,11 @@ JNI_METHOD(void, DoorLockCluster, writeLanguageAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -984,10 +1478,14 @@ JNI_METHOD(void, DoorLockCluster, writeAutoRelockTimeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::DoorLock::Attributes::AutoRelockTime::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1023,6 +1521,11 @@ JNI_METHOD(void, DoorLockCluster, writeAutoRelockTimeAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1031,10 +1534,15 @@ JNI_METHOD(void, DoorLockCluster, writeSoundVolumeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::DoorLock::Attributes::SoundVolume::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1070,6 +1578,11 @@ JNI_METHOD(void, DoorLockCluster, writeSoundVolumeAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1078,10 +1591,15 @@ JNI_METHOD(void, DoorLockCluster, writeOperatingModeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::DoorLock::Attributes::OperatingMode::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1117,6 +1635,11 @@ JNI_METHOD(void, DoorLockCluster, writeOperatingModeAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1125,10 +1648,15 @@ JNI_METHOD(void, DoorLockCluster, writeEnableOneTouchLockingAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::DoorLock::Attributes::EnableOneTouchLocking::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1164,6 +1692,11 @@ JNI_METHOD(void, DoorLockCluster, writeEnableOneTouchLockingAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1172,10 +1705,15 @@ JNI_METHOD(void, DoorLockCluster, writeEnablePrivacyModeButtonAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::DoorLock::Attributes::EnablePrivacyModeButton::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1211,6 +1749,11 @@ JNI_METHOD(void, DoorLockCluster, writeEnablePrivacyModeButtonAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1219,10 +1762,15 @@ JNI_METHOD(void, DoorLockCluster, writeWrongCodeEntryLimitAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::DoorLock::Attributes::WrongCodeEntryLimit::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1258,6 +1806,11 @@ JNI_METHOD(void, DoorLockCluster, writeWrongCodeEntryLimitAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1266,10 +1819,14 @@ JNI_METHOD(void, GeneralCommissioningCluster, writeBreadcrumbAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::GeneralCommissioning::Attributes::Breadcrumb::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1305,6 +1862,11 @@ JNI_METHOD(void, GeneralCommissioningCluster, writeBreadcrumbAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1313,10 +1875,15 @@ JNI_METHOD(void, IdentifyCluster, writeIdentifyTimeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::Identify::Attributes::IdentifyTime::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1352,6 +1919,11 @@ JNI_METHOD(void, IdentifyCluster, writeIdentifyTimeAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1360,10 +1932,15 @@ JNI_METHOD(void, LevelControlCluster, writeOptionsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::LevelControl::Attributes::Options::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1399,6 +1976,11 @@ JNI_METHOD(void, LevelControlCluster, writeOptionsAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1407,10 +1989,15 @@ JNI_METHOD(void, LevelControlCluster, writeOnOffTransitionTimeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::LevelControl::Attributes::OnOffTransitionTime::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1446,6 +2033,11 @@ JNI_METHOD(void, LevelControlCluster, writeOnOffTransitionTimeAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1454,15 +2046,23 @@ JNI_METHOD(void, LevelControlCluster, writeOnLevelAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::LevelControl::Attributes::OnLevel::TypeInfo; TypeInfo::Type cppValue; - uint8_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1498,6 +2098,11 @@ JNI_METHOD(void, LevelControlCluster, writeOnLevelAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1506,15 +2111,23 @@ JNI_METHOD(void, LevelControlCluster, writeOnTransitionTimeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::LevelControl::Attributes::OnTransitionTime::TypeInfo; TypeInfo::Type cppValue; - uint16_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1550,6 +2163,11 @@ JNI_METHOD(void, LevelControlCluster, writeOnTransitionTimeAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1558,15 +2176,23 @@ JNI_METHOD(void, LevelControlCluster, writeOffTransitionTimeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::LevelControl::Attributes::OffTransitionTime::TypeInfo; TypeInfo::Type cppValue; - uint16_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1602,6 +2228,11 @@ JNI_METHOD(void, LevelControlCluster, writeOffTransitionTimeAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1610,15 +2241,23 @@ JNI_METHOD(void, LevelControlCluster, writeDefaultMoveRateAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::LevelControl::Attributes::DefaultMoveRate::TypeInfo; TypeInfo::Type cppValue; - uint8_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1654,6 +2293,11 @@ JNI_METHOD(void, LevelControlCluster, writeDefaultMoveRateAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1662,15 +2306,23 @@ JNI_METHOD(void, LevelControlCluster, writeStartUpCurrentLevelAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::LevelControl::Attributes::StartUpCurrentLevel::TypeInfo; TypeInfo::Type cppValue; - uint8_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1706,6 +2358,11 @@ JNI_METHOD(void, LevelControlCluster, writeStartUpCurrentLevelAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1714,10 +2371,16 @@ JNI_METHOD(void, LocalizationConfigurationCluster, writeActiveLocaleAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jstring value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::LocalizationConfiguration::Attributes::ActiveLocale::TypeInfo; TypeInfo::Type cppValue; - cppValue = chip::JniUtfString(env, static_cast(value)).charSpan(); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + auto valueJni = chip::Platform::New(env, static_cast(value)); + cleanupStrings.push_back(valueJni); + cppValue = valueJni->charSpan(); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1753,6 +2416,11 @@ JNI_METHOD(void, LocalizationConfigurationCluster, writeActiveLocaleAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1761,10 +2429,15 @@ JNI_METHOD(void, ModeSelectCluster, writeOnModeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ModeSelect::Attributes::OnMode::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1800,6 +2473,11 @@ JNI_METHOD(void, ModeSelectCluster, writeOnModeAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1808,10 +2486,15 @@ JNI_METHOD(void, NetworkCommissioningCluster, writeInterfaceEnabledAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::NetworkCommissioning::Attributes::InterfaceEnabled::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1847,6 +2530,106 @@ JNI_METHOD(void, NetworkCommissioningCluster, writeInterfaceEnabledAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, OtaSoftwareUpdateRequestorCluster, writeDefaultOtaProvidersAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::DefaultOtaProviders::TypeInfo; + TypeInfo::Type cppValue; + + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint valueSize; + chip::JniReferences::GetInstance().GetArrayListSize(value, valueSize); + if (valueSize != 0) + { + auto * listHolder_0 = new ListHolder(valueSize); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(valueSize); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(value, i_0, element_0); + jobject element_0_fabricIndexItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "fabricIndex", "Ljava/lang/Integer;", + element_0_fabricIndexItem_1); + listHolder_0->mList[i_0].fabricIndex = + static_castmList[i_0].fabricIndex)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_fabricIndexItem_1)); + jobject element_0_providerNodeIDItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "providerNodeID", "Ljava/lang/Long;", + element_0_providerNodeIDItem_1); + listHolder_0->mList[i_0].providerNodeID = + static_castmList[i_0].providerNodeID)>>( + chip::JniReferences::GetInstance().LongToPrimitive(element_0_providerNodeIDItem_1)); + jobject element_0_endpointItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "endpoint", "Ljava/lang/Integer;", + element_0_endpointItem_1); + listHolder_0->mList[i_0].endpoint = + static_castmList[i_0].endpoint)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_endpointItem_1)); + } + cppValue = ListType_0(listHolder_0->mList, valueSize); + } + else + { + cppValue = ListType_0(); + } + } + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + OtaSoftwareUpdateRequestorCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedWriteTimeoutMs == nullptr) + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedWriteTimeoutMs)); + } + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1855,10 +2638,15 @@ JNI_METHOD(void, OnOffCluster, writeOnTimeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::OnOff::Attributes::OnTime::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1894,6 +2682,11 @@ JNI_METHOD(void, OnOffCluster, writeOnTimeAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1902,10 +2695,15 @@ JNI_METHOD(void, OnOffCluster, writeOffWaitTimeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::OnOff::Attributes::OffWaitTime::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1941,6 +2739,11 @@ JNI_METHOD(void, OnOffCluster, writeOffWaitTimeAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1949,10 +2752,15 @@ JNI_METHOD(void, OnOffCluster, writeStartUpOnOffAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::OnOff::Attributes::StartUpOnOff::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -1988,6 +2796,11 @@ JNI_METHOD(void, OnOffCluster, writeStartUpOnOffAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -1996,10 +2809,15 @@ JNI_METHOD(void, OnOffSwitchConfigurationCluster, writeSwitchActionsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::OnOffSwitchConfiguration::Attributes::SwitchActions::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2035,6 +2853,11 @@ JNI_METHOD(void, OnOffSwitchConfigurationCluster, writeSwitchActionsAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2043,15 +2866,23 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, writeLifetimeRunningHoursAt (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::LifetimeRunningHours::TypeInfo; TypeInfo::Type cppValue; - uint32_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2087,6 +2918,11 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, writeLifetimeRunningHoursAt err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2095,15 +2931,23 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, writeLifetimeEnergyConsumed (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::TypeInfo; TypeInfo::Type cppValue; - uint32_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2139,6 +2983,11 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, writeLifetimeEnergyConsumed err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2147,10 +2996,15 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, writeOperationModeAttribute (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::OperationMode::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2186,6 +3040,11 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, writeOperationModeAttribute err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2194,10 +3053,15 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, writeControlModeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::PumpConfigurationAndControl::Attributes::ControlMode::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2233,6 +3097,11 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, writeControlModeAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2241,10 +3110,15 @@ JNI_METHOD(void, TestClusterCluster, writeBooleanAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Boolean::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2280,6 +3154,11 @@ JNI_METHOD(void, TestClusterCluster, writeBooleanAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2288,10 +3167,15 @@ JNI_METHOD(void, TestClusterCluster, writeBitmap8Attribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Bitmap8::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2327,6 +3211,11 @@ JNI_METHOD(void, TestClusterCluster, writeBitmap8Attribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2335,10 +3224,15 @@ JNI_METHOD(void, TestClusterCluster, writeBitmap16Attribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Bitmap16::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2374,6 +3268,11 @@ JNI_METHOD(void, TestClusterCluster, writeBitmap16Attribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2382,10 +3281,14 @@ JNI_METHOD(void, TestClusterCluster, writeBitmap32Attribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Bitmap32::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2421,6 +3324,11 @@ JNI_METHOD(void, TestClusterCluster, writeBitmap32Attribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2429,10 +3337,14 @@ JNI_METHOD(void, TestClusterCluster, writeBitmap64Attribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Bitmap64::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2468,6 +3380,11 @@ JNI_METHOD(void, TestClusterCluster, writeBitmap64Attribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2476,10 +3393,15 @@ JNI_METHOD(void, TestClusterCluster, writeInt8uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int8u::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2515,6 +3437,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt8uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2523,10 +3450,15 @@ JNI_METHOD(void, TestClusterCluster, writeInt16uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int16u::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2562,6 +3494,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt16uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2570,10 +3507,14 @@ JNI_METHOD(void, TestClusterCluster, writeInt24uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int24u::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2609,6 +3550,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt24uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2617,10 +3563,14 @@ JNI_METHOD(void, TestClusterCluster, writeInt32uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int32u::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2656,6 +3606,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt32uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2664,10 +3619,14 @@ JNI_METHOD(void, TestClusterCluster, writeInt40uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int40u::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2703,6 +3662,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt40uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2711,10 +3675,14 @@ JNI_METHOD(void, TestClusterCluster, writeInt48uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int48u::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2750,6 +3718,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt48uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2758,10 +3731,14 @@ JNI_METHOD(void, TestClusterCluster, writeInt56uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int56u::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2797,6 +3774,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt56uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2805,10 +3787,14 @@ JNI_METHOD(void, TestClusterCluster, writeInt64uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int64u::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2844,6 +3830,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt64uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2852,10 +3843,15 @@ JNI_METHOD(void, TestClusterCluster, writeInt8sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int8s::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2891,6 +3887,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt8sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2899,10 +3900,15 @@ JNI_METHOD(void, TestClusterCluster, writeInt16sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int16s::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2938,6 +3944,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt16sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2946,10 +3957,14 @@ JNI_METHOD(void, TestClusterCluster, writeInt24sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int24s::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -2985,6 +4000,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt24sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -2993,10 +4013,14 @@ JNI_METHOD(void, TestClusterCluster, writeInt32sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int32s::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3032,6 +4056,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt32sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3040,10 +4069,14 @@ JNI_METHOD(void, TestClusterCluster, writeInt40sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int40s::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3079,6 +4112,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt40sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3087,10 +4125,14 @@ JNI_METHOD(void, TestClusterCluster, writeInt48sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int48s::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3126,6 +4168,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt48sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3134,10 +4181,14 @@ JNI_METHOD(void, TestClusterCluster, writeInt56sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int56s::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3173,6 +4224,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt56sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3181,10 +4237,14 @@ JNI_METHOD(void, TestClusterCluster, writeInt64sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Int64s::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3220,6 +4280,11 @@ JNI_METHOD(void, TestClusterCluster, writeInt64sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3228,10 +4293,15 @@ JNI_METHOD(void, TestClusterCluster, writeEnum8Attribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Enum8::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3267,6 +4337,11 @@ JNI_METHOD(void, TestClusterCluster, writeEnum8Attribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3275,10 +4350,15 @@ JNI_METHOD(void, TestClusterCluster, writeEnum16Attribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Enum16::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3314,6 +4394,11 @@ JNI_METHOD(void, TestClusterCluster, writeEnum16Attribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3322,10 +4407,14 @@ JNI_METHOD(void, TestClusterCluster, writeFloatSingleAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::FloatSingle::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().FloatToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().FloatToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3361,6 +4450,11 @@ JNI_METHOD(void, TestClusterCluster, writeFloatSingleAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3369,10 +4463,15 @@ JNI_METHOD(void, TestClusterCluster, writeFloatDoubleAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::FloatDouble::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().DoubleToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().DoubleToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3408,6 +4507,11 @@ JNI_METHOD(void, TestClusterCluster, writeFloatDoubleAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3416,10 +4520,95 @@ JNI_METHOD(void, TestClusterCluster, writeOctetStringAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jbyteArray value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::OctetString::TypeInfo; TypeInfo::Type cppValue; - cppValue = chip::JniByteArray(env, static_cast(value)).byteSpan(); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + auto valueJni = chip::Platform::New(env, static_cast(value)); + cleanupByteArrays.push_back(valueJni); + cppValue = valueJni->byteSpan(); + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedWriteTimeoutMs == nullptr) + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedWriteTimeoutMs)); + } + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeListInt8uAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ListInt8u::TypeInfo; + TypeInfo::Type cppValue; + + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint valueSize; + chip::JniReferences::GetInstance().GetArrayListSize(value, valueSize); + if (valueSize != 0) + { + auto * listHolder_0 = new ListHolder(valueSize); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(valueSize); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(value, i_0, element_0); + listHolder_0->mList[i_0] = static_castmList[i_0])>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0)); + } + cppValue = ListType_0(listHolder_0->mList, valueSize); + } + else + { + cppValue = ListType_0(); + } + } std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3455,6 +4644,181 @@ JNI_METHOD(void, TestClusterCluster, writeOctetStringAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeListOctetStringAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jbyteArray value, jobject timedWriteTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ListOctetString::TypeInfo; + TypeInfo::Type cppValue; + + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint valueSize; + chip::JniReferences::GetInstance().GetArrayListSize(value, valueSize); + if (valueSize != 0) + { + auto * listHolder_0 = new ListHolder(valueSize); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(valueSize); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(value, i_0, element_0); + auto element_0Jni = chip::Platform::New(env, static_cast(element_0)); + cleanupByteArrays.push_back(element_0Jni); + listHolder_0->mList[i_0] = element_0Jni->byteSpan(); + } + cppValue = ListType_0(listHolder_0->mList, valueSize); + } + else + { + cppValue = ListType_0(); + } + } + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedWriteTimeoutMs == nullptr) + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedWriteTimeoutMs)); + } + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeListStructOctetStringAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ListStructOctetString::TypeInfo; + TypeInfo::Type cppValue; + + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint valueSize; + chip::JniReferences::GetInstance().GetArrayListSize(value, valueSize); + if (valueSize != 0) + { + auto * listHolder_0 = new ListHolder(valueSize); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(valueSize); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(value, i_0, element_0); + jobject element_0_fabricIndexItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "fabricIndex", "Ljava/lang/Long;", + element_0_fabricIndexItem_1); + listHolder_0->mList[i_0].fabricIndex = + static_castmList[i_0].fabricIndex)>>( + chip::JniReferences::GetInstance().LongToPrimitive(element_0_fabricIndexItem_1)); + jobject element_0_operationalCertItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "operationalCert", "[B", + element_0_operationalCertItem_1); + auto element_0_operationalCertItem_1Jni = + chip::Platform::New(env, static_cast(element_0_operationalCertItem_1)); + cleanupByteArrays.push_back(element_0_operationalCertItem_1Jni); + listHolder_0->mList[i_0].operationalCert = element_0_operationalCertItem_1Jni->byteSpan(); + } + cppValue = ListType_0(listHolder_0->mList, valueSize); + } + else + { + cppValue = ListType_0(); + } + } + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedWriteTimeoutMs == nullptr) + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedWriteTimeoutMs)); + } + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3463,10 +4827,16 @@ JNI_METHOD(void, TestClusterCluster, writeLongOctetStringAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jbyteArray value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::LongOctetString::TypeInfo; TypeInfo::Type cppValue; - cppValue = chip::JniByteArray(env, static_cast(value)).byteSpan(); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + auto valueJni = chip::Platform::New(env, static_cast(value)); + cleanupByteArrays.push_back(valueJni); + cppValue = valueJni->byteSpan(); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3502,6 +4872,11 @@ JNI_METHOD(void, TestClusterCluster, writeLongOctetStringAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3510,10 +4885,16 @@ JNI_METHOD(void, TestClusterCluster, writeCharStringAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jstring value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::CharString::TypeInfo; TypeInfo::Type cppValue; - cppValue = chip::JniUtfString(env, static_cast(value)).charSpan(); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + auto valueJni = chip::Platform::New(env, static_cast(value)); + cleanupStrings.push_back(valueJni); + cppValue = valueJni->charSpan(); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3549,6 +4930,11 @@ JNI_METHOD(void, TestClusterCluster, writeCharStringAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3557,10 +4943,16 @@ JNI_METHOD(void, TestClusterCluster, writeLongCharStringAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jstring value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::LongCharString::TypeInfo; TypeInfo::Type cppValue; - cppValue = chip::JniUtfString(env, static_cast(value)).charSpan(); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + auto valueJni = chip::Platform::New(env, static_cast(value)); + cleanupStrings.push_back(valueJni); + cppValue = valueJni->charSpan(); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3596,6 +4988,11 @@ JNI_METHOD(void, TestClusterCluster, writeLongCharStringAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3604,10 +5001,14 @@ JNI_METHOD(void, TestClusterCluster, writeEpochUsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::EpochUs::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3643,6 +5044,11 @@ JNI_METHOD(void, TestClusterCluster, writeEpochUsAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3651,10 +5057,71 @@ JNI_METHOD(void, TestClusterCluster, writeEpochSAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::EpochS::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().LongToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = static_cast>(chip::JniReferences::GetInstance().LongToPrimitive(value)); + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedWriteTimeoutMs == nullptr) + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedWriteTimeoutMs)); + } + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeVendorIdAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::VendorId::TypeInfo; + TypeInfo::Type cppValue; + + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3690,18 +5157,418 @@ JNI_METHOD(void, TestClusterCluster, writeEpochSAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } -JNI_METHOD(void, TestClusterCluster, writeVendorIdAttribute) +JNI_METHOD(void, TestClusterCluster, writeListNullablesAndOptionalsStructAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; - using TypeInfo = chip::app::Clusters::TestCluster::Attributes::VendorId::TypeInfo; - TypeInfo::Type cppValue; - - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ListNullablesAndOptionalsStruct::TypeInfo; + TypeInfo::Type cppValue; + + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint valueSize; + chip::JniReferences::GetInstance().GetArrayListSize(value, valueSize); + if (valueSize != 0) + { + auto * listHolder_0 = new ListHolder(valueSize); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(valueSize); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(value, i_0, element_0); + jobject element_0_nullableIntItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "nullableInt", "Ljava/lang/Integer;", + element_0_nullableIntItem_1); + if (element_0_nullableIntItem_1 == nullptr) + { + listHolder_0->mList[i_0].nullableInt.SetNull(); + } + else + { + auto & nonNullValue_2 = listHolder_0->mList[i_0].nullableInt.SetNonNull(); + nonNullValue_2 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_nullableIntItem_1)); + } + jobject element_0_optionalIntItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "optionalInt", "Ljava/util/Optional;", + element_0_optionalIntItem_1); + if (element_0_optionalIntItem_1 != nullptr) + { + jobject optionalValue_2; + chip::JniReferences::GetInstance().GetOptionalValue(element_0_optionalIntItem_1, optionalValue_2); + auto & definedValue_2 = listHolder_0->mList[i_0].optionalInt.Emplace(); + definedValue_2 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionalValue_2)); + } + jobject element_0_nullableOptionalIntItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "nullableOptionalInt", "Ljava/util/Optional;", + element_0_nullableOptionalIntItem_1); + if (element_0_nullableOptionalIntItem_1 != nullptr) + { + jobject optionalValue_2; + chip::JniReferences::GetInstance().GetOptionalValue(element_0_nullableOptionalIntItem_1, optionalValue_2); + auto & definedValue_2 = listHolder_0->mList[i_0].nullableOptionalInt.Emplace(); + if (optionalValue_2 == nullptr) + { + definedValue_2.SetNull(); + } + else + { + auto & nonNullValue_3 = definedValue_2.SetNonNull(); + nonNullValue_3 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionalValue_2)); + } + } + jobject element_0_nullableStringItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "nullableString", "Ljava/lang/String;", + element_0_nullableStringItem_1); + if (element_0_nullableStringItem_1 == nullptr) + { + listHolder_0->mList[i_0].nullableString.SetNull(); + } + else + { + auto & nonNullValue_2 = listHolder_0->mList[i_0].nullableString.SetNonNull(); + auto element_0_nullableStringItem_1Jni = + chip::Platform::New(env, static_cast(element_0_nullableStringItem_1)); + cleanupStrings.push_back(element_0_nullableStringItem_1Jni); + nonNullValue_2 = element_0_nullableStringItem_1Jni->charSpan(); + } + jobject element_0_optionalStringItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "optionalString", "Ljava/util/Optional;", + element_0_optionalStringItem_1); + if (element_0_optionalStringItem_1 != nullptr) + { + jobject optionalValue_2; + chip::JniReferences::GetInstance().GetOptionalValue(element_0_optionalStringItem_1, optionalValue_2); + auto & definedValue_2 = listHolder_0->mList[i_0].optionalString.Emplace(); + auto optionalValue_2Jni = chip::Platform::New(env, static_cast(optionalValue_2)); + cleanupStrings.push_back(optionalValue_2Jni); + definedValue_2 = optionalValue_2Jni->charSpan(); + } + jobject element_0_nullableOptionalStringItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "nullableOptionalString", "Ljava/util/Optional;", + element_0_nullableOptionalStringItem_1); + if (element_0_nullableOptionalStringItem_1 != nullptr) + { + jobject optionalValue_2; + chip::JniReferences::GetInstance().GetOptionalValue(element_0_nullableOptionalStringItem_1, optionalValue_2); + auto & definedValue_2 = listHolder_0->mList[i_0].nullableOptionalString.Emplace(); + if (optionalValue_2 == nullptr) + { + definedValue_2.SetNull(); + } + else + { + auto & nonNullValue_3 = definedValue_2.SetNonNull(); + auto optionalValue_2Jni = + chip::Platform::New(env, static_cast(optionalValue_2)); + cleanupStrings.push_back(optionalValue_2Jni); + nonNullValue_3 = optionalValue_2Jni->charSpan(); + } + } + jobject element_0_nullableStructItem_1; + chip::JniReferences::GetInstance().GetObjectField( + element_0, "nullableStruct", "Lchip/devicecontroller/ChipStructs$TestClusterClusterSimpleStruct;", + element_0_nullableStructItem_1); + if (element_0_nullableStructItem_1 == nullptr) + { + listHolder_0->mList[i_0].nullableStruct.SetNull(); + } + else + { + auto & nonNullValue_2 = listHolder_0->mList[i_0].nullableStruct.SetNonNull(); + jobject element_0_nullableStructItem_1_aItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_0_nullableStructItem_1, "a", "Ljava/lang/Integer;", + element_0_nullableStructItem_1_aItem_3); + nonNullValue_2.a = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_nullableStructItem_1_aItem_3)); + jobject element_0_nullableStructItem_1_bItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_0_nullableStructItem_1, "b", "Ljava/lang/Boolean;", + element_0_nullableStructItem_1_bItem_3); + nonNullValue_2.b = static_cast>( + chip::JniReferences::GetInstance().BooleanToPrimitive(element_0_nullableStructItem_1_bItem_3)); + jobject element_0_nullableStructItem_1_cItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_0_nullableStructItem_1, "c", "Ljava/lang/Integer;", + element_0_nullableStructItem_1_cItem_3); + nonNullValue_2.c = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_nullableStructItem_1_cItem_3)); + jobject element_0_nullableStructItem_1_dItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_0_nullableStructItem_1, "d", "[B", + element_0_nullableStructItem_1_dItem_3); + auto element_0_nullableStructItem_1_dItem_3Jni = chip::Platform::New( + env, static_cast(element_0_nullableStructItem_1_dItem_3)); + cleanupByteArrays.push_back(element_0_nullableStructItem_1_dItem_3Jni); + nonNullValue_2.d = element_0_nullableStructItem_1_dItem_3Jni->byteSpan(); + jobject element_0_nullableStructItem_1_eItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_0_nullableStructItem_1, "e", "Ljava/lang/String;", + element_0_nullableStructItem_1_eItem_3); + auto element_0_nullableStructItem_1_eItem_3Jni = + chip::Platform::New(env, static_cast(element_0_nullableStructItem_1_eItem_3)); + cleanupStrings.push_back(element_0_nullableStructItem_1_eItem_3Jni); + nonNullValue_2.e = element_0_nullableStructItem_1_eItem_3Jni->charSpan(); + jobject element_0_nullableStructItem_1_fItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_0_nullableStructItem_1, "f", "Ljava/lang/Integer;", + element_0_nullableStructItem_1_fItem_3); + nonNullValue_2.f = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_0_nullableStructItem_1_fItem_3)); + jobject element_0_nullableStructItem_1_gItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_0_nullableStructItem_1, "g", "Ljava/lang/Float;", + element_0_nullableStructItem_1_gItem_3); + nonNullValue_2.g = static_cast>( + chip::JniReferences::GetInstance().FloatToPrimitive(element_0_nullableStructItem_1_gItem_3)); + jobject element_0_nullableStructItem_1_hItem_3; + chip::JniReferences::GetInstance().GetObjectField(element_0_nullableStructItem_1, "h", "Ljava/lang/Double;", + element_0_nullableStructItem_1_hItem_3); + nonNullValue_2.h = static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(element_0_nullableStructItem_1_hItem_3)); + } + jobject element_0_optionalStructItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "optionalStruct", "Ljava/util/Optional;", + element_0_optionalStructItem_1); + if (element_0_optionalStructItem_1 != nullptr) + { + jobject optionalValue_2; + chip::JniReferences::GetInstance().GetOptionalValue(element_0_optionalStructItem_1, optionalValue_2); + auto & definedValue_2 = listHolder_0->mList[i_0].optionalStruct.Emplace(); + jobject optionalValue_2_aItem_3; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "a", "Ljava/lang/Integer;", + optionalValue_2_aItem_3); + definedValue_2.a = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionalValue_2_aItem_3)); + jobject optionalValue_2_bItem_3; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "b", "Ljava/lang/Boolean;", + optionalValue_2_bItem_3); + definedValue_2.b = static_cast>( + chip::JniReferences::GetInstance().BooleanToPrimitive(optionalValue_2_bItem_3)); + jobject optionalValue_2_cItem_3; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "c", "Ljava/lang/Integer;", + optionalValue_2_cItem_3); + definedValue_2.c = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionalValue_2_cItem_3)); + jobject optionalValue_2_dItem_3; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "d", "[B", optionalValue_2_dItem_3); + auto optionalValue_2_dItem_3Jni = + chip::Platform::New(env, static_cast(optionalValue_2_dItem_3)); + cleanupByteArrays.push_back(optionalValue_2_dItem_3Jni); + definedValue_2.d = optionalValue_2_dItem_3Jni->byteSpan(); + jobject optionalValue_2_eItem_3; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "e", "Ljava/lang/String;", + optionalValue_2_eItem_3); + auto optionalValue_2_eItem_3Jni = + chip::Platform::New(env, static_cast(optionalValue_2_eItem_3)); + cleanupStrings.push_back(optionalValue_2_eItem_3Jni); + definedValue_2.e = optionalValue_2_eItem_3Jni->charSpan(); + jobject optionalValue_2_fItem_3; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "f", "Ljava/lang/Integer;", + optionalValue_2_fItem_3); + definedValue_2.f = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionalValue_2_fItem_3)); + jobject optionalValue_2_gItem_3; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "g", "Ljava/lang/Float;", + optionalValue_2_gItem_3); + definedValue_2.g = static_cast>( + chip::JniReferences::GetInstance().FloatToPrimitive(optionalValue_2_gItem_3)); + jobject optionalValue_2_hItem_3; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "h", "Ljava/lang/Double;", + optionalValue_2_hItem_3); + definedValue_2.h = static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(optionalValue_2_hItem_3)); + } + jobject element_0_nullableOptionalStructItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "nullableOptionalStruct", "Ljava/util/Optional;", + element_0_nullableOptionalStructItem_1); + if (element_0_nullableOptionalStructItem_1 != nullptr) + { + jobject optionalValue_2; + chip::JniReferences::GetInstance().GetOptionalValue(element_0_nullableOptionalStructItem_1, optionalValue_2); + auto & definedValue_2 = listHolder_0->mList[i_0].nullableOptionalStruct.Emplace(); + if (optionalValue_2 == nullptr) + { + definedValue_2.SetNull(); + } + else + { + auto & nonNullValue_3 = definedValue_2.SetNonNull(); + jobject optionalValue_2_aItem_4; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "a", "Ljava/lang/Integer;", + optionalValue_2_aItem_4); + nonNullValue_3.a = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionalValue_2_aItem_4)); + jobject optionalValue_2_bItem_4; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "b", "Ljava/lang/Boolean;", + optionalValue_2_bItem_4); + nonNullValue_3.b = static_cast>( + chip::JniReferences::GetInstance().BooleanToPrimitive(optionalValue_2_bItem_4)); + jobject optionalValue_2_cItem_4; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "c", "Ljava/lang/Integer;", + optionalValue_2_cItem_4); + nonNullValue_3.c = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionalValue_2_cItem_4)); + jobject optionalValue_2_dItem_4; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "d", "[B", optionalValue_2_dItem_4); + auto optionalValue_2_dItem_4Jni = + chip::Platform::New(env, static_cast(optionalValue_2_dItem_4)); + cleanupByteArrays.push_back(optionalValue_2_dItem_4Jni); + nonNullValue_3.d = optionalValue_2_dItem_4Jni->byteSpan(); + jobject optionalValue_2_eItem_4; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "e", "Ljava/lang/String;", + optionalValue_2_eItem_4); + auto optionalValue_2_eItem_4Jni = + chip::Platform::New(env, static_cast(optionalValue_2_eItem_4)); + cleanupStrings.push_back(optionalValue_2_eItem_4Jni); + nonNullValue_3.e = optionalValue_2_eItem_4Jni->charSpan(); + jobject optionalValue_2_fItem_4; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "f", "Ljava/lang/Integer;", + optionalValue_2_fItem_4); + nonNullValue_3.f = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(optionalValue_2_fItem_4)); + jobject optionalValue_2_gItem_4; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "g", "Ljava/lang/Float;", + optionalValue_2_gItem_4); + nonNullValue_3.g = static_cast>( + chip::JniReferences::GetInstance().FloatToPrimitive(optionalValue_2_gItem_4)); + jobject optionalValue_2_hItem_4; + chip::JniReferences::GetInstance().GetObjectField(optionalValue_2, "h", "Ljava/lang/Double;", + optionalValue_2_hItem_4); + nonNullValue_3.h = static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(optionalValue_2_hItem_4)); + } + } + jobject element_0_nullableListItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "nullableList", "Ljava/util/ArrayList;", + element_0_nullableListItem_1); + if (element_0_nullableListItem_1 == nullptr) + { + listHolder_0->mList[i_0].nullableList.SetNull(); + } + else + { + auto & nonNullValue_2 = listHolder_0->mList[i_0].nullableList.SetNonNull(); + { + using ListType_3 = std::remove_reference_t; + using ListMemberType_3 = ListMemberTypeGetter::Type; + jint element_0_nullableListItem_1Size; + chip::JniReferences::GetInstance().GetArrayListSize(element_0_nullableListItem_1, + element_0_nullableListItem_1Size); + if (element_0_nullableListItem_1Size != 0) + { + auto * listHolder_3 = new ListHolder(element_0_nullableListItem_1Size); + listFreer.add(listHolder_3); + + for (size_t i_3 = 0; i_3 < static_cast(element_0_nullableListItem_1Size); ++i_3) + { + jobject element_3; + chip::JniReferences::GetInstance().GetArrayListItem(element_0_nullableListItem_1, i_3, element_3); + listHolder_3->mList[i_3] = static_castmList[i_3])>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_3)); + } + nonNullValue_2 = ListType_3(listHolder_3->mList, element_0_nullableListItem_1Size); + } + else + { + nonNullValue_2 = ListType_3(); + } + } + } + jobject element_0_optionalListItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "optionalList", "Ljava/util/Optional;", + element_0_optionalListItem_1); + if (element_0_optionalListItem_1 != nullptr) + { + jobject optionalValue_2; + chip::JniReferences::GetInstance().GetOptionalValue(element_0_optionalListItem_1, optionalValue_2); + auto & definedValue_2 = listHolder_0->mList[i_0].optionalList.Emplace(); + { + using ListType_3 = std::remove_reference_t; + using ListMemberType_3 = ListMemberTypeGetter::Type; + jint optionalValue_2Size; + chip::JniReferences::GetInstance().GetArrayListSize(optionalValue_2, optionalValue_2Size); + if (optionalValue_2Size != 0) + { + auto * listHolder_3 = new ListHolder(optionalValue_2Size); + listFreer.add(listHolder_3); + + for (size_t i_3 = 0; i_3 < static_cast(optionalValue_2Size); ++i_3) + { + jobject element_3; + chip::JniReferences::GetInstance().GetArrayListItem(optionalValue_2, i_3, element_3); + listHolder_3->mList[i_3] = static_castmList[i_3])>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_3)); + } + definedValue_2 = ListType_3(listHolder_3->mList, optionalValue_2Size); + } + else + { + definedValue_2 = ListType_3(); + } + } + } + jobject element_0_nullableOptionalListItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "nullableOptionalList", "Ljava/util/Optional;", + element_0_nullableOptionalListItem_1); + if (element_0_nullableOptionalListItem_1 != nullptr) + { + jobject optionalValue_2; + chip::JniReferences::GetInstance().GetOptionalValue(element_0_nullableOptionalListItem_1, optionalValue_2); + auto & definedValue_2 = listHolder_0->mList[i_0].nullableOptionalList.Emplace(); + if (optionalValue_2 == nullptr) + { + definedValue_2.SetNull(); + } + else + { + auto & nonNullValue_3 = definedValue_2.SetNonNull(); + { + using ListType_4 = std::remove_reference_t; + using ListMemberType_4 = ListMemberTypeGetter::Type; + jint optionalValue_2Size; + chip::JniReferences::GetInstance().GetArrayListSize(optionalValue_2, optionalValue_2Size); + if (optionalValue_2Size != 0) + { + auto * listHolder_4 = new ListHolder(optionalValue_2Size); + listFreer.add(listHolder_4); + + for (size_t i_4 = 0; i_4 < static_cast(optionalValue_2Size); ++i_4) + { + jobject element_4; + chip::JniReferences::GetInstance().GetArrayListItem(optionalValue_2, i_4, element_4); + listHolder_4->mList[i_4] = + static_castmList[i_4])>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_4)); + } + nonNullValue_3 = ListType_4(listHolder_4->mList, optionalValue_2Size); + } + else + { + nonNullValue_3 = ListType_4(); + } + } + } + } + } + cppValue = ListType_0(listHolder_0->mList, valueSize); + } + else + { + cppValue = ListType_0(); + } + } std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3737,6 +5604,11 @@ JNI_METHOD(void, TestClusterCluster, writeVendorIdAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3745,10 +5617,15 @@ JNI_METHOD(void, TestClusterCluster, writeEnumAttrAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::EnumAttr::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3784,6 +5661,11 @@ JNI_METHOD(void, TestClusterCluster, writeEnumAttrAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3792,10 +5674,15 @@ JNI_METHOD(void, TestClusterCluster, writeRangeRestrictedInt8uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::RangeRestrictedInt8u::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3831,6 +5718,11 @@ JNI_METHOD(void, TestClusterCluster, writeRangeRestrictedInt8uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3839,10 +5731,15 @@ JNI_METHOD(void, TestClusterCluster, writeRangeRestrictedInt8sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::RangeRestrictedInt8s::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3878,6 +5775,11 @@ JNI_METHOD(void, TestClusterCluster, writeRangeRestrictedInt8sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3886,10 +5788,15 @@ JNI_METHOD(void, TestClusterCluster, writeRangeRestrictedInt16uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::RangeRestrictedInt16u::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3925,6 +5832,11 @@ JNI_METHOD(void, TestClusterCluster, writeRangeRestrictedInt16uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3933,10 +5845,15 @@ JNI_METHOD(void, TestClusterCluster, writeRangeRestrictedInt16sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::RangeRestrictedInt16s::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -3972,6 +5889,11 @@ JNI_METHOD(void, TestClusterCluster, writeRangeRestrictedInt16sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -3980,10 +5902,15 @@ JNI_METHOD(void, TestClusterCluster, writeTimedWriteBooleanAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::TimedWriteBoolean::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4012,6 +5939,11 @@ JNI_METHOD(void, TestClusterCluster, writeTimedWriteBooleanAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4020,10 +5952,15 @@ JNI_METHOD(void, TestClusterCluster, writeUnsupportedAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::Unsupported::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4059,6 +5996,11 @@ JNI_METHOD(void, TestClusterCluster, writeUnsupportedAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4067,15 +6009,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableBooleanAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableBoolean::TypeInfo; TypeInfo::Type cppValue; - bool valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) { - valueValue = chip::JniReferences::GetInstance().BooleanToPrimitive(value); + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().BooleanToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4111,6 +6061,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableBooleanAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4119,15 +6074,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableBitmap8Attribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableBitmap8::TypeInfo; TypeInfo::Type cppValue; - uint8_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4163,6 +6126,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableBitmap8Attribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4171,15 +6139,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableBitmap16Attribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableBitmap16::TypeInfo; TypeInfo::Type cppValue; - uint16_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4215,6 +6191,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableBitmap16Attribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4223,15 +6204,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableBitmap32Attribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableBitmap32::TypeInfo; TypeInfo::Type cppValue; - uint32_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4267,6 +6256,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableBitmap32Attribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4275,15 +6269,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableBitmap64Attribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableBitmap64::TypeInfo; TypeInfo::Type cppValue; - uint64_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4319,6 +6321,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableBitmap64Attribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4327,15 +6334,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt8uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt8u::TypeInfo; TypeInfo::Type cppValue; - uint8_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4371,6 +6386,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt8uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4379,15 +6399,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt16uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt16u::TypeInfo; TypeInfo::Type cppValue; - uint16_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4423,6 +6451,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt16uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4431,15 +6464,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt24uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt24u::TypeInfo; TypeInfo::Type cppValue; - uint32_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4475,6 +6516,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt24uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4483,15 +6529,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt32uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt32u::TypeInfo; TypeInfo::Type cppValue; - uint32_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4527,6 +6581,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt32uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4535,15 +6594,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt40uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt40u::TypeInfo; TypeInfo::Type cppValue; - uint64_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4579,6 +6646,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt40uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4587,15 +6659,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt48uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt48u::TypeInfo; TypeInfo::Type cppValue; - uint64_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4631,6 +6711,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt48uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4639,15 +6724,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt56uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt56u::TypeInfo; TypeInfo::Type cppValue; - uint64_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4683,6 +6776,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt56uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4691,15 +6789,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt64uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt64u::TypeInfo; TypeInfo::Type cppValue; - uint64_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4735,6 +6841,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt64uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4743,15 +6854,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt8sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt8s::TypeInfo; TypeInfo::Type cppValue; - int8_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4787,6 +6906,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt8sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4795,15 +6919,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt16sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt16s::TypeInfo; TypeInfo::Type cppValue; - int16_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4839,6 +6971,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt16sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4847,15 +6984,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt24sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt24s::TypeInfo; TypeInfo::Type cppValue; - int32_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4891,6 +7036,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt24sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4899,15 +7049,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt32sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt32s::TypeInfo; TypeInfo::Type cppValue; - int32_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4943,6 +7101,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt32sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -4951,15 +7114,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt40sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt40s::TypeInfo; TypeInfo::Type cppValue; - int64_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -4995,6 +7166,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt40sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5003,15 +7179,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt48sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt48s::TypeInfo; TypeInfo::Type cppValue; - int64_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5047,6 +7231,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt48sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5055,15 +7244,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt56sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt56s::TypeInfo; TypeInfo::Type cppValue; - int64_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5099,6 +7296,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt56sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5107,15 +7309,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt64sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt64s::TypeInfo; TypeInfo::Type cppValue; - int64_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) { - valueValue = chip::JniReferences::GetInstance().LongToPrimitive(value); + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5151,6 +7361,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableInt64sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5159,15 +7374,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableEnum8Attribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableEnum8::TypeInfo; TypeInfo::Type cppValue; - uint8_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5203,6 +7426,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableEnum8Attribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5211,15 +7439,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableEnum16Attribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableEnum16::TypeInfo; TypeInfo::Type cppValue; - uint16_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5255,6 +7491,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableEnum16Attribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5263,15 +7504,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableFloatSingleAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableFloatSingle::TypeInfo; TypeInfo::Type cppValue; - float valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().FloatToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().FloatToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5307,6 +7556,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableFloatSingleAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5315,15 +7569,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableFloatDoubleAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableFloatDouble::TypeInfo; TypeInfo::Type cppValue; - double valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) { - valueValue = chip::JniReferences::GetInstance().DoubleToPrimitive(value); + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().DoubleToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5359,6 +7621,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableFloatDoubleAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5367,16 +7634,24 @@ JNI_METHOD(void, TestClusterCluster, writeNullableOctetStringAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jbyteArray value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableOctetString::TypeInfo; TypeInfo::Type cppValue; - chip::ByteSpan valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniByteArray(env, static_cast(value)).byteSpan(); + auto & nonNullValue_0 = cppValue.SetNonNull(); + auto valueJni = chip::Platform::New(env, static_cast(value)); + cleanupByteArrays.push_back(valueJni); + nonNullValue_0 = valueJni->byteSpan(); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() - : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5412,6 +7687,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableOctetStringAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5420,16 +7700,24 @@ JNI_METHOD(void, TestClusterCluster, writeNullableCharStringAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jstring value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableCharString::TypeInfo; TypeInfo::Type cppValue; - chip::CharSpan valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniUtfString(env, static_cast(value)).charSpan(); + auto & nonNullValue_0 = cppValue.SetNonNull(); + auto valueJni = chip::Platform::New(env, static_cast(value)); + cleanupStrings.push_back(valueJni); + nonNullValue_0 = valueJni->charSpan(); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() - : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5465,6 +7753,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableCharStringAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5473,16 +7766,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableEnumAttrAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableEnumAttr::TypeInfo; TypeInfo::Type cppValue; - decltype(cppValue)::UnderlyingType valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() - : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5518,6 +7818,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableEnumAttrAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5526,15 +7831,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableRangeRestrictedInt8uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableRangeRestrictedInt8u::TypeInfo; TypeInfo::Type cppValue; - uint8_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5570,6 +7883,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableRangeRestrictedInt8uAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5578,15 +7896,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableRangeRestrictedInt8sAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableRangeRestrictedInt8s::TypeInfo; TypeInfo::Type cppValue; - int8_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5622,6 +7948,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableRangeRestrictedInt8sAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5630,15 +7961,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableRangeRestrictedInt16uAttribute (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableRangeRestrictedInt16u::TypeInfo; TypeInfo::Type cppValue; - uint16_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5674,6 +8013,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableRangeRestrictedInt16uAttribute err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5682,15 +8026,23 @@ JNI_METHOD(void, TestClusterCluster, writeNullableRangeRestrictedInt16sAttribute (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableRangeRestrictedInt16s::TypeInfo; TypeInfo::Type cppValue; - int16_t valueValue; - if (value != nullptr) + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else { - valueValue = chip::JniReferences::GetInstance().IntegerToPrimitive(value); + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } - cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5726,6 +8078,11 @@ JNI_METHOD(void, TestClusterCluster, writeNullableRangeRestrictedInt16sAttribute err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5734,10 +8091,15 @@ JNI_METHOD(void, ThermostatCluster, writeOccupiedCoolingSetpointAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::Thermostat::Attributes::OccupiedCoolingSetpoint::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5773,6 +8135,11 @@ JNI_METHOD(void, ThermostatCluster, writeOccupiedCoolingSetpointAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5781,10 +8148,15 @@ JNI_METHOD(void, ThermostatCluster, writeOccupiedHeatingSetpointAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::Thermostat::Attributes::OccupiedHeatingSetpoint::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5820,6 +8192,11 @@ JNI_METHOD(void, ThermostatCluster, writeOccupiedHeatingSetpointAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5828,10 +8205,15 @@ JNI_METHOD(void, ThermostatCluster, writeMinHeatSetpointLimitAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::Thermostat::Attributes::MinHeatSetpointLimit::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5867,6 +8249,11 @@ JNI_METHOD(void, ThermostatCluster, writeMinHeatSetpointLimitAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5875,10 +8262,15 @@ JNI_METHOD(void, ThermostatCluster, writeMaxHeatSetpointLimitAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::Thermostat::Attributes::MaxHeatSetpointLimit::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5914,6 +8306,11 @@ JNI_METHOD(void, ThermostatCluster, writeMaxHeatSetpointLimitAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5922,10 +8319,15 @@ JNI_METHOD(void, ThermostatCluster, writeMinCoolSetpointLimitAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::Thermostat::Attributes::MinCoolSetpointLimit::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -5961,6 +8363,11 @@ JNI_METHOD(void, ThermostatCluster, writeMinCoolSetpointLimitAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -5969,10 +8376,15 @@ JNI_METHOD(void, ThermostatCluster, writeMaxCoolSetpointLimitAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::Thermostat::Attributes::MaxCoolSetpointLimit::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -6008,6 +8420,11 @@ JNI_METHOD(void, ThermostatCluster, writeMaxCoolSetpointLimitAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -6016,10 +8433,15 @@ JNI_METHOD(void, ThermostatCluster, writeMinSetpointDeadBandAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::Thermostat::Attributes::MinSetpointDeadBand::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -6055,6 +8477,11 @@ JNI_METHOD(void, ThermostatCluster, writeMinSetpointDeadBandAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -6063,10 +8490,15 @@ JNI_METHOD(void, ThermostatCluster, writeControlSequenceOfOperationAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::Thermostat::Attributes::ControlSequenceOfOperation::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -6102,6 +8534,11 @@ JNI_METHOD(void, ThermostatCluster, writeControlSequenceOfOperationAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -6110,10 +8547,15 @@ JNI_METHOD(void, ThermostatCluster, writeSystemModeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::Thermostat::Attributes::SystemMode::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -6149,6 +8591,11 @@ JNI_METHOD(void, ThermostatCluster, writeSystemModeAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -6157,10 +8604,15 @@ JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, writeTemperatureDi (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -6197,6 +8649,11 @@ JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, writeTemperatureDi err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -6205,10 +8662,15 @@ JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, writeKeypadLockout (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -6245,6 +8707,11 @@ JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, writeKeypadLockout err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -6253,10 +8720,15 @@ JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, writeScheduleProgr (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -6293,6 +8765,100 @@ JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, writeScheduleProgr err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, UserLabelCluster, writeLabelListAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::UserLabel::Attributes::LabelList::TypeInfo; + TypeInfo::Type cppValue; + + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + jint valueSize; + chip::JniReferences::GetInstance().GetArrayListSize(value, valueSize); + if (valueSize != 0) + { + auto * listHolder_0 = new ListHolder(valueSize); + listFreer.add(listHolder_0); + + for (size_t i_0 = 0; i_0 < static_cast(valueSize); ++i_0) + { + jobject element_0; + chip::JniReferences::GetInstance().GetArrayListItem(value, i_0, element_0); + jobject element_0_labelItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "label", "Ljava/lang/String;", element_0_labelItem_1); + auto element_0_labelItem_1Jni = + chip::Platform::New(env, static_cast(element_0_labelItem_1)); + cleanupStrings.push_back(element_0_labelItem_1Jni); + listHolder_0->mList[i_0].label = element_0_labelItem_1Jni->charSpan(); + jobject element_0_valueItem_1; + chip::JniReferences::GetInstance().GetObjectField(element_0, "value", "Ljava/lang/String;", element_0_valueItem_1); + auto element_0_valueItem_1Jni = + chip::Platform::New(env, static_cast(element_0_valueItem_1)); + cleanupStrings.push_back(element_0_valueItem_1Jni); + listHolder_0->mList[i_0].value = element_0_valueItem_1Jni->charSpan(); + } + cppValue = ListType_0(listHolder_0->mList, valueSize); + } + else + { + cppValue = ListType_0(); + } + } + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + UserLabelCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedWriteTimeoutMs == nullptr) + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedWriteTimeoutMs)); + } + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } @@ -6301,10 +8867,15 @@ JNI_METHOD(void, WindowCoveringCluster, writeModeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; + ListFreer listFreer; using TypeInfo = chip::app::Clusters::WindowCovering::Attributes::Mode::TypeInfo; TypeInfo::Type cppValue; - cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + std::vector cleanupByteArrays; + std::vector cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); @@ -6340,6 +8911,11 @@ JNI_METHOD(void, WindowCoveringCluster, writeModeAttribute) err == CHIP_NO_ERROR, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + std::for_each(cleanupByteArrays.cbegin(), cleanupByteArrays.cend(), + [](chip::JniByteArray * jniByteArray) { chip::Platform::Delete(jniByteArray); }); + std::for_each(cleanupStrings.cbegin(), cleanupStrings.cend(), + [](chip::JniUtfString * jniString) { chip::Platform::Delete(jniString); }); + onSuccess.release(); onFailure.release(); } diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index 0114899f78b617..cf56de473b7468 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -82,9 +82,7 @@ void CHIPAccountLoginClusterGetSetupPINResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject setupPIN; - - chip::UtfString setupPINUtfString(env, dataResponse.setupPIN); - setupPIN = setupPINUtfString.jniValue(); + setupPIN = env->NewStringUTF(std::string(dataResponse.setupPIN.data(), dataResponse.setupPIN.size()).c_str()); env->CallVoidMethod(javaCallbackRef, javaMethod, setupPIN); } @@ -143,15 +141,12 @@ void CHIPApplicationLauncherClusterLauncherResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); + chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), + static_cast(dataResponse.status), status); jobject data; - - chip::UtfString dataUtfString(env, dataResponse.data); - data = dataUtfString.jniValue(); + data = env->NewStringUTF(std::string(dataResponse.data.data(), dataResponse.data.size()).c_str()); env->CallVoidMethod(javaCallbackRef, javaMethod, status, data); } @@ -203,18 +198,53 @@ void CHIPChannelClusterChangeChannelResponseCallback::CallbackFn( // Java callback is allowed to be null, exit early if this is the case. VerifyOrReturn(javaCallbackRef != nullptr); - err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + err = JniReferences::GetInstance().FindMethod( + env, javaCallbackRef, "onSuccess", "(Lchip/devicecontroller/ChipStructs$ChannelClusterChannelInfo;Ljava/lang/Integer;)V", + &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject channelMatch; - - channelMatch = nullptr; /* Struct - conversion from this type to Java is not properly implemented yet */ + jobject channelMatch_majorNumber; + std::string channelMatch_majorNumberClassName = "java/lang/Integer"; + std::string channelMatch_majorNumberCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(channelMatch_majorNumberClassName.c_str(), + channelMatch_majorNumberCtorSignature.c_str(), + dataResponse.channelMatch.majorNumber, channelMatch_majorNumber); + jobject channelMatch_minorNumber; + std::string channelMatch_minorNumberClassName = "java/lang/Integer"; + std::string channelMatch_minorNumberCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(channelMatch_minorNumberClassName.c_str(), + channelMatch_minorNumberCtorSignature.c_str(), + dataResponse.channelMatch.minorNumber, channelMatch_minorNumber); + jobject channelMatch_name; + channelMatch_name = + env->NewStringUTF(std::string(dataResponse.channelMatch.name.data(), dataResponse.channelMatch.name.size()).c_str()); + jobject channelMatch_callSign; + channelMatch_callSign = env->NewStringUTF( + std::string(dataResponse.channelMatch.callSign.data(), dataResponse.channelMatch.callSign.size()).c_str()); + jobject channelMatch_affiliateCallSign; + channelMatch_affiliateCallSign = env->NewStringUTF( + std::string(dataResponse.channelMatch.affiliateCallSign.data(), dataResponse.channelMatch.affiliateCallSign.size()) + .c_str()); + + jclass channelInfoStructClass; + err = chip::JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/ChipStructs$ChannelClusterChannelInfo", + channelInfoStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find class ChipStructs$ChannelClusterChannelInfo")); + chip::JniClass structJniClass(channelInfoStructClass); + jmethodID channelInfoStructCtor = + env->GetMethodID(channelInfoStructClass, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"); + VerifyOrReturn(channelInfoStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$ChannelClusterChannelInfo constructor")); + + channelMatch = env->NewObject(channelInfoStructClass, channelInfoStructCtor, channelMatch_majorNumber, channelMatch_minorNumber, + channelMatch_name, channelMatch_callSign, channelMatch_affiliateCallSign); jobject errorType; - std::string errorTypeClassName = "java/lang/Integer"; std::string errorTypeCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - errorTypeClassName.c_str(), errorTypeCtorSignature.c_str(), dataResponse.errorType, errorType); + chip::JniReferences::GetInstance().CreateBoxedObject(errorTypeClassName.c_str(), errorTypeCtorSignature.c_str(), + static_cast(dataResponse.errorType), errorType); env->CallVoidMethod(javaCallbackRef, javaMethod, channelMatch, errorType); } @@ -271,15 +301,12 @@ void CHIPContentLauncherClusterLaunchResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); + chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), + static_cast(dataResponse.status), status); jobject data; - - chip::UtfString dataUtfString(env, dataResponse.data); - data = dataUtfString.jniValue(); + data = env->NewStringUTF(std::string(dataResponse.data.data(), dataResponse.data.size()).c_str()); env->CallVoidMethod(javaCallbackRef, javaMethod, status, data); } @@ -337,23 +364,21 @@ void CHIPDiagnosticLogsClusterRetrieveLogsResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); + chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), + static_cast(dataResponse.status), status); jobject content; - - chip::ByteArray contentByteArray(env, dataResponse.content); - content = contentByteArray.jniValue(); + jbyteArray contentByteArray = env->NewByteArray(static_cast(dataResponse.content.size())); + env->SetByteArrayRegion(contentByteArray, 0, static_cast(dataResponse.content.size()), + reinterpret_cast(dataResponse.content.data())); + content = contentByteArray; jobject timeStamp; - std::string timeStampClassName = "java/lang/Long"; std::string timeStampCtorSignature = "(J)V"; chip::JniReferences::GetInstance().CreateBoxedObject(timeStampClassName.c_str(), timeStampCtorSignature.c_str(), dataResponse.timeStamp, timeStamp); jobject timeSinceBoot; - std::string timeSinceBootClassName = "java/lang/Long"; std::string timeSinceBootCtorSignature = "(J)V"; chip::JniReferences::GetInstance().CreateBoxedObject( @@ -416,24 +441,35 @@ void CHIPDoorLockClusterGetCredentialStatusResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject credentialExists; - std::string credentialExistsClassName = "java/lang/Boolean"; std::string credentialExistsCtorSignature = "(Z)V"; chip::JniReferences::GetInstance().CreateBoxedObject( credentialExistsClassName.c_str(), credentialExistsCtorSignature.c_str(), dataResponse.credentialExists, credentialExists); jobject userIndex; - - std::string userIndexClassName = "java/lang/Integer"; - std::string userIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(userIndexClassName.c_str(), userIndexCtorSignature.c_str(), - dataResponse.userIndex.Value(), userIndex); + if (dataResponse.userIndex.IsNull()) + { + userIndex = nullptr; + } + else + { + std::string userIndexClassName = "java/lang/Integer"; + std::string userIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(userIndexClassName.c_str(), userIndexCtorSignature.c_str(), + dataResponse.userIndex.Value(), userIndex); + } jobject nextCredentialIndex; - - std::string nextCredentialIndexClassName = "java/lang/Integer"; - std::string nextCredentialIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(nextCredentialIndexClassName.c_str(), - nextCredentialIndexCtorSignature.c_str(), - dataResponse.nextCredentialIndex.Value(), nextCredentialIndex); + if (dataResponse.nextCredentialIndex.IsNull()) + { + nextCredentialIndex = nullptr; + } + else + { + std::string nextCredentialIndexClassName = "java/lang/Integer"; + std::string nextCredentialIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + nextCredentialIndexClassName.c_str(), nextCredentialIndexCtorSignature.c_str(), + dataResponse.nextCredentialIndex.Value(), nextCredentialIndex); + } env->CallVoidMethod(javaCallbackRef, javaMethod, credentialExists, userIndex, nextCredentialIndex); } @@ -487,64 +523,146 @@ void CHIPDoorLockClusterGetUserResponseCallback::CallbackFn( err = JniReferences::GetInstance().FindMethod( env, javaCallbackRef, "onSuccess", - "(Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/" - "Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", + "(Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/" + "ArrayList;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject userIndex; - std::string userIndexClassName = "java/lang/Integer"; std::string userIndexCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(userIndexClassName.c_str(), userIndexCtorSignature.c_str(), dataResponse.userIndex, userIndex); jobject userName; - - chip::UtfString userNameUtfString(env, dataResponse.userName.Value()); - userName = userNameUtfString.jniValue(); + if (dataResponse.userName.IsNull()) + { + userName = nullptr; + } + else + { + userName = + env->NewStringUTF(std::string(dataResponse.userName.Value().data(), dataResponse.userName.Value().size()).c_str()); + } jobject userUniqueId; - - std::string userUniqueIdClassName = "java/lang/Long"; - std::string userUniqueIdCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(userUniqueIdClassName.c_str(), userUniqueIdCtorSignature.c_str(), - dataResponse.userUniqueId.Value(), userUniqueId); + if (dataResponse.userUniqueId.IsNull()) + { + userUniqueId = nullptr; + } + else + { + std::string userUniqueIdClassName = "java/lang/Long"; + std::string userUniqueIdCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + userUniqueIdClassName.c_str(), userUniqueIdCtorSignature.c_str(), dataResponse.userUniqueId.Value(), userUniqueId); + } jobject userStatus; - - std::string userStatusClassName = "java/lang/Integer"; - std::string userStatusCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - userStatusClassName.c_str(), userStatusCtorSignature.c_str(), dataResponse.userStatus.Value(), userStatus); + if (dataResponse.userStatus.IsNull()) + { + userStatus = nullptr; + } + else + { + std::string userStatusClassName = "java/lang/Integer"; + std::string userStatusCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(userStatusClassName.c_str(), userStatusCtorSignature.c_str(), + static_cast(dataResponse.userStatus.Value()), + userStatus); + } jobject userType; - - std::string userTypeClassName = "java/lang/Integer"; - std::string userTypeCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - userTypeClassName.c_str(), userTypeCtorSignature.c_str(), dataResponse.userType.Value(), userType); + if (dataResponse.userType.IsNull()) + { + userType = nullptr; + } + else + { + std::string userTypeClassName = "java/lang/Integer"; + std::string userTypeCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(userTypeClassName.c_str(), userTypeCtorSignature.c_str(), + static_cast(dataResponse.userType.Value()), + userType); + } jobject credentialRule; - - std::string credentialRuleClassName = "java/lang/Integer"; - std::string credentialRuleCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - credentialRuleClassName.c_str(), credentialRuleCtorSignature.c_str(), dataResponse.credentialRule.Value(), credentialRule); + if (dataResponse.credentialRule.IsNull()) + { + credentialRule = nullptr; + } + else + { + std::string credentialRuleClassName = "java/lang/Integer"; + std::string credentialRuleCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + credentialRuleClassName.c_str(), credentialRuleCtorSignature.c_str(), + static_cast(dataResponse.credentialRule.Value()), credentialRule); + } jobject credentials; + if (dataResponse.credentials.IsNull()) + { + credentials = nullptr; + } + else + { + chip::JniReferences::GetInstance().CreateArrayList(credentials); - credentials = nullptr; /* Array - Conversion from this type to Java is not properly implemented yet */ + auto iter_credentials_1 = dataResponse.credentials.Value().begin(); + while (iter_credentials_1.Next()) + { + auto & entry_1 = iter_credentials_1.GetValue(); + jobject newElement_1; + jobject newElement_1_credentialType; + std::string newElement_1_credentialTypeClassName = "java/lang/Integer"; + std::string newElement_1_credentialTypeCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_credentialTypeClassName.c_str(), newElement_1_credentialTypeCtorSignature.c_str(), + static_cast(entry_1.credentialType), newElement_1_credentialType); + jobject newElement_1_credentialIndex; + std::string newElement_1_credentialIndexClassName = "java/lang/Integer"; + std::string newElement_1_credentialIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_credentialIndexClassName.c_str(), + newElement_1_credentialIndexCtorSignature.c_str(), + entry_1.credentialIndex, newElement_1_credentialIndex); + + jclass dlCredentialStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DoorLockClusterDlCredential", dlCredentialStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find class ChipStructs$DoorLockClusterDlCredential")); + chip::JniClass structJniClass(dlCredentialStructClass); + jmethodID dlCredentialStructCtor = + env->GetMethodID(dlCredentialStructClass, "", "(Ljava/lang/Integer;Ljava/lang/Integer;)V"); + VerifyOrReturn(dlCredentialStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$DoorLockClusterDlCredential constructor")); + + newElement_1 = env->NewObject(dlCredentialStructClass, dlCredentialStructCtor, newElement_1_credentialType, + newElement_1_credentialIndex); + chip::JniReferences::GetInstance().AddToArrayList(credentials, newElement_1); + } + } jobject creatorFabricIndex; - - std::string creatorFabricIndexClassName = "java/lang/Integer"; - std::string creatorFabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - creatorFabricIndexClassName.c_str(), creatorFabricIndexCtorSignature.c_str(), dataResponse.creatorFabricIndex.Value(), - creatorFabricIndex); + if (dataResponse.creatorFabricIndex.IsNull()) + { + creatorFabricIndex = nullptr; + } + else + { + std::string creatorFabricIndexClassName = "java/lang/Integer"; + std::string creatorFabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(creatorFabricIndexClassName.c_str(), + creatorFabricIndexCtorSignature.c_str(), + dataResponse.creatorFabricIndex.Value(), creatorFabricIndex); + } jobject lastModifiedFabricIndex; - - std::string lastModifiedFabricIndexClassName = "java/lang/Integer"; - std::string lastModifiedFabricIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - lastModifiedFabricIndexClassName.c_str(), lastModifiedFabricIndexCtorSignature.c_str(), - dataResponse.lastModifiedFabricIndex.Value(), lastModifiedFabricIndex); + if (dataResponse.lastModifiedFabricIndex.IsNull()) + { + lastModifiedFabricIndex = nullptr; + } + else + { + std::string lastModifiedFabricIndexClassName = "java/lang/Integer"; + std::string lastModifiedFabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + lastModifiedFabricIndexClassName.c_str(), lastModifiedFabricIndexCtorSignature.c_str(), + dataResponse.lastModifiedFabricIndex.Value(), lastModifiedFabricIndex); + } jobject nextUserIndex; - std::string nextUserIndexClassName = "java/lang/Integer"; std::string nextUserIndexCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject( @@ -606,24 +724,35 @@ void CHIPDoorLockClusterSetCredentialResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); + chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), + static_cast(dataResponse.status), status); jobject userIndex; - - std::string userIndexClassName = "java/lang/Integer"; - std::string userIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(userIndexClassName.c_str(), userIndexCtorSignature.c_str(), - dataResponse.userIndex.Value(), userIndex); + if (dataResponse.userIndex.IsNull()) + { + userIndex = nullptr; + } + else + { + std::string userIndexClassName = "java/lang/Integer"; + std::string userIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(userIndexClassName.c_str(), userIndexCtorSignature.c_str(), + dataResponse.userIndex.Value(), userIndex); + } jobject nextCredentialIndex; - - std::string nextCredentialIndexClassName = "java/lang/Integer"; - std::string nextCredentialIndexCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(nextCredentialIndexClassName.c_str(), - nextCredentialIndexCtorSignature.c_str(), - dataResponse.nextCredentialIndex.Value(), nextCredentialIndex); + if (dataResponse.nextCredentialIndex.IsNull()) + { + nextCredentialIndex = nullptr; + } + else + { + std::string nextCredentialIndexClassName = "java/lang/Integer"; + std::string nextCredentialIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + nextCredentialIndexClassName.c_str(), nextCredentialIndexCtorSignature.c_str(), + dataResponse.nextCredentialIndex.Value(), nextCredentialIndex); + } env->CallVoidMethod(javaCallbackRef, javaMethod, status, userIndex, nextCredentialIndex); } @@ -682,15 +811,12 @@ void CHIPGeneralCommissioningClusterArmFailSafeResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject errorCode; - std::string errorCodeClassName = "java/lang/Integer"; std::string errorCodeCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - errorCodeClassName.c_str(), errorCodeCtorSignature.c_str(), dataResponse.errorCode, errorCode); + chip::JniReferences::GetInstance().CreateBoxedObject(errorCodeClassName.c_str(), errorCodeCtorSignature.c_str(), + static_cast(dataResponse.errorCode), errorCode); jobject debugText; - - chip::UtfString debugTextUtfString(env, dataResponse.debugText); - debugText = debugTextUtfString.jniValue(); + debugText = env->NewStringUTF(std::string(dataResponse.debugText.data(), dataResponse.debugText.size()).c_str()); env->CallVoidMethod(javaCallbackRef, javaMethod, errorCode, debugText); } @@ -751,15 +877,12 @@ void CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback::Callb VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject errorCode; - std::string errorCodeClassName = "java/lang/Integer"; std::string errorCodeCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - errorCodeClassName.c_str(), errorCodeCtorSignature.c_str(), dataResponse.errorCode, errorCode); + chip::JniReferences::GetInstance().CreateBoxedObject(errorCodeClassName.c_str(), errorCodeCtorSignature.c_str(), + static_cast(dataResponse.errorCode), errorCode); jobject debugText; - - chip::UtfString debugTextUtfString(env, dataResponse.debugText); - debugText = debugTextUtfString.jniValue(); + debugText = env->NewStringUTF(std::string(dataResponse.debugText.data(), dataResponse.debugText.size()).c_str()); env->CallVoidMethod(javaCallbackRef, javaMethod, errorCode, debugText); } @@ -820,15 +943,12 @@ void CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback::Callbac VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject errorCode; - std::string errorCodeClassName = "java/lang/Integer"; std::string errorCodeCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - errorCodeClassName.c_str(), errorCodeCtorSignature.c_str(), dataResponse.errorCode, errorCode); + chip::JniReferences::GetInstance().CreateBoxedObject(errorCodeClassName.c_str(), errorCodeCtorSignature.c_str(), + static_cast(dataResponse.errorCode), errorCode); jobject debugText; - - chip::UtfString debugTextUtfString(env, dataResponse.debugText); - debugText = debugTextUtfString.jniValue(); + debugText = env->NewStringUTF(std::string(dataResponse.debugText.data(), dataResponse.debugText.size()).c_str()); env->CallVoidMethod(javaCallbackRef, javaMethod, errorCode, debugText); } @@ -884,12 +1004,23 @@ void CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback::Callback // Java callback is allowed to be null, exit early if this is the case. VerifyOrReturn(javaCallbackRef != nullptr); - err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "()V", &javaMethod); + err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/ArrayList;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject groupKeySetIDs; + chip::JniReferences::GetInstance().CreateArrayList(groupKeySetIDs); - groupKeySetIDs = nullptr; /* Array - Conversion from this type to Java is not properly implemented yet */ + auto iter_groupKeySetIDs_0 = dataResponse.groupKeySetIDs.begin(); + while (iter_groupKeySetIDs_0.Next()) + { + auto & entry_0 = iter_groupKeySetIDs_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(groupKeySetIDs, newElement_0); + } env->CallVoidMethod(javaCallbackRef, javaMethod, groupKeySetIDs); } @@ -943,12 +1074,74 @@ void CHIPGroupKeyManagementClusterKeySetReadResponseCallback::CallbackFn( // Java callback is allowed to be null, exit early if this is the case. VerifyOrReturn(javaCallbackRef != nullptr); - err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "()V", &javaMethod); + err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", + "(Lchip/devicecontroller/ChipStructs$GroupKeyManagementClusterGroupKeySet;)V", + &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject groupKeySet; - - groupKeySet = nullptr; /* Struct - conversion from this type to Java is not properly implemented yet */ + jobject groupKeySet_groupKeySetID; + std::string groupKeySet_groupKeySetIDClassName = "java/lang/Integer"; + std::string groupKeySet_groupKeySetIDCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + groupKeySet_groupKeySetIDClassName.c_str(), groupKeySet_groupKeySetIDCtorSignature.c_str(), + dataResponse.groupKeySet.groupKeySetID, groupKeySet_groupKeySetID); + jobject groupKeySet_securityPolicy; + std::string groupKeySet_securityPolicyClassName = "java/lang/Integer"; + std::string groupKeySet_securityPolicyCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + groupKeySet_securityPolicyClassName.c_str(), groupKeySet_securityPolicyCtorSignature.c_str(), + static_cast(dataResponse.groupKeySet.securityPolicy), groupKeySet_securityPolicy); + jobject groupKeySet_epochKey0; + jbyteArray groupKeySet_epochKey0ByteArray = env->NewByteArray(static_cast(dataResponse.groupKeySet.epochKey0.size())); + env->SetByteArrayRegion(groupKeySet_epochKey0ByteArray, 0, static_cast(dataResponse.groupKeySet.epochKey0.size()), + reinterpret_cast(dataResponse.groupKeySet.epochKey0.data())); + groupKeySet_epochKey0 = groupKeySet_epochKey0ByteArray; + jobject groupKeySet_epochStartTime0; + std::string groupKeySet_epochStartTime0ClassName = "java/lang/Long"; + std::string groupKeySet_epochStartTime0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + groupKeySet_epochStartTime0ClassName.c_str(), groupKeySet_epochStartTime0CtorSignature.c_str(), + dataResponse.groupKeySet.epochStartTime0, groupKeySet_epochStartTime0); + jobject groupKeySet_epochKey1; + jbyteArray groupKeySet_epochKey1ByteArray = env->NewByteArray(static_cast(dataResponse.groupKeySet.epochKey1.size())); + env->SetByteArrayRegion(groupKeySet_epochKey1ByteArray, 0, static_cast(dataResponse.groupKeySet.epochKey1.size()), + reinterpret_cast(dataResponse.groupKeySet.epochKey1.data())); + groupKeySet_epochKey1 = groupKeySet_epochKey1ByteArray; + jobject groupKeySet_epochStartTime1; + std::string groupKeySet_epochStartTime1ClassName = "java/lang/Long"; + std::string groupKeySet_epochStartTime1CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + groupKeySet_epochStartTime1ClassName.c_str(), groupKeySet_epochStartTime1CtorSignature.c_str(), + dataResponse.groupKeySet.epochStartTime1, groupKeySet_epochStartTime1); + jobject groupKeySet_epochKey2; + jbyteArray groupKeySet_epochKey2ByteArray = env->NewByteArray(static_cast(dataResponse.groupKeySet.epochKey2.size())); + env->SetByteArrayRegion(groupKeySet_epochKey2ByteArray, 0, static_cast(dataResponse.groupKeySet.epochKey2.size()), + reinterpret_cast(dataResponse.groupKeySet.epochKey2.data())); + groupKeySet_epochKey2 = groupKeySet_epochKey2ByteArray; + jobject groupKeySet_epochStartTime2; + std::string groupKeySet_epochStartTime2ClassName = "java/lang/Long"; + std::string groupKeySet_epochStartTime2CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + groupKeySet_epochStartTime2ClassName.c_str(), groupKeySet_epochStartTime2CtorSignature.c_str(), + dataResponse.groupKeySet.epochStartTime2, groupKeySet_epochStartTime2); + + jclass groupKeySetStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$GroupKeyManagementClusterGroupKeySet", groupKeySetStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$GroupKeyManagementClusterGroupKeySet")); + chip::JniClass structJniClass(groupKeySetStructClass); + jmethodID groupKeySetStructCtor = + env->GetMethodID(groupKeySetStructClass, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;[BLjava/lang/Long;[BLjava/lang/Long;[BLjava/lang/Long;)V"); + VerifyOrReturn(groupKeySetStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$GroupKeyManagementClusterGroupKeySet constructor")); + + groupKeySet = + env->NewObject(groupKeySetStructClass, groupKeySetStructCtor, groupKeySet_groupKeySetID, groupKeySet_securityPolicy, + groupKeySet_epochKey0, groupKeySet_epochStartTime0, groupKeySet_epochKey1, groupKeySet_epochStartTime1, + groupKeySet_epochKey2, groupKeySet_epochStartTime2); env->CallVoidMethod(javaCallbackRef, javaMethod, groupKeySet); } @@ -1005,13 +1198,11 @@ void CHIPGroupsClusterAddGroupResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); jobject groupId; - std::string groupIdClassName = "java/lang/Integer"; std::string groupIdCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(groupIdClassName.c_str(), groupIdCtorSignature.c_str(), @@ -1068,18 +1259,29 @@ void CHIPGroupsClusterGetGroupMembershipResponseCallback::CallbackFn( // Java callback is allowed to be null, exit early if this is the case. VerifyOrReturn(javaCallbackRef != nullptr); - err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;Ljava/util/ArrayList;)V", + &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject capacity; - std::string capacityClassName = "java/lang/Integer"; std::string capacityCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(capacityClassName.c_str(), capacityCtorSignature.c_str(), dataResponse.capacity, capacity); jobject groupList; + chip::JniReferences::GetInstance().CreateArrayList(groupList); - groupList = nullptr; /* Array - Conversion from this type to Java is not properly implemented yet */ + auto iter_groupList_0 = dataResponse.groupList.begin(); + while (iter_groupList_0.Next()) + { + auto & entry_0 = iter_groupList_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(groupList, newElement_0); + } env->CallVoidMethod(javaCallbackRef, javaMethod, capacity, groupList); } @@ -1136,13 +1338,11 @@ void CHIPGroupsClusterRemoveGroupResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); jobject groupId; - std::string groupIdClassName = "java/lang/Integer"; std::string groupIdCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(groupIdClassName.c_str(), groupIdCtorSignature.c_str(), @@ -1203,21 +1403,17 @@ void CHIPGroupsClusterViewGroupResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); jobject groupId; - std::string groupIdClassName = "java/lang/Integer"; std::string groupIdCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(groupIdClassName.c_str(), groupIdCtorSignature.c_str(), dataResponse.groupId, groupId); jobject groupName; - - chip::UtfString groupNameUtfString(env, dataResponse.groupName); - groupName = groupNameUtfString.jniValue(); + groupName = env->NewStringUTF(std::string(dataResponse.groupName.data(), dataResponse.groupName.size()).c_str()); env->CallVoidMethod(javaCallbackRef, javaMethod, status, groupId, groupName); } @@ -1273,7 +1469,6 @@ void CHIPIdentifyClusterIdentifyQueryResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject timeout; - std::string timeoutClassName = "java/lang/Integer"; std::string timeoutCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(timeoutClassName.c_str(), timeoutCtorSignature.c_str(), @@ -1333,11 +1528,10 @@ void CHIPKeypadInputClusterSendKeyResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); + chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), + static_cast(dataResponse.status), status); env->CallVoidMethod(javaCallbackRef, javaMethod, status); } @@ -1393,11 +1587,10 @@ void CHIPMediaPlaybackClusterPlaybackResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); + chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), + static_cast(dataResponse.status), status); env->CallVoidMethod(javaCallbackRef, javaMethod, status); } @@ -1456,17 +1649,14 @@ void CHIPNetworkCommissioningClusterConnectNetworkResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject NetworkingStatus; - std::string NetworkingStatusClassName = "java/lang/Integer"; std::string NetworkingStatusCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - NetworkingStatusClassName.c_str(), NetworkingStatusCtorSignature.c_str(), dataResponse.networkingStatus, NetworkingStatus); + chip::JniReferences::GetInstance().CreateBoxedObject( + NetworkingStatusClassName.c_str(), NetworkingStatusCtorSignature.c_str(), + static_cast(dataResponse.networkingStatus), NetworkingStatus); jobject DebugText; - - chip::UtfString DebugTextUtfString(env, dataResponse.debugText); - DebugText = DebugTextUtfString.jniValue(); + DebugText = env->NewStringUTF(std::string(dataResponse.debugText.data(), dataResponse.debugText.size()).c_str()); jobject ErrorValue; - std::string ErrorValueClassName = "java/lang/Long"; std::string ErrorValueCtorSignature = "(J)V"; chip::JniReferences::GetInstance().CreateBoxedObject(ErrorValueClassName.c_str(), ErrorValueCtorSignature.c_str(), @@ -1529,15 +1719,13 @@ void CHIPNetworkCommissioningClusterNetworkConfigResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject NetworkingStatus; - std::string NetworkingStatusClassName = "java/lang/Integer"; std::string NetworkingStatusCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - NetworkingStatusClassName.c_str(), NetworkingStatusCtorSignature.c_str(), dataResponse.networkingStatus, NetworkingStatus); + chip::JniReferences::GetInstance().CreateBoxedObject( + NetworkingStatusClassName.c_str(), NetworkingStatusCtorSignature.c_str(), + static_cast(dataResponse.networkingStatus), NetworkingStatus); jobject DebugText; - - chip::UtfString DebugTextUtfString(env, dataResponse.debugText); - DebugText = DebugTextUtfString.jniValue(); + DebugText = env->NewStringUTF(std::string(dataResponse.debugText.data(), dataResponse.debugText.size()).c_str()); env->CallVoidMethod(javaCallbackRef, javaMethod, NetworkingStatus, DebugText); } @@ -1591,20 +1779,19 @@ void CHIPNetworkCommissioningClusterScanNetworksResponseCallback::CallbackFn( // Java callback is allowed to be null, exit early if this is the case. VerifyOrReturn(javaCallbackRef != nullptr); - err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;Ljava/lang/String;)V", - &javaMethod); + err = JniReferences::GetInstance().FindMethod( + env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;Ljava/lang/String;Ljava/util/Optional;Ljava/util/Optional;)V", + &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject NetworkingStatus; - std::string NetworkingStatusClassName = "java/lang/Integer"; std::string NetworkingStatusCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - NetworkingStatusClassName.c_str(), NetworkingStatusCtorSignature.c_str(), dataResponse.networkingStatus, NetworkingStatus); + chip::JniReferences::GetInstance().CreateBoxedObject( + NetworkingStatusClassName.c_str(), NetworkingStatusCtorSignature.c_str(), + static_cast(dataResponse.networkingStatus), NetworkingStatus); jobject DebugText; - - chip::UtfString DebugTextUtfString(env, dataResponse.debugText); - DebugText = DebugTextUtfString.jniValue(); + DebugText = env->NewStringUTF(std::string(dataResponse.debugText.data(), dataResponse.debugText.size()).c_str()); jobject WiFiScanResults; if (!dataResponse.wiFiScanResults.HasValue()) { @@ -1612,9 +1799,67 @@ void CHIPNetworkCommissioningClusterScanNetworksResponseCallback::CallbackFn( } else { + chip::JniReferences::GetInstance().CreateArrayList(WiFiScanResults); - WiFiScanResults = nullptr; /* Array - Conversion from this type to Java is not properly implemented yet */ - chip::JniReferences::GetInstance().CreateOptional(WiFiScanResults, WiFiScanResults); + auto iter_WiFiScanResults_1 = dataResponse.wiFiScanResults.Value().begin(); + while (iter_WiFiScanResults_1.Next()) + { + auto & entry_1 = iter_WiFiScanResults_1.GetValue(); + jobject newElement_1; + jobject newElement_1_security; + std::string newElement_1_securityClassName = "java/lang/Integer"; + std::string newElement_1_securityCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_securityClassName.c_str(), + newElement_1_securityCtorSignature.c_str(), + entry_1.security, newElement_1_security); + jobject newElement_1_ssid; + jbyteArray newElement_1_ssidByteArray = env->NewByteArray(static_cast(entry_1.ssid.size())); + env->SetByteArrayRegion(newElement_1_ssidByteArray, 0, static_cast(entry_1.ssid.size()), + reinterpret_cast(entry_1.ssid.data())); + newElement_1_ssid = newElement_1_ssidByteArray; + jobject newElement_1_bssid; + jbyteArray newElement_1_bssidByteArray = env->NewByteArray(static_cast(entry_1.bssid.size())); + env->SetByteArrayRegion(newElement_1_bssidByteArray, 0, static_cast(entry_1.bssid.size()), + reinterpret_cast(entry_1.bssid.data())); + newElement_1_bssid = newElement_1_bssidByteArray; + jobject newElement_1_channel; + std::string newElement_1_channelClassName = "java/lang/Integer"; + std::string newElement_1_channelCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_channelClassName.c_str(), + newElement_1_channelCtorSignature.c_str(), + entry_1.channel, newElement_1_channel); + jobject newElement_1_wiFiBand; + std::string newElement_1_wiFiBandClassName = "java/lang/Integer"; + std::string newElement_1_wiFiBandCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_wiFiBandClassName.c_str(), newElement_1_wiFiBandCtorSignature.c_str(), + static_cast(entry_1.wiFiBand), newElement_1_wiFiBand); + jobject newElement_1_rssi; + std::string newElement_1_rssiClassName = "java/lang/Integer"; + std::string newElement_1_rssiCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_rssiClassName.c_str(), newElement_1_rssiCtorSignature.c_str(), entry_1.rssi, newElement_1_rssi); + + jclass wiFiInterfaceScanResultStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$NetworkCommissioningClusterWiFiInterfaceScanResult", + wiFiInterfaceScanResultStructClass); + VerifyOrReturn( + err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$NetworkCommissioningClusterWiFiInterfaceScanResult")); + chip::JniClass structJniClass(wiFiInterfaceScanResultStructClass); + jmethodID wiFiInterfaceScanResultStructCtor = + env->GetMethodID(wiFiInterfaceScanResultStructClass, "", + "(Ljava/lang/Integer;[B[BLjava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V"); + VerifyOrReturn( + wiFiInterfaceScanResultStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$NetworkCommissioningClusterWiFiInterfaceScanResult constructor")); + + newElement_1 = env->NewObject(wiFiInterfaceScanResultStructClass, wiFiInterfaceScanResultStructCtor, + newElement_1_security, newElement_1_ssid, newElement_1_bssid, newElement_1_channel, + newElement_1_wiFiBand, newElement_1_rssi); + chip::JniReferences::GetInstance().AddToArrayList(WiFiScanResults, newElement_1); + } } jobject ThreadScanResults; if (!dataResponse.threadScanResults.HasValue()) @@ -1623,9 +1868,78 @@ void CHIPNetworkCommissioningClusterScanNetworksResponseCallback::CallbackFn( } else { + chip::JniReferences::GetInstance().CreateArrayList(ThreadScanResults); - ThreadScanResults = nullptr; /* Array - Conversion from this type to Java is not properly implemented yet */ - chip::JniReferences::GetInstance().CreateOptional(ThreadScanResults, ThreadScanResults); + auto iter_ThreadScanResults_1 = dataResponse.threadScanResults.Value().begin(); + while (iter_ThreadScanResults_1.Next()) + { + auto & entry_1 = iter_ThreadScanResults_1.GetValue(); + jobject newElement_1; + jobject newElement_1_panId; + std::string newElement_1_panIdClassName = "java/lang/Long"; + std::string newElement_1_panIdCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_panIdClassName.c_str(), newElement_1_panIdCtorSignature.c_str(), entry_1.panId, newElement_1_panId); + jobject newElement_1_extendedPanId; + std::string newElement_1_extendedPanIdClassName = "java/lang/Long"; + std::string newElement_1_extendedPanIdCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_extendedPanIdClassName.c_str(), + newElement_1_extendedPanIdCtorSignature.c_str(), + entry_1.extendedPanId, newElement_1_extendedPanId); + jobject newElement_1_networkName; + newElement_1_networkName = + env->NewStringUTF(std::string(entry_1.networkName.data(), entry_1.networkName.size()).c_str()); + jobject newElement_1_channel; + std::string newElement_1_channelClassName = "java/lang/Integer"; + std::string newElement_1_channelCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_channelClassName.c_str(), + newElement_1_channelCtorSignature.c_str(), + entry_1.channel, newElement_1_channel); + jobject newElement_1_version; + std::string newElement_1_versionClassName = "java/lang/Integer"; + std::string newElement_1_versionCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_versionClassName.c_str(), + newElement_1_versionCtorSignature.c_str(), + entry_1.version, newElement_1_version); + jobject newElement_1_extendedAddress; + std::string newElement_1_extendedAddressClassName = "java/lang/Long"; + std::string newElement_1_extendedAddressCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_extendedAddressClassName.c_str(), + newElement_1_extendedAddressCtorSignature.c_str(), + entry_1.extendedAddress, newElement_1_extendedAddress); + jobject newElement_1_rssi; + std::string newElement_1_rssiClassName = "java/lang/Integer"; + std::string newElement_1_rssiCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_rssiClassName.c_str(), newElement_1_rssiCtorSignature.c_str(), entry_1.rssi, newElement_1_rssi); + jobject newElement_1_lqi; + std::string newElement_1_lqiClassName = "java/lang/Integer"; + std::string newElement_1_lqiCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_lqiClassName.c_str(), newElement_1_lqiCtorSignature.c_str(), entry_1.lqi, newElement_1_lqi); + + jclass threadInterfaceScanResultStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$NetworkCommissioningClusterThreadInterfaceScanResult", + threadInterfaceScanResultStructClass); + VerifyOrReturn( + err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$NetworkCommissioningClusterThreadInterfaceScanResult")); + chip::JniClass structJniClass(threadInterfaceScanResultStructClass); + jmethodID threadInterfaceScanResultStructCtor = + env->GetMethodID(threadInterfaceScanResultStructClass, "", + "(Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/" + "lang/Long;Ljava/lang/Integer;Ljava/lang/Integer;)V"); + VerifyOrReturn( + threadInterfaceScanResultStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$NetworkCommissioningClusterThreadInterfaceScanResult constructor")); + + newElement_1 = + env->NewObject(threadInterfaceScanResultStructClass, threadInterfaceScanResultStructCtor, newElement_1_panId, + newElement_1_extendedPanId, newElement_1_networkName, newElement_1_channel, newElement_1_version, + newElement_1_extendedAddress, newElement_1_rssi, newElement_1_lqi); + chip::JniReferences::GetInstance().AddToArrayList(ThreadScanResults, newElement_1); + } } env->CallVoidMethod(javaCallbackRef, javaMethod, NetworkingStatus, DebugText, WiFiScanResults, ThreadScanResults); @@ -1686,13 +2000,11 @@ void CHIPOtaSoftwareUpdateProviderClusterApplyUpdateResponseCallback::CallbackFn VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject action; - std::string actionClassName = "java/lang/Integer"; std::string actionCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - actionClassName.c_str(), actionCtorSignature.c_str(), dataResponse.action, action); + chip::JniReferences::GetInstance().CreateBoxedObject(actionClassName.c_str(), actionCtorSignature.c_str(), + static_cast(dataResponse.action), action); jobject delayedActionTime; - std::string delayedActionTimeClassName = "java/lang/Long"; std::string delayedActionTimeCtorSignature = "(J)V"; chip::JniReferences::GetInstance().CreateBoxedObject(delayedActionTimeClassName.c_str(), @@ -1760,11 +2072,10 @@ void CHIPOtaSoftwareUpdateProviderClusterQueryImageResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); + chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), + static_cast(dataResponse.status), status); jobject delayedActionTime; if (!dataResponse.delayedActionTime.HasValue()) { @@ -1772,13 +2083,11 @@ void CHIPOtaSoftwareUpdateProviderClusterQueryImageResponseCallback::CallbackFn( } else { - std::string delayedActionTimeClassName = "java/lang/Long"; std::string delayedActionTimeCtorSignature = "(J)V"; chip::JniReferences::GetInstance().CreateBoxedObject(delayedActionTimeClassName.c_str(), delayedActionTimeCtorSignature.c_str(), dataResponse.delayedActionTime.Value(), delayedActionTime); - chip::JniReferences::GetInstance().CreateOptional(delayedActionTime, delayedActionTime); } jobject imageURI; if (!dataResponse.imageURI.HasValue()) @@ -1787,10 +2096,8 @@ void CHIPOtaSoftwareUpdateProviderClusterQueryImageResponseCallback::CallbackFn( } else { - - chip::UtfString imageURIUtfString(env, dataResponse.imageURI.Value()); - imageURI = imageURIUtfString.jniValue(); - chip::JniReferences::GetInstance().CreateOptional(imageURI, imageURI); + imageURI = + env->NewStringUTF(std::string(dataResponse.imageURI.Value().data(), dataResponse.imageURI.Value().size()).c_str()); } jobject softwareVersion; if (!dataResponse.softwareVersion.HasValue()) @@ -1799,13 +2106,11 @@ void CHIPOtaSoftwareUpdateProviderClusterQueryImageResponseCallback::CallbackFn( } else { - std::string softwareVersionClassName = "java/lang/Long"; std::string softwareVersionCtorSignature = "(J)V"; chip::JniReferences::GetInstance().CreateBoxedObject(softwareVersionClassName.c_str(), softwareVersionCtorSignature.c_str(), dataResponse.softwareVersion.Value(), softwareVersion); - chip::JniReferences::GetInstance().CreateOptional(softwareVersion, softwareVersion); } jobject softwareVersionString; if (!dataResponse.softwareVersionString.HasValue()) @@ -1814,10 +2119,9 @@ void CHIPOtaSoftwareUpdateProviderClusterQueryImageResponseCallback::CallbackFn( } else { - - chip::UtfString softwareVersionStringUtfString(env, dataResponse.softwareVersionString.Value()); - softwareVersionString = softwareVersionStringUtfString.jniValue(); - chip::JniReferences::GetInstance().CreateOptional(softwareVersionString, softwareVersionString); + softwareVersionString = env->NewStringUTF( + std::string(dataResponse.softwareVersionString.Value().data(), dataResponse.softwareVersionString.Value().size()) + .c_str()); } jobject updateToken; if (!dataResponse.updateToken.HasValue()) @@ -1826,10 +2130,10 @@ void CHIPOtaSoftwareUpdateProviderClusterQueryImageResponseCallback::CallbackFn( } else { - - chip::ByteArray updateTokenByteArray(env, dataResponse.updateToken.Value()); - updateToken = updateTokenByteArray.jniValue(); - chip::JniReferences::GetInstance().CreateOptional(updateToken, updateToken); + jbyteArray updateTokenByteArray = env->NewByteArray(static_cast(dataResponse.updateToken.Value().size())); + env->SetByteArrayRegion(updateTokenByteArray, 0, static_cast(dataResponse.updateToken.Value().size()), + reinterpret_cast(dataResponse.updateToken.Value().data())); + updateToken = updateTokenByteArray; } jobject userConsentNeeded; if (!dataResponse.userConsentNeeded.HasValue()) @@ -1838,13 +2142,11 @@ void CHIPOtaSoftwareUpdateProviderClusterQueryImageResponseCallback::CallbackFn( } else { - std::string userConsentNeededClassName = "java/lang/Boolean"; std::string userConsentNeededCtorSignature = "(Z)V"; chip::JniReferences::GetInstance().CreateBoxedObject(userConsentNeededClassName.c_str(), userConsentNeededCtorSignature.c_str(), dataResponse.userConsentNeeded.Value(), userConsentNeeded); - chip::JniReferences::GetInstance().CreateOptional(userConsentNeeded, userConsentNeeded); } jobject metadataForRequestor; if (!dataResponse.metadataForRequestor.HasValue()) @@ -1853,10 +2155,12 @@ void CHIPOtaSoftwareUpdateProviderClusterQueryImageResponseCallback::CallbackFn( } else { - - chip::ByteArray metadataForRequestorByteArray(env, dataResponse.metadataForRequestor.Value()); - metadataForRequestor = metadataForRequestorByteArray.jniValue(); - chip::JniReferences::GetInstance().CreateOptional(metadataForRequestor, metadataForRequestor); + jbyteArray metadataForRequestorByteArray = + env->NewByteArray(static_cast(dataResponse.metadataForRequestor.Value().size())); + env->SetByteArrayRegion(metadataForRequestorByteArray, 0, + static_cast(dataResponse.metadataForRequestor.Value().size()), + reinterpret_cast(dataResponse.metadataForRequestor.Value().data())); + metadataForRequestor = metadataForRequestorByteArray; } env->CallVoidMethod(javaCallbackRef, javaMethod, status, delayedActionTime, imageURI, softwareVersion, softwareVersionString, @@ -1916,13 +2220,15 @@ void CHIPOperationalCredentialsClusterAttestationResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject AttestationElements; - - chip::ByteArray AttestationElementsByteArray(env, dataResponse.attestationElements); - AttestationElements = AttestationElementsByteArray.jniValue(); + jbyteArray AttestationElementsByteArray = env->NewByteArray(static_cast(dataResponse.attestationElements.size())); + env->SetByteArrayRegion(AttestationElementsByteArray, 0, static_cast(dataResponse.attestationElements.size()), + reinterpret_cast(dataResponse.attestationElements.data())); + AttestationElements = AttestationElementsByteArray; jobject Signature; - - chip::ByteArray SignatureByteArray(env, dataResponse.signature); - Signature = SignatureByteArray.jniValue(); + jbyteArray SignatureByteArray = env->NewByteArray(static_cast(dataResponse.signature.size())); + env->SetByteArrayRegion(SignatureByteArray, 0, static_cast(dataResponse.signature.size()), + reinterpret_cast(dataResponse.signature.data())); + Signature = SignatureByteArray; env->CallVoidMethod(javaCallbackRef, javaMethod, AttestationElements, Signature); } @@ -1982,9 +2288,10 @@ void CHIPOperationalCredentialsClusterCertificateChainResponseCallback::Callback VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject Certificate; - - chip::ByteArray CertificateByteArray(env, dataResponse.certificate); - Certificate = CertificateByteArray.jniValue(); + jbyteArray CertificateByteArray = env->NewByteArray(static_cast(dataResponse.certificate.size())); + env->SetByteArrayRegion(CertificateByteArray, 0, static_cast(dataResponse.certificate.size()), + reinterpret_cast(dataResponse.certificate.data())); + Certificate = CertificateByteArray; env->CallVoidMethod(javaCallbackRef, javaMethod, Certificate); } @@ -2042,21 +2349,17 @@ void CHIPOperationalCredentialsClusterNOCResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject StatusCode; - std::string StatusCodeClassName = "java/lang/Integer"; std::string StatusCodeCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(StatusCodeClassName.c_str(), StatusCodeCtorSignature.c_str(), dataResponse.statusCode, StatusCode); jobject FabricIndex; - std::string FabricIndexClassName = "java/lang/Integer"; std::string FabricIndexCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(FabricIndexClassName.c_str(), FabricIndexCtorSignature.c_str(), dataResponse.fabricIndex, FabricIndex); jobject DebugText; - - chip::UtfString DebugTextUtfString(env, dataResponse.debugText); - DebugText = DebugTextUtfString.jniValue(); + DebugText = env->NewStringUTF(std::string(dataResponse.debugText.data(), dataResponse.debugText.size()).c_str()); env->CallVoidMethod(javaCallbackRef, javaMethod, StatusCode, FabricIndex, DebugText); } @@ -2114,13 +2417,15 @@ void CHIPOperationalCredentialsClusterOpCSRResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject NOCSRElements; - - chip::ByteArray NOCSRElementsByteArray(env, dataResponse.NOCSRElements); - NOCSRElements = NOCSRElementsByteArray.jniValue(); + jbyteArray NOCSRElementsByteArray = env->NewByteArray(static_cast(dataResponse.NOCSRElements.size())); + env->SetByteArrayRegion(NOCSRElementsByteArray, 0, static_cast(dataResponse.NOCSRElements.size()), + reinterpret_cast(dataResponse.NOCSRElements.data())); + NOCSRElements = NOCSRElementsByteArray; jobject AttestationSignature; - - chip::ByteArray AttestationSignatureByteArray(env, dataResponse.attestationSignature); - AttestationSignature = AttestationSignatureByteArray.jniValue(); + jbyteArray AttestationSignatureByteArray = env->NewByteArray(static_cast(dataResponse.attestationSignature.size())); + env->SetByteArrayRegion(AttestationSignatureByteArray, 0, static_cast(dataResponse.attestationSignature.size()), + reinterpret_cast(dataResponse.attestationSignature.data())); + AttestationSignature = AttestationSignatureByteArray; env->CallVoidMethod(javaCallbackRef, javaMethod, NOCSRElements, AttestationSignature); } @@ -2177,19 +2482,16 @@ void CHIPScenesClusterAddSceneResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); jobject groupId; - std::string groupIdClassName = "java/lang/Integer"; std::string groupIdCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(groupIdClassName.c_str(), groupIdCtorSignature.c_str(), dataResponse.groupId, groupId); jobject sceneId; - std::string sceneIdClassName = "java/lang/Integer"; std::string sceneIdCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(sceneIdClassName.c_str(), sceneIdCtorSignature.c_str(), @@ -2246,38 +2548,45 @@ void CHIPScenesClusterGetSceneMembershipResponseCallback::CallbackFn( // Java callback is allowed to be null, exit early if this is the case. VerifyOrReturn(javaCallbackRef != nullptr); - err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", - &javaMethod); + err = JniReferences::GetInstance().FindMethod( + env, javaCallbackRef, "onSuccess", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/ArrayList;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); jobject capacity; - std::string capacityClassName = "java/lang/Integer"; std::string capacityCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(capacityClassName.c_str(), capacityCtorSignature.c_str(), dataResponse.capacity, capacity); jobject groupId; - std::string groupIdClassName = "java/lang/Integer"; std::string groupIdCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(groupIdClassName.c_str(), groupIdCtorSignature.c_str(), dataResponse.groupId, groupId); jobject sceneCount; - std::string sceneCountClassName = "java/lang/Integer"; std::string sceneCountCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(sceneCountClassName.c_str(), sceneCountCtorSignature.c_str(), dataResponse.sceneCount, sceneCount); jobject sceneList; + chip::JniReferences::GetInstance().CreateArrayList(sceneList); - sceneList = nullptr; /* Array - Conversion from this type to Java is not properly implemented yet */ + auto iter_sceneList_0 = dataResponse.sceneList.begin(); + while (iter_sceneList_0.Next()) + { + auto & entry_0 = iter_sceneList_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(sceneList, newElement_0); + } env->CallVoidMethod(javaCallbackRef, javaMethod, status, capacity, groupId, sceneCount, sceneList); } @@ -2334,13 +2643,11 @@ void CHIPScenesClusterRemoveAllScenesResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); jobject groupId; - std::string groupIdClassName = "java/lang/Integer"; std::string groupIdCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(groupIdClassName.c_str(), groupIdCtorSignature.c_str(), @@ -2401,19 +2708,16 @@ void CHIPScenesClusterRemoveSceneResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); jobject groupId; - std::string groupIdClassName = "java/lang/Integer"; std::string groupIdCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(groupIdClassName.c_str(), groupIdCtorSignature.c_str(), dataResponse.groupId, groupId); jobject sceneId; - std::string sceneIdClassName = "java/lang/Integer"; std::string sceneIdCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(sceneIdClassName.c_str(), sceneIdCtorSignature.c_str(), @@ -2474,19 +2778,16 @@ void CHIPScenesClusterStoreSceneResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); jobject groupId; - std::string groupIdClassName = "java/lang/Integer"; std::string groupIdCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(groupIdClassName.c_str(), groupIdCtorSignature.c_str(), dataResponse.groupId, groupId); jobject sceneId; - std::string sceneIdClassName = "java/lang/Integer"; std::string sceneIdCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(sceneIdClassName.c_str(), sceneIdCtorSignature.c_str(), @@ -2544,40 +2845,72 @@ void CHIPScenesClusterViewSceneResponseCallback::CallbackFn( err = JniReferences::GetInstance().FindMethod( env, javaCallbackRef, "onSuccess", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;)V", &javaMethod); + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/util/ArrayList;)V", + &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); jobject groupId; - std::string groupIdClassName = "java/lang/Integer"; std::string groupIdCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(groupIdClassName.c_str(), groupIdCtorSignature.c_str(), dataResponse.groupId, groupId); jobject sceneId; - std::string sceneIdClassName = "java/lang/Integer"; std::string sceneIdCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(sceneIdClassName.c_str(), sceneIdCtorSignature.c_str(), dataResponse.sceneId, sceneId); jobject transitionTime; - std::string transitionTimeClassName = "java/lang/Integer"; std::string transitionTimeCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject( transitionTimeClassName.c_str(), transitionTimeCtorSignature.c_str(), dataResponse.transitionTime, transitionTime); jobject sceneName; - - chip::UtfString sceneNameUtfString(env, dataResponse.sceneName); - sceneName = sceneNameUtfString.jniValue(); + sceneName = env->NewStringUTF(std::string(dataResponse.sceneName.data(), dataResponse.sceneName.size()).c_str()); jobject extensionFieldSets; - - extensionFieldSets = nullptr; /* Array - Conversion from this type to Java is not properly implemented yet */ + chip::JniReferences::GetInstance().CreateArrayList(extensionFieldSets); + + auto iter_extensionFieldSets_0 = dataResponse.extensionFieldSets.begin(); + while (iter_extensionFieldSets_0.Next()) + { + auto & entry_0 = iter_extensionFieldSets_0.GetValue(); + jobject newElement_0; + jobject newElement_0_clusterId; + std::string newElement_0_clusterIdClassName = "java/lang/Long"; + std::string newElement_0_clusterIdCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_clusterIdClassName.c_str(), + newElement_0_clusterIdCtorSignature.c_str(), + entry_0.clusterId, newElement_0_clusterId); + jobject newElement_0_length; + std::string newElement_0_lengthClassName = "java/lang/Integer"; + std::string newElement_0_lengthCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_lengthClassName.c_str(), newElement_0_lengthCtorSignature.c_str(), entry_0.length, newElement_0_length); + jobject newElement_0_value; + std::string newElement_0_valueClassName = "java/lang/Integer"; + std::string newElement_0_valueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_valueClassName.c_str(), newElement_0_valueCtorSignature.c_str(), entry_0.value, newElement_0_value); + + jclass sceneExtensionFieldSetStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ScenesClusterSceneExtensionFieldSet", sceneExtensionFieldSetStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$ScenesClusterSceneExtensionFieldSet")); + chip::JniClass structJniClass(sceneExtensionFieldSetStructClass); + jmethodID sceneExtensionFieldSetStructCtor = env->GetMethodID(sceneExtensionFieldSetStructClass, "", + "(Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Integer;)V"); + VerifyOrReturn(sceneExtensionFieldSetStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$ScenesClusterSceneExtensionFieldSet constructor")); + + newElement_0 = env->NewObject(sceneExtensionFieldSetStructClass, sceneExtensionFieldSetStructCtor, newElement_0_clusterId, + newElement_0_length, newElement_0_value); + chip::JniReferences::GetInstance().AddToArrayList(extensionFieldSets, newElement_0); + } env->CallVoidMethod(javaCallbackRef, javaMethod, status, groupId, sceneId, transitionTime, sceneName, extensionFieldSets); } @@ -2636,15 +2969,12 @@ void CHIPTargetNavigatorClusterNavigateTargetResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject status; - std::string statusClassName = "java/lang/Integer"; std::string statusCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - statusClassName.c_str(), statusCtorSignature.c_str(), dataResponse.status, status); + chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), + static_cast(dataResponse.status), status); jobject data; - - chip::UtfString dataUtfString(env, dataResponse.data); - data = dataUtfString.jniValue(); + data = env->NewStringUTF(std::string(dataResponse.data.data(), dataResponse.data.size()).c_str()); env->CallVoidMethod(javaCallbackRef, javaMethod, status, data); } @@ -2700,7 +3030,6 @@ void CHIPTestClusterClusterBooleanResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject value; - std::string valueClassName = "java/lang/Boolean"; std::string valueCtorSignature = "(Z)V"; chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), @@ -2757,12 +3086,62 @@ void CHIPTestClusterClusterSimpleStructResponseCallback::CallbackFn( // Java callback is allowed to be null, exit early if this is the case. VerifyOrReturn(javaCallbackRef != nullptr); - err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "()V", &javaMethod); + err = JniReferences::GetInstance().FindMethod( + env, javaCallbackRef, "onSuccess", "(Lchip/devicecontroller/ChipStructs$TestClusterClusterSimpleStruct;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject arg1; - - arg1 = nullptr; /* Struct - conversion from this type to Java is not properly implemented yet */ + jobject arg1_a; + std::string arg1_aClassName = "java/lang/Integer"; + std::string arg1_aCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(arg1_aClassName.c_str(), arg1_aCtorSignature.c_str(), + dataResponse.arg1.a, arg1_a); + jobject arg1_b; + std::string arg1_bClassName = "java/lang/Boolean"; + std::string arg1_bCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(arg1_bClassName.c_str(), arg1_bCtorSignature.c_str(), + dataResponse.arg1.b, arg1_b); + jobject arg1_c; + std::string arg1_cClassName = "java/lang/Integer"; + std::string arg1_cCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(arg1_cClassName.c_str(), arg1_cCtorSignature.c_str(), + static_cast(dataResponse.arg1.c), arg1_c); + jobject arg1_d; + jbyteArray arg1_dByteArray = env->NewByteArray(static_cast(dataResponse.arg1.d.size())); + env->SetByteArrayRegion(arg1_dByteArray, 0, static_cast(dataResponse.arg1.d.size()), + reinterpret_cast(dataResponse.arg1.d.data())); + arg1_d = arg1_dByteArray; + jobject arg1_e; + arg1_e = env->NewStringUTF(std::string(dataResponse.arg1.e.data(), dataResponse.arg1.e.size()).c_str()); + jobject arg1_f; + std::string arg1_fClassName = "java/lang/Integer"; + std::string arg1_fCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(arg1_fClassName.c_str(), arg1_fCtorSignature.c_str(), + dataResponse.arg1.f.Raw(), arg1_f); + jobject arg1_g; + std::string arg1_gClassName = "java/lang/Float"; + std::string arg1_gCtorSignature = "(F)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(arg1_gClassName.c_str(), arg1_gCtorSignature.c_str(), + dataResponse.arg1.g, arg1_g); + jobject arg1_h; + std::string arg1_hClassName = "java/lang/Double"; + std::string arg1_hCtorSignature = "(D)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(arg1_hClassName.c_str(), arg1_hCtorSignature.c_str(), + dataResponse.arg1.h, arg1_h); + + jclass simpleStructStructClass; + err = chip::JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/ChipStructs$TestClusterClusterSimpleStruct", + simpleStructStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find class ChipStructs$TestClusterClusterSimpleStruct")); + chip::JniClass structJniClass(simpleStructStructClass); + jmethodID simpleStructStructCtor = env->GetMethodID(simpleStructStructClass, "", + "(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Integer;[BLjava/lang/" + "String;Ljava/lang/Integer;Ljava/lang/Float;Ljava/lang/Double;)V"); + VerifyOrReturn(simpleStructStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$TestClusterClusterSimpleStruct constructor")); + + arg1 = env->NewObject(simpleStructStructClass, simpleStructStructCtor, arg1_a, arg1_b, arg1_c, arg1_d, arg1_e, arg1_f, arg1_g, + arg1_h); env->CallVoidMethod(javaCallbackRef, javaMethod, arg1); } @@ -2820,7 +3199,6 @@ void CHIPTestClusterClusterTestAddArgumentsResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject returnValue; - std::string returnValueClassName = "java/lang/Integer"; std::string returnValueCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(returnValueClassName.c_str(), returnValueCtorSignature.c_str(), @@ -2882,7 +3260,6 @@ void CHIPTestClusterClusterTestEmitTestEventResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject value; - std::string valueClassName = "java/lang/Long"; std::string valueCtorSignature = "(J)V"; chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), @@ -2943,17 +3320,15 @@ void CHIPTestClusterClusterTestEnumsResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject arg1; - std::string arg1ClassName = "java/lang/Integer"; std::string arg1CtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(arg1ClassName.c_str(), arg1CtorSignature.c_str(), - dataResponse.arg1, arg1); + chip::JniReferences::GetInstance().CreateBoxedObject(arg1ClassName.c_str(), arg1CtorSignature.c_str(), + static_cast(dataResponse.arg1), arg1); jobject arg2; - std::string arg2ClassName = "java/lang/Integer"; std::string arg2CtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - arg2ClassName.c_str(), arg2CtorSignature.c_str(), dataResponse.arg2, arg2); + chip::JniReferences::GetInstance().CreateBoxedObject(arg2ClassName.c_str(), arg2CtorSignature.c_str(), + static_cast(dataResponse.arg2), arg2); env->CallVoidMethod(javaCallbackRef, javaMethod, arg1, arg2); } @@ -3007,12 +3382,23 @@ void CHIPTestClusterClusterTestListInt8UReverseResponseCallback::CallbackFn( // Java callback is allowed to be null, exit early if this is the case. VerifyOrReturn(javaCallbackRef != nullptr); - err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "()V", &javaMethod); + err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/ArrayList;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject arg1; + chip::JniReferences::GetInstance().CreateArrayList(arg1); - arg1 = nullptr; /* Array - Conversion from this type to Java is not properly implemented yet */ + auto iter_arg1_0 = dataResponse.arg1.begin(); + while (iter_arg1_0.Next()) + { + auto & entry_0 = iter_arg1_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arg1, newElement_0); + } env->CallVoidMethod(javaCallbackRef, javaMethod, arg1); } @@ -3072,7 +3458,6 @@ void CHIPTestClusterClusterTestNullableOptionalResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject wasPresent; - std::string wasPresentClassName = "java/lang/Boolean"; std::string wasPresentCtorSignature = "(Z)V"; chip::JniReferences::GetInstance().CreateBoxedObject(wasPresentClassName.c_str(), wasPresentCtorSignature.c_str(), @@ -3084,12 +3469,10 @@ void CHIPTestClusterClusterTestNullableOptionalResponseCallback::CallbackFn( } else { - std::string wasNullClassName = "java/lang/Boolean"; std::string wasNullCtorSignature = "(Z)V"; chip::JniReferences::GetInstance().CreateBoxedObject(wasNullClassName.c_str(), wasNullCtorSignature.c_str(), dataResponse.wasNull.Value(), wasNull); - chip::JniReferences::GetInstance().CreateOptional(wasNull, wasNull); } jobject value; if (!dataResponse.value.HasValue()) @@ -3098,12 +3481,10 @@ void CHIPTestClusterClusterTestNullableOptionalResponseCallback::CallbackFn( } else { - std::string valueClassName = "java/lang/Integer"; std::string valueCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), dataResponse.value.Value(), value); - chip::JniReferences::GetInstance().CreateOptional(value, value); } jobject originalValue; if (!dataResponse.originalValue.HasValue()) @@ -3114,17 +3495,15 @@ void CHIPTestClusterClusterTestNullableOptionalResponseCallback::CallbackFn( { if (dataResponse.originalValue.Value().IsNull()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, originalValue); + originalValue = nullptr; } else { - std::string originalValueClassName = "java/lang/Integer"; std::string originalValueCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject( originalValueClassName.c_str(), originalValueCtorSignature.c_str(), dataResponse.originalValue.Value().Value(), originalValue); - chip::JniReferences::GetInstance().CreateOptional(originalValue, originalValue); } } @@ -3183,7 +3562,6 @@ void CHIPTestClusterClusterTestSpecificResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject returnValue; - std::string returnValueClassName = "java/lang/Integer"; std::string returnValueCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(returnValueClassName.c_str(), returnValueCtorSignature.c_str(), @@ -3248,38 +3626,32 @@ void CHIPThermostatClusterGetRelayStatusLogResponseCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject timeOfDay; - std::string timeOfDayClassName = "java/lang/Integer"; std::string timeOfDayCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(timeOfDayClassName.c_str(), timeOfDayCtorSignature.c_str(), dataResponse.timeOfDay, timeOfDay); jobject relayStatus; - std::string relayStatusClassName = "java/lang/Integer"; std::string relayStatusCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(relayStatusClassName.c_str(), relayStatusCtorSignature.c_str(), dataResponse.relayStatus, relayStatus); jobject localTemperature; - std::string localTemperatureClassName = "java/lang/Integer"; std::string localTemperatureCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject( localTemperatureClassName.c_str(), localTemperatureCtorSignature.c_str(), dataResponse.localTemperature, localTemperature); jobject humidityInPercentage; - std::string humidityInPercentageClassName = "java/lang/Integer"; std::string humidityInPercentageCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(humidityInPercentageClassName.c_str(), humidityInPercentageCtorSignature.c_str(), dataResponse.humidityInPercentage, humidityInPercentage); jobject setpoint; - std::string setpointClassName = "java/lang/Integer"; std::string setpointCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(setpointClassName.c_str(), setpointCtorSignature.c_str(), dataResponse.setpoint, setpoint); jobject unreadEntries; - std::string unreadEntriesClassName = "java/lang/Integer"; std::string unreadEntriesCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject( @@ -3338,33 +3710,43 @@ void CHIPThermostatClusterGetWeeklyScheduleResponseCallback::CallbackFn( // Java callback is allowed to be null, exit early if this is the case. VerifyOrReturn(javaCallbackRef != nullptr); - err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", &javaMethod); + err = JniReferences::GetInstance().FindMethod( + env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/ArrayList;)V", + &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); jobject numberOfTransitionsForSequence; - std::string numberOfTransitionsForSequenceClassName = "java/lang/Integer"; std::string numberOfTransitionsForSequenceCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject( numberOfTransitionsForSequenceClassName.c_str(), numberOfTransitionsForSequenceCtorSignature.c_str(), dataResponse.numberOfTransitionsForSequence, numberOfTransitionsForSequence); jobject dayOfWeekForSequence; - std::string dayOfWeekForSequenceClassName = "java/lang/Integer"; std::string dayOfWeekForSequenceCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject>( - dayOfWeekForSequenceClassName.c_str(), dayOfWeekForSequenceCtorSignature.c_str(), dataResponse.dayOfWeekForSequence, - dayOfWeekForSequence); + chip::JniReferences::GetInstance().CreateBoxedObject(dayOfWeekForSequenceClassName.c_str(), + dayOfWeekForSequenceCtorSignature.c_str(), + dataResponse.dayOfWeekForSequence.Raw(), dayOfWeekForSequence); jobject modeForSequence; - std::string modeForSequenceClassName = "java/lang/Integer"; std::string modeForSequenceCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject>( - modeForSequenceClassName.c_str(), modeForSequenceCtorSignature.c_str(), dataResponse.modeForSequence, modeForSequence); + chip::JniReferences::GetInstance().CreateBoxedObject(modeForSequenceClassName.c_str(), + modeForSequenceCtorSignature.c_str(), + dataResponse.modeForSequence.Raw(), modeForSequence); jobject payload; + chip::JniReferences::GetInstance().CreateArrayList(payload); - payload = nullptr; /* Array - Conversion from this type to Java is not properly implemented yet */ + auto iter_payload_0 = dataResponse.payload.begin(); + while (iter_payload_0.Next()) + { + auto & entry_0 = iter_payload_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(payload, newElement_0); + } env->CallVoidMethod(javaCallbackRef, javaMethod, numberOfTransitionsForSequence, dayOfWeekForSequence, modeForSequence, payload); diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index 95e39a8076ad99..774f6aac1f807d 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -720,88 +720,145 @@ void CHIPAccessControlAclAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$AccessControlCluster$AclAttribute", attributeClass); - VerifyOrReturn(err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$AccessControlCluster$AclAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = - env->GetMethodID(attributeClass, "", "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find AclAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool fabricIndexNull = false; - bool fabricIndexHasValue = true; - - chip::FabricIndex fabricIndexValue = entry.fabricIndex; - - jobject fabricIndex = nullptr; - if (!fabricIndexNull && fabricIndexHasValue) - { - jclass fabricIndexEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", fabricIndexEntryCls); - chip::JniClass fabricIndexJniClass(fabricIndexEntryCls); - jmethodID fabricIndexEntryTypeCtor = env->GetMethodID(fabricIndexEntryCls, "", "(I)V"); - fabricIndex = env->NewObject(fabricIndexEntryCls, fabricIndexEntryTypeCtor, fabricIndexValue); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); + jobject newElement_0_privilege; + std::string newElement_0_privilegeClassName = "java/lang/Integer"; + std::string newElement_0_privilegeCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_privilegeClassName.c_str(), newElement_0_privilegeCtorSignature.c_str(), + static_cast(entry_0.privilege), newElement_0_privilege); + jobject newElement_0_authMode; + std::string newElement_0_authModeClassName = "java/lang/Integer"; + std::string newElement_0_authModeCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_authModeClassName.c_str(), newElement_0_authModeCtorSignature.c_str(), + static_cast(entry_0.authMode), newElement_0_authMode); + jobject newElement_0_subjects; + if (entry_0.subjects.IsNull()) + { + newElement_0_subjects = nullptr; + } + else + { + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_subjects); + + auto iter_newElement_0_subjects_NaN = entry_0.subjects.Value().begin(); + while (iter_newElement_0_subjects_NaN.Next()) + { + auto & entry_NaN = iter_newElement_0_subjects_NaN.GetValue(); + jobject newElement_NaN; + std::string newElement_NaNClassName = "java/lang/Long"; + std::string newElement_NaNCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_NaNClassName.c_str(), newElement_NaNCtorSignature.c_str(), entry_NaN, newElement_NaN); + chip::JniReferences::GetInstance().AddToArrayList(newElement_0_subjects, newElement_NaN); + } } - - bool privilegeNull = false; - bool privilegeHasValue = true; - - chip::app::Clusters::AccessControl::Privilege privilegeValue = entry.privilege; - - jobject privilege = nullptr; - if (!privilegeNull && privilegeHasValue) + jobject newElement_0_targets; + if (entry_0.targets.IsNull()) { - jclass privilegeEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", privilegeEntryCls); - chip::JniClass privilegeJniClass(privilegeEntryCls); - jmethodID privilegeEntryTypeCtor = env->GetMethodID(privilegeEntryCls, "", "(I)V"); - privilege = env->NewObject(privilegeEntryCls, privilegeEntryTypeCtor, privilegeValue); + newElement_0_targets = nullptr; } - - bool authModeNull = false; - bool authModeHasValue = true; - - chip::app::Clusters::AccessControl::AuthMode authModeValue = entry.authMode; - - jobject authMode = nullptr; - if (!authModeNull && authModeHasValue) + else { - jclass authModeEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", authModeEntryCls); - chip::JniClass authModeJniClass(authModeEntryCls); - jmethodID authModeEntryTypeCtor = env->GetMethodID(authModeEntryCls, "", "(I)V"); - authMode = env->NewObject(authModeEntryCls, authModeEntryTypeCtor, authModeValue); + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_targets); + + auto iter_newElement_0_targets_NaN = entry_0.targets.Value().begin(); + while (iter_newElement_0_targets_NaN.Next()) + { + auto & entry_NaN = iter_newElement_0_targets_NaN.GetValue(); + jobject newElement_NaN; + jobject newElement_NaN_cluster; + if (entry_NaN.cluster.IsNull()) + { + newElement_NaN_cluster = nullptr; + } + else + { + std::string newElement_NaN_clusterClassName = "java/lang/Long"; + std::string newElement_NaN_clusterCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_NaN_clusterClassName.c_str(), newElement_NaN_clusterCtorSignature.c_str(), + entry_NaN.cluster.Value(), newElement_NaN_cluster); + } + jobject newElement_NaN_endpoint; + if (entry_NaN.endpoint.IsNull()) + { + newElement_NaN_endpoint = nullptr; + } + else + { + std::string newElement_NaN_endpointClassName = "java/lang/Integer"; + std::string newElement_NaN_endpointCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_NaN_endpointClassName.c_str(), newElement_NaN_endpointCtorSignature.c_str(), + entry_NaN.endpoint.Value(), newElement_NaN_endpoint); + } + jobject newElement_NaN_deviceType; + if (entry_NaN.deviceType.IsNull()) + { + newElement_NaN_deviceType = nullptr; + } + else + { + std::string newElement_NaN_deviceTypeClassName = "java/lang/Long"; + std::string newElement_NaN_deviceTypeCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_NaN_deviceTypeClassName.c_str(), newElement_NaN_deviceTypeCtorSignature.c_str(), + entry_NaN.deviceType.Value(), newElement_NaN_deviceType); + } + + jclass targetStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$AccessControlClusterTarget", targetStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$AccessControlClusterTarget")); + chip::JniClass structJniClass(targetStructClass); + jmethodID targetStructCtor = + env->GetMethodID(targetStructClass, "", "(Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Long;)V"); + VerifyOrReturn(targetStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$AccessControlClusterTarget constructor")); + + newElement_NaN = env->NewObject(targetStructClass, targetStructCtor, newElement_NaN_cluster, + newElement_NaN_endpoint, newElement_NaN_deviceType); + chip::JniReferences::GetInstance().AddToArrayList(newElement_0_targets, newElement_NaN); + } } - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, fabricIndex, privilege, authMode); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create AclAttribute object")); + jclass accessControlEntryStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$AccessControlClusterAccessControlEntry", accessControlEntryStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$AccessControlClusterAccessControlEntry")); + chip::JniClass structJniClass(accessControlEntryStructClass); + jmethodID accessControlEntryStructCtor = + env->GetMethodID(accessControlEntryStructClass, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/ArrayList;Lchip/" + "devicecontroller/ChipStructs$AccessControlClusterTarget;)V"); + VerifyOrReturn(accessControlEntryStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$AccessControlClusterAccessControlEntry constructor")); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + newElement_0 = env->NewObject(accessControlEntryStructClass, accessControlEntryStructCtor, newElement_0_fabricIndex, + newElement_0_privilege, newElement_0_authMode, newElement_0_subjects, newElement_0_targets); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AclAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -854,70 +911,44 @@ void CHIPAccessControlExtensionAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$AccessControlCluster$ExtensionAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$AccessControlCluster$ExtensionAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(Ljava/lang/Integer;[B)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find ExtensionAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool fabricIndexNull = false; - bool fabricIndexHasValue = true; - - chip::FabricIndex fabricIndexValue = entry.fabricIndex; - - jobject fabricIndex = nullptr; - if (!fabricIndexNull && fabricIndexHasValue) - { - jclass fabricIndexEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", fabricIndexEntryCls); - chip::JniClass fabricIndexJniClass(fabricIndexEntryCls); - jmethodID fabricIndexEntryTypeCtor = env->GetMethodID(fabricIndexEntryCls, "", "(I)V"); - fabricIndex = env->NewObject(fabricIndexEntryCls, fabricIndexEntryTypeCtor, fabricIndexValue); - } - - bool dataNull = false; - bool dataHasValue = true; - - chip::ByteSpan dataValue = entry.data; - - jbyteArray data = nullptr; - if (!dataNull && dataHasValue) - { - data = env->NewByteArray(dataValue.size()); - env->SetByteArrayRegion(data, 0, dataValue.size(), reinterpret_cast(dataValue.data())); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, fabricIndex, data); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create ExtensionAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); + jobject newElement_0_data; + jbyteArray newElement_0_dataByteArray = env->NewByteArray(static_cast(entry_0.data.size())); + env->SetByteArrayRegion(newElement_0_dataByteArray, 0, static_cast(entry_0.data.size()), + reinterpret_cast(entry_0.data.data())); + newElement_0_data = newElement_0_dataByteArray; + + jclass extensionEntryStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$AccessControlClusterExtensionEntry", extensionEntryStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$AccessControlClusterExtensionEntry")); + chip::JniClass structJniClass(extensionEntryStructClass); + jmethodID extensionEntryStructCtor = env->GetMethodID(extensionEntryStructClass, "", "(Ljava/lang/Integer;[B)V"); + VerifyOrReturn(extensionEntryStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$AccessControlClusterExtensionEntry constructor")); + + newElement_0 = + env->NewObject(extensionEntryStructClass, extensionEntryStructCtor, newElement_0_fabricIndex, newElement_0_data); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ExtensionAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -971,43 +1002,24 @@ void CHIPAccessControlAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -1061,43 +1073,24 @@ void CHIPAccountLoginAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -1154,11 +1147,10 @@ void CHIPAdministratorCommissioningAdminFabricIndexAttributeCallback::CallbackFn VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - std::string javaValueClassName = "java/lang/Integer"; std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), - javaValueCtorSignature.c_str(), value, javaValue); + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), value, + javaValue); env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -1211,43 +1203,24 @@ void CHIPAdministratorCommissioningAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -1301,43 +1274,24 @@ void CHIPApplicationBasicAllowedVendorListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::VendorId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(I)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), static_cast(entry_0), newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AllowedVendorListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -1391,43 +1345,24 @@ void CHIPApplicationBasicAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -1481,43 +1416,24 @@ void CHIPApplicationLauncherApplicationLauncherListAttributeCallback::CallbackFn VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - uint16_t entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(I)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ApplicationLauncherListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -1571,43 +1487,24 @@ void CHIPApplicationLauncherAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -1662,87 +1559,46 @@ void CHIPAudioOutputAudioOutputListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$AudioOutputCluster$AudioOutputListAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$AudioOutputCluster$AudioOutputListAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = - env->GetMethodID(attributeClass, "", "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find AudioOutputListAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool indexNull = false; - bool indexHasValue = true; - - uint8_t indexValue = entry.index; - - jobject index = nullptr; - if (!indexNull && indexHasValue) - { - jclass indexEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", indexEntryCls); - chip::JniClass indexJniClass(indexEntryCls); - jmethodID indexEntryTypeCtor = env->GetMethodID(indexEntryCls, "", "(I)V"); - index = env->NewObject(indexEntryCls, indexEntryTypeCtor, indexValue); - } - - bool outputTypeNull = false; - bool outputTypeHasValue = true; - - chip::app::Clusters::AudioOutput::OutputTypeEnum outputTypeValue = entry.outputType; - - jobject outputType = nullptr; - if (!outputTypeNull && outputTypeHasValue) - { - jclass outputTypeEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", outputTypeEntryCls); - chip::JniClass outputTypeJniClass(outputTypeEntryCls); - jmethodID outputTypeEntryTypeCtor = env->GetMethodID(outputTypeEntryCls, "", "(I)V"); - outputType = env->NewObject(outputTypeEntryCls, outputTypeEntryTypeCtor, outputTypeValue); - } - - bool nameNull = false; - bool nameHasValue = true; - - chip::CharSpan nameValue = entry.name; - - jstring name = nullptr; - chip::UtfString nameStr(env, nameValue); - if (!nameNull && nameHasValue) - { - name = jstring(nameStr.jniValue()); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, index, outputType, name); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create AudioOutputListAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_index; + std::string newElement_0_indexClassName = "java/lang/Integer"; + std::string newElement_0_indexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_indexClassName.c_str(), newElement_0_indexCtorSignature.c_str(), entry_0.index, newElement_0_index); + jobject newElement_0_outputType; + std::string newElement_0_outputTypeClassName = "java/lang/Integer"; + std::string newElement_0_outputTypeCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_outputTypeClassName.c_str(), newElement_0_outputTypeCtorSignature.c_str(), + static_cast(entry_0.outputType), newElement_0_outputType); + jobject newElement_0_name; + newElement_0_name = env->NewStringUTF(std::string(entry_0.name.data(), entry_0.name.size()).c_str()); + + jclass outputInfoStructClass; + err = chip::JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/ChipStructs$AudioOutputClusterOutputInfo", + outputInfoStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find class ChipStructs$AudioOutputClusterOutputInfo")); + chip::JniClass structJniClass(outputInfoStructClass); + jmethodID outputInfoStructCtor = + env->GetMethodID(outputInfoStructClass, "", "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;)V"); + VerifyOrReturn(outputInfoStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$AudioOutputClusterOutputInfo constructor")); + + newElement_0 = env->NewObject(outputInfoStructClass, outputInfoStructCtor, newElement_0_index, newElement_0_outputType, + newElement_0_name); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AudioOutputListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -1794,43 +1650,24 @@ void CHIPAudioOutputAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -1884,43 +1721,24 @@ void CHIPBarrierControlAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -1975,11 +1793,10 @@ void CHIPBasicVendorIDAttributeCallback::CallbackFn(void * context, chip::Vendor VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - std::string javaValueClassName = "java/lang/Integer"; std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value, javaValue); + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + static_cast(value), javaValue); env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -2030,43 +1847,24 @@ void CHIPBasicAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -2120,43 +1918,24 @@ void CHIPBinaryInputBasicAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -2208,43 +1987,24 @@ void CHIPBindingAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -2298,43 +2058,24 @@ void CHIPBooleanStateAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -2387,133 +2128,68 @@ void CHIPBridgedActionsActionListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$BridgedActionsCluster$ActionListAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$BridgedActionsCluster$ActionListAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID( - attributeClass, "", - "(Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find ActionListAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool actionIDNull = false; - bool actionIDHasValue = true; - - uint16_t actionIDValue = entry.actionID; - - jobject actionID = nullptr; - if (!actionIDNull && actionIDHasValue) - { - jclass actionIDEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", actionIDEntryCls); - chip::JniClass actionIDJniClass(actionIDEntryCls); - jmethodID actionIDEntryTypeCtor = env->GetMethodID(actionIDEntryCls, "", "(I)V"); - actionID = env->NewObject(actionIDEntryCls, actionIDEntryTypeCtor, actionIDValue); - } - - bool nameNull = false; - bool nameHasValue = true; - - chip::CharSpan nameValue = entry.name; - - jstring name = nullptr; - chip::UtfString nameStr(env, nameValue); - if (!nameNull && nameHasValue) - { - name = jstring(nameStr.jniValue()); - } - - bool typeNull = false; - bool typeHasValue = true; - - chip::app::Clusters::BridgedActions::ActionTypeEnum typeValue = entry.type; - - jobject type = nullptr; - if (!typeNull && typeHasValue) - { - jclass typeEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", typeEntryCls); - chip::JniClass typeJniClass(typeEntryCls); - jmethodID typeEntryTypeCtor = env->GetMethodID(typeEntryCls, "", "(I)V"); - type = env->NewObject(typeEntryCls, typeEntryTypeCtor, typeValue); - } - - bool endpointListIDNull = false; - bool endpointListIDHasValue = true; - - uint16_t endpointListIDValue = entry.endpointListID; - - jobject endpointListID = nullptr; - if (!endpointListIDNull && endpointListIDHasValue) - { - jclass endpointListIDEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", endpointListIDEntryCls); - chip::JniClass endpointListIDJniClass(endpointListIDEntryCls); - jmethodID endpointListIDEntryTypeCtor = env->GetMethodID(endpointListIDEntryCls, "", "(I)V"); - endpointListID = env->NewObject(endpointListIDEntryCls, endpointListIDEntryTypeCtor, endpointListIDValue); - } - - bool supportedCommandsNull = false; - bool supportedCommandsHasValue = true; - - uint16_t supportedCommandsValue = entry.supportedCommands; - - jobject supportedCommands = nullptr; - if (!supportedCommandsNull && supportedCommandsHasValue) - { - jclass supportedCommandsEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", supportedCommandsEntryCls); - chip::JniClass supportedCommandsJniClass(supportedCommandsEntryCls); - jmethodID supportedCommandsEntryTypeCtor = env->GetMethodID(supportedCommandsEntryCls, "", "(I)V"); - supportedCommands = env->NewObject(supportedCommandsEntryCls, supportedCommandsEntryTypeCtor, supportedCommandsValue); - } - - bool statusNull = false; - bool statusHasValue = true; - - chip::app::Clusters::BridgedActions::ActionStateEnum statusValue = entry.status; - - jobject status = nullptr; - if (!statusNull && statusHasValue) - { - jclass statusEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", statusEntryCls); - chip::JniClass statusJniClass(statusEntryCls); - jmethodID statusEntryTypeCtor = env->GetMethodID(statusEntryCls, "", "(I)V"); - status = env->NewObject(statusEntryCls, statusEntryTypeCtor, statusValue); - } - - jobject attributeObj = - env->NewObject(attributeClass, attributeCtor, actionID, name, type, endpointListID, supportedCommands, status); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create ActionListAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_actionID; + std::string newElement_0_actionIDClassName = "java/lang/Integer"; + std::string newElement_0_actionIDCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_actionIDClassName.c_str(), + newElement_0_actionIDCtorSignature.c_str(), entry_0.actionID, + newElement_0_actionID); + jobject newElement_0_name; + newElement_0_name = env->NewStringUTF(std::string(entry_0.name.data(), entry_0.name.size()).c_str()); + jobject newElement_0_type; + std::string newElement_0_typeClassName = "java/lang/Integer"; + std::string newElement_0_typeCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_typeClassName.c_str(), + newElement_0_typeCtorSignature.c_str(), + static_cast(entry_0.type), newElement_0_type); + jobject newElement_0_endpointListID; + std::string newElement_0_endpointListIDClassName = "java/lang/Integer"; + std::string newElement_0_endpointListIDCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_endpointListIDClassName.c_str(), + newElement_0_endpointListIDCtorSignature.c_str(), + entry_0.endpointListID, newElement_0_endpointListID); + jobject newElement_0_supportedCommands; + std::string newElement_0_supportedCommandsClassName = "java/lang/Integer"; + std::string newElement_0_supportedCommandsCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_supportedCommandsClassName.c_str(), + newElement_0_supportedCommandsCtorSignature.c_str(), + entry_0.supportedCommands, newElement_0_supportedCommands); + jobject newElement_0_status; + std::string newElement_0_statusClassName = "java/lang/Integer"; + std::string newElement_0_statusCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_statusClassName.c_str(), + newElement_0_statusCtorSignature.c_str(), + static_cast(entry_0.status), newElement_0_status); + + jclass actionStructStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$BridgedActionsClusterActionStruct", actionStructStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$BridgedActionsClusterActionStruct")); + chip::JniClass structJniClass(actionStructStructClass); + jmethodID actionStructStructCtor = env->GetMethodID( + actionStructStructClass, "", + "(Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V"); + VerifyOrReturn(actionStructStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$BridgedActionsClusterActionStruct constructor")); + + newElement_0 = + env->NewObject(actionStructStructClass, actionStructStructCtor, newElement_0_actionID, newElement_0_name, + newElement_0_type, newElement_0_endpointListID, newElement_0_supportedCommands, newElement_0_status); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ActionListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -2569,86 +2245,63 @@ void CHIPBridgedActionsEndpointListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$BridgedActionsCluster$EndpointListAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$BridgedActionsCluster$EndpointListAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = - env->GetMethodID(attributeClass, "", "(Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/Integer;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find EndpointListAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool endpointListIDNull = false; - bool endpointListIDHasValue = true; - - uint16_t endpointListIDValue = entry.endpointListID; - - jobject endpointListID = nullptr; - if (!endpointListIDNull && endpointListIDHasValue) - { - jclass endpointListIDEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", endpointListIDEntryCls); - chip::JniClass endpointListIDJniClass(endpointListIDEntryCls); - jmethodID endpointListIDEntryTypeCtor = env->GetMethodID(endpointListIDEntryCls, "", "(I)V"); - endpointListID = env->NewObject(endpointListIDEntryCls, endpointListIDEntryTypeCtor, endpointListIDValue); - } - - bool nameNull = false; - bool nameHasValue = true; - - chip::CharSpan nameValue = entry.name; - - jstring name = nullptr; - chip::UtfString nameStr(env, nameValue); - if (!nameNull && nameHasValue) - { - name = jstring(nameStr.jniValue()); - } - - bool typeNull = false; - bool typeHasValue = true; - - chip::app::Clusters::BridgedActions::EndpointListTypeEnum typeValue = entry.type; - - jobject type = nullptr; - if (!typeNull && typeHasValue) - { - jclass typeEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", typeEntryCls); - chip::JniClass typeJniClass(typeEntryCls); - jmethodID typeEntryTypeCtor = env->GetMethodID(typeEntryCls, "", "(I)V"); - type = env->NewObject(typeEntryCls, typeEntryTypeCtor, typeValue); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, endpointListID, name, type); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create EndpointListAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_endpointListID; + std::string newElement_0_endpointListIDClassName = "java/lang/Integer"; + std::string newElement_0_endpointListIDCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_endpointListIDClassName.c_str(), + newElement_0_endpointListIDCtorSignature.c_str(), + entry_0.endpointListID, newElement_0_endpointListID); + jobject newElement_0_name; + newElement_0_name = env->NewStringUTF(std::string(entry_0.name.data(), entry_0.name.size()).c_str()); + jobject newElement_0_type; + std::string newElement_0_typeClassName = "java/lang/Integer"; + std::string newElement_0_typeCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_typeClassName.c_str(), + newElement_0_typeCtorSignature.c_str(), + static_cast(entry_0.type), newElement_0_type); + jobject newElement_0_endpoints; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_endpoints); + + auto iter_newElement_0_endpoints_NaN = entry_0.endpoints.begin(); + while (iter_newElement_0_endpoints_NaN.Next()) + { + auto & entry_NaN = iter_newElement_0_endpoints_NaN.GetValue(); + jobject newElement_NaN; + std::string newElement_NaNClassName = "java/lang/Integer"; + std::string newElement_NaNCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_NaNClassName.c_str(), newElement_NaNCtorSignature.c_str(), entry_NaN, newElement_NaN); + chip::JniReferences::GetInstance().AddToArrayList(newElement_0_endpoints, newElement_NaN); + } + + jclass endpointListStructStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$BridgedActionsClusterEndpointListStruct", endpointListStructStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$BridgedActionsClusterEndpointListStruct")); + chip::JniClass structJniClass(endpointListStructStructClass); + jmethodID endpointListStructStructCtor = + env->GetMethodID(endpointListStructStructClass, "", + "(Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/ArrayList;)V"); + VerifyOrReturn(endpointListStructStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$BridgedActionsClusterEndpointListStruct constructor")); + + newElement_0 = env->NewObject(endpointListStructStructClass, endpointListStructStructCtor, newElement_0_endpointListID, + newElement_0_name, newElement_0_type, newElement_0_endpoints); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding EndpointListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -2702,43 +2355,24 @@ void CHIPBridgedActionsAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -2792,43 +2426,24 @@ void CHIPBridgedDeviceBasicAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -2881,112 +2496,54 @@ void CHIPChannelChannelListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$ChannelCluster$ChannelListAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$ChannelCluster$ChannelListAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = - env->GetMethodID(attributeClass, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find ChannelListAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool majorNumberNull = false; - bool majorNumberHasValue = true; - - uint16_t majorNumberValue = entry.majorNumber; - - jobject majorNumber = nullptr; - if (!majorNumberNull && majorNumberHasValue) - { - jclass majorNumberEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", majorNumberEntryCls); - chip::JniClass majorNumberJniClass(majorNumberEntryCls); - jmethodID majorNumberEntryTypeCtor = env->GetMethodID(majorNumberEntryCls, "", "(I)V"); - majorNumber = env->NewObject(majorNumberEntryCls, majorNumberEntryTypeCtor, majorNumberValue); - } - - bool minorNumberNull = false; - bool minorNumberHasValue = true; - - uint16_t minorNumberValue = entry.minorNumber; - - jobject minorNumber = nullptr; - if (!minorNumberNull && minorNumberHasValue) - { - jclass minorNumberEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", minorNumberEntryCls); - chip::JniClass minorNumberJniClass(minorNumberEntryCls); - jmethodID minorNumberEntryTypeCtor = env->GetMethodID(minorNumberEntryCls, "", "(I)V"); - minorNumber = env->NewObject(minorNumberEntryCls, minorNumberEntryTypeCtor, minorNumberValue); - } - - bool nameNull = false; - bool nameHasValue = true; - - chip::CharSpan nameValue = entry.name; - - jstring name = nullptr; - chip::UtfString nameStr(env, nameValue); - if (!nameNull && nameHasValue) - { - name = jstring(nameStr.jniValue()); - } - - bool callSignNull = false; - bool callSignHasValue = true; - - chip::CharSpan callSignValue = entry.callSign; - - jstring callSign = nullptr; - chip::UtfString callSignStr(env, callSignValue); - if (!callSignNull && callSignHasValue) - { - callSign = jstring(callSignStr.jniValue()); - } - - bool affiliateCallSignNull = false; - bool affiliateCallSignHasValue = true; - - chip::CharSpan affiliateCallSignValue = entry.affiliateCallSign; - - jstring affiliateCallSign = nullptr; - chip::UtfString affiliateCallSignStr(env, affiliateCallSignValue); - if (!affiliateCallSignNull && affiliateCallSignHasValue) - { - affiliateCallSign = jstring(affiliateCallSignStr.jniValue()); - } - - jobject attributeObj = - env->NewObject(attributeClass, attributeCtor, majorNumber, minorNumber, name, callSign, affiliateCallSign); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create ChannelListAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_majorNumber; + std::string newElement_0_majorNumberClassName = "java/lang/Integer"; + std::string newElement_0_majorNumberCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_majorNumberClassName.c_str(), + newElement_0_majorNumberCtorSignature.c_str(), + entry_0.majorNumber, newElement_0_majorNumber); + jobject newElement_0_minorNumber; + std::string newElement_0_minorNumberClassName = "java/lang/Integer"; + std::string newElement_0_minorNumberCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_minorNumberClassName.c_str(), + newElement_0_minorNumberCtorSignature.c_str(), + entry_0.minorNumber, newElement_0_minorNumber); + jobject newElement_0_name; + newElement_0_name = env->NewStringUTF(std::string(entry_0.name.data(), entry_0.name.size()).c_str()); + jobject newElement_0_callSign; + newElement_0_callSign = env->NewStringUTF(std::string(entry_0.callSign.data(), entry_0.callSign.size()).c_str()); + jobject newElement_0_affiliateCallSign; + newElement_0_affiliateCallSign = + env->NewStringUTF(std::string(entry_0.affiliateCallSign.data(), entry_0.affiliateCallSign.size()).c_str()); + + jclass channelInfoStructClass; + err = chip::JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/ChipStructs$ChannelClusterChannelInfo", + channelInfoStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find class ChipStructs$ChannelClusterChannelInfo")); + chip::JniClass structJniClass(channelInfoStructClass); + jmethodID channelInfoStructCtor = + env->GetMethodID(channelInfoStructClass, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"); + VerifyOrReturn(channelInfoStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$ChannelClusterChannelInfo constructor")); + + newElement_0 = + env->NewObject(channelInfoStructClass, channelInfoStructCtor, newElement_0_majorNumber, newElement_0_minorNumber, + newElement_0_name, newElement_0_callSign, newElement_0_affiliateCallSign); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ChannelListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -3038,43 +2595,24 @@ void CHIPChannelAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -3128,43 +2666,24 @@ void CHIPColorControlAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -3218,40 +2737,21 @@ void CHIPContentLauncherAcceptHeaderListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::CharSpan entryValue = entry; - - jstring entryObject = nullptr; - chip::UtfString entryStr(env, entryValue); - if (!entryNull) - { - entryObject = jstring(entryStr.jniValue()); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + newElement_0 = env->NewStringUTF(std::string(entry_0.data(), entry_0.size()).c_str()); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AcceptHeaderListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -3305,43 +2805,24 @@ void CHIPContentLauncherAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -3394,77 +2875,47 @@ void CHIPDescriptorDeviceListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$DescriptorCluster$DeviceListAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$DescriptorCluster$DeviceListAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(Ljava/lang/Long;Ljava/lang/Integer;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find DeviceListAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool typeNull = false; - bool typeHasValue = true; + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_type; + std::string newElement_0_typeClassName = "java/lang/Long"; + std::string newElement_0_typeCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_typeClassName.c_str(), newElement_0_typeCtorSignature.c_str(), entry_0.type, newElement_0_type); + jobject newElement_0_revision; + std::string newElement_0_revisionClassName = "java/lang/Integer"; + std::string newElement_0_revisionCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_revisionClassName.c_str(), + newElement_0_revisionCtorSignature.c_str(), entry_0.revision, + newElement_0_revision); + + jclass deviceTypeStructClass; + err = chip::JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/ChipStructs$DescriptorClusterDeviceType", + deviceTypeStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find class ChipStructs$DescriptorClusterDeviceType")); + chip::JniClass structJniClass(deviceTypeStructClass); + jmethodID deviceTypeStructCtor = + env->GetMethodID(deviceTypeStructClass, "", "(Ljava/lang/Long;Ljava/lang/Integer;)V"); + VerifyOrReturn(deviceTypeStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$DescriptorClusterDeviceType constructor")); + + newElement_0 = env->NewObject(deviceTypeStructClass, deviceTypeStructCtor, newElement_0_type, newElement_0_revision); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); + } - chip::DeviceTypeId typeValue = entry.type; - - jobject type = nullptr; - if (!typeNull && typeHasValue) - { - jclass typeEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", typeEntryCls); - chip::JniClass typeJniClass(typeEntryCls); - jmethodID typeEntryTypeCtor = env->GetMethodID(typeEntryCls, "", "(J)V"); - type = env->NewObject(typeEntryCls, typeEntryTypeCtor, typeValue); - } - - bool revisionNull = false; - bool revisionHasValue = true; - - uint16_t revisionValue = entry.revision; - - jobject revision = nullptr; - if (!revisionNull && revisionHasValue) - { - jclass revisionEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", revisionEntryCls); - chip::JniClass revisionJniClass(revisionEntryCls); - jmethodID revisionEntryTypeCtor = env->GetMethodID(revisionEntryCls, "", "(I)V"); - revision = env->NewObject(revisionEntryCls, revisionEntryTypeCtor, revisionValue); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, type, revision); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create DeviceListAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); - } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding DeviceListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); - - env->ExceptionClear(); - env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); -} + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} CHIPDescriptorServerListAttributeCallback::CHIPDescriptorServerListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -3512,42 +2963,24 @@ void CHIPDescriptorServerListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::ClusterId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ServerListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -3599,42 +3032,24 @@ void CHIPDescriptorClientListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::ClusterId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ClientListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -3686,42 +3101,24 @@ void CHIPDescriptorPartsListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::EndpointId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(I)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding PartsListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -3773,43 +3170,24 @@ void CHIPDescriptorAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -3863,43 +3241,24 @@ void CHIPDiagnosticLogsAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -3955,11 +3314,17 @@ void CHIPDoorLockLockStateAttributeCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - javaValueClassName.c_str(), javaValueCtorSignature.c_str(), value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + static_cast(value.Value()), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -4014,11 +3379,17 @@ void CHIPDoorLockDoorStateAttributeCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - javaValueClassName.c_str(), javaValueCtorSignature.c_str(), value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + static_cast(value.Value()), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -4069,43 +3440,24 @@ void CHIPDoorLockAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -4159,43 +3511,24 @@ void CHIPElectricalMeasurementAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -4249,43 +3582,24 @@ void CHIPEthernetNetworkDiagnosticsAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -4338,67 +3652,36 @@ void CHIPFixedLabelLabelListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$FixedLabelCluster$LabelListAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$FixedLabelCluster$LabelListAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(Ljava/lang/String;Ljava/lang/String;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find LabelListAttribute constructor")); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - auto iter = list.begin(); - while (iter.Next()) + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) { - auto & entry = iter.GetValue(); - (void) entry; - bool labelNull = false; - bool labelHasValue = true; - - chip::CharSpan labelValue = entry.label; - - jstring label = nullptr; - chip::UtfString labelStr(env, labelValue); - if (!labelNull && labelHasValue) - { - label = jstring(labelStr.jniValue()); - } - - bool valueNull = false; - bool valueHasValue = true; - - chip::CharSpan valueValue = entry.value; + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_label; + newElement_0_label = env->NewStringUTF(std::string(entry_0.label.data(), entry_0.label.size()).c_str()); + jobject newElement_0_value; + newElement_0_value = env->NewStringUTF(std::string(entry_0.value.data(), entry_0.value.size()).c_str()); - jstring value = nullptr; - chip::UtfString valueStr(env, valueValue); - if (!valueNull && valueHasValue) - { - value = jstring(valueStr.jniValue()); - } + jclass labelStructStructClass; + err = chip::JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/ChipStructs$FixedLabelClusterLabelStruct", + labelStructStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find class ChipStructs$FixedLabelClusterLabelStruct")); + chip::JniClass structJniClass(labelStructStructClass); + jmethodID labelStructStructCtor = + env->GetMethodID(labelStructStructClass, "", "(Ljava/lang/String;Ljava/lang/String;)V"); + VerifyOrReturn(labelStructStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$FixedLabelClusterLabelStruct constructor")); - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, label, value); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create LabelListAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + newElement_0 = env->NewObject(labelStructStructClass, labelStructStructCtor, newElement_0_label, newElement_0_value); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding LabelListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -4450,43 +3733,24 @@ void CHIPFixedLabelAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -4540,43 +3804,24 @@ void CHIPFlowMeasurementAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -4633,62 +3878,42 @@ void CHIPGeneralCommissioningBasicCommissioningInfoListAttributeCallback::Callba VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$GeneralCommissioningCluster$BasicCommissioningInfoListAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, - "Could not find class " - "chip/devicecontroller/ChipClusters$GeneralCommissioningCluster$BasicCommissioningInfoListAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(Ljava/lang/Long;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find BasicCommissioningInfoListAttribute constructor")); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - auto iter = list.begin(); - while (iter.Next()) + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) { - auto & entry = iter.GetValue(); - (void) entry; - bool failSafeExpiryLengthMsNull = false; - bool failSafeExpiryLengthMsHasValue = true; - - uint32_t failSafeExpiryLengthMsValue = entry.failSafeExpiryLengthMs; - - jobject failSafeExpiryLengthMs = nullptr; - if (!failSafeExpiryLengthMsNull && failSafeExpiryLengthMsHasValue) - { - jclass failSafeExpiryLengthMsEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", failSafeExpiryLengthMsEntryCls); - chip::JniClass failSafeExpiryLengthMsJniClass(failSafeExpiryLengthMsEntryCls); - jmethodID failSafeExpiryLengthMsEntryTypeCtor = env->GetMethodID(failSafeExpiryLengthMsEntryCls, "", "(J)V"); - failSafeExpiryLengthMs = - env->NewObject(failSafeExpiryLengthMsEntryCls, failSafeExpiryLengthMsEntryTypeCtor, failSafeExpiryLengthMsValue); - } + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_failSafeExpiryLengthMs; + std::string newElement_0_failSafeExpiryLengthMsClassName = "java/lang/Long"; + std::string newElement_0_failSafeExpiryLengthMsCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_failSafeExpiryLengthMsClassName.c_str(), newElement_0_failSafeExpiryLengthMsCtorSignature.c_str(), + entry_0.failSafeExpiryLengthMs, newElement_0_failSafeExpiryLengthMs); - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, failSafeExpiryLengthMs); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create BasicCommissioningInfoListAttribute object")); + jclass basicCommissioningInfoTypeStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$GeneralCommissioningClusterBasicCommissioningInfoType", + basicCommissioningInfoTypeStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$GeneralCommissioningClusterBasicCommissioningInfoType")); + chip::JniClass structJniClass(basicCommissioningInfoTypeStructClass); + jmethodID basicCommissioningInfoTypeStructCtor = + env->GetMethodID(basicCommissioningInfoTypeStructClass, "", "(Ljava/lang/Long;)V"); + VerifyOrReturn( + basicCommissioningInfoTypeStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$GeneralCommissioningClusterBasicCommissioningInfoType constructor")); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + newElement_0 = env->NewObject(basicCommissioningInfoTypeStructClass, basicCommissioningInfoTypeStructCtor, + newElement_0_failSafeExpiryLengthMs); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding BasicCommissioningInfoListAttribute value: %" CHIP_ERROR_FORMAT, - iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -4742,43 +3967,24 @@ void CHIPGeneralCommissioningAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -4834,139 +4040,71 @@ void CHIPGeneralDiagnosticsNetworkInterfacesAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$GeneralDiagnosticsCluster$NetworkInterfacesAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError( - Zcl, "Could not find class chip/devicecontroller/ChipClusters$GeneralDiagnosticsCluster$NetworkInterfacesAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = - env->GetMethodID(attributeClass, "", - "(Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;[BLjava/lang/Integer;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find NetworkInterfacesAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool nameNull = false; - bool nameHasValue = true; - - chip::CharSpan nameValue = entry.name; - - jstring name = nullptr; - chip::UtfString nameStr(env, nameValue); - if (!nameNull && nameHasValue) - { - name = jstring(nameStr.jniValue()); - } - - bool fabricConnectedNull = false; - bool fabricConnectedHasValue = true; - - bool fabricConnectedValue = entry.fabricConnected; - - jobject fabricConnected = nullptr; - if (!fabricConnectedNull && fabricConnectedHasValue) - { - jclass fabricConnectedEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", fabricConnectedEntryCls); - chip::JniClass fabricConnectedJniClass(fabricConnectedEntryCls); - jmethodID fabricConnectedEntryTypeCtor = env->GetMethodID(fabricConnectedEntryCls, "", "(Z)V"); - fabricConnected = env->NewObject(fabricConnectedEntryCls, fabricConnectedEntryTypeCtor, fabricConnectedValue); - } - - bool offPremiseServicesReachableIPv4Null = false; - bool offPremiseServicesReachableIPv4HasValue = true; - - bool offPremiseServicesReachableIPv4Value = entry.offPremiseServicesReachableIPv4; - - jobject offPremiseServicesReachableIPv4 = nullptr; - if (!offPremiseServicesReachableIPv4Null && offPremiseServicesReachableIPv4HasValue) - { - jclass offPremiseServicesReachableIPv4EntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", offPremiseServicesReachableIPv4EntryCls); - chip::JniClass offPremiseServicesReachableIPv4JniClass(offPremiseServicesReachableIPv4EntryCls); - jmethodID offPremiseServicesReachableIPv4EntryTypeCtor = - env->GetMethodID(offPremiseServicesReachableIPv4EntryCls, "", "(Z)V"); - offPremiseServicesReachableIPv4 = - env->NewObject(offPremiseServicesReachableIPv4EntryCls, offPremiseServicesReachableIPv4EntryTypeCtor, - offPremiseServicesReachableIPv4Value); - } - - bool offPremiseServicesReachableIPv6Null = false; - bool offPremiseServicesReachableIPv6HasValue = true; - - bool offPremiseServicesReachableIPv6Value = entry.offPremiseServicesReachableIPv6; - - jobject offPremiseServicesReachableIPv6 = nullptr; - if (!offPremiseServicesReachableIPv6Null && offPremiseServicesReachableIPv6HasValue) - { - jclass offPremiseServicesReachableIPv6EntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", offPremiseServicesReachableIPv6EntryCls); - chip::JniClass offPremiseServicesReachableIPv6JniClass(offPremiseServicesReachableIPv6EntryCls); - jmethodID offPremiseServicesReachableIPv6EntryTypeCtor = - env->GetMethodID(offPremiseServicesReachableIPv6EntryCls, "", "(Z)V"); - offPremiseServicesReachableIPv6 = - env->NewObject(offPremiseServicesReachableIPv6EntryCls, offPremiseServicesReachableIPv6EntryTypeCtor, - offPremiseServicesReachableIPv6Value); - } - - bool hardwareAddressNull = false; - bool hardwareAddressHasValue = true; - - chip::ByteSpan hardwareAddressValue = entry.hardwareAddress; - - jbyteArray hardwareAddress = nullptr; - if (!hardwareAddressNull && hardwareAddressHasValue) - { - hardwareAddress = env->NewByteArray(hardwareAddressValue.size()); - env->SetByteArrayRegion(hardwareAddress, 0, hardwareAddressValue.size(), - reinterpret_cast(hardwareAddressValue.data())); - } - - bool typeNull = false; - bool typeHasValue = true; - - chip::app::Clusters::GeneralDiagnostics::InterfaceType typeValue = entry.type; - - jobject type = nullptr; - if (!typeNull && typeHasValue) - { - jclass typeEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", typeEntryCls); - chip::JniClass typeJniClass(typeEntryCls); - jmethodID typeEntryTypeCtor = env->GetMethodID(typeEntryCls, "", "(I)V"); - type = env->NewObject(typeEntryCls, typeEntryTypeCtor, typeValue); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, name, fabricConnected, offPremiseServicesReachableIPv4, - offPremiseServicesReachableIPv6, hardwareAddress, type); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create NetworkInterfacesAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_name; + newElement_0_name = env->NewStringUTF(std::string(entry_0.name.data(), entry_0.name.size()).c_str()); + jobject newElement_0_fabricConnected; + std::string newElement_0_fabricConnectedClassName = "java/lang/Boolean"; + std::string newElement_0_fabricConnectedCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricConnectedClassName.c_str(), + newElement_0_fabricConnectedCtorSignature.c_str(), + entry_0.fabricConnected, newElement_0_fabricConnected); + jobject newElement_0_offPremiseServicesReachableIPv4; + std::string newElement_0_offPremiseServicesReachableIPv4ClassName = "java/lang/Boolean"; + std::string newElement_0_offPremiseServicesReachableIPv4CtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_offPremiseServicesReachableIPv4ClassName.c_str(), + newElement_0_offPremiseServicesReachableIPv4CtorSignature.c_str(), entry_0.offPremiseServicesReachableIPv4, + newElement_0_offPremiseServicesReachableIPv4); + jobject newElement_0_offPremiseServicesReachableIPv6; + std::string newElement_0_offPremiseServicesReachableIPv6ClassName = "java/lang/Boolean"; + std::string newElement_0_offPremiseServicesReachableIPv6CtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_offPremiseServicesReachableIPv6ClassName.c_str(), + newElement_0_offPremiseServicesReachableIPv6CtorSignature.c_str(), entry_0.offPremiseServicesReachableIPv6, + newElement_0_offPremiseServicesReachableIPv6); + jobject newElement_0_hardwareAddress; + jbyteArray newElement_0_hardwareAddressByteArray = env->NewByteArray(static_cast(entry_0.hardwareAddress.size())); + env->SetByteArrayRegion(newElement_0_hardwareAddressByteArray, 0, static_cast(entry_0.hardwareAddress.size()), + reinterpret_cast(entry_0.hardwareAddress.data())); + newElement_0_hardwareAddress = newElement_0_hardwareAddressByteArray; + jobject newElement_0_type; + std::string newElement_0_typeClassName = "java/lang/Integer"; + std::string newElement_0_typeCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_typeClassName.c_str(), + newElement_0_typeCtorSignature.c_str(), + static_cast(entry_0.type), newElement_0_type); + + jclass networkInterfaceTypeStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$GeneralDiagnosticsClusterNetworkInterfaceType", + networkInterfaceTypeStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$GeneralDiagnosticsClusterNetworkInterfaceType")); + chip::JniClass structJniClass(networkInterfaceTypeStructClass); + jmethodID networkInterfaceTypeStructCtor = + env->GetMethodID(networkInterfaceTypeStructClass, "", + "(Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;[BLjava/lang/Integer;)V"); + VerifyOrReturn(networkInterfaceTypeStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$GeneralDiagnosticsClusterNetworkInterfaceType constructor")); + + newElement_0 = + env->NewObject(networkInterfaceTypeStructClass, networkInterfaceTypeStructCtor, newElement_0_name, + newElement_0_fabricConnected, newElement_0_offPremiseServicesReachableIPv4, + newElement_0_offPremiseServicesReachableIPv6, newElement_0_hardwareAddress, newElement_0_type); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding NetworkInterfacesAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -5020,43 +4158,24 @@ void CHIPGeneralDiagnosticsActiveHardwareFaultsAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - uint8_t entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(I)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ActiveHardwareFaultsAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -5110,43 +4229,24 @@ void CHIPGeneralDiagnosticsActiveRadioFaultsAttributeCallback::CallbackFn(void * VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - uint8_t entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(I)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ActiveRadioFaultsAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -5200,43 +4300,24 @@ void CHIPGeneralDiagnosticsActiveNetworkFaultsAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - uint8_t entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(I)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ActiveNetworkFaultsAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -5290,43 +4371,24 @@ void CHIPGeneralDiagnosticsAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -5381,90 +4443,52 @@ void CHIPGroupKeyManagementGroupKeyMapAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$GroupKeyManagementCluster$GroupKeyMapAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, - "Could not find class chip/devicecontroller/ChipClusters$GroupKeyManagementCluster$GroupKeyMapAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = - env->GetMethodID(attributeClass, "", "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find GroupKeyMapAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool fabricIndexNull = false; - bool fabricIndexHasValue = true; - - chip::FabricIndex fabricIndexValue = entry.fabricIndex; - - jobject fabricIndex = nullptr; - if (!fabricIndexNull && fabricIndexHasValue) - { - jclass fabricIndexEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", fabricIndexEntryCls); - chip::JniClass fabricIndexJniClass(fabricIndexEntryCls); - jmethodID fabricIndexEntryTypeCtor = env->GetMethodID(fabricIndexEntryCls, "", "(I)V"); - fabricIndex = env->NewObject(fabricIndexEntryCls, fabricIndexEntryTypeCtor, fabricIndexValue); - } - - bool groupIdNull = false; - bool groupIdHasValue = true; - - uint16_t groupIdValue = entry.groupId; - - jobject groupId = nullptr; - if (!groupIdNull && groupIdHasValue) - { - jclass groupIdEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", groupIdEntryCls); - chip::JniClass groupIdJniClass(groupIdEntryCls); - jmethodID groupIdEntryTypeCtor = env->GetMethodID(groupIdEntryCls, "", "(I)V"); - groupId = env->NewObject(groupIdEntryCls, groupIdEntryTypeCtor, groupIdValue); - } - - bool groupKeySetIDNull = false; - bool groupKeySetIDHasValue = true; - - uint16_t groupKeySetIDValue = entry.groupKeySetID; - - jobject groupKeySetID = nullptr; - if (!groupKeySetIDNull && groupKeySetIDHasValue) - { - jclass groupKeySetIDEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", groupKeySetIDEntryCls); - chip::JniClass groupKeySetIDJniClass(groupKeySetIDEntryCls); - jmethodID groupKeySetIDEntryTypeCtor = env->GetMethodID(groupKeySetIDEntryCls, "", "(I)V"); - groupKeySetID = env->NewObject(groupKeySetIDEntryCls, groupKeySetIDEntryTypeCtor, groupKeySetIDValue); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, fabricIndex, groupId, groupKeySetID); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create GroupKeyMapAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); + jobject newElement_0_groupId; + std::string newElement_0_groupIdClassName = "java/lang/Integer"; + std::string newElement_0_groupIdCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_groupIdClassName.c_str(), + newElement_0_groupIdCtorSignature.c_str(), entry_0.groupId, + newElement_0_groupId); + jobject newElement_0_groupKeySetID; + std::string newElement_0_groupKeySetIDClassName = "java/lang/Integer"; + std::string newElement_0_groupKeySetIDCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_groupKeySetIDClassName.c_str(), + newElement_0_groupKeySetIDCtorSignature.c_str(), + entry_0.groupKeySetID, newElement_0_groupKeySetID); + + jclass groupKeyStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$GroupKeyManagementClusterGroupKey", groupKeyStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$GroupKeyManagementClusterGroupKey")); + chip::JniClass structJniClass(groupKeyStructClass); + jmethodID groupKeyStructCtor = + env->GetMethodID(groupKeyStructClass, "", "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V"); + VerifyOrReturn(groupKeyStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$GroupKeyManagementClusterGroupKey constructor")); + + newElement_0 = env->NewObject(groupKeyStructClass, groupKeyStructCtor, newElement_0_fabricIndex, newElement_0_groupId, + newElement_0_groupKeySetID); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding GroupKeyMapAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -5519,86 +4543,62 @@ void CHIPGroupKeyManagementGroupTableAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$GroupKeyManagementCluster$GroupTableAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$GroupKeyManagementCluster$GroupTableAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = - env->GetMethodID(attributeClass, "", "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find GroupTableAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool fabricIndexNull = false; - bool fabricIndexHasValue = true; - - uint16_t fabricIndexValue = entry.fabricIndex; - - jobject fabricIndex = nullptr; - if (!fabricIndexNull && fabricIndexHasValue) - { - jclass fabricIndexEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", fabricIndexEntryCls); - chip::JniClass fabricIndexJniClass(fabricIndexEntryCls); - jmethodID fabricIndexEntryTypeCtor = env->GetMethodID(fabricIndexEntryCls, "", "(I)V"); - fabricIndex = env->NewObject(fabricIndexEntryCls, fabricIndexEntryTypeCtor, fabricIndexValue); - } - - bool groupIdNull = false; - bool groupIdHasValue = true; - - uint16_t groupIdValue = entry.groupId; - - jobject groupId = nullptr; - if (!groupIdNull && groupIdHasValue) - { - jclass groupIdEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", groupIdEntryCls); - chip::JniClass groupIdJniClass(groupIdEntryCls); - jmethodID groupIdEntryTypeCtor = env->GetMethodID(groupIdEntryCls, "", "(I)V"); - groupId = env->NewObject(groupIdEntryCls, groupIdEntryTypeCtor, groupIdValue); - } - - bool groupNameNull = false; - bool groupNameHasValue = true; - - chip::CharSpan groupNameValue = entry.groupName; - - jstring groupName = nullptr; - chip::UtfString groupNameStr(env, groupNameValue); - if (!groupNameNull && groupNameHasValue) - { - groupName = jstring(groupNameStr.jniValue()); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, fabricIndex, groupId, groupName); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create GroupTableAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); + jobject newElement_0_groupId; + std::string newElement_0_groupIdClassName = "java/lang/Integer"; + std::string newElement_0_groupIdCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_groupIdClassName.c_str(), + newElement_0_groupIdCtorSignature.c_str(), entry_0.groupId, + newElement_0_groupId); + jobject newElement_0_endpoints; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_endpoints); + + auto iter_newElement_0_endpoints_NaN = entry_0.endpoints.begin(); + while (iter_newElement_0_endpoints_NaN.Next()) + { + auto & entry_NaN = iter_newElement_0_endpoints_NaN.GetValue(); + jobject newElement_NaN; + std::string newElement_NaNClassName = "java/lang/Integer"; + std::string newElement_NaNCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_NaNClassName.c_str(), newElement_NaNCtorSignature.c_str(), entry_NaN, newElement_NaN); + chip::JniReferences::GetInstance().AddToArrayList(newElement_0_endpoints, newElement_NaN); + } + jobject newElement_0_groupName; + newElement_0_groupName = env->NewStringUTF(std::string(entry_0.groupName.data(), entry_0.groupName.size()).c_str()); + + jclass groupInfoStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$GroupKeyManagementClusterGroupInfo", groupInfoStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$GroupKeyManagementClusterGroupInfo")); + chip::JniClass structJniClass(groupInfoStructClass); + jmethodID groupInfoStructCtor = env->GetMethodID( + groupInfoStructClass, "", "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/ArrayList;Ljava/lang/String;)V"); + VerifyOrReturn(groupInfoStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$GroupKeyManagementClusterGroupInfo constructor")); + + newElement_0 = env->NewObject(groupInfoStructClass, groupInfoStructCtor, newElement_0_fabricIndex, newElement_0_groupId, + newElement_0_endpoints, newElement_0_groupName); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding GroupTableAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -5652,43 +4652,24 @@ void CHIPGroupKeyManagementAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -5740,43 +4721,24 @@ void CHIPGroupsAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -5828,43 +4790,24 @@ void CHIPIdentifyAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -5922,11 +4865,17 @@ void CHIPIlluminanceMeasurementMeasuredValueAttributeCallback::CallbackFn(void * VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -5983,11 +4932,17 @@ void CHIPIlluminanceMeasurementMinMeasuredValueAttributeCallback::CallbackFn(voi VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -6044,11 +4999,17 @@ void CHIPIlluminanceMeasurementMaxMeasuredValueAttributeCallback::CallbackFn(voi VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -6105,11 +5066,17 @@ void CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback::CallbackFn(void VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -6162,43 +5129,24 @@ void CHIPIlluminanceMeasurementAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -6250,43 +5198,24 @@ void CHIPKeypadInputAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -6341,11 +5270,17 @@ void CHIPLevelControlOnLevelAttributeCallback::CallbackFn(void * context, const VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -6402,11 +5337,17 @@ void CHIPLevelControlOnTransitionTimeAttributeCallback::CallbackFn(void * contex VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -6463,11 +5404,17 @@ void CHIPLevelControlOffTransitionTimeAttributeCallback::CallbackFn(void * conte VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -6524,11 +5471,17 @@ void CHIPLevelControlDefaultMoveRateAttributeCallback::CallbackFn(void * context VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -6585,11 +5538,17 @@ void CHIPLevelControlStartUpCurrentLevelAttributeCallback::CallbackFn(void * con VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -6642,43 +5601,24 @@ void CHIPLevelControlAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -6732,40 +5672,21 @@ void CHIPLocalizationConfigurationSupportedLocalesAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::CharSpan entryValue = entry; - - jstring entryObject = nullptr; - chip::UtfString entryStr(env, entryValue); - if (!entryNull) - { - entryObject = jstring(entryStr.jniValue()); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + newElement_0 = env->NewStringUTF(std::string(entry_0.data(), entry_0.size()).c_str()); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding SupportedLocalesAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -6817,43 +5738,24 @@ void CHIPLowPowerAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -6906,99 +5808,48 @@ void CHIPMediaInputMediaInputListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$MediaInputCluster$MediaInputListAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$MediaInputCluster$MediaInputListAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = - env->GetMethodID(attributeClass, "", "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find MediaInputListAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool indexNull = false; - bool indexHasValue = true; - - uint8_t indexValue = entry.index; - - jobject index = nullptr; - if (!indexNull && indexHasValue) - { - jclass indexEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", indexEntryCls); - chip::JniClass indexJniClass(indexEntryCls); - jmethodID indexEntryTypeCtor = env->GetMethodID(indexEntryCls, "", "(I)V"); - index = env->NewObject(indexEntryCls, indexEntryTypeCtor, indexValue); - } - - bool inputTypeNull = false; - bool inputTypeHasValue = true; - - chip::app::Clusters::MediaInput::InputTypeEnum inputTypeValue = entry.inputType; - - jobject inputType = nullptr; - if (!inputTypeNull && inputTypeHasValue) - { - jclass inputTypeEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", inputTypeEntryCls); - chip::JniClass inputTypeJniClass(inputTypeEntryCls); - jmethodID inputTypeEntryTypeCtor = env->GetMethodID(inputTypeEntryCls, "", "(I)V"); - inputType = env->NewObject(inputTypeEntryCls, inputTypeEntryTypeCtor, inputTypeValue); - } - - bool nameNull = false; - bool nameHasValue = true; - - chip::CharSpan nameValue = entry.name; - - jstring name = nullptr; - chip::UtfString nameStr(env, nameValue); - if (!nameNull && nameHasValue) - { - name = jstring(nameStr.jniValue()); - } - - bool descriptionNull = false; - bool descriptionHasValue = true; - - chip::CharSpan descriptionValue = entry.description; - - jstring description = nullptr; - chip::UtfString descriptionStr(env, descriptionValue); - if (!descriptionNull && descriptionHasValue) - { - description = jstring(descriptionStr.jniValue()); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, index, inputType, name, description); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create MediaInputListAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_index; + std::string newElement_0_indexClassName = "java/lang/Integer"; + std::string newElement_0_indexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_indexClassName.c_str(), newElement_0_indexCtorSignature.c_str(), entry_0.index, newElement_0_index); + jobject newElement_0_inputType; + std::string newElement_0_inputTypeClassName = "java/lang/Integer"; + std::string newElement_0_inputTypeCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_inputTypeClassName.c_str(), newElement_0_inputTypeCtorSignature.c_str(), + static_cast(entry_0.inputType), newElement_0_inputType); + jobject newElement_0_name; + newElement_0_name = env->NewStringUTF(std::string(entry_0.name.data(), entry_0.name.size()).c_str()); + jobject newElement_0_description; + newElement_0_description = env->NewStringUTF(std::string(entry_0.description.data(), entry_0.description.size()).c_str()); + + jclass inputInfoStructClass; + err = chip::JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/ChipStructs$MediaInputClusterInputInfo", + inputInfoStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find class ChipStructs$MediaInputClusterInputInfo")); + chip::JniClass structJniClass(inputInfoStructClass); + jmethodID inputInfoStructCtor = env->GetMethodID( + inputInfoStructClass, "", "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;)V"); + VerifyOrReturn(inputInfoStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$MediaInputClusterInputInfo constructor")); + + newElement_0 = env->NewObject(inputInfoStructClass, inputInfoStructCtor, newElement_0_index, newElement_0_inputType, + newElement_0_name, newElement_0_description); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding MediaInputListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -7050,43 +5901,24 @@ void CHIPMediaInputAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -7140,43 +5972,24 @@ void CHIPMediaPlaybackAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -7229,87 +6042,47 @@ void CHIPModeSelectSupportedModesAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$ModeSelectCluster$SupportedModesAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$ModeSelectCluster$SupportedModesAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = - env->GetMethodID(attributeClass, "", "(Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Long;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find SupportedModesAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool labelNull = false; - bool labelHasValue = true; - - chip::CharSpan labelValue = entry.label; - - jstring label = nullptr; - chip::UtfString labelStr(env, labelValue); - if (!labelNull && labelHasValue) - { - label = jstring(labelStr.jniValue()); - } - - bool modeNull = false; - bool modeHasValue = true; - - uint8_t modeValue = entry.mode; - - jobject mode = nullptr; - if (!modeNull && modeHasValue) - { - jclass modeEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", modeEntryCls); - chip::JniClass modeJniClass(modeEntryCls); - jmethodID modeEntryTypeCtor = env->GetMethodID(modeEntryCls, "", "(I)V"); - mode = env->NewObject(modeEntryCls, modeEntryTypeCtor, modeValue); - } - - bool semanticTagNull = false; - bool semanticTagHasValue = true; - - uint32_t semanticTagValue = entry.semanticTag; - - jobject semanticTag = nullptr; - if (!semanticTagNull && semanticTagHasValue) - { - jclass semanticTagEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", semanticTagEntryCls); - chip::JniClass semanticTagJniClass(semanticTagEntryCls); - jmethodID semanticTagEntryTypeCtor = env->GetMethodID(semanticTagEntryCls, "", "(J)V"); - semanticTag = env->NewObject(semanticTagEntryCls, semanticTagEntryTypeCtor, semanticTagValue); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, label, mode, semanticTag); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create SupportedModesAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_label; + newElement_0_label = env->NewStringUTF(std::string(entry_0.label.data(), entry_0.label.size()).c_str()); + jobject newElement_0_mode; + std::string newElement_0_modeClassName = "java/lang/Integer"; + std::string newElement_0_modeCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_modeClassName.c_str(), newElement_0_modeCtorSignature.c_str(), entry_0.mode, newElement_0_mode); + jobject newElement_0_semanticTag; + std::string newElement_0_semanticTagClassName = "java/lang/Long"; + std::string newElement_0_semanticTagCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_semanticTagClassName.c_str(), + newElement_0_semanticTagCtorSignature.c_str(), + entry_0.semanticTag, newElement_0_semanticTag); + + jclass modeOptionStructStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ModeSelectClusterModeOptionStruct", modeOptionStructStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$ModeSelectClusterModeOptionStruct")); + chip::JniClass structJniClass(modeOptionStructStructClass); + jmethodID modeOptionStructStructCtor = + env->GetMethodID(modeOptionStructStructClass, "", "(Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Long;)V"); + VerifyOrReturn(modeOptionStructStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$ModeSelectClusterModeOptionStruct constructor")); + + newElement_0 = env->NewObject(modeOptionStructStructClass, modeOptionStructStructCtor, newElement_0_label, + newElement_0_mode, newElement_0_semanticTag); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding SupportedModesAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -7361,43 +6134,24 @@ void CHIPModeSelectAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -7453,70 +6207,44 @@ void CHIPNetworkCommissioningNetworksAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$NetworkCommissioningCluster$NetworksAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$NetworkCommissioningCluster$NetworksAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "([BLjava/lang/Boolean;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find NetworksAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool networkIDNull = false; - bool networkIDHasValue = true; - - chip::ByteSpan networkIDValue = entry.networkID; - - jbyteArray networkID = nullptr; - if (!networkIDNull && networkIDHasValue) - { - networkID = env->NewByteArray(networkIDValue.size()); - env->SetByteArrayRegion(networkID, 0, networkIDValue.size(), reinterpret_cast(networkIDValue.data())); - } - - bool connectedNull = false; - bool connectedHasValue = true; - - bool connectedValue = entry.connected; - - jobject connected = nullptr; - if (!connectedNull && connectedHasValue) - { - jclass connectedEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", connectedEntryCls); - chip::JniClass connectedJniClass(connectedEntryCls); - jmethodID connectedEntryTypeCtor = env->GetMethodID(connectedEntryCls, "", "(Z)V"); - connected = env->NewObject(connectedEntryCls, connectedEntryTypeCtor, connectedValue); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, networkID, connected); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create NetworksAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_networkID; + jbyteArray newElement_0_networkIDByteArray = env->NewByteArray(static_cast(entry_0.networkID.size())); + env->SetByteArrayRegion(newElement_0_networkIDByteArray, 0, static_cast(entry_0.networkID.size()), + reinterpret_cast(entry_0.networkID.data())); + newElement_0_networkID = newElement_0_networkIDByteArray; + jobject newElement_0_connected; + std::string newElement_0_connectedClassName = "java/lang/Boolean"; + std::string newElement_0_connectedCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_connectedClassName.c_str(), + newElement_0_connectedCtorSignature.c_str(), entry_0.connected, + newElement_0_connected); + + jclass networkInfoStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$NetworkCommissioningClusterNetworkInfo", networkInfoStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$NetworkCommissioningClusterNetworkInfo")); + chip::JniClass structJniClass(networkInfoStructClass); + jmethodID networkInfoStructCtor = env->GetMethodID(networkInfoStructClass, "", "([BLjava/lang/Boolean;)V"); + VerifyOrReturn(networkInfoStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$NetworkCommissioningClusterNetworkInfo constructor")); + + newElement_0 = + env->NewObject(networkInfoStructClass, networkInfoStructCtor, newElement_0_networkID, newElement_0_connected); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding NetworksAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -7570,43 +6298,24 @@ void CHIPOtaSoftwareUpdateProviderAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -7663,92 +6372,54 @@ void CHIPOtaSoftwareUpdateRequestorDefaultOtaProvidersAttributeCallback::Callbac VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$OtaSoftwareUpdateRequestorCluster$DefaultOtaProvidersAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, - "Could not find class " - "chip/devicecontroller/ChipClusters$OtaSoftwareUpdateRequestorCluster$DefaultOtaProvidersAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = - env->GetMethodID(attributeClass, "", "(Ljava/lang/Integer;Ljava/lang/Long;Ljava/lang/Integer;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find DefaultOtaProvidersAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool fabricIndexNull = false; - bool fabricIndexHasValue = true; - - chip::FabricIndex fabricIndexValue = entry.fabricIndex; - - jobject fabricIndex = nullptr; - if (!fabricIndexNull && fabricIndexHasValue) - { - jclass fabricIndexEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", fabricIndexEntryCls); - chip::JniClass fabricIndexJniClass(fabricIndexEntryCls); - jmethodID fabricIndexEntryTypeCtor = env->GetMethodID(fabricIndexEntryCls, "", "(I)V"); - fabricIndex = env->NewObject(fabricIndexEntryCls, fabricIndexEntryTypeCtor, fabricIndexValue); - } - - bool providerNodeIDNull = false; - bool providerNodeIDHasValue = true; - - chip::NodeId providerNodeIDValue = entry.providerNodeID; - - jobject providerNodeID = nullptr; - if (!providerNodeIDNull && providerNodeIDHasValue) - { - jclass providerNodeIDEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", providerNodeIDEntryCls); - chip::JniClass providerNodeIDJniClass(providerNodeIDEntryCls); - jmethodID providerNodeIDEntryTypeCtor = env->GetMethodID(providerNodeIDEntryCls, "", "(J)V"); - providerNodeID = env->NewObject(providerNodeIDEntryCls, providerNodeIDEntryTypeCtor, providerNodeIDValue); - } - - bool endpointNull = false; - bool endpointHasValue = true; - - chip::EndpointId endpointValue = entry.endpoint; - - jobject endpoint = nullptr; - if (!endpointNull && endpointHasValue) - { - jclass endpointEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", endpointEntryCls); - chip::JniClass endpointJniClass(endpointEntryCls); - jmethodID endpointEntryTypeCtor = env->GetMethodID(endpointEntryCls, "", "(I)V"); - endpoint = env->NewObject(endpointEntryCls, endpointEntryTypeCtor, endpointValue); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, fabricIndex, providerNodeID, endpoint); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create DefaultOtaProvidersAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); + jobject newElement_0_providerNodeID; + std::string newElement_0_providerNodeIDClassName = "java/lang/Long"; + std::string newElement_0_providerNodeIDCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_providerNodeIDClassName.c_str(), + newElement_0_providerNodeIDCtorSignature.c_str(), + entry_0.providerNodeID, newElement_0_providerNodeID); + jobject newElement_0_endpoint; + std::string newElement_0_endpointClassName = "java/lang/Integer"; + std::string newElement_0_endpointCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_endpointClassName.c_str(), + newElement_0_endpointCtorSignature.c_str(), entry_0.endpoint, + newElement_0_endpoint); + + jclass providerLocationStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$OtaSoftwareUpdateRequestorClusterProviderLocation", + providerLocationStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$OtaSoftwareUpdateRequestorClusterProviderLocation")); + chip::JniClass structJniClass(providerLocationStructClass); + jmethodID providerLocationStructCtor = + env->GetMethodID(providerLocationStructClass, "", "(Ljava/lang/Integer;Ljava/lang/Long;Ljava/lang/Integer;)V"); + VerifyOrReturn( + providerLocationStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$OtaSoftwareUpdateRequestorClusterProviderLocation constructor")); + + newElement_0 = env->NewObject(providerLocationStructClass, providerLocationStructCtor, newElement_0_fabricIndex, + newElement_0_providerNodeID, newElement_0_endpoint); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding DefaultOtaProvidersAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -7807,11 +6478,17 @@ void CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback::Callbac VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -7864,43 +6541,24 @@ void CHIPOtaSoftwareUpdateRequestorAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -7954,43 +6612,24 @@ void CHIPOccupancySensingAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -8042,43 +6681,24 @@ void CHIPOnOffAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -8132,43 +6752,24 @@ void CHIPOnOffSwitchConfigurationAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -8224,82 +6825,49 @@ void CHIPOperationalCredentialsNOCsAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$OperationalCredentialsCluster$NOCsAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$OperationalCredentialsCluster$NOCsAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(Ljava/lang/Integer;[B[B)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find NOCsAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool fabricIndexNull = false; - bool fabricIndexHasValue = true; - - chip::FabricIndex fabricIndexValue = entry.fabricIndex; - - jobject fabricIndex = nullptr; - if (!fabricIndexNull && fabricIndexHasValue) - { - jclass fabricIndexEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", fabricIndexEntryCls); - chip::JniClass fabricIndexJniClass(fabricIndexEntryCls); - jmethodID fabricIndexEntryTypeCtor = env->GetMethodID(fabricIndexEntryCls, "", "(I)V"); - fabricIndex = env->NewObject(fabricIndexEntryCls, fabricIndexEntryTypeCtor, fabricIndexValue); - } - - bool nocNull = false; - bool nocHasValue = true; - - chip::ByteSpan nocValue = entry.noc; - - jbyteArray noc = nullptr; - if (!nocNull && nocHasValue) - { - noc = env->NewByteArray(nocValue.size()); - env->SetByteArrayRegion(noc, 0, nocValue.size(), reinterpret_cast(nocValue.data())); - } - - bool icacNull = false; - bool icacHasValue = true; - - chip::ByteSpan icacValue = entry.icac; - - jbyteArray icac = nullptr; - if (!icacNull && icacHasValue) - { - icac = env->NewByteArray(icacValue.size()); - env->SetByteArrayRegion(icac, 0, icacValue.size(), reinterpret_cast(icacValue.data())); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, fabricIndex, noc, icac); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create NOCsAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); + jobject newElement_0_noc; + jbyteArray newElement_0_nocByteArray = env->NewByteArray(static_cast(entry_0.noc.size())); + env->SetByteArrayRegion(newElement_0_nocByteArray, 0, static_cast(entry_0.noc.size()), + reinterpret_cast(entry_0.noc.data())); + newElement_0_noc = newElement_0_nocByteArray; + jobject newElement_0_icac; + jbyteArray newElement_0_icacByteArray = env->NewByteArray(static_cast(entry_0.icac.size())); + env->SetByteArrayRegion(newElement_0_icacByteArray, 0, static_cast(entry_0.icac.size()), + reinterpret_cast(entry_0.icac.data())); + newElement_0_icac = newElement_0_icacByteArray; + + jclass NOCStructStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$OperationalCredentialsClusterNOCStruct", NOCStructStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$OperationalCredentialsClusterNOCStruct")); + chip::JniClass structJniClass(NOCStructStructClass); + jmethodID NOCStructStructCtor = env->GetMethodID(NOCStructStructClass, "", "(Ljava/lang/Integer;[B[B)V"); + VerifyOrReturn(NOCStructStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$OperationalCredentialsClusterNOCStruct constructor")); + + newElement_0 = env->NewObject(NOCStructStructClass, NOCStructStructCtor, newElement_0_fabricIndex, newElement_0_noc, + newElement_0_icac); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding NOCsAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -8355,131 +6923,66 @@ void CHIPOperationalCredentialsFabricsListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$OperationalCredentialsCluster$FabricsListAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, - "Could not find class chip/devicecontroller/ChipClusters$OperationalCredentialsCluster$FabricsListAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID( - attributeClass, "", "(Ljava/lang/Integer;[BLjava/lang/Integer;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/String;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find FabricsListAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool fabricIndexNull = false; - bool fabricIndexHasValue = true; - - chip::FabricIndex fabricIndexValue = entry.fabricIndex; - - jobject fabricIndex = nullptr; - if (!fabricIndexNull && fabricIndexHasValue) - { - jclass fabricIndexEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", fabricIndexEntryCls); - chip::JniClass fabricIndexJniClass(fabricIndexEntryCls); - jmethodID fabricIndexEntryTypeCtor = env->GetMethodID(fabricIndexEntryCls, "", "(I)V"); - fabricIndex = env->NewObject(fabricIndexEntryCls, fabricIndexEntryTypeCtor, fabricIndexValue); - } - - bool rootPublicKeyNull = false; - bool rootPublicKeyHasValue = true; - - chip::ByteSpan rootPublicKeyValue = entry.rootPublicKey; - - jbyteArray rootPublicKey = nullptr; - if (!rootPublicKeyNull && rootPublicKeyHasValue) - { - rootPublicKey = env->NewByteArray(rootPublicKeyValue.size()); - env->SetByteArrayRegion(rootPublicKey, 0, rootPublicKeyValue.size(), - reinterpret_cast(rootPublicKeyValue.data())); - } - - bool vendorIdNull = false; - bool vendorIdHasValue = true; - - uint16_t vendorIdValue = entry.vendorId; - - jobject vendorId = nullptr; - if (!vendorIdNull && vendorIdHasValue) - { - jclass vendorIdEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", vendorIdEntryCls); - chip::JniClass vendorIdJniClass(vendorIdEntryCls); - jmethodID vendorIdEntryTypeCtor = env->GetMethodID(vendorIdEntryCls, "", "(I)V"); - vendorId = env->NewObject(vendorIdEntryCls, vendorIdEntryTypeCtor, vendorIdValue); - } - - bool fabricIdNull = false; - bool fabricIdHasValue = true; - - chip::FabricId fabricIdValue = entry.fabricId; - - jobject fabricId = nullptr; - if (!fabricIdNull && fabricIdHasValue) - { - jclass fabricIdEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", fabricIdEntryCls); - chip::JniClass fabricIdJniClass(fabricIdEntryCls); - jmethodID fabricIdEntryTypeCtor = env->GetMethodID(fabricIdEntryCls, "", "(J)V"); - fabricId = env->NewObject(fabricIdEntryCls, fabricIdEntryTypeCtor, fabricIdValue); - } - - bool nodeIdNull = false; - bool nodeIdHasValue = true; - - chip::NodeId nodeIdValue = entry.nodeId; - - jobject nodeId = nullptr; - if (!nodeIdNull && nodeIdHasValue) - { - jclass nodeIdEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", nodeIdEntryCls); - chip::JniClass nodeIdJniClass(nodeIdEntryCls); - jmethodID nodeIdEntryTypeCtor = env->GetMethodID(nodeIdEntryCls, "", "(J)V"); - nodeId = env->NewObject(nodeIdEntryCls, nodeIdEntryTypeCtor, nodeIdValue); - } - - bool labelNull = false; - bool labelHasValue = true; - - chip::CharSpan labelValue = entry.label; - - jstring label = nullptr; - chip::UtfString labelStr(env, labelValue); - if (!labelNull && labelHasValue) - { - label = jstring(labelStr.jniValue()); - } - - jobject attributeObj = - env->NewObject(attributeClass, attributeCtor, fabricIndex, rootPublicKey, vendorId, fabricId, nodeId, label); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create FabricsListAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); + jobject newElement_0_rootPublicKey; + jbyteArray newElement_0_rootPublicKeyByteArray = env->NewByteArray(static_cast(entry_0.rootPublicKey.size())); + env->SetByteArrayRegion(newElement_0_rootPublicKeyByteArray, 0, static_cast(entry_0.rootPublicKey.size()), + reinterpret_cast(entry_0.rootPublicKey.data())); + newElement_0_rootPublicKey = newElement_0_rootPublicKeyByteArray; + jobject newElement_0_vendorId; + std::string newElement_0_vendorIdClassName = "java/lang/Integer"; + std::string newElement_0_vendorIdCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_vendorIdClassName.c_str(), + newElement_0_vendorIdCtorSignature.c_str(), entry_0.vendorId, + newElement_0_vendorId); + jobject newElement_0_fabricId; + std::string newElement_0_fabricIdClassName = "java/lang/Long"; + std::string newElement_0_fabricIdCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIdClassName.c_str(), + newElement_0_fabricIdCtorSignature.c_str(), entry_0.fabricId, + newElement_0_fabricId); + jobject newElement_0_nodeId; + std::string newElement_0_nodeIdClassName = "java/lang/Long"; + std::string newElement_0_nodeIdCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nodeIdClassName.c_str(), newElement_0_nodeIdCtorSignature.c_str(), entry_0.nodeId, newElement_0_nodeId); + jobject newElement_0_label; + newElement_0_label = env->NewStringUTF(std::string(entry_0.label.data(), entry_0.label.size()).c_str()); + + jclass fabricDescriptorStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$OperationalCredentialsClusterFabricDescriptor", fabricDescriptorStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$OperationalCredentialsClusterFabricDescriptor")); + chip::JniClass structJniClass(fabricDescriptorStructClass); + jmethodID fabricDescriptorStructCtor = + env->GetMethodID(fabricDescriptorStructClass, "", + "(Ljava/lang/Integer;[BLjava/lang/Integer;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/String;)V"); + VerifyOrReturn(fabricDescriptorStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$OperationalCredentialsClusterFabricDescriptor constructor")); + + newElement_0 = env->NewObject(fabricDescriptorStructClass, fabricDescriptorStructCtor, newElement_0_fabricIndex, + newElement_0_rootPublicKey, newElement_0_vendorId, newElement_0_fabricId, newElement_0_nodeId, + newElement_0_label); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding FabricsListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -8534,40 +7037,24 @@ void CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback::Callbac VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::ByteSpan entryValue = entry; - - jbyteArray entryObject = nullptr; - if (!entryNull) - { - entryObject = env->NewByteArray(entryValue.size()); - env->SetByteArrayRegion(entryObject, 0, entryValue.size(), reinterpret_cast(entryValue.data())); - } - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); - } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding TrustedRootCertificatesAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jbyteArray newElement_0ByteArray = env->NewByteArray(static_cast(entry_0.size())); + env->SetByteArrayRegion(newElement_0ByteArray, 0, static_cast(entry_0.size()), + reinterpret_cast(entry_0.data())); + newElement_0 = newElement_0ByteArray; + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); + } env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -8624,11 +7111,10 @@ void CHIPOperationalCredentialsCurrentFabricIndexAttributeCallback::CallbackFn(v VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - std::string javaValueClassName = "java/lang/Integer"; std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), - javaValueCtorSignature.c_str(), value, javaValue); + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), value, + javaValue); env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -8681,43 +7167,24 @@ void CHIPOperationalCredentialsAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -8771,43 +7238,24 @@ void CHIPPowerSourceActiveBatteryFaultsAttributeCallback::CallbackFn(void * cont VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - uint8_t entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(I)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ActiveBatteryFaultsAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -8859,43 +7307,24 @@ void CHIPPowerSourceAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -8949,42 +7378,24 @@ void CHIPPowerSourceConfigurationSourcesAttributeCallback::CallbackFn(void * con VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - uint8_t entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(I)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding SourcesAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -9038,43 +7449,24 @@ void CHIPPowerSourceConfigurationAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -9128,43 +7520,24 @@ void CHIPPressureMeasurementAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -9223,11 +7596,17 @@ void CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback::Callb VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -9285,11 +7664,17 @@ void CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback::Cal VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -9342,43 +7727,24 @@ void CHIPPumpConfigurationAndControlAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -9432,43 +7798,24 @@ void CHIPRelativeHumidityMeasurementAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -9520,43 +7867,24 @@ void CHIPScenesAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -9612,119 +7940,60 @@ void CHIPSoftwareDiagnosticsThreadMetricsAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$SoftwareDiagnosticsCluster$ThreadMetricsAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, - "Could not find class chip/devicecontroller/ChipClusters$SoftwareDiagnosticsCluster$ThreadMetricsAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID( - attributeClass, "", "(Ljava/lang/Long;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Long;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find ThreadMetricsAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool idNull = false; - bool idHasValue = true; - - uint64_t idValue = entry.id; - - jobject id = nullptr; - if (!idNull && idHasValue) - { - jclass idEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", idEntryCls); - chip::JniClass idJniClass(idEntryCls); - jmethodID idEntryTypeCtor = env->GetMethodID(idEntryCls, "", "(J)V"); - id = env->NewObject(idEntryCls, idEntryTypeCtor, idValue); - } - - bool nameNull = false; - bool nameHasValue = true; - - chip::CharSpan nameValue = entry.name; - - jstring name = nullptr; - chip::UtfString nameStr(env, nameValue); - if (!nameNull && nameHasValue) - { - name = jstring(nameStr.jniValue()); - } - - bool stackFreeCurrentNull = false; - bool stackFreeCurrentHasValue = true; - - uint32_t stackFreeCurrentValue = entry.stackFreeCurrent; - - jobject stackFreeCurrent = nullptr; - if (!stackFreeCurrentNull && stackFreeCurrentHasValue) - { - jclass stackFreeCurrentEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", stackFreeCurrentEntryCls); - chip::JniClass stackFreeCurrentJniClass(stackFreeCurrentEntryCls); - jmethodID stackFreeCurrentEntryTypeCtor = env->GetMethodID(stackFreeCurrentEntryCls, "", "(J)V"); - stackFreeCurrent = env->NewObject(stackFreeCurrentEntryCls, stackFreeCurrentEntryTypeCtor, stackFreeCurrentValue); - } - - bool stackFreeMinimumNull = false; - bool stackFreeMinimumHasValue = true; - - uint32_t stackFreeMinimumValue = entry.stackFreeMinimum; - - jobject stackFreeMinimum = nullptr; - if (!stackFreeMinimumNull && stackFreeMinimumHasValue) - { - jclass stackFreeMinimumEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", stackFreeMinimumEntryCls); - chip::JniClass stackFreeMinimumJniClass(stackFreeMinimumEntryCls); - jmethodID stackFreeMinimumEntryTypeCtor = env->GetMethodID(stackFreeMinimumEntryCls, "", "(J)V"); - stackFreeMinimum = env->NewObject(stackFreeMinimumEntryCls, stackFreeMinimumEntryTypeCtor, stackFreeMinimumValue); - } - - bool stackSizeNull = false; - bool stackSizeHasValue = true; - - uint32_t stackSizeValue = entry.stackSize; - - jobject stackSize = nullptr; - if (!stackSizeNull && stackSizeHasValue) - { - jclass stackSizeEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", stackSizeEntryCls); - chip::JniClass stackSizeJniClass(stackSizeEntryCls); - jmethodID stackSizeEntryTypeCtor = env->GetMethodID(stackSizeEntryCls, "", "(J)V"); - stackSize = env->NewObject(stackSizeEntryCls, stackSizeEntryTypeCtor, stackSizeValue); - } - - jobject attributeObj = - env->NewObject(attributeClass, attributeCtor, id, name, stackFreeCurrent, stackFreeMinimum, stackSize); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create ThreadMetricsAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_id; + std::string newElement_0_idClassName = "java/lang/Long"; + std::string newElement_0_idCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_idClassName.c_str(), newElement_0_idCtorSignature.c_str(), entry_0.id, newElement_0_id); + jobject newElement_0_name; + newElement_0_name = env->NewStringUTF(std::string(entry_0.name.data(), entry_0.name.size()).c_str()); + jobject newElement_0_stackFreeCurrent; + std::string newElement_0_stackFreeCurrentClassName = "java/lang/Long"; + std::string newElement_0_stackFreeCurrentCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_stackFreeCurrentClassName.c_str(), + newElement_0_stackFreeCurrentCtorSignature.c_str(), + entry_0.stackFreeCurrent, newElement_0_stackFreeCurrent); + jobject newElement_0_stackFreeMinimum; + std::string newElement_0_stackFreeMinimumClassName = "java/lang/Long"; + std::string newElement_0_stackFreeMinimumCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_stackFreeMinimumClassName.c_str(), + newElement_0_stackFreeMinimumCtorSignature.c_str(), + entry_0.stackFreeMinimum, newElement_0_stackFreeMinimum); + jobject newElement_0_stackSize; + std::string newElement_0_stackSizeClassName = "java/lang/Long"; + std::string newElement_0_stackSizeCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_stackSizeClassName.c_str(), + newElement_0_stackSizeCtorSignature.c_str(), + entry_0.stackSize, newElement_0_stackSize); + + jclass threadMetricsStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$SoftwareDiagnosticsClusterThreadMetrics", threadMetricsStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$SoftwareDiagnosticsClusterThreadMetrics")); + chip::JniClass structJniClass(threadMetricsStructClass); + jmethodID threadMetricsStructCtor = + env->GetMethodID(threadMetricsStructClass, "", + "(Ljava/lang/Long;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Long;)V"); + VerifyOrReturn(threadMetricsStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$SoftwareDiagnosticsClusterThreadMetrics constructor")); + + newElement_0 = env->NewObject(threadMetricsStructClass, threadMetricsStructCtor, newElement_0_id, newElement_0_name, + newElement_0_stackFreeCurrent, newElement_0_stackFreeMinimum, newElement_0_stackSize); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ThreadMetricsAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -9778,43 +8047,24 @@ void CHIPSoftwareDiagnosticsAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -9866,43 +8116,24 @@ void CHIPSwitchAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -9957,72 +8188,41 @@ void CHIPTargetNavigatorTargetNavigatorListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$TargetNavigatorCluster$TargetNavigatorListAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError( - Zcl, "Could not find class chip/devicecontroller/ChipClusters$TargetNavigatorCluster$TargetNavigatorListAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(Ljava/lang/Integer;Ljava/lang/String;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find TargetNavigatorListAttribute constructor")); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - auto iter = list.begin(); - while (iter.Next()) + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) { - auto & entry = iter.GetValue(); - (void) entry; - bool identifierNull = false; - bool identifierHasValue = true; + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_identifier; + std::string newElement_0_identifierClassName = "java/lang/Integer"; + std::string newElement_0_identifierCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_identifierClassName.c_str(), + newElement_0_identifierCtorSignature.c_str(), + entry_0.identifier, newElement_0_identifier); + jobject newElement_0_name; + newElement_0_name = env->NewStringUTF(std::string(entry_0.name.data(), entry_0.name.size()).c_str()); - uint8_t identifierValue = entry.identifier; + jclass targetInfoStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$TargetNavigatorClusterTargetInfo", targetInfoStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$TargetNavigatorClusterTargetInfo")); + chip::JniClass structJniClass(targetInfoStructClass); + jmethodID targetInfoStructCtor = + env->GetMethodID(targetInfoStructClass, "", "(Ljava/lang/Integer;Ljava/lang/String;)V"); + VerifyOrReturn(targetInfoStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$TargetNavigatorClusterTargetInfo constructor")); - jobject identifier = nullptr; - if (!identifierNull && identifierHasValue) - { - jclass identifierEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", identifierEntryCls); - chip::JniClass identifierJniClass(identifierEntryCls); - jmethodID identifierEntryTypeCtor = env->GetMethodID(identifierEntryCls, "", "(I)V"); - identifier = env->NewObject(identifierEntryCls, identifierEntryTypeCtor, identifierValue); - } - - bool nameNull = false; - bool nameHasValue = true; - - chip::CharSpan nameValue = entry.name; - - jstring name = nullptr; - chip::UtfString nameStr(env, nameValue); - if (!nameNull && nameHasValue) - { - name = jstring(nameStr.jniValue()); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, identifier, name); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create TargetNavigatorListAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + newElement_0 = env->NewObject(targetInfoStructClass, targetInfoStructCtor, newElement_0_identifier, newElement_0_name); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding TargetNavigatorListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -10076,43 +8276,24 @@ void CHIPTargetNavigatorAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -10166,43 +8347,24 @@ void CHIPTemperatureMeasurementAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -10254,42 +8416,24 @@ void CHIPTestClusterListInt8uAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - uint8_t entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(I)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ListInt8uAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -10343,40 +8487,24 @@ void CHIPTestClusterListOctetStringAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::ByteSpan entryValue = entry; - - jbyteArray entryObject = nullptr; - if (!entryNull) - { - entryObject = env->NewByteArray(entryValue.size()); - env->SetByteArrayRegion(entryObject, 0, entryValue.size(), reinterpret_cast(entryValue.data())); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jbyteArray newElement_0ByteArray = env->NewByteArray(static_cast(entry_0.size())); + env->SetByteArrayRegion(newElement_0ByteArray, 0, static_cast(entry_0.size()), + reinterpret_cast(entry_0.data())); + newElement_0 = newElement_0ByteArray; + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ListOctetStringAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -10431,73 +8559,45 @@ void CHIPTestClusterListStructOctetStringAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$TestClusterCluster$ListStructOctetStringAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, - "Could not find class chip/devicecontroller/ChipClusters$TestClusterCluster$ListStructOctetStringAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(Ljava/lang/Long;[B)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find ListStructOctetStringAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool fabricIndexNull = false; - bool fabricIndexHasValue = true; - - uint64_t fabricIndexValue = entry.fabricIndex; - - jobject fabricIndex = nullptr; - if (!fabricIndexNull && fabricIndexHasValue) - { - jclass fabricIndexEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", fabricIndexEntryCls); - chip::JniClass fabricIndexJniClass(fabricIndexEntryCls); - jmethodID fabricIndexEntryTypeCtor = env->GetMethodID(fabricIndexEntryCls, "", "(J)V"); - fabricIndex = env->NewObject(fabricIndexEntryCls, fabricIndexEntryTypeCtor, fabricIndexValue); - } - - bool operationalCertNull = false; - bool operationalCertHasValue = true; - - chip::ByteSpan operationalCertValue = entry.operationalCert; - - jbyteArray operationalCert = nullptr; - if (!operationalCertNull && operationalCertHasValue) - { - operationalCert = env->NewByteArray(operationalCertValue.size()); - env->SetByteArrayRegion(operationalCert, 0, operationalCertValue.size(), - reinterpret_cast(operationalCertValue.data())); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, fabricIndex, operationalCert); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create ListStructOctetStringAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Long"; + std::string newElement_0_fabricIndexCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); + jobject newElement_0_operationalCert; + jbyteArray newElement_0_operationalCertByteArray = env->NewByteArray(static_cast(entry_0.operationalCert.size())); + env->SetByteArrayRegion(newElement_0_operationalCertByteArray, 0, static_cast(entry_0.operationalCert.size()), + reinterpret_cast(entry_0.operationalCert.data())); + newElement_0_operationalCert = newElement_0_operationalCertByteArray; + + jclass testListStructOctetStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$TestClusterClusterTestListStructOctet", testListStructOctetStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$TestClusterClusterTestListStructOctet")); + chip::JniClass structJniClass(testListStructOctetStructClass); + jmethodID testListStructOctetStructCtor = + env->GetMethodID(testListStructOctetStructClass, "", "(Ljava/lang/Long;[B)V"); + VerifyOrReturn(testListStructOctetStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$TestClusterClusterTestListStructOctet constructor")); + + newElement_0 = env->NewObject(testListStructOctetStructClass, testListStructOctetStructCtor, newElement_0_fabricIndex, + newElement_0_operationalCert); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ListStructOctetStringAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -10552,11 +8652,10 @@ void CHIPTestClusterVendorIdAttributeCallback::CallbackFn(void * context, chip:: VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - std::string javaValueClassName = "java/lang/Integer"; std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value, javaValue); + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + static_cast(value), javaValue); env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -10611,181 +8710,432 @@ void CHIPTestClusterListNullablesAndOptionalsStructAttributeCallback::CallbackFn VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$TestClusterCluster$ListNullablesAndOptionalsStructAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError( - Zcl, - "Could not find class chip/devicecontroller/ChipClusters$TestClusterCluster$ListNullablesAndOptionalsStructAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID( - attributeClass, "", - "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/lang/String;Ljava/util/Optional;Ljava/util/Optional;)V"); - VerifyOrReturn(attributeCtor != nullptr, - ChipLogError(Zcl, "Could not find ListNullablesAndOptionalsStructAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool nullableIntNull = false; - bool nullableIntHasValue = true; - uint16_t nullableIntValue; - nullableIntNull = entry.nullableInt.IsNull(); - if (!nullableIntNull) + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_nullableInt; + if (entry_0.nullableInt.IsNull()) { - nullableIntValue = entry.nullableInt.Value(); + newElement_0_nullableInt = nullptr; } - - jobject nullableInt = nullptr; - if (!nullableIntNull && nullableIntHasValue) + else { - jclass nullableIntEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", nullableIntEntryCls); - chip::JniClass nullableIntJniClass(nullableIntEntryCls); - jmethodID nullableIntEntryTypeCtor = env->GetMethodID(nullableIntEntryCls, "", "(I)V"); - nullableInt = env->NewObject(nullableIntEntryCls, nullableIntEntryTypeCtor, nullableIntValue); + std::string newElement_0_nullableIntClassName = "java/lang/Integer"; + std::string newElement_0_nullableIntCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_nullableIntClassName.c_str(), + newElement_0_nullableIntCtorSignature.c_str(), + entry_0.nullableInt.Value(), newElement_0_nullableInt); } - - bool optionalIntNull = false; - bool optionalIntHasValue = true; - - uint16_t optionalIntValue; - optionalIntHasValue = entry.optionalInt.HasValue(); - if (optionalIntHasValue) + jobject newElement_0_optionalInt; + if (!entry_0.optionalInt.HasValue()) { - optionalIntValue = entry.optionalInt.Value(); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_optionalInt); } - - jobject optionalInt = nullptr; - if (!optionalIntNull && optionalIntHasValue) + else { - jclass optionalIntEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", optionalIntEntryCls); - chip::JniClass optionalIntJniClass(optionalIntEntryCls); - jmethodID optionalIntEntryTypeCtor = env->GetMethodID(optionalIntEntryCls, "", "(I)V"); - optionalInt = env->NewObject(optionalIntEntryCls, optionalIntEntryTypeCtor, optionalIntValue); + std::string newElement_0_optionalIntClassName = "java/lang/Integer"; + std::string newElement_0_optionalIntCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_optionalIntClassName.c_str(), + newElement_0_optionalIntCtorSignature.c_str(), + entry_0.optionalInt.Value(), newElement_0_optionalInt); } - - jobject optionalIntOptional = nullptr; - chip::JniReferences::GetInstance().CreateOptional(optionalInt, optionalIntOptional); - bool nullableOptionalIntNull = false; - bool nullableOptionalIntHasValue = true; - - uint16_t nullableOptionalIntValue; - nullableOptionalIntHasValue = entry.nullableOptionalInt.HasValue(); - if (nullableOptionalIntHasValue) + jobject newElement_0_nullableOptionalInt; + if (!entry_0.nullableOptionalInt.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_nullableOptionalInt); + } + else { - auto nullableOptionalIntValueFromOptional = entry.nullableOptionalInt.Value(); - nullableOptionalIntNull = nullableOptionalIntValueFromOptional.IsNull(); - if (!nullableOptionalIntNull) + if (entry_0.nullableOptionalInt.Value().IsNull()) { - nullableOptionalIntValue = nullableOptionalIntValueFromOptional.Value(); + newElement_0_nullableOptionalInt = nullptr; + } + else + { + std::string newElement_0_nullableOptionalIntClassName = "java/lang/Integer"; + std::string newElement_0_nullableOptionalIntCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableOptionalIntClassName.c_str(), newElement_0_nullableOptionalIntCtorSignature.c_str(), + entry_0.nullableOptionalInt.Value().Value(), newElement_0_nullableOptionalInt); } } - - jobject nullableOptionalInt = nullptr; - if (!nullableOptionalIntNull && nullableOptionalIntHasValue) + jobject newElement_0_nullableString; + if (entry_0.nullableString.IsNull()) { - jclass nullableOptionalIntEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", nullableOptionalIntEntryCls); - chip::JniClass nullableOptionalIntJniClass(nullableOptionalIntEntryCls); - jmethodID nullableOptionalIntEntryTypeCtor = env->GetMethodID(nullableOptionalIntEntryCls, "", "(I)V"); - nullableOptionalInt = - env->NewObject(nullableOptionalIntEntryCls, nullableOptionalIntEntryTypeCtor, nullableOptionalIntValue); + newElement_0_nullableString = nullptr; } - - jobject nullableOptionalIntOptional = nullptr; - chip::JniReferences::GetInstance().CreateOptional(nullableOptionalInt, nullableOptionalIntOptional); - bool nullableStringNull = false; - bool nullableStringHasValue = true; - chip::CharSpan nullableStringValue; - nullableStringNull = entry.nullableString.IsNull(); - if (!nullableStringNull) + else { - nullableStringValue = entry.nullableString.Value(); + newElement_0_nullableString = env->NewStringUTF( + std::string(entry_0.nullableString.Value().data(), entry_0.nullableString.Value().size()).c_str()); } - - jstring nullableString = nullptr; - chip::UtfString nullableStringStr(env, nullableStringValue); - if (!nullableStringNull && nullableStringHasValue) + jobject newElement_0_optionalString; + if (!entry_0.optionalString.HasValue()) { - nullableString = jstring(nullableStringStr.jniValue()); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_optionalString); } - - bool optionalStringNull = false; - bool optionalStringHasValue = true; - - chip::CharSpan optionalStringValue; - optionalStringHasValue = entry.optionalString.HasValue(); - if (optionalStringHasValue) + else { - optionalStringValue = entry.optionalString.Value(); + newElement_0_optionalString = env->NewStringUTF( + std::string(entry_0.optionalString.Value().data(), entry_0.optionalString.Value().size()).c_str()); } - - jstring optionalString = nullptr; - chip::UtfString optionalStringStr(env, optionalStringValue); - if (!optionalStringNull && optionalStringHasValue) + jobject newElement_0_nullableOptionalString; + if (!entry_0.nullableOptionalString.HasValue()) { - optionalString = jstring(optionalStringStr.jniValue()); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_nullableOptionalString); } - - jobject optionalStringOptional = nullptr; - chip::JniReferences::GetInstance().CreateOptional(optionalString, optionalStringOptional); - bool nullableOptionalStringNull = false; - bool nullableOptionalStringHasValue = true; - - chip::CharSpan nullableOptionalStringValue; - nullableOptionalStringHasValue = entry.nullableOptionalString.HasValue(); - if (nullableOptionalStringHasValue) + else { - auto nullableOptionalStringValueFromOptional = entry.nullableOptionalString.Value(); - nullableOptionalStringNull = nullableOptionalStringValueFromOptional.IsNull(); - if (!nullableOptionalStringNull) + if (entry_0.nullableOptionalString.Value().IsNull()) + { + newElement_0_nullableOptionalString = nullptr; + } + else { - nullableOptionalStringValue = nullableOptionalStringValueFromOptional.Value(); + newElement_0_nullableOptionalString = + env->NewStringUTF(std::string(entry_0.nullableOptionalString.Value().Value().data(), + entry_0.nullableOptionalString.Value().Value().size()) + .c_str()); } } - - jstring nullableOptionalString = nullptr; - chip::UtfString nullableOptionalStringStr(env, nullableOptionalStringValue); - if (!nullableOptionalStringNull && nullableOptionalStringHasValue) + jobject newElement_0_nullableStruct; + if (entry_0.nullableStruct.IsNull()) + { + newElement_0_nullableStruct = nullptr; + } + else + { + jobject newElement_0_nullableStruct_a; + std::string newElement_0_nullableStruct_aClassName = "java/lang/Integer"; + std::string newElement_0_nullableStruct_aCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableStruct_aClassName.c_str(), newElement_0_nullableStruct_aCtorSignature.c_str(), + entry_0.nullableStruct.Value().a, newElement_0_nullableStruct_a); + jobject newElement_0_nullableStruct_b; + std::string newElement_0_nullableStruct_bClassName = "java/lang/Boolean"; + std::string newElement_0_nullableStruct_bCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableStruct_bClassName.c_str(), newElement_0_nullableStruct_bCtorSignature.c_str(), + entry_0.nullableStruct.Value().b, newElement_0_nullableStruct_b); + jobject newElement_0_nullableStruct_c; + std::string newElement_0_nullableStruct_cClassName = "java/lang/Integer"; + std::string newElement_0_nullableStruct_cCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableStruct_cClassName.c_str(), newElement_0_nullableStruct_cCtorSignature.c_str(), + static_cast(entry_0.nullableStruct.Value().c), newElement_0_nullableStruct_c); + jobject newElement_0_nullableStruct_d; + jbyteArray newElement_0_nullableStruct_dByteArray = + env->NewByteArray(static_cast(entry_0.nullableStruct.Value().d.size())); + env->SetByteArrayRegion(newElement_0_nullableStruct_dByteArray, 0, + static_cast(entry_0.nullableStruct.Value().d.size()), + reinterpret_cast(entry_0.nullableStruct.Value().d.data())); + newElement_0_nullableStruct_d = newElement_0_nullableStruct_dByteArray; + jobject newElement_0_nullableStruct_e; + newElement_0_nullableStruct_e = env->NewStringUTF( + std::string(entry_0.nullableStruct.Value().e.data(), entry_0.nullableStruct.Value().e.size()).c_str()); + jobject newElement_0_nullableStruct_f; + std::string newElement_0_nullableStruct_fClassName = "java/lang/Integer"; + std::string newElement_0_nullableStruct_fCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableStruct_fClassName.c_str(), newElement_0_nullableStruct_fCtorSignature.c_str(), + entry_0.nullableStruct.Value().f.Raw(), newElement_0_nullableStruct_f); + jobject newElement_0_nullableStruct_g; + std::string newElement_0_nullableStruct_gClassName = "java/lang/Float"; + std::string newElement_0_nullableStruct_gCtorSignature = "(F)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableStruct_gClassName.c_str(), newElement_0_nullableStruct_gCtorSignature.c_str(), + entry_0.nullableStruct.Value().g, newElement_0_nullableStruct_g); + jobject newElement_0_nullableStruct_h; + std::string newElement_0_nullableStruct_hClassName = "java/lang/Double"; + std::string newElement_0_nullableStruct_hCtorSignature = "(D)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableStruct_hClassName.c_str(), newElement_0_nullableStruct_hCtorSignature.c_str(), + entry_0.nullableStruct.Value().h, newElement_0_nullableStruct_h); + + jclass simpleStructStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$TestClusterClusterSimpleStruct", simpleStructStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$TestClusterClusterSimpleStruct")); + chip::JniClass structJniClass(simpleStructStructClass); + jmethodID simpleStructStructCtor = + env->GetMethodID(simpleStructStructClass, "", + "(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Integer;[BLjava/lang/String;Ljava/lang/" + "Integer;Ljava/lang/Float;Ljava/lang/Double;)V"); + VerifyOrReturn(simpleStructStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$TestClusterClusterSimpleStruct constructor")); + + newElement_0_nullableStruct = env->NewObject( + simpleStructStructClass, simpleStructStructCtor, newElement_0_nullableStruct_a, newElement_0_nullableStruct_b, + newElement_0_nullableStruct_c, newElement_0_nullableStruct_d, newElement_0_nullableStruct_e, + newElement_0_nullableStruct_f, newElement_0_nullableStruct_g, newElement_0_nullableStruct_h); + } + jobject newElement_0_optionalStruct; + if (!entry_0.optionalStruct.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_optionalStruct); + } + else + { + jobject newElement_0_optionalStruct_a; + std::string newElement_0_optionalStruct_aClassName = "java/lang/Integer"; + std::string newElement_0_optionalStruct_aCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_optionalStruct_aClassName.c_str(), newElement_0_optionalStruct_aCtorSignature.c_str(), + entry_0.optionalStruct.Value().a, newElement_0_optionalStruct_a); + jobject newElement_0_optionalStruct_b; + std::string newElement_0_optionalStruct_bClassName = "java/lang/Boolean"; + std::string newElement_0_optionalStruct_bCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_optionalStruct_bClassName.c_str(), newElement_0_optionalStruct_bCtorSignature.c_str(), + entry_0.optionalStruct.Value().b, newElement_0_optionalStruct_b); + jobject newElement_0_optionalStruct_c; + std::string newElement_0_optionalStruct_cClassName = "java/lang/Integer"; + std::string newElement_0_optionalStruct_cCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_optionalStruct_cClassName.c_str(), newElement_0_optionalStruct_cCtorSignature.c_str(), + static_cast(entry_0.optionalStruct.Value().c), newElement_0_optionalStruct_c); + jobject newElement_0_optionalStruct_d; + jbyteArray newElement_0_optionalStruct_dByteArray = + env->NewByteArray(static_cast(entry_0.optionalStruct.Value().d.size())); + env->SetByteArrayRegion(newElement_0_optionalStruct_dByteArray, 0, + static_cast(entry_0.optionalStruct.Value().d.size()), + reinterpret_cast(entry_0.optionalStruct.Value().d.data())); + newElement_0_optionalStruct_d = newElement_0_optionalStruct_dByteArray; + jobject newElement_0_optionalStruct_e; + newElement_0_optionalStruct_e = env->NewStringUTF( + std::string(entry_0.optionalStruct.Value().e.data(), entry_0.optionalStruct.Value().e.size()).c_str()); + jobject newElement_0_optionalStruct_f; + std::string newElement_0_optionalStruct_fClassName = "java/lang/Integer"; + std::string newElement_0_optionalStruct_fCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_optionalStruct_fClassName.c_str(), newElement_0_optionalStruct_fCtorSignature.c_str(), + entry_0.optionalStruct.Value().f.Raw(), newElement_0_optionalStruct_f); + jobject newElement_0_optionalStruct_g; + std::string newElement_0_optionalStruct_gClassName = "java/lang/Float"; + std::string newElement_0_optionalStruct_gCtorSignature = "(F)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_optionalStruct_gClassName.c_str(), newElement_0_optionalStruct_gCtorSignature.c_str(), + entry_0.optionalStruct.Value().g, newElement_0_optionalStruct_g); + jobject newElement_0_optionalStruct_h; + std::string newElement_0_optionalStruct_hClassName = "java/lang/Double"; + std::string newElement_0_optionalStruct_hCtorSignature = "(D)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_optionalStruct_hClassName.c_str(), newElement_0_optionalStruct_hCtorSignature.c_str(), + entry_0.optionalStruct.Value().h, newElement_0_optionalStruct_h); + + jclass simpleStructStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$TestClusterClusterSimpleStruct", simpleStructStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$TestClusterClusterSimpleStruct")); + chip::JniClass structJniClass(simpleStructStructClass); + jmethodID simpleStructStructCtor = + env->GetMethodID(simpleStructStructClass, "", + "(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Integer;[BLjava/lang/String;Ljava/lang/" + "Integer;Ljava/lang/Float;Ljava/lang/Double;)V"); + VerifyOrReturn(simpleStructStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$TestClusterClusterSimpleStruct constructor")); + + newElement_0_optionalStruct = env->NewObject( + simpleStructStructClass, simpleStructStructCtor, newElement_0_optionalStruct_a, newElement_0_optionalStruct_b, + newElement_0_optionalStruct_c, newElement_0_optionalStruct_d, newElement_0_optionalStruct_e, + newElement_0_optionalStruct_f, newElement_0_optionalStruct_g, newElement_0_optionalStruct_h); + } + jobject newElement_0_nullableOptionalStruct; + if (!entry_0.nullableOptionalStruct.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_nullableOptionalStruct); + } + else + { + if (entry_0.nullableOptionalStruct.Value().IsNull()) + { + newElement_0_nullableOptionalStruct = nullptr; + } + else + { + jobject newElement_0_nullableOptionalStruct_a; + std::string newElement_0_nullableOptionalStruct_aClassName = "java/lang/Integer"; + std::string newElement_0_nullableOptionalStruct_aCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableOptionalStruct_aClassName.c_str(), + newElement_0_nullableOptionalStruct_aCtorSignature.c_str(), entry_0.nullableOptionalStruct.Value().Value().a, + newElement_0_nullableOptionalStruct_a); + jobject newElement_0_nullableOptionalStruct_b; + std::string newElement_0_nullableOptionalStruct_bClassName = "java/lang/Boolean"; + std::string newElement_0_nullableOptionalStruct_bCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableOptionalStruct_bClassName.c_str(), + newElement_0_nullableOptionalStruct_bCtorSignature.c_str(), entry_0.nullableOptionalStruct.Value().Value().b, + newElement_0_nullableOptionalStruct_b); + jobject newElement_0_nullableOptionalStruct_c; + std::string newElement_0_nullableOptionalStruct_cClassName = "java/lang/Integer"; + std::string newElement_0_nullableOptionalStruct_cCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableOptionalStruct_cClassName.c_str(), + newElement_0_nullableOptionalStruct_cCtorSignature.c_str(), + static_cast(entry_0.nullableOptionalStruct.Value().Value().c), newElement_0_nullableOptionalStruct_c); + jobject newElement_0_nullableOptionalStruct_d; + jbyteArray newElement_0_nullableOptionalStruct_dByteArray = + env->NewByteArray(static_cast(entry_0.nullableOptionalStruct.Value().Value().d.size())); + env->SetByteArrayRegion(newElement_0_nullableOptionalStruct_dByteArray, 0, + static_cast(entry_0.nullableOptionalStruct.Value().Value().d.size()), + reinterpret_cast(entry_0.nullableOptionalStruct.Value().Value().d.data())); + newElement_0_nullableOptionalStruct_d = newElement_0_nullableOptionalStruct_dByteArray; + jobject newElement_0_nullableOptionalStruct_e; + newElement_0_nullableOptionalStruct_e = + env->NewStringUTF(std::string(entry_0.nullableOptionalStruct.Value().Value().e.data(), + entry_0.nullableOptionalStruct.Value().Value().e.size()) + .c_str()); + jobject newElement_0_nullableOptionalStruct_f; + std::string newElement_0_nullableOptionalStruct_fClassName = "java/lang/Integer"; + std::string newElement_0_nullableOptionalStruct_fCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableOptionalStruct_fClassName.c_str(), + newElement_0_nullableOptionalStruct_fCtorSignature.c_str(), + entry_0.nullableOptionalStruct.Value().Value().f.Raw(), newElement_0_nullableOptionalStruct_f); + jobject newElement_0_nullableOptionalStruct_g; + std::string newElement_0_nullableOptionalStruct_gClassName = "java/lang/Float"; + std::string newElement_0_nullableOptionalStruct_gCtorSignature = "(F)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableOptionalStruct_gClassName.c_str(), + newElement_0_nullableOptionalStruct_gCtorSignature.c_str(), entry_0.nullableOptionalStruct.Value().Value().g, + newElement_0_nullableOptionalStruct_g); + jobject newElement_0_nullableOptionalStruct_h; + std::string newElement_0_nullableOptionalStruct_hClassName = "java/lang/Double"; + std::string newElement_0_nullableOptionalStruct_hCtorSignature = "(D)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableOptionalStruct_hClassName.c_str(), + newElement_0_nullableOptionalStruct_hCtorSignature.c_str(), entry_0.nullableOptionalStruct.Value().Value().h, + newElement_0_nullableOptionalStruct_h); + + jclass simpleStructStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$TestClusterClusterSimpleStruct", simpleStructStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$TestClusterClusterSimpleStruct")); + chip::JniClass structJniClass(simpleStructStructClass); + jmethodID simpleStructStructCtor = + env->GetMethodID(simpleStructStructClass, "", + "(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Integer;[BLjava/lang/String;Ljava/lang/" + "Integer;Ljava/lang/Float;Ljava/lang/Double;)V"); + VerifyOrReturn(simpleStructStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$TestClusterClusterSimpleStruct constructor")); + + newElement_0_nullableOptionalStruct = + env->NewObject(simpleStructStructClass, simpleStructStructCtor, newElement_0_nullableOptionalStruct_a, + newElement_0_nullableOptionalStruct_b, newElement_0_nullableOptionalStruct_c, + newElement_0_nullableOptionalStruct_d, newElement_0_nullableOptionalStruct_e, + newElement_0_nullableOptionalStruct_f, newElement_0_nullableOptionalStruct_g, + newElement_0_nullableOptionalStruct_h); + } + } + jobject newElement_0_nullableList; + if (entry_0.nullableList.IsNull()) { - nullableOptionalString = jstring(nullableOptionalStringStr.jniValue()); + newElement_0_nullableList = nullptr; } + else + { + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_nullableList); - jobject nullableOptionalStringOptional = nullptr; - chip::JniReferences::GetInstance().CreateOptional(nullableOptionalString, nullableOptionalStringOptional); + auto iter_newElement_0_nullableList_NaN = entry_0.nullableList.Value().begin(); + while (iter_newElement_0_nullableList_NaN.Next()) + { + auto & entry_NaN = iter_newElement_0_nullableList_NaN.GetValue(); + jobject newElement_NaN; + std::string newElement_NaNClassName = "java/lang/Integer"; + std::string newElement_NaNCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_NaNClassName.c_str(), + newElement_NaNCtorSignature.c_str(), + static_cast(entry_NaN), newElement_NaN); + chip::JniReferences::GetInstance().AddToArrayList(newElement_0_nullableList, newElement_NaN); + } + } + jobject newElement_0_optionalList; + if (!entry_0.optionalList.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_optionalList); + } + else + { + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_optionalList); - jobject attributeObj = - env->NewObject(attributeClass, attributeCtor, nullableInt, optionalIntOptional, nullableOptionalIntOptional, - nullableString, optionalStringOptional, nullableOptionalStringOptional); - VerifyOrReturn(attributeObj != nullptr, - ChipLogError(Zcl, "Could not create ListNullablesAndOptionalsStructAttribute object")); + auto iter_newElement_0_optionalList_NaN = entry_0.optionalList.Value().begin(); + while (iter_newElement_0_optionalList_NaN.Next()) + { + auto & entry_NaN = iter_newElement_0_optionalList_NaN.GetValue(); + jobject newElement_NaN; + std::string newElement_NaNClassName = "java/lang/Integer"; + std::string newElement_NaNCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_NaNClassName.c_str(), + newElement_NaNCtorSignature.c_str(), + static_cast(entry_NaN), newElement_NaN); + chip::JniReferences::GetInstance().AddToArrayList(newElement_0_optionalList, newElement_NaN); + } + } + jobject newElement_0_nullableOptionalList; + if (!entry_0.nullableOptionalList.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_nullableOptionalList); + } + else + { + if (entry_0.nullableOptionalList.Value().IsNull()) + { + newElement_0_nullableOptionalList = nullptr; + } + else + { + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_nullableOptionalList); + + auto iter_newElement_0_nullableOptionalList_NaN = entry_0.nullableOptionalList.Value().Value().begin(); + while (iter_newElement_0_nullableOptionalList_NaN.Next()) + { + auto & entry_NaN = iter_newElement_0_nullableOptionalList_NaN.GetValue(); + jobject newElement_NaN; + std::string newElement_NaNClassName = "java/lang/Integer"; + std::string newElement_NaNCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_NaNClassName.c_str(), + newElement_NaNCtorSignature.c_str(), + static_cast(entry_NaN), newElement_NaN); + chip::JniReferences::GetInstance().AddToArrayList(newElement_0_nullableOptionalList, newElement_NaN); + } + } + } - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jclass nullablesAndOptionalsStructStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$TestClusterClusterNullablesAndOptionalsStruct", + nullablesAndOptionalsStructStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$TestClusterClusterNullablesAndOptionalsStruct")); + chip::JniClass structJniClass(nullablesAndOptionalsStructStructClass); + jmethodID nullablesAndOptionalsStructStructCtor = + env->GetMethodID(nullablesAndOptionalsStructStructClass, "", + "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/lang/String;Ljava/util/" + "Optional;Ljava/util/Optional;Lchip/devicecontroller/ChipStructs$TestClusterClusterSimpleStruct;Ljava/" + "util/Optional;Ljava/util/Optional;Ljava/util/ArrayList;Ljava/util/Optional;Ljava/util/Optional;)V"); + VerifyOrReturn(nullablesAndOptionalsStructStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$TestClusterClusterNullablesAndOptionalsStruct constructor")); + + newElement_0 = env->NewObject(nullablesAndOptionalsStructStructClass, nullablesAndOptionalsStructStructCtor, + newElement_0_nullableInt, newElement_0_optionalInt, newElement_0_nullableOptionalInt, + newElement_0_nullableString, newElement_0_optionalString, newElement_0_nullableOptionalString, + newElement_0_nullableStruct, newElement_0_optionalStruct, newElement_0_nullableOptionalStruct, + newElement_0_nullableList, newElement_0_optionalList, newElement_0_nullableOptionalList); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ListNullablesAndOptionalsStructAttribute value: %" CHIP_ERROR_FORMAT, - iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -10839,40 +9189,24 @@ void CHIPTestClusterListLongOctetStringAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::ByteSpan entryValue = entry; - - jbyteArray entryObject = nullptr; - if (!entryNull) - { - entryObject = env->NewByteArray(entryValue.size()); - env->SetByteArrayRegion(entryObject, 0, entryValue.size(), reinterpret_cast(entryValue.data())); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jbyteArray newElement_0ByteArray = env->NewByteArray(static_cast(entry_0.size())); + env->SetByteArrayRegion(newElement_0ByteArray, 0, static_cast(entry_0.size()), + reinterpret_cast(entry_0.data())); + newElement_0 = newElement_0ByteArray; + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ListLongOctetStringAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -10929,11 +9263,17 @@ void CHIPTestClusterNullableBooleanAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Boolean"; - std::string javaValueCtorSignature = "(Z)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Boolean"; + std::string javaValueCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -10990,11 +9330,17 @@ void CHIPTestClusterNullableBitmap8AttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11051,11 +9397,17 @@ void CHIPTestClusterNullableBitmap16AttributeCallback::CallbackFn(void * context VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11112,11 +9464,17 @@ void CHIPTestClusterNullableBitmap32AttributeCallback::CallbackFn(void * context VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11173,11 +9531,17 @@ void CHIPTestClusterNullableBitmap64AttributeCallback::CallbackFn(void * context VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11232,11 +9596,17 @@ void CHIPTestClusterNullableInt8uAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11293,11 +9663,17 @@ void CHIPTestClusterNullableInt16uAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11354,11 +9730,17 @@ void CHIPTestClusterNullableInt24uAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11415,11 +9797,17 @@ void CHIPTestClusterNullableInt32uAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11476,11 +9864,17 @@ void CHIPTestClusterNullableInt40uAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11537,11 +9931,17 @@ void CHIPTestClusterNullableInt48uAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11598,11 +9998,17 @@ void CHIPTestClusterNullableInt56uAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11659,11 +10065,17 @@ void CHIPTestClusterNullableInt64uAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11717,11 +10129,17 @@ void CHIPTestClusterNullableInt8sAttributeCallback::CallbackFn(void * context, c VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11778,11 +10196,17 @@ void CHIPTestClusterNullableInt16sAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11839,11 +10263,17 @@ void CHIPTestClusterNullableInt24sAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11900,11 +10330,17 @@ void CHIPTestClusterNullableInt32sAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -11961,11 +10397,17 @@ void CHIPTestClusterNullableInt40sAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12022,11 +10464,17 @@ void CHIPTestClusterNullableInt48sAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12083,11 +10531,17 @@ void CHIPTestClusterNullableInt56sAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12144,11 +10598,17 @@ void CHIPTestClusterNullableInt64sAttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Long"; - std::string javaValueCtorSignature = "(J)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12203,11 +10663,17 @@ void CHIPTestClusterNullableEnum8AttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12264,11 +10730,17 @@ void CHIPTestClusterNullableEnum16AttributeCallback::CallbackFn(void * context, VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12325,11 +10797,17 @@ void CHIPTestClusterNullableFloatSingleAttributeCallback::CallbackFn(void * cont VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Float"; - std::string javaValueCtorSignature = "(F)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Float"; + std::string javaValueCtorSignature = "(F)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12386,11 +10864,17 @@ void CHIPTestClusterNullableFloatDoubleAttributeCallback::CallbackFn(void * cont VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Double"; - std::string javaValueCtorSignature = "(D)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Double"; + std::string javaValueCtorSignature = "(D)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12447,9 +10931,17 @@ void CHIPTestClusterNullableOctetStringAttributeCallback::CallbackFn(void * cont VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - chip::ByteArray javaValueByteArray(env, value.Value()); - javaValue = javaValueByteArray.jniValue(); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + jbyteArray javaValueByteArray = env->NewByteArray(static_cast(value.Value().size())); + env->SetByteArrayRegion(javaValueByteArray, 0, static_cast(value.Value().size()), + reinterpret_cast(value.Value().data())); + javaValue = javaValueByteArray; + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12506,9 +10998,14 @@ void CHIPTestClusterNullableCharStringAttributeCallback::CallbackFn(void * conte VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - chip::UtfString javaValueUtfString(env, value.Value()); - javaValue = javaValueUtfString.jniValue(); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + javaValue = env->NewStringUTF(std::string(value.Value().data(), value.Value().size()).c_str()); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12565,11 +11062,17 @@ void CHIPTestClusterNullableEnumAttrAttributeCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - javaValueClassName.c_str(), javaValueCtorSignature.c_str(), value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + static_cast(value.Value()), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12626,11 +11129,17 @@ void CHIPTestClusterNullableRangeRestrictedInt8uAttributeCallback::CallbackFn(vo VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12687,11 +11196,17 @@ void CHIPTestClusterNullableRangeRestrictedInt8sAttributeCallback::CallbackFn(vo VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12748,11 +11263,17 @@ void CHIPTestClusterNullableRangeRestrictedInt16uAttributeCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12809,11 +11330,17 @@ void CHIPTestClusterNullableRangeRestrictedInt16sAttributeCallback::CallbackFn( VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -12864,43 +11391,24 @@ void CHIPTestClusterAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -12952,43 +11460,24 @@ void CHIPThermostatAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -13043,43 +11532,24 @@ void CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback::Cal VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -13135,262 +11605,121 @@ void CHIPThreadNetworkDiagnosticsNeighborTableListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$ThreadNetworkDiagnosticsCluster$NeighborTableListAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError( - Zcl, - "Could not find class chip/devicecontroller/ChipClusters$ThreadNetworkDiagnosticsCluster$NeighborTableListAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = - env->GetMethodID(attributeClass, "", - "(Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/" - "Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/" - "Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find NeighborTableListAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool extAddressNull = false; - bool extAddressHasValue = true; - - uint64_t extAddressValue = entry.extAddress; - - jobject extAddress = nullptr; - if (!extAddressNull && extAddressHasValue) - { - jclass extAddressEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", extAddressEntryCls); - chip::JniClass extAddressJniClass(extAddressEntryCls); - jmethodID extAddressEntryTypeCtor = env->GetMethodID(extAddressEntryCls, "", "(J)V"); - extAddress = env->NewObject(extAddressEntryCls, extAddressEntryTypeCtor, extAddressValue); - } - - bool ageNull = false; - bool ageHasValue = true; - - uint32_t ageValue = entry.age; - - jobject age = nullptr; - if (!ageNull && ageHasValue) - { - jclass ageEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", ageEntryCls); - chip::JniClass ageJniClass(ageEntryCls); - jmethodID ageEntryTypeCtor = env->GetMethodID(ageEntryCls, "", "(J)V"); - age = env->NewObject(ageEntryCls, ageEntryTypeCtor, ageValue); - } - - bool rloc16Null = false; - bool rloc16HasValue = true; - - uint16_t rloc16Value = entry.rloc16; - - jobject rloc16 = nullptr; - if (!rloc16Null && rloc16HasValue) - { - jclass rloc16EntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", rloc16EntryCls); - chip::JniClass rloc16JniClass(rloc16EntryCls); - jmethodID rloc16EntryTypeCtor = env->GetMethodID(rloc16EntryCls, "", "(I)V"); - rloc16 = env->NewObject(rloc16EntryCls, rloc16EntryTypeCtor, rloc16Value); - } - - bool linkFrameCounterNull = false; - bool linkFrameCounterHasValue = true; - - uint32_t linkFrameCounterValue = entry.linkFrameCounter; - - jobject linkFrameCounter = nullptr; - if (!linkFrameCounterNull && linkFrameCounterHasValue) - { - jclass linkFrameCounterEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", linkFrameCounterEntryCls); - chip::JniClass linkFrameCounterJniClass(linkFrameCounterEntryCls); - jmethodID linkFrameCounterEntryTypeCtor = env->GetMethodID(linkFrameCounterEntryCls, "", "(J)V"); - linkFrameCounter = env->NewObject(linkFrameCounterEntryCls, linkFrameCounterEntryTypeCtor, linkFrameCounterValue); - } - - bool mleFrameCounterNull = false; - bool mleFrameCounterHasValue = true; - - uint32_t mleFrameCounterValue = entry.mleFrameCounter; - - jobject mleFrameCounter = nullptr; - if (!mleFrameCounterNull && mleFrameCounterHasValue) - { - jclass mleFrameCounterEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", mleFrameCounterEntryCls); - chip::JniClass mleFrameCounterJniClass(mleFrameCounterEntryCls); - jmethodID mleFrameCounterEntryTypeCtor = env->GetMethodID(mleFrameCounterEntryCls, "", "(J)V"); - mleFrameCounter = env->NewObject(mleFrameCounterEntryCls, mleFrameCounterEntryTypeCtor, mleFrameCounterValue); - } - - bool lqiNull = false; - bool lqiHasValue = true; - - uint8_t lqiValue = entry.lqi; - - jobject lqi = nullptr; - if (!lqiNull && lqiHasValue) - { - jclass lqiEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", lqiEntryCls); - chip::JniClass lqiJniClass(lqiEntryCls); - jmethodID lqiEntryTypeCtor = env->GetMethodID(lqiEntryCls, "", "(I)V"); - lqi = env->NewObject(lqiEntryCls, lqiEntryTypeCtor, lqiValue); - } - - bool averageRssiNull = false; - bool averageRssiHasValue = true; - - int8_t averageRssiValue = entry.averageRssi; - - jobject averageRssi = nullptr; - if (!averageRssiNull && averageRssiHasValue) - { - jclass averageRssiEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", averageRssiEntryCls); - chip::JniClass averageRssiJniClass(averageRssiEntryCls); - jmethodID averageRssiEntryTypeCtor = env->GetMethodID(averageRssiEntryCls, "", "(I)V"); - averageRssi = env->NewObject(averageRssiEntryCls, averageRssiEntryTypeCtor, averageRssiValue); - } - - bool lastRssiNull = false; - bool lastRssiHasValue = true; - - int8_t lastRssiValue = entry.lastRssi; - - jobject lastRssi = nullptr; - if (!lastRssiNull && lastRssiHasValue) - { - jclass lastRssiEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", lastRssiEntryCls); - chip::JniClass lastRssiJniClass(lastRssiEntryCls); - jmethodID lastRssiEntryTypeCtor = env->GetMethodID(lastRssiEntryCls, "", "(I)V"); - lastRssi = env->NewObject(lastRssiEntryCls, lastRssiEntryTypeCtor, lastRssiValue); - } - - bool frameErrorRateNull = false; - bool frameErrorRateHasValue = true; - - uint8_t frameErrorRateValue = entry.frameErrorRate; - - jobject frameErrorRate = nullptr; - if (!frameErrorRateNull && frameErrorRateHasValue) - { - jclass frameErrorRateEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", frameErrorRateEntryCls); - chip::JniClass frameErrorRateJniClass(frameErrorRateEntryCls); - jmethodID frameErrorRateEntryTypeCtor = env->GetMethodID(frameErrorRateEntryCls, "", "(I)V"); - frameErrorRate = env->NewObject(frameErrorRateEntryCls, frameErrorRateEntryTypeCtor, frameErrorRateValue); - } - - bool messageErrorRateNull = false; - bool messageErrorRateHasValue = true; - - uint8_t messageErrorRateValue = entry.messageErrorRate; - - jobject messageErrorRate = nullptr; - if (!messageErrorRateNull && messageErrorRateHasValue) - { - jclass messageErrorRateEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", messageErrorRateEntryCls); - chip::JniClass messageErrorRateJniClass(messageErrorRateEntryCls); - jmethodID messageErrorRateEntryTypeCtor = env->GetMethodID(messageErrorRateEntryCls, "", "(I)V"); - messageErrorRate = env->NewObject(messageErrorRateEntryCls, messageErrorRateEntryTypeCtor, messageErrorRateValue); - } - - bool rxOnWhenIdleNull = false; - bool rxOnWhenIdleHasValue = true; - - bool rxOnWhenIdleValue = entry.rxOnWhenIdle; - - jobject rxOnWhenIdle = nullptr; - if (!rxOnWhenIdleNull && rxOnWhenIdleHasValue) - { - jclass rxOnWhenIdleEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", rxOnWhenIdleEntryCls); - chip::JniClass rxOnWhenIdleJniClass(rxOnWhenIdleEntryCls); - jmethodID rxOnWhenIdleEntryTypeCtor = env->GetMethodID(rxOnWhenIdleEntryCls, "", "(Z)V"); - rxOnWhenIdle = env->NewObject(rxOnWhenIdleEntryCls, rxOnWhenIdleEntryTypeCtor, rxOnWhenIdleValue); - } - - bool fullThreadDeviceNull = false; - bool fullThreadDeviceHasValue = true; - - bool fullThreadDeviceValue = entry.fullThreadDevice; - - jobject fullThreadDevice = nullptr; - if (!fullThreadDeviceNull && fullThreadDeviceHasValue) - { - jclass fullThreadDeviceEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", fullThreadDeviceEntryCls); - chip::JniClass fullThreadDeviceJniClass(fullThreadDeviceEntryCls); - jmethodID fullThreadDeviceEntryTypeCtor = env->GetMethodID(fullThreadDeviceEntryCls, "", "(Z)V"); - fullThreadDevice = env->NewObject(fullThreadDeviceEntryCls, fullThreadDeviceEntryTypeCtor, fullThreadDeviceValue); - } - - bool fullNetworkDataNull = false; - bool fullNetworkDataHasValue = true; - - bool fullNetworkDataValue = entry.fullNetworkData; - - jobject fullNetworkData = nullptr; - if (!fullNetworkDataNull && fullNetworkDataHasValue) - { - jclass fullNetworkDataEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", fullNetworkDataEntryCls); - chip::JniClass fullNetworkDataJniClass(fullNetworkDataEntryCls); - jmethodID fullNetworkDataEntryTypeCtor = env->GetMethodID(fullNetworkDataEntryCls, "", "(Z)V"); - fullNetworkData = env->NewObject(fullNetworkDataEntryCls, fullNetworkDataEntryTypeCtor, fullNetworkDataValue); - } - - bool isChildNull = false; - bool isChildHasValue = true; - - bool isChildValue = entry.isChild; - - jobject isChild = nullptr; - if (!isChildNull && isChildHasValue) - { - jclass isChildEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", isChildEntryCls); - chip::JniClass isChildJniClass(isChildEntryCls); - jmethodID isChildEntryTypeCtor = env->GetMethodID(isChildEntryCls, "", "(Z)V"); - isChild = env->NewObject(isChildEntryCls, isChildEntryTypeCtor, isChildValue); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, extAddress, age, rloc16, linkFrameCounter, - mleFrameCounter, lqi, averageRssi, lastRssi, frameErrorRate, messageErrorRate, - rxOnWhenIdle, fullThreadDevice, fullNetworkData, isChild); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create NeighborTableListAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_extAddress; + std::string newElement_0_extAddressClassName = "java/lang/Long"; + std::string newElement_0_extAddressCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_extAddressClassName.c_str(), + newElement_0_extAddressCtorSignature.c_str(), + entry_0.extAddress, newElement_0_extAddress); + jobject newElement_0_age; + std::string newElement_0_ageClassName = "java/lang/Long"; + std::string newElement_0_ageCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_ageClassName.c_str(), newElement_0_ageCtorSignature.c_str(), entry_0.age, newElement_0_age); + jobject newElement_0_rloc16; + std::string newElement_0_rloc16ClassName = "java/lang/Integer"; + std::string newElement_0_rloc16CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_rloc16ClassName.c_str(), newElement_0_rloc16CtorSignature.c_str(), entry_0.rloc16, newElement_0_rloc16); + jobject newElement_0_linkFrameCounter; + std::string newElement_0_linkFrameCounterClassName = "java/lang/Long"; + std::string newElement_0_linkFrameCounterCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_linkFrameCounterClassName.c_str(), + newElement_0_linkFrameCounterCtorSignature.c_str(), + entry_0.linkFrameCounter, newElement_0_linkFrameCounter); + jobject newElement_0_mleFrameCounter; + std::string newElement_0_mleFrameCounterClassName = "java/lang/Long"; + std::string newElement_0_mleFrameCounterCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_mleFrameCounterClassName.c_str(), + newElement_0_mleFrameCounterCtorSignature.c_str(), + entry_0.mleFrameCounter, newElement_0_mleFrameCounter); + jobject newElement_0_lqi; + std::string newElement_0_lqiClassName = "java/lang/Integer"; + std::string newElement_0_lqiCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_lqiClassName.c_str(), newElement_0_lqiCtorSignature.c_str(), entry_0.lqi, newElement_0_lqi); + jobject newElement_0_averageRssi; + std::string newElement_0_averageRssiClassName = "java/lang/Integer"; + std::string newElement_0_averageRssiCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_averageRssiClassName.c_str(), + newElement_0_averageRssiCtorSignature.c_str(), + entry_0.averageRssi, newElement_0_averageRssi); + jobject newElement_0_lastRssi; + std::string newElement_0_lastRssiClassName = "java/lang/Integer"; + std::string newElement_0_lastRssiCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_lastRssiClassName.c_str(), + newElement_0_lastRssiCtorSignature.c_str(), entry_0.lastRssi, + newElement_0_lastRssi); + jobject newElement_0_frameErrorRate; + std::string newElement_0_frameErrorRateClassName = "java/lang/Integer"; + std::string newElement_0_frameErrorRateCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_frameErrorRateClassName.c_str(), + newElement_0_frameErrorRateCtorSignature.c_str(), + entry_0.frameErrorRate, newElement_0_frameErrorRate); + jobject newElement_0_messageErrorRate; + std::string newElement_0_messageErrorRateClassName = "java/lang/Integer"; + std::string newElement_0_messageErrorRateCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_messageErrorRateClassName.c_str(), + newElement_0_messageErrorRateCtorSignature.c_str(), + entry_0.messageErrorRate, newElement_0_messageErrorRate); + jobject newElement_0_rxOnWhenIdle; + std::string newElement_0_rxOnWhenIdleClassName = "java/lang/Boolean"; + std::string newElement_0_rxOnWhenIdleCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_rxOnWhenIdleClassName.c_str(), + newElement_0_rxOnWhenIdleCtorSignature.c_str(), + entry_0.rxOnWhenIdle, newElement_0_rxOnWhenIdle); + jobject newElement_0_fullThreadDevice; + std::string newElement_0_fullThreadDeviceClassName = "java/lang/Boolean"; + std::string newElement_0_fullThreadDeviceCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fullThreadDeviceClassName.c_str(), + newElement_0_fullThreadDeviceCtorSignature.c_str(), + entry_0.fullThreadDevice, newElement_0_fullThreadDevice); + jobject newElement_0_fullNetworkData; + std::string newElement_0_fullNetworkDataClassName = "java/lang/Boolean"; + std::string newElement_0_fullNetworkDataCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fullNetworkDataClassName.c_str(), + newElement_0_fullNetworkDataCtorSignature.c_str(), + entry_0.fullNetworkData, newElement_0_fullNetworkData); + jobject newElement_0_isChild; + std::string newElement_0_isChildClassName = "java/lang/Boolean"; + std::string newElement_0_isChildCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_isChildClassName.c_str(), + newElement_0_isChildCtorSignature.c_str(), entry_0.isChild, + newElement_0_isChild); + + jclass neighborTableStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ThreadNetworkDiagnosticsClusterNeighborTable", neighborTableStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$ThreadNetworkDiagnosticsClusterNeighborTable")); + chip::JniClass structJniClass(neighborTableStructClass); + jmethodID neighborTableStructCtor = + env->GetMethodID(neighborTableStructClass, "", + "(Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/" + "Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/" + "Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)V"); + VerifyOrReturn(neighborTableStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$ThreadNetworkDiagnosticsClusterNeighborTable constructor")); + + newElement_0 = env->NewObject(neighborTableStructClass, neighborTableStructCtor, newElement_0_extAddress, newElement_0_age, + newElement_0_rloc16, newElement_0_linkFrameCounter, newElement_0_mleFrameCounter, + newElement_0_lqi, newElement_0_averageRssi, newElement_0_lastRssi, + newElement_0_frameErrorRate, newElement_0_messageErrorRate, newElement_0_rxOnWhenIdle, + newElement_0_fullThreadDevice, newElement_0_fullNetworkData, newElement_0_isChild); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding NeighborTableListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -13446,200 +11775,93 @@ void CHIPThreadNetworkDiagnosticsRouteTableListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$ThreadNetworkDiagnosticsCluster$RouteTableListAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError( - Zcl, - "Could not find class chip/devicecontroller/ChipClusters$ThreadNetworkDiagnosticsCluster$RouteTableListAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = - env->GetMethodID(attributeClass, "", - "(Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/" - "Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Boolean;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find RouteTableListAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool extAddressNull = false; - bool extAddressHasValue = true; - - uint64_t extAddressValue = entry.extAddress; - - jobject extAddress = nullptr; - if (!extAddressNull && extAddressHasValue) - { - jclass extAddressEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", extAddressEntryCls); - chip::JniClass extAddressJniClass(extAddressEntryCls); - jmethodID extAddressEntryTypeCtor = env->GetMethodID(extAddressEntryCls, "", "(J)V"); - extAddress = env->NewObject(extAddressEntryCls, extAddressEntryTypeCtor, extAddressValue); - } - - bool rloc16Null = false; - bool rloc16HasValue = true; - - uint16_t rloc16Value = entry.rloc16; - - jobject rloc16 = nullptr; - if (!rloc16Null && rloc16HasValue) - { - jclass rloc16EntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", rloc16EntryCls); - chip::JniClass rloc16JniClass(rloc16EntryCls); - jmethodID rloc16EntryTypeCtor = env->GetMethodID(rloc16EntryCls, "", "(I)V"); - rloc16 = env->NewObject(rloc16EntryCls, rloc16EntryTypeCtor, rloc16Value); - } - - bool routerIdNull = false; - bool routerIdHasValue = true; - - uint8_t routerIdValue = entry.routerId; - - jobject routerId = nullptr; - if (!routerIdNull && routerIdHasValue) - { - jclass routerIdEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", routerIdEntryCls); - chip::JniClass routerIdJniClass(routerIdEntryCls); - jmethodID routerIdEntryTypeCtor = env->GetMethodID(routerIdEntryCls, "", "(I)V"); - routerId = env->NewObject(routerIdEntryCls, routerIdEntryTypeCtor, routerIdValue); - } - - bool nextHopNull = false; - bool nextHopHasValue = true; - - uint8_t nextHopValue = entry.nextHop; - - jobject nextHop = nullptr; - if (!nextHopNull && nextHopHasValue) - { - jclass nextHopEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", nextHopEntryCls); - chip::JniClass nextHopJniClass(nextHopEntryCls); - jmethodID nextHopEntryTypeCtor = env->GetMethodID(nextHopEntryCls, "", "(I)V"); - nextHop = env->NewObject(nextHopEntryCls, nextHopEntryTypeCtor, nextHopValue); - } - - bool pathCostNull = false; - bool pathCostHasValue = true; - - uint8_t pathCostValue = entry.pathCost; - - jobject pathCost = nullptr; - if (!pathCostNull && pathCostHasValue) - { - jclass pathCostEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", pathCostEntryCls); - chip::JniClass pathCostJniClass(pathCostEntryCls); - jmethodID pathCostEntryTypeCtor = env->GetMethodID(pathCostEntryCls, "", "(I)V"); - pathCost = env->NewObject(pathCostEntryCls, pathCostEntryTypeCtor, pathCostValue); - } - - bool LQIInNull = false; - bool LQIInHasValue = true; - - uint8_t LQIInValue = entry.LQIIn; - - jobject LQIIn = nullptr; - if (!LQIInNull && LQIInHasValue) - { - jclass LQIInEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", LQIInEntryCls); - chip::JniClass LQIInJniClass(LQIInEntryCls); - jmethodID LQIInEntryTypeCtor = env->GetMethodID(LQIInEntryCls, "", "(I)V"); - LQIIn = env->NewObject(LQIInEntryCls, LQIInEntryTypeCtor, LQIInValue); - } - - bool LQIOutNull = false; - bool LQIOutHasValue = true; - - uint8_t LQIOutValue = entry.LQIOut; - - jobject LQIOut = nullptr; - if (!LQIOutNull && LQIOutHasValue) - { - jclass LQIOutEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", LQIOutEntryCls); - chip::JniClass LQIOutJniClass(LQIOutEntryCls); - jmethodID LQIOutEntryTypeCtor = env->GetMethodID(LQIOutEntryCls, "", "(I)V"); - LQIOut = env->NewObject(LQIOutEntryCls, LQIOutEntryTypeCtor, LQIOutValue); - } - - bool ageNull = false; - bool ageHasValue = true; - - uint8_t ageValue = entry.age; - - jobject age = nullptr; - if (!ageNull && ageHasValue) - { - jclass ageEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", ageEntryCls); - chip::JniClass ageJniClass(ageEntryCls); - jmethodID ageEntryTypeCtor = env->GetMethodID(ageEntryCls, "", "(I)V"); - age = env->NewObject(ageEntryCls, ageEntryTypeCtor, ageValue); - } - - bool allocatedNull = false; - bool allocatedHasValue = true; - - bool allocatedValue = entry.allocated; - - jobject allocated = nullptr; - if (!allocatedNull && allocatedHasValue) - { - jclass allocatedEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", allocatedEntryCls); - chip::JniClass allocatedJniClass(allocatedEntryCls); - jmethodID allocatedEntryTypeCtor = env->GetMethodID(allocatedEntryCls, "", "(Z)V"); - allocated = env->NewObject(allocatedEntryCls, allocatedEntryTypeCtor, allocatedValue); - } - - bool linkEstablishedNull = false; - bool linkEstablishedHasValue = true; - - bool linkEstablishedValue = entry.linkEstablished; - - jobject linkEstablished = nullptr; - if (!linkEstablishedNull && linkEstablishedHasValue) - { - jclass linkEstablishedEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", linkEstablishedEntryCls); - chip::JniClass linkEstablishedJniClass(linkEstablishedEntryCls); - jmethodID linkEstablishedEntryTypeCtor = env->GetMethodID(linkEstablishedEntryCls, "", "(Z)V"); - linkEstablished = env->NewObject(linkEstablishedEntryCls, linkEstablishedEntryTypeCtor, linkEstablishedValue); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, extAddress, rloc16, routerId, nextHop, pathCost, LQIIn, - LQIOut, age, allocated, linkEstablished); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create RouteTableListAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_extAddress; + std::string newElement_0_extAddressClassName = "java/lang/Long"; + std::string newElement_0_extAddressCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_extAddressClassName.c_str(), + newElement_0_extAddressCtorSignature.c_str(), + entry_0.extAddress, newElement_0_extAddress); + jobject newElement_0_rloc16; + std::string newElement_0_rloc16ClassName = "java/lang/Integer"; + std::string newElement_0_rloc16CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_rloc16ClassName.c_str(), newElement_0_rloc16CtorSignature.c_str(), entry_0.rloc16, newElement_0_rloc16); + jobject newElement_0_routerId; + std::string newElement_0_routerIdClassName = "java/lang/Integer"; + std::string newElement_0_routerIdCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_routerIdClassName.c_str(), + newElement_0_routerIdCtorSignature.c_str(), entry_0.routerId, + newElement_0_routerId); + jobject newElement_0_nextHop; + std::string newElement_0_nextHopClassName = "java/lang/Integer"; + std::string newElement_0_nextHopCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_nextHopClassName.c_str(), + newElement_0_nextHopCtorSignature.c_str(), entry_0.nextHop, + newElement_0_nextHop); + jobject newElement_0_pathCost; + std::string newElement_0_pathCostClassName = "java/lang/Integer"; + std::string newElement_0_pathCostCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_pathCostClassName.c_str(), + newElement_0_pathCostCtorSignature.c_str(), entry_0.pathCost, + newElement_0_pathCost); + jobject newElement_0_LQIIn; + std::string newElement_0_LQIInClassName = "java/lang/Integer"; + std::string newElement_0_LQIInCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_LQIInClassName.c_str(), newElement_0_LQIInCtorSignature.c_str(), entry_0.LQIIn, newElement_0_LQIIn); + jobject newElement_0_LQIOut; + std::string newElement_0_LQIOutClassName = "java/lang/Integer"; + std::string newElement_0_LQIOutCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_LQIOutClassName.c_str(), newElement_0_LQIOutCtorSignature.c_str(), entry_0.LQIOut, newElement_0_LQIOut); + jobject newElement_0_age; + std::string newElement_0_ageClassName = "java/lang/Integer"; + std::string newElement_0_ageCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_ageClassName.c_str(), newElement_0_ageCtorSignature.c_str(), entry_0.age, newElement_0_age); + jobject newElement_0_allocated; + std::string newElement_0_allocatedClassName = "java/lang/Boolean"; + std::string newElement_0_allocatedCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_allocatedClassName.c_str(), + newElement_0_allocatedCtorSignature.c_str(), entry_0.allocated, + newElement_0_allocated); + jobject newElement_0_linkEstablished; + std::string newElement_0_linkEstablishedClassName = "java/lang/Boolean"; + std::string newElement_0_linkEstablishedCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_linkEstablishedClassName.c_str(), + newElement_0_linkEstablishedCtorSignature.c_str(), + entry_0.linkEstablished, newElement_0_linkEstablished); + + jclass routeTableStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ThreadNetworkDiagnosticsClusterRouteTable", routeTableStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$ThreadNetworkDiagnosticsClusterRouteTable")); + chip::JniClass structJniClass(routeTableStructClass); + jmethodID routeTableStructCtor = + env->GetMethodID(routeTableStructClass, "", + "(Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/" + "lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Boolean;)V"); + VerifyOrReturn(routeTableStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$ThreadNetworkDiagnosticsClusterRouteTable constructor")); + + newElement_0 = env->NewObject(routeTableStructClass, routeTableStructCtor, newElement_0_extAddress, newElement_0_rloc16, + newElement_0_routerId, newElement_0_nextHop, newElement_0_pathCost, newElement_0_LQIIn, + newElement_0_LQIOut, newElement_0_age, newElement_0_allocated, newElement_0_linkEstablished); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding RouteTableListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -13695,76 +11917,45 @@ void CHIPThreadNetworkDiagnosticsSecurityPolicyAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$ThreadNetworkDiagnosticsCluster$SecurityPolicyAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError( - Zcl, - "Could not find class chip/devicecontroller/ChipClusters$ThreadNetworkDiagnosticsCluster$SecurityPolicyAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(Ljava/lang/Integer;Ljava/lang/Integer;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find SecurityPolicyAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool rotationTimeNull = false; - bool rotationTimeHasValue = true; - - uint16_t rotationTimeValue = entry.rotationTime; - - jobject rotationTime = nullptr; - if (!rotationTimeNull && rotationTimeHasValue) - { - jclass rotationTimeEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", rotationTimeEntryCls); - chip::JniClass rotationTimeJniClass(rotationTimeEntryCls); - jmethodID rotationTimeEntryTypeCtor = env->GetMethodID(rotationTimeEntryCls, "", "(I)V"); - rotationTime = env->NewObject(rotationTimeEntryCls, rotationTimeEntryTypeCtor, rotationTimeValue); - } - - bool flagsNull = false; - bool flagsHasValue = true; - - uint16_t flagsValue = entry.flags; - - jobject flags = nullptr; - if (!flagsNull && flagsHasValue) - { - jclass flagsEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", flagsEntryCls); - chip::JniClass flagsJniClass(flagsEntryCls); - jmethodID flagsEntryTypeCtor = env->GetMethodID(flagsEntryCls, "", "(I)V"); - flags = env->NewObject(flagsEntryCls, flagsEntryTypeCtor, flagsValue); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, rotationTime, flags); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create SecurityPolicyAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_rotationTime; + std::string newElement_0_rotationTimeClassName = "java/lang/Integer"; + std::string newElement_0_rotationTimeCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_rotationTimeClassName.c_str(), + newElement_0_rotationTimeCtorSignature.c_str(), + entry_0.rotationTime, newElement_0_rotationTime); + jobject newElement_0_flags; + std::string newElement_0_flagsClassName = "java/lang/Integer"; + std::string newElement_0_flagsCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_flagsClassName.c_str(), newElement_0_flagsCtorSignature.c_str(), entry_0.flags, newElement_0_flags); + + jclass securityPolicyStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ThreadNetworkDiagnosticsClusterSecurityPolicy", securityPolicyStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$ThreadNetworkDiagnosticsClusterSecurityPolicy")); + chip::JniClass structJniClass(securityPolicyStructClass); + jmethodID securityPolicyStructCtor = + env->GetMethodID(securityPolicyStructClass, "", "(Ljava/lang/Integer;Ljava/lang/Integer;)V"); + VerifyOrReturn(securityPolicyStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$ThreadNetworkDiagnosticsClusterSecurityPolicy constructor")); + + newElement_0 = + env->NewObject(securityPolicyStructClass, securityPolicyStructCtor, newElement_0_rotationTime, newElement_0_flags); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding SecurityPolicyAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -13822,240 +12013,117 @@ void CHIPThreadNetworkDiagnosticsOperationalDatasetComponentsAttributeCallback:: VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$ThreadNetworkDiagnosticsCluster$OperationalDatasetComponentsAttribute", - attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, - "Could not find class " - "chip/devicecontroller/ChipClusters$ThreadNetworkDiagnosticsCluster$OperationalDatasetComponentsAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID( - attributeClass, "", - "(Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/" - "lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find OperationalDatasetComponentsAttribute constructor")); - - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - (void) entry; - bool activeTimestampPresentNull = false; - bool activeTimestampPresentHasValue = true; - - bool activeTimestampPresentValue = entry.activeTimestampPresent; - - jobject activeTimestampPresent = nullptr; - if (!activeTimestampPresentNull && activeTimestampPresentHasValue) - { - jclass activeTimestampPresentEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", activeTimestampPresentEntryCls); - chip::JniClass activeTimestampPresentJniClass(activeTimestampPresentEntryCls); - jmethodID activeTimestampPresentEntryTypeCtor = env->GetMethodID(activeTimestampPresentEntryCls, "", "(Z)V"); - activeTimestampPresent = - env->NewObject(activeTimestampPresentEntryCls, activeTimestampPresentEntryTypeCtor, activeTimestampPresentValue); - } - - bool pendingTimestampPresentNull = false; - bool pendingTimestampPresentHasValue = true; - - bool pendingTimestampPresentValue = entry.pendingTimestampPresent; - - jobject pendingTimestampPresent = nullptr; - if (!pendingTimestampPresentNull && pendingTimestampPresentHasValue) - { - jclass pendingTimestampPresentEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", pendingTimestampPresentEntryCls); - chip::JniClass pendingTimestampPresentJniClass(pendingTimestampPresentEntryCls); - jmethodID pendingTimestampPresentEntryTypeCtor = env->GetMethodID(pendingTimestampPresentEntryCls, "", "(Z)V"); - pendingTimestampPresent = - env->NewObject(pendingTimestampPresentEntryCls, pendingTimestampPresentEntryTypeCtor, pendingTimestampPresentValue); - } - - bool masterKeyPresentNull = false; - bool masterKeyPresentHasValue = true; - - bool masterKeyPresentValue = entry.masterKeyPresent; - - jobject masterKeyPresent = nullptr; - if (!masterKeyPresentNull && masterKeyPresentHasValue) - { - jclass masterKeyPresentEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", masterKeyPresentEntryCls); - chip::JniClass masterKeyPresentJniClass(masterKeyPresentEntryCls); - jmethodID masterKeyPresentEntryTypeCtor = env->GetMethodID(masterKeyPresentEntryCls, "", "(Z)V"); - masterKeyPresent = env->NewObject(masterKeyPresentEntryCls, masterKeyPresentEntryTypeCtor, masterKeyPresentValue); - } - - bool networkNamePresentNull = false; - bool networkNamePresentHasValue = true; - - bool networkNamePresentValue = entry.networkNamePresent; - - jobject networkNamePresent = nullptr; - if (!networkNamePresentNull && networkNamePresentHasValue) - { - jclass networkNamePresentEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", networkNamePresentEntryCls); - chip::JniClass networkNamePresentJniClass(networkNamePresentEntryCls); - jmethodID networkNamePresentEntryTypeCtor = env->GetMethodID(networkNamePresentEntryCls, "", "(Z)V"); - networkNamePresent = - env->NewObject(networkNamePresentEntryCls, networkNamePresentEntryTypeCtor, networkNamePresentValue); - } - - bool extendedPanIdPresentNull = false; - bool extendedPanIdPresentHasValue = true; - - bool extendedPanIdPresentValue = entry.extendedPanIdPresent; - - jobject extendedPanIdPresent = nullptr; - if (!extendedPanIdPresentNull && extendedPanIdPresentHasValue) - { - jclass extendedPanIdPresentEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", extendedPanIdPresentEntryCls); - chip::JniClass extendedPanIdPresentJniClass(extendedPanIdPresentEntryCls); - jmethodID extendedPanIdPresentEntryTypeCtor = env->GetMethodID(extendedPanIdPresentEntryCls, "", "(Z)V"); - extendedPanIdPresent = - env->NewObject(extendedPanIdPresentEntryCls, extendedPanIdPresentEntryTypeCtor, extendedPanIdPresentValue); - } - - bool meshLocalPrefixPresentNull = false; - bool meshLocalPrefixPresentHasValue = true; - - bool meshLocalPrefixPresentValue = entry.meshLocalPrefixPresent; - - jobject meshLocalPrefixPresent = nullptr; - if (!meshLocalPrefixPresentNull && meshLocalPrefixPresentHasValue) - { - jclass meshLocalPrefixPresentEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", meshLocalPrefixPresentEntryCls); - chip::JniClass meshLocalPrefixPresentJniClass(meshLocalPrefixPresentEntryCls); - jmethodID meshLocalPrefixPresentEntryTypeCtor = env->GetMethodID(meshLocalPrefixPresentEntryCls, "", "(Z)V"); - meshLocalPrefixPresent = - env->NewObject(meshLocalPrefixPresentEntryCls, meshLocalPrefixPresentEntryTypeCtor, meshLocalPrefixPresentValue); - } - - bool delayPresentNull = false; - bool delayPresentHasValue = true; - - bool delayPresentValue = entry.delayPresent; - - jobject delayPresent = nullptr; - if (!delayPresentNull && delayPresentHasValue) - { - jclass delayPresentEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", delayPresentEntryCls); - chip::JniClass delayPresentJniClass(delayPresentEntryCls); - jmethodID delayPresentEntryTypeCtor = env->GetMethodID(delayPresentEntryCls, "", "(Z)V"); - delayPresent = env->NewObject(delayPresentEntryCls, delayPresentEntryTypeCtor, delayPresentValue); - } - - bool panIdPresentNull = false; - bool panIdPresentHasValue = true; - - bool panIdPresentValue = entry.panIdPresent; - - jobject panIdPresent = nullptr; - if (!panIdPresentNull && panIdPresentHasValue) - { - jclass panIdPresentEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", panIdPresentEntryCls); - chip::JniClass panIdPresentJniClass(panIdPresentEntryCls); - jmethodID panIdPresentEntryTypeCtor = env->GetMethodID(panIdPresentEntryCls, "", "(Z)V"); - panIdPresent = env->NewObject(panIdPresentEntryCls, panIdPresentEntryTypeCtor, panIdPresentValue); - } - - bool channelPresentNull = false; - bool channelPresentHasValue = true; - - bool channelPresentValue = entry.channelPresent; - - jobject channelPresent = nullptr; - if (!channelPresentNull && channelPresentHasValue) - { - jclass channelPresentEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", channelPresentEntryCls); - chip::JniClass channelPresentJniClass(channelPresentEntryCls); - jmethodID channelPresentEntryTypeCtor = env->GetMethodID(channelPresentEntryCls, "", "(Z)V"); - channelPresent = env->NewObject(channelPresentEntryCls, channelPresentEntryTypeCtor, channelPresentValue); - } - - bool pskcPresentNull = false; - bool pskcPresentHasValue = true; - - bool pskcPresentValue = entry.pskcPresent; - - jobject pskcPresent = nullptr; - if (!pskcPresentNull && pskcPresentHasValue) - { - jclass pskcPresentEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", pskcPresentEntryCls); - chip::JniClass pskcPresentJniClass(pskcPresentEntryCls); - jmethodID pskcPresentEntryTypeCtor = env->GetMethodID(pskcPresentEntryCls, "", "(Z)V"); - pskcPresent = env->NewObject(pskcPresentEntryCls, pskcPresentEntryTypeCtor, pskcPresentValue); - } - - bool securityPolicyPresentNull = false; - bool securityPolicyPresentHasValue = true; - - bool securityPolicyPresentValue = entry.securityPolicyPresent; - - jobject securityPolicyPresent = nullptr; - if (!securityPolicyPresentNull && securityPolicyPresentHasValue) - { - jclass securityPolicyPresentEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", securityPolicyPresentEntryCls); - chip::JniClass securityPolicyPresentJniClass(securityPolicyPresentEntryCls); - jmethodID securityPolicyPresentEntryTypeCtor = env->GetMethodID(securityPolicyPresentEntryCls, "", "(Z)V"); - securityPolicyPresent = - env->NewObject(securityPolicyPresentEntryCls, securityPolicyPresentEntryTypeCtor, securityPolicyPresentValue); - } - - bool channelMaskPresentNull = false; - bool channelMaskPresentHasValue = true; - - bool channelMaskPresentValue = entry.channelMaskPresent; - - jobject channelMaskPresent = nullptr; - if (!channelMaskPresentNull && channelMaskPresentHasValue) - { - jclass channelMaskPresentEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Boolean", channelMaskPresentEntryCls); - chip::JniClass channelMaskPresentJniClass(channelMaskPresentEntryCls); - jmethodID channelMaskPresentEntryTypeCtor = env->GetMethodID(channelMaskPresentEntryCls, "", "(Z)V"); - channelMaskPresent = - env->NewObject(channelMaskPresentEntryCls, channelMaskPresentEntryTypeCtor, channelMaskPresentValue); - } - - jobject attributeObj = - env->NewObject(attributeClass, attributeCtor, activeTimestampPresent, pendingTimestampPresent, masterKeyPresent, - networkNamePresent, extendedPanIdPresent, meshLocalPrefixPresent, delayPresent, panIdPresent, - channelPresent, pskcPresent, securityPolicyPresent, channelMaskPresent); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create OperationalDatasetComponentsAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_activeTimestampPresent; + std::string newElement_0_activeTimestampPresentClassName = "java/lang/Boolean"; + std::string newElement_0_activeTimestampPresentCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_activeTimestampPresentClassName.c_str(), newElement_0_activeTimestampPresentCtorSignature.c_str(), + entry_0.activeTimestampPresent, newElement_0_activeTimestampPresent); + jobject newElement_0_pendingTimestampPresent; + std::string newElement_0_pendingTimestampPresentClassName = "java/lang/Boolean"; + std::string newElement_0_pendingTimestampPresentCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_pendingTimestampPresentClassName.c_str(), newElement_0_pendingTimestampPresentCtorSignature.c_str(), + entry_0.pendingTimestampPresent, newElement_0_pendingTimestampPresent); + jobject newElement_0_masterKeyPresent; + std::string newElement_0_masterKeyPresentClassName = "java/lang/Boolean"; + std::string newElement_0_masterKeyPresentCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_masterKeyPresentClassName.c_str(), + newElement_0_masterKeyPresentCtorSignature.c_str(), + entry_0.masterKeyPresent, newElement_0_masterKeyPresent); + jobject newElement_0_networkNamePresent; + std::string newElement_0_networkNamePresentClassName = "java/lang/Boolean"; + std::string newElement_0_networkNamePresentCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_networkNamePresentClassName.c_str(), + newElement_0_networkNamePresentCtorSignature.c_str(), + entry_0.networkNamePresent, newElement_0_networkNamePresent); + jobject newElement_0_extendedPanIdPresent; + std::string newElement_0_extendedPanIdPresentClassName = "java/lang/Boolean"; + std::string newElement_0_extendedPanIdPresentCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_extendedPanIdPresentClassName.c_str(), + newElement_0_extendedPanIdPresentCtorSignature.c_str(), + entry_0.extendedPanIdPresent, newElement_0_extendedPanIdPresent); + jobject newElement_0_meshLocalPrefixPresent; + std::string newElement_0_meshLocalPrefixPresentClassName = "java/lang/Boolean"; + std::string newElement_0_meshLocalPrefixPresentCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_meshLocalPrefixPresentClassName.c_str(), newElement_0_meshLocalPrefixPresentCtorSignature.c_str(), + entry_0.meshLocalPrefixPresent, newElement_0_meshLocalPrefixPresent); + jobject newElement_0_delayPresent; + std::string newElement_0_delayPresentClassName = "java/lang/Boolean"; + std::string newElement_0_delayPresentCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_delayPresentClassName.c_str(), + newElement_0_delayPresentCtorSignature.c_str(), + entry_0.delayPresent, newElement_0_delayPresent); + jobject newElement_0_panIdPresent; + std::string newElement_0_panIdPresentClassName = "java/lang/Boolean"; + std::string newElement_0_panIdPresentCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_panIdPresentClassName.c_str(), + newElement_0_panIdPresentCtorSignature.c_str(), + entry_0.panIdPresent, newElement_0_panIdPresent); + jobject newElement_0_channelPresent; + std::string newElement_0_channelPresentClassName = "java/lang/Boolean"; + std::string newElement_0_channelPresentCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_channelPresentClassName.c_str(), + newElement_0_channelPresentCtorSignature.c_str(), + entry_0.channelPresent, newElement_0_channelPresent); + jobject newElement_0_pskcPresent; + std::string newElement_0_pskcPresentClassName = "java/lang/Boolean"; + std::string newElement_0_pskcPresentCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_pskcPresentClassName.c_str(), + newElement_0_pskcPresentCtorSignature.c_str(), + entry_0.pskcPresent, newElement_0_pskcPresent); + jobject newElement_0_securityPolicyPresent; + std::string newElement_0_securityPolicyPresentClassName = "java/lang/Boolean"; + std::string newElement_0_securityPolicyPresentCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_securityPolicyPresentClassName.c_str(), newElement_0_securityPolicyPresentCtorSignature.c_str(), + entry_0.securityPolicyPresent, newElement_0_securityPolicyPresent); + jobject newElement_0_channelMaskPresent; + std::string newElement_0_channelMaskPresentClassName = "java/lang/Boolean"; + std::string newElement_0_channelMaskPresentCtorSignature = "(Z)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_channelMaskPresentClassName.c_str(), + newElement_0_channelMaskPresentCtorSignature.c_str(), + entry_0.channelMaskPresent, newElement_0_channelMaskPresent); + + jclass operationalDatasetComponentsStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ThreadNetworkDiagnosticsClusterOperationalDatasetComponents", + operationalDatasetComponentsStructClass); + VerifyOrReturn( + err == CHIP_NO_ERROR, + ChipLogError(Zcl, "Could not find class ChipStructs$ThreadNetworkDiagnosticsClusterOperationalDatasetComponents")); + chip::JniClass structJniClass(operationalDatasetComponentsStructClass); + jmethodID operationalDatasetComponentsStructCtor = + env->GetMethodID(operationalDatasetComponentsStructClass, "", + "(Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/" + "Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/" + "Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)V"); + VerifyOrReturn( + operationalDatasetComponentsStructCtor != nullptr, + ChipLogError(Zcl, + "Could not find ChipStructs$ThreadNetworkDiagnosticsClusterOperationalDatasetComponents constructor")); + + newElement_0 = + env->NewObject(operationalDatasetComponentsStructClass, operationalDatasetComponentsStructCtor, + newElement_0_activeTimestampPresent, newElement_0_pendingTimestampPresent, newElement_0_masterKeyPresent, + newElement_0_networkNamePresent, newElement_0_extendedPanIdPresent, newElement_0_meshLocalPrefixPresent, + newElement_0_delayPresent, newElement_0_panIdPresent, newElement_0_channelPresent, + newElement_0_pskcPresent, newElement_0_securityPolicyPresent, newElement_0_channelMaskPresent); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding OperationalDatasetComponentsAttribute value: %" CHIP_ERROR_FORMAT, - iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -14110,43 +12178,24 @@ void CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback::Callb VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::app::Clusters::ThreadNetworkDiagnostics::NetworkFault entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(I)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), static_cast(entry_0), newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding ActiveNetworkFaultsListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -14200,43 +12249,24 @@ void CHIPThreadNetworkDiagnosticsAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -14289,67 +12319,36 @@ void CHIPUserLabelLabelListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - jclass attributeClass; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$UserLabelCluster$LabelListAttribute", attributeClass); - VerifyOrReturn( - err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$UserLabelCluster$LabelListAttribute")); - chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(Ljava/lang/String;Ljava/lang/String;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find LabelListAttribute constructor")); + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - auto iter = list.begin(); - while (iter.Next()) + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) { - auto & entry = iter.GetValue(); - (void) entry; - bool labelNull = false; - bool labelHasValue = true; - - chip::CharSpan labelValue = entry.label; - - jstring label = nullptr; - chip::UtfString labelStr(env, labelValue); - if (!labelNull && labelHasValue) - { - label = jstring(labelStr.jniValue()); - } - - bool valueNull = false; - bool valueHasValue = true; + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_label; + newElement_0_label = env->NewStringUTF(std::string(entry_0.label.data(), entry_0.label.size()).c_str()); + jobject newElement_0_value; + newElement_0_value = env->NewStringUTF(std::string(entry_0.value.data(), entry_0.value.size()).c_str()); - chip::CharSpan valueValue = entry.value; + jclass labelStructStructClass; + err = chip::JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/ChipStructs$UserLabelClusterLabelStruct", + labelStructStructClass); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find class ChipStructs$UserLabelClusterLabelStruct")); + chip::JniClass structJniClass(labelStructStructClass); + jmethodID labelStructStructCtor = + env->GetMethodID(labelStructStructClass, "", "(Ljava/lang/String;Ljava/lang/String;)V"); + VerifyOrReturn(labelStructStructCtor != nullptr, + ChipLogError(Zcl, "Could not find ChipStructs$UserLabelClusterLabelStruct constructor")); - jstring value = nullptr; - chip::UtfString valueStr(env, valueValue); - if (!valueNull && valueHasValue) - { - value = jstring(valueStr.jniValue()); - } - - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, label, value); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create LabelListAttribute object")); - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); + newElement_0 = env->NewObject(labelStructStructClass, labelStructStructCtor, newElement_0_label, newElement_0_value); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding LabelListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -14401,43 +12400,24 @@ void CHIPWakeOnLanAttributeListAttributeCallback::CallbackFn(void * context, VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; - - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -14491,43 +12471,24 @@ void CHIPWiFiNetworkDiagnosticsAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); @@ -14585,11 +12546,17 @@ void CHIPWindowCoveringCurrentPositionLiftAttributeCallback::CallbackFn(void * c VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -14646,11 +12613,17 @@ void CHIPWindowCoveringCurrentPositionTiltAttributeCallback::CallbackFn(void * c VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -14708,11 +12681,17 @@ void CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback::CallbackF VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -14770,11 +12749,17 @@ void CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback::CallbackF VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -14832,11 +12817,17 @@ void CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback::Callbac VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - javaValueClassName.c_str(), javaValueCtorSignature.c_str(), value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -14894,11 +12885,17 @@ void CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback::Callbac VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - javaValueClassName.c_str(), javaValueCtorSignature.c_str(), value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -14956,11 +12953,17 @@ void CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback::Callba VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - javaValueClassName.c_str(), javaValueCtorSignature.c_str(), value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -15018,11 +13021,17 @@ void CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback::Callba VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; - - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject( - javaValueClassName.c_str(), javaValueCtorSignature.c_str(), value.Value(), javaValue); + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } @@ -15075,43 +13084,24 @@ void CHIPWindowCoveringAttributeListAttributeCallback::CallbackFn( VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); - jclass arrayListClass; - err = chip::JniReferences::GetInstance().GetClassRef(env, "java/util/ArrayList", arrayListClass); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error using Java ArrayList")); - chip::JniClass arrayListJniClass(arrayListClass); - jmethodID arrayListCtor = env->GetMethodID(arrayListClass, "", "()V"); - jmethodID arrayListAddMethod = env->GetMethodID(arrayListClass, "add", "(Ljava/lang/Object;)Z"); - VerifyOrReturn(arrayListCtor != nullptr && arrayListAddMethod != nullptr, - ChipLogError(Zcl, "Error finding Java ArrayList methods")); - jobject arrayListObj = env->NewObject(arrayListClass, arrayListCtor); - VerifyOrReturn(arrayListObj != nullptr, ChipLogError(Zcl, "Error creating Java ArrayList")); - jmethodID javaMethod; err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - auto iter = list.begin(); - while (iter.Next()) - { - auto & entry = iter.GetValue(); - bool entryNull = false; - chip::AttributeId entryValue = entry; + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); - jobject entryObject = nullptr; - if (!entryNull) - { - jclass entryTypeCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", entryTypeCls); - chip::JniClass jniClass(entryTypeCls); - jmethodID entryTypeCtor = env->GetMethodID(entryTypeCls, "", "(J)V"); - entryObject = env->NewObject(entryTypeCls, entryTypeCtor, entryValue); - } - - env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToArrayList(arrayListObj, newElement_0); } - VerifyOrReturn( - iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AttributeListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 3ccf41825d1d7c..20c86d5eb9ccd0 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -20,7 +20,7 @@ package chip.devicecontroller; import androidx.annotation.Nullable; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -122,70 +122,16 @@ public AccessControlCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); - public static class AclAttribute { - public Integer fabricIndex; - public Integer privilege; - public Integer authMode; - - public AclAttribute(Integer fabricIndex, Integer privilege, Integer authMode) { - this.fabricIndex = fabricIndex; - this.privilege = privilege; - this.authMode = authMode; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("int fabricIndex: "); - output.append(this.fabricIndex); - output.append("\n"); - - output.append("int privilege: "); - output.append(this.privilege); - output.append("\n"); - - output.append("int authMode: "); - output.append(this.authMode); - output.append("\n"); - - return output.toString(); - } - } - public interface AclAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); default void onSubscriptionEstablished() {} } - public static class ExtensionAttribute { - public Integer fabricIndex; - public byte[] data; - - public ExtensionAttribute(Integer fabricIndex, byte[] data) { - this.fabricIndex = fabricIndex; - this.data = data; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("int fabricIndex: "); - output.append(this.fabricIndex); - output.append("\n"); - - output.append("byte[] "); - output.append(Arrays.toString(data)); - output.append("\n"); - - return output.toString(); - } - } - public interface ExtensionAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -193,7 +139,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -204,14 +150,55 @@ public void readAclAttribute(AclAttributeCallback callback) { readAclAttribute(chipClusterPtr, callback); } + public void writeAclAttribute( + DefaultClusterCallback callback, + ArrayList value) { + writeAclAttribute(chipClusterPtr, callback, value, null); + } + + public void writeAclAttribute( + DefaultClusterCallback callback, + ArrayList value, + int timedWriteTimeoutMs) { + writeAclAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); + } + + public void subscribeAclAttribute( + AclAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAclAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readExtensionAttribute(ExtensionAttributeCallback callback) { readExtensionAttribute(chipClusterPtr, callback); } + public void writeExtensionAttribute( + DefaultClusterCallback callback, + ArrayList value) { + writeExtensionAttribute(chipClusterPtr, callback, value, null); + } + + public void writeExtensionAttribute( + DefaultClusterCallback callback, + ArrayList value, + int timedWriteTimeoutMs) { + writeExtensionAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); + } + + public void subscribeExtensionAttribute( + ExtensionAttributeCallback callback, int minInterval, int maxInterval) { + subscribeExtensionAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readAttributeListAttribute(AttributeListAttributeCallback callback) { readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -223,12 +210,36 @@ public void subscribeClusterRevisionAttribute( private native void readAclAttribute(long chipClusterPtr, AclAttributeCallback callback); + private native void writeAclAttribute( + long chipClusterPtr, + DefaultClusterCallback callback, + ArrayList value, + @Nullable Integer timedWriteTimeoutMs); + + private native void subscribeAclAttribute( + long chipClusterPtr, AclAttributeCallback callback, int minInterval, int maxInterval); + private native void readExtensionAttribute( long chipClusterPtr, ExtensionAttributeCallback callback); + private native void writeExtensionAttribute( + long chipClusterPtr, + DefaultClusterCallback callback, + ArrayList value, + @Nullable Integer timedWriteTimeoutMs); + + private native void subscribeExtensionAttribute( + long chipClusterPtr, ExtensionAttributeCallback callback, int minInterval, int maxInterval); + private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -267,6 +278,7 @@ public void loginRequest( } public void logoutRequest(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + logoutRequest(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -295,7 +307,7 @@ public interface GetSetupPINResponseCallback { } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -306,6 +318,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -318,6 +335,12 @@ public void subscribeClusterRevisionAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -392,6 +415,7 @@ public void revokeCommissioning(DefaultClusterCallback callback) { } public void revokeCommissioning(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + revokeCommissioning(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -426,7 +450,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -464,6 +488,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -497,6 +526,12 @@ private native void subscribeAdminVendorIdAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -515,7 +550,7 @@ public ApplicationBasicCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface AllowedVendorListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -523,7 +558,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -588,10 +623,20 @@ public void readAllowedVendorListAttribute(AllowedVendorListAttributeCallback ca readAllowedVendorListAttribute(chipClusterPtr, callback); } + public void subscribeAllowedVendorListAttribute( + AllowedVendorListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAllowedVendorListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readAttributeListAttribute(AttributeListAttributeCallback callback) { readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -649,9 +694,21 @@ private native void subscribeApplicationVersionAttribute( private native void readAllowedVendorListAttribute( long chipClusterPtr, AllowedVendorListAttributeCallback callback); + private native void subscribeAllowedVendorListAttribute( + long chipClusterPtr, + AllowedVendorListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -670,71 +727,63 @@ public ApplicationLauncherCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public void hideAppRequest( - LauncherResponseCallback callback, Integer catalogVendorId, String applicationId) { - hideAppRequest(chipClusterPtr, callback, catalogVendorId, applicationId, null); + LauncherResponseCallback callback, + ChipStructs.ApplicationLauncherClusterApplicationLauncherApplication application) { + hideAppRequest(chipClusterPtr, callback, application, null); } public void hideAppRequest( LauncherResponseCallback callback, - Integer catalogVendorId, - String applicationId, + ChipStructs.ApplicationLauncherClusterApplicationLauncherApplication application, int timedInvokeTimeoutMs) { - hideAppRequest( - chipClusterPtr, callback, catalogVendorId, applicationId, timedInvokeTimeoutMs); + hideAppRequest(chipClusterPtr, callback, application, timedInvokeTimeoutMs); } public void launchAppRequest( LauncherResponseCallback callback, String data, - Integer catalogVendorId, - String applicationId) { - launchAppRequest(chipClusterPtr, callback, data, catalogVendorId, applicationId, null); + ChipStructs.ApplicationLauncherClusterApplicationLauncherApplication application) { + launchAppRequest(chipClusterPtr, callback, data, application, null); } public void launchAppRequest( LauncherResponseCallback callback, String data, - Integer catalogVendorId, - String applicationId, + ChipStructs.ApplicationLauncherClusterApplicationLauncherApplication application, int timedInvokeTimeoutMs) { - launchAppRequest( - chipClusterPtr, callback, data, catalogVendorId, applicationId, timedInvokeTimeoutMs); + launchAppRequest(chipClusterPtr, callback, data, application, timedInvokeTimeoutMs); } public void stopAppRequest( - LauncherResponseCallback callback, Integer catalogVendorId, String applicationId) { - stopAppRequest(chipClusterPtr, callback, catalogVendorId, applicationId, null); + LauncherResponseCallback callback, + ChipStructs.ApplicationLauncherClusterApplicationLauncherApplication application) { + stopAppRequest(chipClusterPtr, callback, application, null); } public void stopAppRequest( LauncherResponseCallback callback, - Integer catalogVendorId, - String applicationId, + ChipStructs.ApplicationLauncherClusterApplicationLauncherApplication application, int timedInvokeTimeoutMs) { - stopAppRequest( - chipClusterPtr, callback, catalogVendorId, applicationId, timedInvokeTimeoutMs); + stopAppRequest(chipClusterPtr, callback, application, timedInvokeTimeoutMs); } private native void hideAppRequest( long chipClusterPtr, LauncherResponseCallback Callback, - Integer catalogVendorId, - String applicationId, + ChipStructs.ApplicationLauncherClusterApplicationLauncherApplication application, @Nullable Integer timedInvokeTimeoutMs); private native void launchAppRequest( long chipClusterPtr, LauncherResponseCallback Callback, String data, - Integer catalogVendorId, - String applicationId, + ChipStructs.ApplicationLauncherClusterApplicationLauncherApplication application, @Nullable Integer timedInvokeTimeoutMs); private native void stopAppRequest( long chipClusterPtr, LauncherResponseCallback Callback, - Integer catalogVendorId, - String applicationId, + ChipStructs.ApplicationLauncherClusterApplicationLauncherApplication application, @Nullable Integer timedInvokeTimeoutMs); public interface LauncherResponseCallback { @@ -744,7 +793,7 @@ public interface LauncherResponseCallback { } public interface ApplicationLauncherListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -752,7 +801,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -764,10 +813,20 @@ public void readApplicationLauncherListAttribute( readApplicationLauncherListAttribute(chipClusterPtr, callback); } + public void subscribeApplicationLauncherListAttribute( + ApplicationLauncherListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeApplicationLauncherListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readAttributeListAttribute(AttributeListAttributeCallback callback) { readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -780,9 +839,21 @@ public void subscribeClusterRevisionAttribute( private native void readApplicationLauncherListAttribute( long chipClusterPtr, ApplicationLauncherListAttributeCallback callback); + private native void subscribeApplicationLauncherListAttribute( + long chipClusterPtr, + ApplicationLauncherListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -831,38 +902,8 @@ private native void selectOutputRequest( Integer index, @Nullable Integer timedInvokeTimeoutMs); - public static class AudioOutputListAttribute { - public Integer index; - public Integer outputType; - public String name; - - public AudioOutputListAttribute(Integer index, Integer outputType, String name) { - this.index = index; - this.outputType = outputType; - this.name = name; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("int index: "); - output.append(this.index); - output.append("\n"); - - output.append("int outputType: "); - output.append(this.outputType); - output.append("\n"); - - output.append("String name: "); - output.append(this.name); - output.append("\n"); - - return output.toString(); - } - } - public interface AudioOutputListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -870,7 +911,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -881,6 +922,11 @@ public void readAudioOutputListAttribute(AudioOutputListAttributeCallback callba readAudioOutputListAttribute(chipClusterPtr, callback); } + public void subscribeAudioOutputListAttribute( + AudioOutputListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAudioOutputListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readCurrentAudioOutputAttribute(IntegerAttributeCallback callback) { readCurrentAudioOutputAttribute(chipClusterPtr, callback); } @@ -894,6 +940,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -906,6 +957,12 @@ public void subscribeClusterRevisionAttribute( private native void readAudioOutputListAttribute( long chipClusterPtr, AudioOutputListAttributeCallback callback); + private native void subscribeAudioOutputListAttribute( + long chipClusterPtr, + AudioOutputListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readCurrentAudioOutputAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -915,6 +972,12 @@ private native void subscribeCurrentAudioOutputAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -946,6 +1009,7 @@ public void barrierControlStop(DefaultClusterCallback callback) { } public void barrierControlStop(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + barrierControlStop(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -961,7 +1025,7 @@ private native void barrierControlStop( @Nullable Integer timedInvokeTimeoutMs); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -1008,6 +1072,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -1044,6 +1113,12 @@ private native void subscribeBarrierPositionAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -1066,6 +1141,7 @@ public void mfgSpecificPing(DefaultClusterCallback callback) { } public void mfgSpecificPing(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + mfgSpecificPing(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -1083,7 +1159,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -1292,6 +1368,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -1472,6 +1553,12 @@ private native void subscribeUniqueIDAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -1490,7 +1577,7 @@ public BinaryInputBasicCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -1546,6 +1633,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -1588,6 +1680,12 @@ private native void subscribeStatusFlagsAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -1663,7 +1761,7 @@ private native void unbind( @Nullable Integer timedInvokeTimeoutMs); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -1674,6 +1772,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -1686,6 +1789,12 @@ public void subscribeClusterRevisionAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -1704,7 +1813,7 @@ public BooleanStateCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -1724,6 +1833,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -1742,6 +1856,12 @@ private native void subscribeStateValueAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -2018,100 +2138,16 @@ private native void stopAction( Optional invokeID, @Nullable Integer timedInvokeTimeoutMs); - public static class ActionListAttribute { - public Integer actionID; - public String name; - public Integer type; - public Integer endpointListID; - public Integer supportedCommands; - public Integer status; - - public ActionListAttribute( - Integer actionID, - String name, - Integer type, - Integer endpointListID, - Integer supportedCommands, - Integer status) { - this.actionID = actionID; - this.name = name; - this.type = type; - this.endpointListID = endpointListID; - this.supportedCommands = supportedCommands; - this.status = status; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("int actionID: "); - output.append(this.actionID); - output.append("\n"); - - output.append("String name: "); - output.append(this.name); - output.append("\n"); - - output.append("int type: "); - output.append(this.type); - output.append("\n"); - - output.append("int endpointListID: "); - output.append(this.endpointListID); - output.append("\n"); - - output.append("int supportedCommands: "); - output.append(this.supportedCommands); - output.append("\n"); - - output.append("int status: "); - output.append(this.status); - output.append("\n"); - - return output.toString(); - } - } - public interface ActionListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); default void onSubscriptionEstablished() {} } - public static class EndpointListAttribute { - public Integer endpointListID; - public String name; - public Integer type; - - public EndpointListAttribute(Integer endpointListID, String name, Integer type) { - this.endpointListID = endpointListID; - this.name = name; - this.type = type; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("int endpointListID: "); - output.append(this.endpointListID); - output.append("\n"); - - output.append("String name: "); - output.append(this.name); - output.append("\n"); - - output.append("int type: "); - output.append(this.type); - output.append("\n"); - - return output.toString(); - } - } - public interface EndpointListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -2119,7 +2155,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -2130,10 +2166,20 @@ public void readActionListAttribute(ActionListAttributeCallback callback) { readActionListAttribute(chipClusterPtr, callback); } + public void subscribeActionListAttribute( + ActionListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeActionListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readEndpointListAttribute(EndpointListAttributeCallback callback) { readEndpointListAttribute(chipClusterPtr, callback); } + public void subscribeEndpointListAttribute( + EndpointListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeEndpointListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readSetupUrlAttribute(CharStringAttributeCallback callback) { readSetupUrlAttribute(chipClusterPtr, callback); } @@ -2147,6 +2193,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -2159,9 +2210,21 @@ public void subscribeClusterRevisionAttribute( private native void readActionListAttribute( long chipClusterPtr, ActionListAttributeCallback callback); + private native void subscribeActionListAttribute( + long chipClusterPtr, + ActionListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readEndpointListAttribute( long chipClusterPtr, EndpointListAttributeCallback callback); + private native void subscribeEndpointListAttribute( + long chipClusterPtr, + EndpointListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readSetupUrlAttribute( long chipClusterPtr, CharStringAttributeCallback callback); @@ -2174,6 +2237,12 @@ private native void subscribeSetupUrlAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -2192,7 +2261,7 @@ public BridgedDeviceBasicCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -2203,6 +2272,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -2215,6 +2289,12 @@ public void subscribeClusterRevisionAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -2284,62 +2364,13 @@ private native void skipChannelRequest( @Nullable Integer timedInvokeTimeoutMs); public interface ChangeChannelResponseCallback { - void onSuccess( // channelMatch: Struct ChannelInfo - // Conversion from this type to Java is not properly implemented yet - Integer errorType); + void onSuccess(ChipStructs.ChannelClusterChannelInfo channelMatch, Integer errorType); void onError(Exception error); } - public static class ChannelListAttribute { - public Integer majorNumber; - public Integer minorNumber; - public String name; - public String callSign; - public String affiliateCallSign; - - public ChannelListAttribute( - Integer majorNumber, - Integer minorNumber, - String name, - String callSign, - String affiliateCallSign) { - this.majorNumber = majorNumber; - this.minorNumber = minorNumber; - this.name = name; - this.callSign = callSign; - this.affiliateCallSign = affiliateCallSign; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("int majorNumber: "); - output.append(this.majorNumber); - output.append("\n"); - - output.append("int minorNumber: "); - output.append(this.minorNumber); - output.append("\n"); - - output.append("String name: "); - output.append(this.name); - output.append("\n"); - - output.append("String callSign: "); - output.append(this.callSign); - output.append("\n"); - - output.append("String affiliateCallSign: "); - output.append(this.affiliateCallSign); - output.append("\n"); - - return output.toString(); - } - } - public interface ChannelListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -2347,7 +2378,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -2358,10 +2389,20 @@ public void readChannelListAttribute(ChannelListAttributeCallback callback) { readChannelListAttribute(chipClusterPtr, callback); } + public void subscribeChannelListAttribute( + ChannelListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeChannelListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readAttributeListAttribute(AttributeListAttributeCallback callback) { readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -2374,9 +2415,21 @@ public void subscribeClusterRevisionAttribute( private native void readChannelListAttribute( long chipClusterPtr, ChannelListAttributeCallback callback); + private native void subscribeChannelListAttribute( + long chipClusterPtr, + ChannelListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -3222,7 +3275,7 @@ private native void stopMoveStep( @Nullable Integer timedInvokeTimeoutMs); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -3824,6 +3877,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -4229,6 +4287,12 @@ private native void subscribeStartUpColorTemperatureMiredsAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -4247,31 +4311,44 @@ public ContentLauncherCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public void launchContentRequest( - LaunchResponseCallback callback, Boolean autoPlay, String data) { - launchContentRequest(chipClusterPtr, callback, autoPlay, data, null); + LaunchResponseCallback callback, + Boolean autoPlay, + String data, + ArrayList search) { + launchContentRequest(chipClusterPtr, callback, autoPlay, data, search, null); } public void launchContentRequest( - LaunchResponseCallback callback, Boolean autoPlay, String data, int timedInvokeTimeoutMs) { - launchContentRequest(chipClusterPtr, callback, autoPlay, data, timedInvokeTimeoutMs); + LaunchResponseCallback callback, + Boolean autoPlay, + String data, + ArrayList search, + int timedInvokeTimeoutMs) { + launchContentRequest(chipClusterPtr, callback, autoPlay, data, search, timedInvokeTimeoutMs); } public void launchURLRequest( LaunchResponseCallback callback, String contentURL, String displayString, - String providerName) { - launchURLRequest(chipClusterPtr, callback, contentURL, displayString, providerName, null); + ChipStructs.ContentLauncherClusterBrandingInformation brandingInformation) { + launchURLRequest( + chipClusterPtr, callback, contentURL, displayString, brandingInformation, null); } public void launchURLRequest( LaunchResponseCallback callback, String contentURL, String displayString, - String providerName, + ChipStructs.ContentLauncherClusterBrandingInformation brandingInformation, int timedInvokeTimeoutMs) { launchURLRequest( - chipClusterPtr, callback, contentURL, displayString, providerName, timedInvokeTimeoutMs); + chipClusterPtr, + callback, + contentURL, + displayString, + brandingInformation, + timedInvokeTimeoutMs); } private native void launchContentRequest( @@ -4279,6 +4356,7 @@ private native void launchContentRequest( LaunchResponseCallback Callback, Boolean autoPlay, String data, + ArrayList search, @Nullable Integer timedInvokeTimeoutMs); private native void launchURLRequest( @@ -4286,7 +4364,7 @@ private native void launchURLRequest( LaunchResponseCallback Callback, String contentURL, String displayString, - String providerName, + ChipStructs.ContentLauncherClusterBrandingInformation brandingInformation, @Nullable Integer timedInvokeTimeoutMs); public interface LaunchResponseCallback { @@ -4296,7 +4374,7 @@ public interface LaunchResponseCallback { } public interface AcceptHeaderListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -4304,7 +4382,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -4315,6 +4393,11 @@ public void readAcceptHeaderListAttribute(AcceptHeaderListAttributeCallback call readAcceptHeaderListAttribute(chipClusterPtr, callback); } + public void subscribeAcceptHeaderListAttribute( + AcceptHeaderListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAcceptHeaderListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readSupportedStreamingProtocolsAttribute(LongAttributeCallback callback) { readSupportedStreamingProtocolsAttribute(chipClusterPtr, callback); } @@ -4340,6 +4423,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -4352,6 +4440,12 @@ public void subscribeClusterRevisionAttribute( private native void readAcceptHeaderListAttribute( long chipClusterPtr, AcceptHeaderListAttributeCallback callback); + private native void subscribeAcceptHeaderListAttribute( + long chipClusterPtr, + AcceptHeaderListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readSupportedStreamingProtocolsAttribute( long chipClusterPtr, LongAttributeCallback callback); @@ -4367,6 +4461,12 @@ private native void subscribeSupportedStreamingProtocolsAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -4384,32 +4484,8 @@ public DescriptorCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); - public static class DeviceListAttribute { - public Long type; - public Integer revision; - - public DeviceListAttribute(Long type, Integer revision) { - this.type = type; - this.revision = revision; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("long type: "); - output.append(this.type); - output.append("\n"); - - output.append("int revision: "); - output.append(this.revision); - output.append("\n"); - - return output.toString(); - } - } - public interface DeviceListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -4417,7 +4493,7 @@ default void onSubscriptionEstablished() {} } public interface ServerListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -4425,7 +4501,7 @@ default void onSubscriptionEstablished() {} } public interface ClientListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -4433,7 +4509,7 @@ default void onSubscriptionEstablished() {} } public interface PartsListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -4441,7 +4517,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -4452,22 +4528,47 @@ public void readDeviceListAttribute(DeviceListAttributeCallback callback) { readDeviceListAttribute(chipClusterPtr, callback); } + public void subscribeDeviceListAttribute( + DeviceListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeDeviceListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readServerListAttribute(ServerListAttributeCallback callback) { readServerListAttribute(chipClusterPtr, callback); } + public void subscribeServerListAttribute( + ServerListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeServerListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClientListAttribute(ClientListAttributeCallback callback) { readClientListAttribute(chipClusterPtr, callback); } + public void subscribeClientListAttribute( + ClientListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeClientListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readPartsListAttribute(PartsListAttributeCallback callback) { readPartsListAttribute(chipClusterPtr, callback); } + public void subscribePartsListAttribute( + PartsListAttributeCallback callback, int minInterval, int maxInterval) { + subscribePartsListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readAttributeListAttribute(AttributeListAttributeCallback callback) { readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -4480,18 +4581,45 @@ public void subscribeClusterRevisionAttribute( private native void readDeviceListAttribute( long chipClusterPtr, DeviceListAttributeCallback callback); - private native void readServerListAttribute( + private native void subscribeDeviceListAttribute( + long chipClusterPtr, + DeviceListAttributeCallback callback, + int minInterval, + int maxInterval); + + private native void readServerListAttribute( long chipClusterPtr, ServerListAttributeCallback callback); + private native void subscribeServerListAttribute( + long chipClusterPtr, + ServerListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClientListAttribute( long chipClusterPtr, ClientListAttributeCallback callback); + private native void subscribeClientListAttribute( + long chipClusterPtr, + ClientListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readPartsListAttribute( long chipClusterPtr, PartsListAttributeCallback callback); + private native void subscribePartsListAttribute( + long chipClusterPtr, PartsListAttributeCallback callback, int minInterval, int maxInterval); + private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -4548,7 +4676,7 @@ public interface RetrieveLogsResponseCallback { } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -4559,8 +4687,19 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); } public static class DoorLockCluster extends BaseChipCluster { @@ -4574,17 +4713,15 @@ public DoorLockCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public void clearCredential( - DefaultClusterCallback callback, Integer credentialType, Integer credentialIndex) { - clearCredential(chipClusterPtr, callback, credentialType, credentialIndex, null); + DefaultClusterCallback callback, ChipStructs.DoorLockClusterDlCredential credential) { + clearCredential(chipClusterPtr, callback, credential, null); } public void clearCredential( DefaultClusterCallback callback, - Integer credentialType, - Integer credentialIndex, + ChipStructs.DoorLockClusterDlCredential credential, int timedInvokeTimeoutMs) { - clearCredential( - chipClusterPtr, callback, credentialType, credentialIndex, timedInvokeTimeoutMs); + clearCredential(chipClusterPtr, callback, credential, timedInvokeTimeoutMs); } public void clearUser(DefaultClusterCallback callback, Integer userIndex) { @@ -4598,18 +4735,15 @@ public void clearUser( public void getCredentialStatus( GetCredentialStatusResponseCallback callback, - Integer credentialType, - Integer credentialIndex) { - getCredentialStatus(chipClusterPtr, callback, credentialType, credentialIndex, null); + ChipStructs.DoorLockClusterDlCredential credential) { + getCredentialStatus(chipClusterPtr, callback, credential, null); } public void getCredentialStatus( GetCredentialStatusResponseCallback callback, - Integer credentialType, - Integer credentialIndex, + ChipStructs.DoorLockClusterDlCredential credential, int timedInvokeTimeoutMs) { - getCredentialStatus( - chipClusterPtr, callback, credentialType, credentialIndex, timedInvokeTimeoutMs); + getCredentialStatus(chipClusterPtr, callback, credential, timedInvokeTimeoutMs); } public void getUser(GetUserResponseCallback callback, Integer userIndex) { @@ -4633,8 +4767,7 @@ public void lockDoor( public void setCredential( SetCredentialResponseCallback callback, Integer operationType, - Integer credentialType, - Integer credentialIndex, + ChipStructs.DoorLockClusterDlCredential credential, byte[] credentialData, Integer userIndex, Integer userStatus) { @@ -4642,8 +4775,7 @@ public void setCredential( chipClusterPtr, callback, operationType, - credentialType, - credentialIndex, + credential, credentialData, userIndex, userStatus, @@ -4653,8 +4785,7 @@ public void setCredential( public void setCredential( SetCredentialResponseCallback callback, Integer operationType, - Integer credentialType, - Integer credentialIndex, + ChipStructs.DoorLockClusterDlCredential credential, byte[] credentialData, Integer userIndex, Integer userStatus, @@ -4663,8 +4794,7 @@ public void setCredential( chipClusterPtr, callback, operationType, - credentialType, - credentialIndex, + credential, credentialData, userIndex, userStatus, @@ -4728,8 +4858,7 @@ public void unlockDoor( private native void clearCredential( long chipClusterPtr, DefaultClusterCallback Callback, - Integer credentialType, - Integer credentialIndex, + ChipStructs.DoorLockClusterDlCredential credential, @Nullable Integer timedInvokeTimeoutMs); private native void clearUser( @@ -4741,8 +4870,7 @@ private native void clearUser( private native void getCredentialStatus( long chipClusterPtr, GetCredentialStatusResponseCallback Callback, - Integer credentialType, - Integer credentialIndex, + ChipStructs.DoorLockClusterDlCredential credential, @Nullable Integer timedInvokeTimeoutMs); private native void getUser( @@ -4761,8 +4889,7 @@ private native void setCredential( long chipClusterPtr, SetCredentialResponseCallback Callback, Integer operationType, - Integer credentialType, - Integer credentialIndex, + ChipStructs.DoorLockClusterDlCredential credential, byte[] credentialData, Integer userIndex, Integer userStatus, @@ -4803,8 +4930,7 @@ void onSuccess( @Nullable Integer userStatus, @Nullable Integer userType, @Nullable Integer credentialRule, - // credentials: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet + @Nullable ArrayList credentials, @Nullable Integer creatorFabricIndex, @Nullable Integer lastModifiedFabricIndex, Integer nextUserIndex); @@ -4836,7 +4962,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -5058,6 +5184,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -5211,6 +5342,12 @@ private native void subscribeWrongCodeEntryLimitAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -5229,7 +5366,7 @@ public ElectricalMeasurementCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -5339,6 +5476,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -5417,6 +5559,12 @@ private native void subscribeActivePowerMaxAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -5439,6 +5587,7 @@ public void resetCounts(DefaultClusterCallback callback) { } public void resetCounts(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + resetCounts(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -5448,7 +5597,7 @@ private native void resetCounts( @Nullable Integer timedInvokeTimeoutMs); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -5540,6 +5689,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readFeatureMapAttribute(LongAttributeCallback callback) { readFeatureMapAttribute(chipClusterPtr, callback); } @@ -5615,6 +5769,12 @@ private native void subscribeTimeSinceResetAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readFeatureMapAttribute( long chipClusterPtr, LongAttributeCallback callback); @@ -5638,32 +5798,8 @@ public FixedLabelCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); - public static class LabelListAttribute { - public String label; - public String value; - - public LabelListAttribute(String label, String value) { - this.label = label; - this.value = value; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("String label: "); - output.append(this.label); - output.append("\n"); - - output.append("String value: "); - output.append(this.value); - output.append("\n"); - - return output.toString(); - } - } - public interface LabelListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -5671,7 +5807,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -5682,10 +5818,20 @@ public void readLabelListAttribute(LabelListAttributeCallback callback) { readLabelListAttribute(chipClusterPtr, callback); } + public void subscribeLabelListAttribute( + LabelListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeLabelListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readAttributeListAttribute(AttributeListAttributeCallback callback) { readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -5698,9 +5844,18 @@ public void subscribeClusterRevisionAttribute( private native void readLabelListAttribute( long chipClusterPtr, LabelListAttributeCallback callback); + private native void subscribeLabelListAttribute( + long chipClusterPtr, LabelListAttributeCallback callback, int minInterval, int maxInterval); + private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -5719,7 +5874,7 @@ public FlowMeasurementCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -5766,6 +5921,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -5802,6 +5962,12 @@ private native void subscribeToleranceAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -5848,6 +6014,7 @@ public void commissioningComplete(CommissioningCompleteResponseCallback callback public void commissioningComplete( CommissioningCompleteResponseCallback callback, int timedInvokeTimeoutMs) { + commissioningComplete(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -5918,26 +6085,9 @@ public interface SetRegulatoryConfigResponseCallback { void onError(Exception error); } - public static class BasicCommissioningInfoListAttribute { - public Long failSafeExpiryLengthMs; - - public BasicCommissioningInfoListAttribute(Long failSafeExpiryLengthMs) { - this.failSafeExpiryLengthMs = failSafeExpiryLengthMs; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("long failSafeExpiryLengthMs: "); - output.append(this.failSafeExpiryLengthMs); - output.append("\n"); - - return output.toString(); - } - } - public interface BasicCommissioningInfoListAttributeCallback { - void onSuccess(List valueList); + void onSuccess( + List valueList); void onError(Exception ex); @@ -5945,7 +6095,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -5975,6 +6125,12 @@ public void readBasicCommissioningInfoListAttribute( readBasicCommissioningInfoListAttribute(chipClusterPtr, callback); } + public void subscribeBasicCommissioningInfoListAttribute( + BasicCommissioningInfoListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeBasicCommissioningInfoListAttribute( + chipClusterPtr, callback, minInterval, maxInterval); + } + public void readRegulatoryConfigAttribute(IntegerAttributeCallback callback) { readRegulatoryConfigAttribute(chipClusterPtr, callback); } @@ -5997,6 +6153,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -6021,6 +6182,12 @@ private native void subscribeBreadcrumbAttribute( private native void readBasicCommissioningInfoListAttribute( long chipClusterPtr, BasicCommissioningInfoListAttributeCallback callback); + private native void subscribeBasicCommissioningInfoListAttribute( + long chipClusterPtr, + BasicCommissioningInfoListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readRegulatoryConfigAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -6036,6 +6203,12 @@ private native void subscribeLocationCapabilityAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -6053,62 +6226,8 @@ public GeneralDiagnosticsCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); - public static class NetworkInterfacesAttribute { - public String name; - public Boolean fabricConnected; - public Boolean offPremiseServicesReachableIPv4; - public Boolean offPremiseServicesReachableIPv6; - public byte[] hardwareAddress; - public Integer type; - - public NetworkInterfacesAttribute( - String name, - Boolean fabricConnected, - Boolean offPremiseServicesReachableIPv4, - Boolean offPremiseServicesReachableIPv6, - byte[] hardwareAddress, - Integer type) { - this.name = name; - this.fabricConnected = fabricConnected; - this.offPremiseServicesReachableIPv4 = offPremiseServicesReachableIPv4; - this.offPremiseServicesReachableIPv6 = offPremiseServicesReachableIPv6; - this.hardwareAddress = hardwareAddress; - this.type = type; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("String name: "); - output.append(this.name); - output.append("\n"); - - output.append("boolean fabricConnected: "); - output.append(this.fabricConnected); - output.append("\n"); - - output.append("boolean offPremiseServicesReachableIPv4: "); - output.append(this.offPremiseServicesReachableIPv4); - output.append("\n"); - - output.append("boolean offPremiseServicesReachableIPv6: "); - output.append(this.offPremiseServicesReachableIPv6); - output.append("\n"); - - output.append("byte[] "); - output.append(Arrays.toString(hardwareAddress)); - output.append("\n"); - - output.append("int type: "); - output.append(this.type); - output.append("\n"); - - return output.toString(); - } - } - public interface NetworkInterfacesAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -6116,7 +6235,7 @@ default void onSubscriptionEstablished() {} } public interface ActiveHardwareFaultsAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -6124,7 +6243,7 @@ default void onSubscriptionEstablished() {} } public interface ActiveRadioFaultsAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -6132,7 +6251,7 @@ default void onSubscriptionEstablished() {} } public interface ActiveNetworkFaultsAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -6140,7 +6259,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -6151,6 +6270,11 @@ public void readNetworkInterfacesAttribute(NetworkInterfacesAttributeCallback ca readNetworkInterfacesAttribute(chipClusterPtr, callback); } + public void subscribeNetworkInterfacesAttribute( + NetworkInterfacesAttributeCallback callback, int minInterval, int maxInterval) { + subscribeNetworkInterfacesAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readRebootCountAttribute(IntegerAttributeCallback callback) { readRebootCountAttribute(chipClusterPtr, callback); } @@ -6191,18 +6315,38 @@ public void readActiveHardwareFaultsAttribute(ActiveHardwareFaultsAttributeCallb readActiveHardwareFaultsAttribute(chipClusterPtr, callback); } + public void subscribeActiveHardwareFaultsAttribute( + ActiveHardwareFaultsAttributeCallback callback, int minInterval, int maxInterval) { + subscribeActiveHardwareFaultsAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readActiveRadioFaultsAttribute(ActiveRadioFaultsAttributeCallback callback) { readActiveRadioFaultsAttribute(chipClusterPtr, callback); } + public void subscribeActiveRadioFaultsAttribute( + ActiveRadioFaultsAttributeCallback callback, int minInterval, int maxInterval) { + subscribeActiveRadioFaultsAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readActiveNetworkFaultsAttribute(ActiveNetworkFaultsAttributeCallback callback) { readActiveNetworkFaultsAttribute(chipClusterPtr, callback); } + public void subscribeActiveNetworkFaultsAttribute( + ActiveNetworkFaultsAttributeCallback callback, int minInterval, int maxInterval) { + subscribeActiveNetworkFaultsAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readAttributeListAttribute(AttributeListAttributeCallback callback) { readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -6215,6 +6359,12 @@ public void subscribeClusterRevisionAttribute( private native void readNetworkInterfacesAttribute( long chipClusterPtr, NetworkInterfacesAttributeCallback callback); + private native void subscribeNetworkInterfacesAttribute( + long chipClusterPtr, + NetworkInterfacesAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readRebootCountAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -6241,15 +6391,39 @@ private native void subscribeBootReasonsAttribute( private native void readActiveHardwareFaultsAttribute( long chipClusterPtr, ActiveHardwareFaultsAttributeCallback callback); + private native void subscribeActiveHardwareFaultsAttribute( + long chipClusterPtr, + ActiveHardwareFaultsAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readActiveRadioFaultsAttribute( long chipClusterPtr, ActiveRadioFaultsAttributeCallback callback); + private native void subscribeActiveRadioFaultsAttribute( + long chipClusterPtr, + ActiveRadioFaultsAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readActiveNetworkFaultsAttribute( long chipClusterPtr, ActiveNetworkFaultsAttributeCallback callback); + private native void subscribeActiveNetworkFaultsAttribute( + long chipClusterPtr, + ActiveNetworkFaultsAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -6277,13 +6451,13 @@ public void keySetRead( } public void keySetReadAllIndices( - KeySetReadAllIndicesResponseCallback callback, Integer groupKeySetIDs) { + KeySetReadAllIndicesResponseCallback callback, ArrayList groupKeySetIDs) { keySetReadAllIndices(chipClusterPtr, callback, groupKeySetIDs, null); } public void keySetReadAllIndices( KeySetReadAllIndicesResponseCallback callback, - Integer groupKeySetIDs, + ArrayList groupKeySetIDs, int timedInvokeTimeoutMs) { keySetReadAllIndices(chipClusterPtr, callback, groupKeySetIDs, timedInvokeTimeoutMs); } @@ -6299,51 +6473,15 @@ public void keySetRemove( public void keySetWrite( DefaultClusterCallback callback, - Integer groupKeySetID, - Integer securityPolicy, - byte[] epochKey0, - Long epochStartTime0, - byte[] epochKey1, - Long epochStartTime1, - byte[] epochKey2, - Long epochStartTime2) { - keySetWrite( - chipClusterPtr, - callback, - groupKeySetID, - securityPolicy, - epochKey0, - epochStartTime0, - epochKey1, - epochStartTime1, - epochKey2, - epochStartTime2, - null); + ChipStructs.GroupKeyManagementClusterGroupKeySet groupKeySet) { + keySetWrite(chipClusterPtr, callback, groupKeySet, null); } public void keySetWrite( DefaultClusterCallback callback, - Integer groupKeySetID, - Integer securityPolicy, - byte[] epochKey0, - Long epochStartTime0, - byte[] epochKey1, - Long epochStartTime1, - byte[] epochKey2, - Long epochStartTime2, + ChipStructs.GroupKeyManagementClusterGroupKeySet groupKeySet, int timedInvokeTimeoutMs) { - keySetWrite( - chipClusterPtr, - callback, - groupKeySetID, - securityPolicy, - epochKey0, - epochStartTime0, - epochKey1, - epochStartTime1, - epochKey2, - epochStartTime2, - timedInvokeTimeoutMs); + keySetWrite(chipClusterPtr, callback, groupKeySet, timedInvokeTimeoutMs); } private native void keySetRead( @@ -6355,7 +6493,7 @@ private native void keySetRead( private native void keySetReadAllIndices( long chipClusterPtr, KeySetReadAllIndicesResponseCallback Callback, - Integer groupKeySetIDs, + ArrayList groupKeySetIDs, @Nullable Integer timedInvokeTimeoutMs); private native void keySetRemove( @@ -6367,102 +6505,31 @@ private native void keySetRemove( private native void keySetWrite( long chipClusterPtr, DefaultClusterCallback Callback, - Integer groupKeySetID, - Integer securityPolicy, - byte[] epochKey0, - Long epochStartTime0, - byte[] epochKey1, - Long epochStartTime1, - byte[] epochKey2, - Long epochStartTime2, + ChipStructs.GroupKeyManagementClusterGroupKeySet groupKeySet, @Nullable Integer timedInvokeTimeoutMs); public interface KeySetReadAllIndicesResponseCallback { - void onSuccess( // groupKeySetIDs: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - ); + void onSuccess(ArrayList groupKeySetIDs); void onError(Exception error); } public interface KeySetReadResponseCallback { - void onSuccess( // groupKeySet: Struct GroupKeySet - // Conversion from this type to Java is not properly implemented yet - ); + void onSuccess(ChipStructs.GroupKeyManagementClusterGroupKeySet groupKeySet); void onError(Exception error); } - public static class GroupKeyMapAttribute { - public Integer fabricIndex; - public Integer groupId; - public Integer groupKeySetID; - - public GroupKeyMapAttribute(Integer fabricIndex, Integer groupId, Integer groupKeySetID) { - this.fabricIndex = fabricIndex; - this.groupId = groupId; - this.groupKeySetID = groupKeySetID; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("int fabricIndex: "); - output.append(this.fabricIndex); - output.append("\n"); - - output.append("int groupId: "); - output.append(this.groupId); - output.append("\n"); - - output.append("int groupKeySetID: "); - output.append(this.groupKeySetID); - output.append("\n"); - - return output.toString(); - } - } - public interface GroupKeyMapAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); default void onSubscriptionEstablished() {} } - public static class GroupTableAttribute { - public Integer fabricIndex; - public Integer groupId; - public String groupName; - - public GroupTableAttribute(Integer fabricIndex, Integer groupId, String groupName) { - this.fabricIndex = fabricIndex; - this.groupId = groupId; - this.groupName = groupName; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("int fabricIndex: "); - output.append(this.fabricIndex); - output.append("\n"); - - output.append("int groupId: "); - output.append(this.groupId); - output.append("\n"); - - output.append("String groupName: "); - output.append(this.groupName); - output.append("\n"); - - return output.toString(); - } - } - public interface GroupTableAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -6470,7 +6537,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -6481,10 +6548,20 @@ public void readGroupKeyMapAttribute(GroupKeyMapAttributeCallback callback) { readGroupKeyMapAttribute(chipClusterPtr, callback); } + public void subscribeGroupKeyMapAttribute( + GroupKeyMapAttributeCallback callback, int minInterval, int maxInterval) { + subscribeGroupKeyMapAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readGroupTableAttribute(GroupTableAttributeCallback callback) { readGroupTableAttribute(chipClusterPtr, callback); } + public void subscribeGroupTableAttribute( + GroupTableAttributeCallback callback, int minInterval, int maxInterval) { + subscribeGroupTableAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readMaxGroupsPerFabricAttribute(IntegerAttributeCallback callback) { readMaxGroupsPerFabricAttribute(chipClusterPtr, callback); } @@ -6507,6 +6584,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -6519,9 +6601,21 @@ public void subscribeClusterRevisionAttribute( private native void readGroupKeyMapAttribute( long chipClusterPtr, GroupKeyMapAttributeCallback callback); + private native void subscribeGroupKeyMapAttribute( + long chipClusterPtr, + GroupKeyMapAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readGroupTableAttribute( long chipClusterPtr, GroupTableAttributeCallback callback); + private native void subscribeGroupTableAttribute( + long chipClusterPtr, + GroupTableAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readMaxGroupsPerFabricAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -6537,6 +6631,12 @@ private native void subscribeMaxGroupKeysPerFabricAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -6579,12 +6679,15 @@ public void addGroupIfIdentifying( addGroupIfIdentifying(chipClusterPtr, callback, groupId, groupName, timedInvokeTimeoutMs); } - public void getGroupMembership(GetGroupMembershipResponseCallback callback, Integer groupList) { + public void getGroupMembership( + GetGroupMembershipResponseCallback callback, ArrayList groupList) { getGroupMembership(chipClusterPtr, callback, groupList, null); } public void getGroupMembership( - GetGroupMembershipResponseCallback callback, Integer groupList, int timedInvokeTimeoutMs) { + GetGroupMembershipResponseCallback callback, + ArrayList groupList, + int timedInvokeTimeoutMs) { getGroupMembership(chipClusterPtr, callback, groupList, timedInvokeTimeoutMs); } @@ -6593,6 +6696,7 @@ public void removeAllGroups(DefaultClusterCallback callback) { } public void removeAllGroups(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + removeAllGroups(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -6631,7 +6735,7 @@ private native void addGroupIfIdentifying( private native void getGroupMembership( long chipClusterPtr, GetGroupMembershipResponseCallback Callback, - Integer groupList, + ArrayList groupList, @Nullable Integer timedInvokeTimeoutMs); private native void removeAllGroups( @@ -6658,10 +6762,7 @@ public interface AddGroupResponseCallback { } public interface GetGroupMembershipResponseCallback { - void onSuccess(Integer capacity - // groupList: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - ); + void onSuccess(Integer capacity, ArrayList groupList); void onError(Exception error); } @@ -6679,7 +6780,7 @@ public interface ViewGroupResponseCallback { } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -6699,6 +6800,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -6717,6 +6823,12 @@ private native void subscribeNameSupportAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -6748,6 +6860,7 @@ public void identifyQuery(IdentifyQueryResponseCallback callback) { } public void identifyQuery(IdentifyQueryResponseCallback callback, int timedInvokeTimeoutMs) { + identifyQuery(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -6790,7 +6903,7 @@ public interface IdentifyQueryResponseCallback { } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -6828,6 +6941,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -6858,6 +6976,12 @@ private native void subscribeIdentifyTypeAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -6908,7 +7032,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -6964,6 +7088,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -7018,6 +7147,12 @@ private native void subscribeLightSensorTypeAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -7057,7 +7192,7 @@ public interface SendKeyResponseCallback { } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -7068,6 +7203,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -7080,6 +7220,12 @@ public void subscribeClusterRevisionAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -7244,6 +7390,7 @@ public void stopWithOnOff(DefaultClusterCallback callback) { } public void stopWithOnOff(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + stopWithOnOff(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -7350,7 +7497,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -7460,12 +7607,12 @@ public void readOnLevelAttribute(OnLevelAttributeCallback callback) { readOnLevelAttribute(chipClusterPtr, callback); } - public void writeOnLevelAttribute(DefaultClusterCallback callback, @Nullable Integer value) { + public void writeOnLevelAttribute(DefaultClusterCallback callback, Integer value) { writeOnLevelAttribute(chipClusterPtr, callback, value, null); } public void writeOnLevelAttribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeOnLevelAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -7478,13 +7625,12 @@ public void readOnTransitionTimeAttribute(OnTransitionTimeAttributeCallback call readOnTransitionTimeAttribute(chipClusterPtr, callback); } - public void writeOnTransitionTimeAttribute( - DefaultClusterCallback callback, @Nullable Integer value) { + public void writeOnTransitionTimeAttribute(DefaultClusterCallback callback, Integer value) { writeOnTransitionTimeAttribute(chipClusterPtr, callback, value, null); } public void writeOnTransitionTimeAttribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeOnTransitionTimeAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -7497,13 +7643,12 @@ public void readOffTransitionTimeAttribute(OffTransitionTimeAttributeCallback ca readOffTransitionTimeAttribute(chipClusterPtr, callback); } - public void writeOffTransitionTimeAttribute( - DefaultClusterCallback callback, @Nullable Integer value) { + public void writeOffTransitionTimeAttribute(DefaultClusterCallback callback, Integer value) { writeOffTransitionTimeAttribute(chipClusterPtr, callback, value, null); } public void writeOffTransitionTimeAttribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeOffTransitionTimeAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -7516,13 +7661,12 @@ public void readDefaultMoveRateAttribute(DefaultMoveRateAttributeCallback callba readDefaultMoveRateAttribute(chipClusterPtr, callback); } - public void writeDefaultMoveRateAttribute( - DefaultClusterCallback callback, @Nullable Integer value) { + public void writeDefaultMoveRateAttribute(DefaultClusterCallback callback, Integer value) { writeDefaultMoveRateAttribute(chipClusterPtr, callback, value, null); } public void writeDefaultMoveRateAttribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeDefaultMoveRateAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -7535,13 +7679,12 @@ public void readStartUpCurrentLevelAttribute(StartUpCurrentLevelAttributeCallbac readStartUpCurrentLevelAttribute(chipClusterPtr, callback); } - public void writeStartUpCurrentLevelAttribute( - DefaultClusterCallback callback, @Nullable Integer value) { + public void writeStartUpCurrentLevelAttribute(DefaultClusterCallback callback, Integer value) { writeStartUpCurrentLevelAttribute(chipClusterPtr, callback, value, null); } public void writeStartUpCurrentLevelAttribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeStartUpCurrentLevelAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -7554,6 +7697,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readFeatureMapAttribute(LongAttributeCallback callback) { readFeatureMapAttribute(chipClusterPtr, callback); } @@ -7644,7 +7792,7 @@ private native void readOnLevelAttribute( private native void writeOnLevelAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeOnLevelAttribute( @@ -7656,7 +7804,7 @@ private native void readOnTransitionTimeAttribute( private native void writeOnTransitionTimeAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeOnTransitionTimeAttribute( @@ -7671,7 +7819,7 @@ private native void readOffTransitionTimeAttribute( private native void writeOffTransitionTimeAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeOffTransitionTimeAttribute( @@ -7686,7 +7834,7 @@ private native void readDefaultMoveRateAttribute( private native void writeDefaultMoveRateAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeDefaultMoveRateAttribute( @@ -7701,7 +7849,7 @@ private native void readStartUpCurrentLevelAttribute( private native void writeStartUpCurrentLevelAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeStartUpCurrentLevelAttribute( @@ -7713,6 +7861,12 @@ private native void subscribeStartUpCurrentLevelAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readFeatureMapAttribute( long chipClusterPtr, LongAttributeCallback callback); @@ -7737,7 +7891,7 @@ public LocalizationConfigurationCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface SupportedLocalesAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -7766,6 +7920,11 @@ public void readSupportedLocalesAttribute(SupportedLocalesAttributeCallback call readSupportedLocalesAttribute(chipClusterPtr, callback); } + public void subscribeSupportedLocalesAttribute( + SupportedLocalesAttributeCallback callback, int minInterval, int maxInterval) { + subscribeSupportedLocalesAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + private native void readActiveLocaleAttribute( long chipClusterPtr, CharStringAttributeCallback callback); @@ -7783,6 +7942,12 @@ private native void subscribeActiveLocaleAttribute( private native void readSupportedLocalesAttribute( long chipClusterPtr, SupportedLocalesAttributeCallback callback); + + private native void subscribeSupportedLocalesAttribute( + long chipClusterPtr, + SupportedLocalesAttributeCallback callback, + int minInterval, + int maxInterval); } public static class LowPowerCluster extends BaseChipCluster { @@ -7800,6 +7965,7 @@ public void sleep(DefaultClusterCallback callback) { } public void sleep(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + sleep(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -7809,7 +7975,7 @@ private native void sleep( @Nullable Integer timedInvokeTimeoutMs); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -7820,6 +7986,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -7832,6 +8003,12 @@ public void subscribeClusterRevisionAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -7854,6 +8031,7 @@ public void hideInputStatusRequest(DefaultClusterCallback callback) { } public void hideInputStatusRequest(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + hideInputStatusRequest(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -7880,6 +8058,7 @@ public void showInputStatusRequest(DefaultClusterCallback callback) { } public void showInputStatusRequest(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + showInputStatusRequest(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -7906,45 +8085,8 @@ private native void showInputStatusRequest( DefaultClusterCallback Callback, @Nullable Integer timedInvokeTimeoutMs); - public static class MediaInputListAttribute { - public Integer index; - public Integer inputType; - public String name; - public String description; - - public MediaInputListAttribute( - Integer index, Integer inputType, String name, String description) { - this.index = index; - this.inputType = inputType; - this.name = name; - this.description = description; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("int index: "); - output.append(this.index); - output.append("\n"); - - output.append("int inputType: "); - output.append(this.inputType); - output.append("\n"); - - output.append("String name: "); - output.append(this.name); - output.append("\n"); - - output.append("String description: "); - output.append(this.description); - output.append("\n"); - - return output.toString(); - } - } - public interface MediaInputListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -7952,7 +8094,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -7963,6 +8105,11 @@ public void readMediaInputListAttribute(MediaInputListAttributeCallback callback readMediaInputListAttribute(chipClusterPtr, callback); } + public void subscribeMediaInputListAttribute( + MediaInputListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeMediaInputListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readCurrentMediaInputAttribute(IntegerAttributeCallback callback) { readCurrentMediaInputAttribute(chipClusterPtr, callback); } @@ -7976,6 +8123,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -7988,6 +8140,12 @@ public void subscribeClusterRevisionAttribute( private native void readMediaInputListAttribute( long chipClusterPtr, MediaInputListAttributeCallback callback); + private native void subscribeMediaInputListAttribute( + long chipClusterPtr, + MediaInputListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readCurrentMediaInputAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -7997,6 +8155,12 @@ private native void subscribeCurrentMediaInputAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -8019,6 +8183,7 @@ public void fastForwardRequest(PlaybackResponseCallback callback) { } public void fastForwardRequest(PlaybackResponseCallback callback, int timedInvokeTimeoutMs) { + fastForwardRequest(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -8027,6 +8192,7 @@ public void nextRequest(PlaybackResponseCallback callback) { } public void nextRequest(PlaybackResponseCallback callback, int timedInvokeTimeoutMs) { + nextRequest(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -8035,6 +8201,7 @@ public void pauseRequest(PlaybackResponseCallback callback) { } public void pauseRequest(PlaybackResponseCallback callback, int timedInvokeTimeoutMs) { + pauseRequest(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -8043,6 +8210,7 @@ public void playRequest(PlaybackResponseCallback callback) { } public void playRequest(PlaybackResponseCallback callback, int timedInvokeTimeoutMs) { + playRequest(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -8051,6 +8219,7 @@ public void previousRequest(PlaybackResponseCallback callback) { } public void previousRequest(PlaybackResponseCallback callback, int timedInvokeTimeoutMs) { + previousRequest(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -8059,6 +8228,7 @@ public void rewindRequest(PlaybackResponseCallback callback) { } public void rewindRequest(PlaybackResponseCallback callback, int timedInvokeTimeoutMs) { + rewindRequest(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -8101,6 +8271,7 @@ public void startOverRequest(PlaybackResponseCallback callback) { } public void startOverRequest(PlaybackResponseCallback callback, int timedInvokeTimeoutMs) { + startOverRequest(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -8109,6 +8280,7 @@ public void stopRequest(PlaybackResponseCallback callback) { } public void stopRequest(PlaybackResponseCallback callback, int timedInvokeTimeoutMs) { + stopRequest(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -8177,7 +8349,7 @@ public interface PlaybackResponseCallback { } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -8242,6 +8414,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -8288,6 +8465,12 @@ private native void subscribeSeekRangeStartAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -8320,38 +8503,8 @@ private native void changeToMode( Integer newMode, @Nullable Integer timedInvokeTimeoutMs); - public static class SupportedModesAttribute { - public String label; - public Integer mode; - public Long semanticTag; - - public SupportedModesAttribute(String label, Integer mode, Long semanticTag) { - this.label = label; - this.mode = mode; - this.semanticTag = semanticTag; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("String label: "); - output.append(this.label); - output.append("\n"); - - output.append("int mode: "); - output.append(this.mode); - output.append("\n"); - - output.append("long semanticTag: "); - output.append(this.semanticTag); - output.append("\n"); - - return output.toString(); - } - } - public interface SupportedModesAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -8359,7 +8512,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -8379,6 +8532,11 @@ public void readSupportedModesAttribute(SupportedModesAttributeCallback callback readSupportedModesAttribute(chipClusterPtr, callback); } + public void subscribeSupportedModesAttribute( + SupportedModesAttributeCallback callback, int minInterval, int maxInterval) { + subscribeSupportedModesAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readOnModeAttribute(IntegerAttributeCallback callback) { readOnModeAttribute(chipClusterPtr, callback); } @@ -8419,6 +8577,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -8437,6 +8600,12 @@ private native void subscribeCurrentModeAttribute( private native void readSupportedModesAttribute( long chipClusterPtr, SupportedModesAttributeCallback callback); + private native void subscribeSupportedModesAttribute( + long chipClusterPtr, + SupportedModesAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readOnModeAttribute(long chipClusterPtr, IntegerAttributeCallback callback); private native void writeOnModeAttribute( @@ -8466,6 +8635,12 @@ private native void subscribeDescriptionAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -8613,54 +8788,31 @@ private native void scanNetworks( @Nullable Integer timedInvokeTimeoutMs); public interface ConnectNetworkResponseCallback { - void onSuccess(Integer NetworkingStatus, String DebugText, Long ErrorValue); + void onSuccess(Integer networkingStatus, String debugText, Long errorValue); void onError(Exception error); } public interface NetworkConfigResponseCallback { - void onSuccess(Integer NetworkingStatus, String DebugText); + void onSuccess(Integer networkingStatus, String debugText); void onError(Exception error); } public interface ScanNetworksResponseCallback { - void onSuccess(Integer NetworkingStatus, String DebugText - // WiFiScanResults: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - // ThreadScanResults: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - ); + void onSuccess( + Integer networkingStatus, + String debugText, + Optional> + wiFiScanResults, + Optional> + threadScanResults); void onError(Exception error); } - public static class NetworksAttribute { - public byte[] networkID; - public Boolean connected; - - public NetworksAttribute(byte[] networkID, Boolean connected) { - this.networkID = networkID; - this.connected = connected; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("byte[] "); - output.append(Arrays.toString(networkID)); - output.append("\n"); - - output.append("boolean connected: "); - output.append(this.connected); - output.append("\n"); - - return output.toString(); - } - } - public interface NetworksAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -8680,6 +8832,11 @@ public void readNetworksAttribute(NetworksAttributeCallback callback) { readNetworksAttribute(chipClusterPtr, callback); } + public void subscribeNetworksAttribute( + NetworksAttributeCallback callback, int minInterval, int maxInterval) { + subscribeNetworksAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readScanMaxTimeSecondsAttribute(IntegerAttributeCallback callback) { readScanMaxTimeSecondsAttribute(chipClusterPtr, callback); } @@ -8770,6 +8927,9 @@ private native void subscribeMaxNetworksAttribute( private native void readNetworksAttribute( long chipClusterPtr, NetworksAttributeCallback callback); + private native void subscribeNetworksAttribute( + long chipClusterPtr, NetworksAttributeCallback callback, int minInterval, int maxInterval); + private native void readScanMaxTimeSecondsAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -8870,7 +9030,7 @@ public void queryImage( Integer vendorId, Integer productId, Long softwareVersion, - Integer protocolsSupported, + ArrayList protocolsSupported, Optional hardwareVersion, Optional location, Optional requestorCanConsent, @@ -8894,7 +9054,7 @@ public void queryImage( Integer vendorId, Integer productId, Long softwareVersion, - Integer protocolsSupported, + ArrayList protocolsSupported, Optional hardwareVersion, Optional location, Optional requestorCanConsent, @@ -8934,7 +9094,7 @@ private native void queryImage( Integer vendorId, Integer productId, Long softwareVersion, - Integer protocolsSupported, + ArrayList protocolsSupported, Optional hardwareVersion, Optional location, Optional requestorCanConsent, @@ -8962,7 +9122,7 @@ void onSuccess( } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -8973,6 +9133,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -8985,6 +9150,12 @@ public void subscribeClusterRevisionAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -9049,39 +9220,8 @@ private native void announceOtaProvider( Integer endpoint, @Nullable Integer timedInvokeTimeoutMs); - public static class DefaultOtaProvidersAttribute { - public Integer fabricIndex; - public Long providerNodeID; - public Integer endpoint; - - public DefaultOtaProvidersAttribute( - Integer fabricIndex, Long providerNodeID, Integer endpoint) { - this.fabricIndex = fabricIndex; - this.providerNodeID = providerNodeID; - this.endpoint = endpoint; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("int fabricIndex: "); - output.append(this.fabricIndex); - output.append("\n"); - - output.append("long providerNodeID: "); - output.append(this.providerNodeID); - output.append("\n"); - - output.append("int endpoint: "); - output.append(this.endpoint); - output.append("\n"); - - return output.toString(); - } - } - public interface DefaultOtaProvidersAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -9097,7 +9237,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -9108,6 +9248,24 @@ public void readDefaultOtaProvidersAttribute(DefaultOtaProvidersAttributeCallbac readDefaultOtaProvidersAttribute(chipClusterPtr, callback); } + public void writeDefaultOtaProvidersAttribute( + DefaultClusterCallback callback, + ArrayList value) { + writeDefaultOtaProvidersAttribute(chipClusterPtr, callback, value, null); + } + + public void writeDefaultOtaProvidersAttribute( + DefaultClusterCallback callback, + ArrayList value, + int timedWriteTimeoutMs) { + writeDefaultOtaProvidersAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); + } + + public void subscribeDefaultOtaProvidersAttribute( + DefaultOtaProvidersAttributeCallback callback, int minInterval, int maxInterval) { + subscribeDefaultOtaProvidersAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readUpdatePossibleAttribute(BooleanAttributeCallback callback) { readUpdatePossibleAttribute(chipClusterPtr, callback); } @@ -9139,6 +9297,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -9151,6 +9314,18 @@ public void subscribeClusterRevisionAttribute( private native void readDefaultOtaProvidersAttribute( long chipClusterPtr, DefaultOtaProvidersAttributeCallback callback); + private native void writeDefaultOtaProvidersAttribute( + long chipClusterPtr, + DefaultClusterCallback callback, + ArrayList value, + @Nullable Integer timedWriteTimeoutMs); + + private native void subscribeDefaultOtaProvidersAttribute( + long chipClusterPtr, + DefaultOtaProvidersAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readUpdatePossibleAttribute( long chipClusterPtr, BooleanAttributeCallback callback); @@ -9175,6 +9350,12 @@ private native void subscribeUpdateStateProgressAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -9193,7 +9374,7 @@ public OccupancySensingCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -9232,6 +9413,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -9262,6 +9448,12 @@ private native void subscribeOccupancySensorTypeBitmapAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -9284,6 +9476,7 @@ public void off(DefaultClusterCallback callback) { } public void off(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + off(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -9305,6 +9498,7 @@ public void on(DefaultClusterCallback callback) { } public void on(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + on(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -9313,6 +9507,7 @@ public void onWithRecallGlobalScene(DefaultClusterCallback callback) { } public void onWithRecallGlobalScene(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + onWithRecallGlobalScene(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -9339,6 +9534,7 @@ public void toggle(DefaultClusterCallback callback) { } public void toggle(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + toggle(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -9378,7 +9574,7 @@ private native void toggle( @Nullable Integer timedInvokeTimeoutMs); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -9461,6 +9657,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readFeatureMapAttribute(LongAttributeCallback callback) { readFeatureMapAttribute(chipClusterPtr, callback); } @@ -9528,6 +9729,12 @@ private native void subscribeStartUpOnOffAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readFeatureMapAttribute( long chipClusterPtr, LongAttributeCallback callback); @@ -9552,7 +9759,7 @@ public OnOffSwitchConfigurationCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -9590,6 +9797,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -9620,6 +9832,12 @@ private native void subscribeSwitchActionsAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -9815,123 +10033,39 @@ private native void updateNOC( @Nullable Integer timedInvokeTimeoutMs); public interface AttestationResponseCallback { - void onSuccess(byte[] AttestationElements, byte[] Signature); + void onSuccess(byte[] attestationElements, byte[] signature); void onError(Exception error); } public interface CertificateChainResponseCallback { - void onSuccess(byte[] Certificate); + void onSuccess(byte[] certificate); void onError(Exception error); } public interface NOCResponseCallback { - void onSuccess(Integer StatusCode, Integer FabricIndex, String DebugText); + void onSuccess(Integer statusCode, Integer fabricIndex, String debugText); void onError(Exception error); } public interface OpCSRResponseCallback { - void onSuccess(byte[] NOCSRElements, byte[] AttestationSignature); + void onSuccess(byte[] NOCSRElements, byte[] attestationSignature); void onError(Exception error); } - public static class NOCsAttribute { - public Integer fabricIndex; - public byte[] noc; - public byte[] icac; - - public NOCsAttribute(Integer fabricIndex, byte[] noc, byte[] icac) { - this.fabricIndex = fabricIndex; - this.noc = noc; - this.icac = icac; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("int fabricIndex: "); - output.append(this.fabricIndex); - output.append("\n"); - - output.append("byte[] "); - output.append(Arrays.toString(noc)); - output.append("\n"); - - output.append("byte[] "); - output.append(Arrays.toString(icac)); - output.append("\n"); - - return output.toString(); - } - } - public interface NOCsAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); default void onSubscriptionEstablished() {} } - public static class FabricsListAttribute { - public Integer fabricIndex; - public byte[] rootPublicKey; - public Integer vendorId; - public Long fabricId; - public Long nodeId; - public String label; - - public FabricsListAttribute( - Integer fabricIndex, - byte[] rootPublicKey, - Integer vendorId, - Long fabricId, - Long nodeId, - String label) { - this.fabricIndex = fabricIndex; - this.rootPublicKey = rootPublicKey; - this.vendorId = vendorId; - this.fabricId = fabricId; - this.nodeId = nodeId; - this.label = label; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("int fabricIndex: "); - output.append(this.fabricIndex); - output.append("\n"); - - output.append("byte[] "); - output.append(Arrays.toString(rootPublicKey)); - output.append("\n"); - - output.append("int vendorId: "); - output.append(this.vendorId); - output.append("\n"); - - output.append("long fabricId: "); - output.append(this.fabricId); - output.append("\n"); - - output.append("long nodeId: "); - output.append(this.nodeId); - output.append("\n"); - - output.append("String label: "); - output.append(this.label); - output.append("\n"); - - return output.toString(); - } - } - public interface FabricsListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -9939,7 +10073,7 @@ default void onSubscriptionEstablished() {} } public interface TrustedRootCertificatesAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -9955,7 +10089,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -9970,6 +10104,11 @@ public void readFabricsListAttribute(FabricsListAttributeCallback callback) { readFabricsListAttribute(chipClusterPtr, callback); } + public void subscribeFabricsListAttribute( + FabricsListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeFabricsListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readSupportedFabricsAttribute(IntegerAttributeCallback callback) { readSupportedFabricsAttribute(chipClusterPtr, callback); } @@ -9993,6 +10132,11 @@ public void readTrustedRootCertificatesAttribute( readTrustedRootCertificatesAttribute(chipClusterPtr, callback); } + public void subscribeTrustedRootCertificatesAttribute( + TrustedRootCertificatesAttributeCallback callback, int minInterval, int maxInterval) { + subscribeTrustedRootCertificatesAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readCurrentFabricIndexAttribute(CurrentFabricIndexAttributeCallback callback) { readCurrentFabricIndexAttribute(chipClusterPtr, callback); } @@ -10006,6 +10150,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -10020,6 +10169,12 @@ public void subscribeClusterRevisionAttribute( private native void readFabricsListAttribute( long chipClusterPtr, FabricsListAttributeCallback callback); + private native void subscribeFabricsListAttribute( + long chipClusterPtr, + FabricsListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readSupportedFabricsAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -10035,6 +10190,12 @@ private native void subscribeCommissionedFabricsAttribute( private native void readTrustedRootCertificatesAttribute( long chipClusterPtr, TrustedRootCertificatesAttributeCallback callback); + private native void subscribeTrustedRootCertificatesAttribute( + long chipClusterPtr, + TrustedRootCertificatesAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readCurrentFabricIndexAttribute( long chipClusterPtr, CurrentFabricIndexAttributeCallback callback); @@ -10047,6 +10208,12 @@ private native void subscribeCurrentFabricIndexAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -10065,7 +10232,7 @@ public PowerSourceCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface ActiveBatteryFaultsAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -10073,7 +10240,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -10147,6 +10314,11 @@ public void readActiveBatteryFaultsAttribute(ActiveBatteryFaultsAttributeCallbac readActiveBatteryFaultsAttribute(chipClusterPtr, callback); } + public void subscribeActiveBatteryFaultsAttribute( + ActiveBatteryFaultsAttributeCallback callback, int minInterval, int maxInterval) { + subscribeActiveBatteryFaultsAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readBatteryChargeStateAttribute(IntegerAttributeCallback callback) { readBatteryChargeStateAttribute(chipClusterPtr, callback); } @@ -10160,6 +10332,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readFeatureMapAttribute(LongAttributeCallback callback) { readFeatureMapAttribute(chipClusterPtr, callback); } @@ -10224,6 +10401,12 @@ private native void subscribeBatteryChargeLevelAttribute( private native void readActiveBatteryFaultsAttribute( long chipClusterPtr, ActiveBatteryFaultsAttributeCallback callback); + private native void subscribeActiveBatteryFaultsAttribute( + long chipClusterPtr, + ActiveBatteryFaultsAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readBatteryChargeStateAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -10233,6 +10416,12 @@ private native void subscribeBatteryChargeStateAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readFeatureMapAttribute( long chipClusterPtr, LongAttributeCallback callback); @@ -10257,7 +10446,7 @@ public PowerSourceConfigurationCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface SourcesAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -10265,7 +10454,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -10276,10 +10465,20 @@ public void readSourcesAttribute(SourcesAttributeCallback callback) { readSourcesAttribute(chipClusterPtr, callback); } + public void subscribeSourcesAttribute( + SourcesAttributeCallback callback, int minInterval, int maxInterval) { + subscribeSourcesAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readAttributeListAttribute(AttributeListAttributeCallback callback) { readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -10292,9 +10491,18 @@ public void subscribeClusterRevisionAttribute( private native void readSourcesAttribute( long chipClusterPtr, SourcesAttributeCallback callback); + private native void subscribeSourcesAttribute( + long chipClusterPtr, SourcesAttributeCallback callback, int minInterval, int maxInterval); + private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -10313,7 +10521,7 @@ public PressureMeasurementCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -10351,6 +10559,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -10381,6 +10594,12 @@ private native void subscribeMaxMeasuredValueAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -10415,7 +10634,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -10588,13 +10807,12 @@ public void readLifetimeRunningHoursAttribute(LifetimeRunningHoursAttributeCallb readLifetimeRunningHoursAttribute(chipClusterPtr, callback); } - public void writeLifetimeRunningHoursAttribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeLifetimeRunningHoursAttribute(DefaultClusterCallback callback, Long value) { writeLifetimeRunningHoursAttribute(chipClusterPtr, callback, value, null); } public void writeLifetimeRunningHoursAttribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeLifetimeRunningHoursAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -10617,13 +10835,12 @@ public void readLifetimeEnergyConsumedAttribute( readLifetimeEnergyConsumedAttribute(chipClusterPtr, callback); } - public void writeLifetimeEnergyConsumedAttribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeLifetimeEnergyConsumedAttribute(DefaultClusterCallback callback, Long value) { writeLifetimeEnergyConsumedAttribute(chipClusterPtr, callback, value, null); } public void writeLifetimeEnergyConsumedAttribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeLifetimeEnergyConsumedAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -10681,6 +10898,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readFeatureMapAttribute(LongAttributeCallback callback) { readFeatureMapAttribute(chipClusterPtr, callback); } @@ -10812,7 +11034,7 @@ private native void readLifetimeRunningHoursAttribute( private native void writeLifetimeRunningHoursAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeLifetimeRunningHoursAttribute( @@ -10832,7 +11054,7 @@ private native void readLifetimeEnergyConsumedAttribute( private native void writeLifetimeEnergyConsumedAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeLifetimeEnergyConsumedAttribute( @@ -10874,6 +11096,12 @@ private native void subscribeAlarmMaskAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readFeatureMapAttribute( long chipClusterPtr, LongAttributeCallback callback); @@ -10898,7 +11126,7 @@ public RelativeHumidityMeasurementCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -10945,6 +11173,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -10981,6 +11214,12 @@ private native void subscribeToleranceAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -11004,9 +11243,7 @@ public void addScene( Integer sceneId, Integer transitionTime, String sceneName, - Long clusterId, - Integer length, - Integer value) { + ArrayList extensionFieldSets) { addScene( chipClusterPtr, callback, @@ -11014,9 +11251,7 @@ public void addScene( sceneId, transitionTime, sceneName, - clusterId, - length, - value, + extensionFieldSets, null); } @@ -11026,9 +11261,7 @@ public void addScene( Integer sceneId, Integer transitionTime, String sceneName, - Long clusterId, - Integer length, - Integer value, + ArrayList extensionFieldSets, int timedInvokeTimeoutMs) { addScene( chipClusterPtr, @@ -11037,9 +11270,7 @@ public void addScene( sceneId, transitionTime, sceneName, - clusterId, - length, - value, + extensionFieldSets, timedInvokeTimeoutMs); } @@ -11119,9 +11350,7 @@ private native void addScene( Integer sceneId, Integer transitionTime, String sceneName, - Long clusterId, - Integer length, - Integer value, + ArrayList extensionFieldSets, @Nullable Integer timedInvokeTimeoutMs); private native void getSceneMembership( @@ -11172,10 +11401,12 @@ public interface AddSceneResponseCallback { } public interface GetSceneMembershipResponseCallback { - void onSuccess(Integer status, Integer capacity, Integer groupId, Integer sceneCount - // sceneList: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - ); + void onSuccess( + Integer status, + Integer capacity, + Integer groupId, + Integer sceneCount, + ArrayList sceneList); void onError(Exception error); } @@ -11200,16 +11431,18 @@ public interface StoreSceneResponseCallback { public interface ViewSceneResponseCallback { void onSuccess( - Integer status, Integer groupId, Integer sceneId, Integer transitionTime, String sceneName - // extensionFieldSets: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - ); + Integer status, + Integer groupId, + Integer sceneId, + Integer transitionTime, + String sceneName, + ArrayList extensionFieldSets); void onError(Exception error); } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -11265,6 +11498,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -11307,6 +11545,12 @@ private native void subscribeNameSupportAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -11329,6 +11573,7 @@ public void resetWatermarks(DefaultClusterCallback callback) { } public void resetWatermarks(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + resetWatermarks(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -11337,51 +11582,8 @@ private native void resetWatermarks( DefaultClusterCallback Callback, @Nullable Integer timedInvokeTimeoutMs); - public static class ThreadMetricsAttribute { - public Long id; - public String name; - public Long stackFreeCurrent; - public Long stackFreeMinimum; - public Long stackSize; - - public ThreadMetricsAttribute( - Long id, String name, Long stackFreeCurrent, Long stackFreeMinimum, Long stackSize) { - this.id = id; - this.name = name; - this.stackFreeCurrent = stackFreeCurrent; - this.stackFreeMinimum = stackFreeMinimum; - this.stackSize = stackSize; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("long id: "); - output.append(this.id); - output.append("\n"); - - output.append("String name: "); - output.append(this.name); - output.append("\n"); - - output.append("long stackFreeCurrent: "); - output.append(this.stackFreeCurrent); - output.append("\n"); - - output.append("long stackFreeMinimum: "); - output.append(this.stackFreeMinimum); - output.append("\n"); - - output.append("long stackSize: "); - output.append(this.stackSize); - output.append("\n"); - - return output.toString(); - } - } - public interface ThreadMetricsAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -11389,7 +11591,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -11400,6 +11602,11 @@ public void readThreadMetricsAttribute(ThreadMetricsAttributeCallback callback) readThreadMetricsAttribute(chipClusterPtr, callback); } + public void subscribeThreadMetricsAttribute( + ThreadMetricsAttributeCallback callback, int minInterval, int maxInterval) { + subscribeThreadMetricsAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readCurrentHeapFreeAttribute(LongAttributeCallback callback) { readCurrentHeapFreeAttribute(chipClusterPtr, callback); } @@ -11432,6 +11639,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readFeatureMapAttribute(LongAttributeCallback callback) { readFeatureMapAttribute(chipClusterPtr, callback); } @@ -11453,6 +11665,12 @@ public void subscribeClusterRevisionAttribute( private native void readThreadMetricsAttribute( long chipClusterPtr, ThreadMetricsAttributeCallback callback); + private native void subscribeThreadMetricsAttribute( + long chipClusterPtr, + ThreadMetricsAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readCurrentHeapFreeAttribute( long chipClusterPtr, LongAttributeCallback callback); @@ -11474,6 +11692,12 @@ private native void subscribeCurrentHeapHighWatermarkAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readFeatureMapAttribute( long chipClusterPtr, LongAttributeCallback callback); @@ -11498,7 +11722,7 @@ public SwitchCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -11536,6 +11760,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readFeatureMapAttribute(LongAttributeCallback callback) { readFeatureMapAttribute(chipClusterPtr, callback); } @@ -11575,6 +11804,12 @@ private native void subscribeMultiPressMaxAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readFeatureMapAttribute( long chipClusterPtr, LongAttributeCallback callback); @@ -11624,32 +11859,8 @@ public interface NavigateTargetResponseCallback { void onError(Exception error); } - public static class TargetNavigatorListAttribute { - public Integer identifier; - public String name; - - public TargetNavigatorListAttribute(Integer identifier, String name) { - this.identifier = identifier; - this.name = name; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("int identifier: "); - output.append(this.identifier); - output.append("\n"); - - output.append("String name: "); - output.append(this.name); - output.append("\n"); - - return output.toString(); - } - } - public interface TargetNavigatorListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -11657,7 +11868,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -11668,6 +11879,11 @@ public void readTargetNavigatorListAttribute(TargetNavigatorListAttributeCallbac readTargetNavigatorListAttribute(chipClusterPtr, callback); } + public void subscribeTargetNavigatorListAttribute( + TargetNavigatorListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeTargetNavigatorListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readCurrentNavigatorTargetAttribute(IntegerAttributeCallback callback) { readCurrentNavigatorTargetAttribute(chipClusterPtr, callback); } @@ -11681,6 +11897,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -11693,6 +11914,12 @@ public void subscribeClusterRevisionAttribute( private native void readTargetNavigatorListAttribute( long chipClusterPtr, TargetNavigatorListAttributeCallback callback); + private native void subscribeTargetNavigatorListAttribute( + long chipClusterPtr, + TargetNavigatorListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readCurrentNavigatorTargetAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -11702,6 +11929,12 @@ private native void subscribeCurrentNavigatorTargetAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -11720,7 +11953,7 @@ public TemperatureMeasurementCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -11767,6 +12000,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -11803,6 +12041,12 @@ private native void subscribeToleranceAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -11821,31 +12065,15 @@ public TestClusterCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public void simpleStructEchoRequest( - SimpleStructResponseCallback callback, - Integer a, - Boolean b, - Integer c, - byte[] d, - String e, - Integer f, - Float g, - Double h) { - simpleStructEchoRequest(chipClusterPtr, callback, a, b, c, d, e, f, g, h, null); + SimpleStructResponseCallback callback, ChipStructs.TestClusterClusterSimpleStruct arg1) { + simpleStructEchoRequest(chipClusterPtr, callback, arg1, null); } public void simpleStructEchoRequest( SimpleStructResponseCallback callback, - Integer a, - Boolean b, - Integer c, - byte[] d, - String e, - Integer f, - Float g, - Double h, + ChipStructs.TestClusterClusterSimpleStruct arg1, int timedInvokeTimeoutMs) { - simpleStructEchoRequest( - chipClusterPtr, callback, a, b, c, d, e, f, g, h, timedInvokeTimeoutMs); + simpleStructEchoRequest(chipClusterPtr, callback, arg1, timedInvokeTimeoutMs); } public void test(DefaultClusterCallback callback) { @@ -11853,6 +12081,7 @@ public void test(DefaultClusterCallback callback) { } public void test(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + test(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -11892,95 +12121,76 @@ public void testEnumsRequest( testEnumsRequest(chipClusterPtr, callback, arg1, arg2, timedInvokeTimeoutMs); } - public void testListInt8UArgumentRequest(BooleanResponseCallback callback, Integer arg1) { + public void testListInt8UArgumentRequest( + BooleanResponseCallback callback, ArrayList arg1) { testListInt8UArgumentRequest(chipClusterPtr, callback, arg1, null); } public void testListInt8UArgumentRequest( - BooleanResponseCallback callback, Integer arg1, int timedInvokeTimeoutMs) { + BooleanResponseCallback callback, ArrayList arg1, int timedInvokeTimeoutMs) { testListInt8UArgumentRequest(chipClusterPtr, callback, arg1, timedInvokeTimeoutMs); } public void testListInt8UReverseRequest( - TestListInt8UReverseResponseCallback callback, Integer arg1) { + TestListInt8UReverseResponseCallback callback, ArrayList arg1) { testListInt8UReverseRequest(chipClusterPtr, callback, arg1, null); } public void testListInt8UReverseRequest( - TestListInt8UReverseResponseCallback callback, Integer arg1, int timedInvokeTimeoutMs) { + TestListInt8UReverseResponseCallback callback, + ArrayList arg1, + int timedInvokeTimeoutMs) { testListInt8UReverseRequest(chipClusterPtr, callback, arg1, timedInvokeTimeoutMs); } public void testListNestedStructListArgumentRequest( - BooleanResponseCallback callback, Integer a, Boolean b, Long e, byte[] f, Integer g) { - testListNestedStructListArgumentRequest(chipClusterPtr, callback, a, b, e, f, g, null); + BooleanResponseCallback callback, + ArrayList arg1) { + testListNestedStructListArgumentRequest(chipClusterPtr, callback, arg1, null); } public void testListNestedStructListArgumentRequest( BooleanResponseCallback callback, - Integer a, - Boolean b, - Long e, - byte[] f, - Integer g, + ArrayList arg1, int timedInvokeTimeoutMs) { - testListNestedStructListArgumentRequest( - chipClusterPtr, callback, a, b, e, f, g, timedInvokeTimeoutMs); + testListNestedStructListArgumentRequest(chipClusterPtr, callback, arg1, timedInvokeTimeoutMs); } public void testListStructArgumentRequest( BooleanResponseCallback callback, - Integer a, - Boolean b, - Integer c, - byte[] d, - String e, - Integer f, - Float g, - Double h) { - testListStructArgumentRequest(chipClusterPtr, callback, a, b, c, d, e, f, g, h, null); + ArrayList arg1) { + testListStructArgumentRequest(chipClusterPtr, callback, arg1, null); } public void testListStructArgumentRequest( BooleanResponseCallback callback, - Integer a, - Boolean b, - Integer c, - byte[] d, - String e, - Integer f, - Float g, - Double h, + ArrayList arg1, int timedInvokeTimeoutMs) { - testListStructArgumentRequest( - chipClusterPtr, callback, a, b, c, d, e, f, g, h, timedInvokeTimeoutMs); + testListStructArgumentRequest(chipClusterPtr, callback, arg1, timedInvokeTimeoutMs); } public void testNestedStructArgumentRequest( - BooleanResponseCallback callback, Integer a, Boolean b) { - testNestedStructArgumentRequest(chipClusterPtr, callback, a, b, null); + BooleanResponseCallback callback, ChipStructs.TestClusterClusterNestedStruct arg1) { + testNestedStructArgumentRequest(chipClusterPtr, callback, arg1, null); } public void testNestedStructArgumentRequest( - BooleanResponseCallback callback, Integer a, Boolean b, int timedInvokeTimeoutMs) { - testNestedStructArgumentRequest(chipClusterPtr, callback, a, b, timedInvokeTimeoutMs); + BooleanResponseCallback callback, + ChipStructs.TestClusterClusterNestedStruct arg1, + int timedInvokeTimeoutMs) { + testNestedStructArgumentRequest(chipClusterPtr, callback, arg1, timedInvokeTimeoutMs); } public void testNestedStructListArgumentRequest( - BooleanResponseCallback callback, Integer a, Boolean b, Long e, byte[] f, Integer g) { - testNestedStructListArgumentRequest(chipClusterPtr, callback, a, b, e, f, g, null); + BooleanResponseCallback callback, ChipStructs.TestClusterClusterNestedStructList arg1) { + testNestedStructListArgumentRequest(chipClusterPtr, callback, arg1, null); } public void testNestedStructListArgumentRequest( BooleanResponseCallback callback, - Integer a, - Boolean b, - Long e, - byte[] f, - Integer g, + ChipStructs.TestClusterClusterNestedStructList arg1, int timedInvokeTimeoutMs) { - testNestedStructListArgumentRequest( - chipClusterPtr, callback, a, b, e, f, g, timedInvokeTimeoutMs); + testNestedStructListArgumentRequest(chipClusterPtr, callback, arg1, timedInvokeTimeoutMs); } public void testNotHandled(DefaultClusterCallback callback) { @@ -11988,17 +12198,18 @@ public void testNotHandled(DefaultClusterCallback callback) { } public void testNotHandled(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + testNotHandled(chipClusterPtr, callback, timedInvokeTimeoutMs); } public void testNullableOptionalRequest( - TestNullableOptionalResponseCallback callback, Optional arg1) { + TestNullableOptionalResponseCallback callback, @Nullable Optional arg1) { testNullableOptionalRequest(chipClusterPtr, callback, arg1, null); } public void testNullableOptionalRequest( TestNullableOptionalResponseCallback callback, - Optional arg1, + @Nullable Optional arg1, int timedInvokeTimeoutMs) { testNullableOptionalRequest(chipClusterPtr, callback, arg1, timedInvokeTimeoutMs); } @@ -12018,35 +12229,20 @@ public void testSpecific(TestSpecificResponseCallback callback) { } public void testSpecific(TestSpecificResponseCallback callback, int timedInvokeTimeoutMs) { + testSpecific(chipClusterPtr, callback, timedInvokeTimeoutMs); } public void testStructArgumentRequest( - BooleanResponseCallback callback, - Integer a, - Boolean b, - Integer c, - byte[] d, - String e, - Integer f, - Float g, - Double h) { - testStructArgumentRequest(chipClusterPtr, callback, a, b, c, d, e, f, g, h, null); + BooleanResponseCallback callback, ChipStructs.TestClusterClusterSimpleStruct arg1) { + testStructArgumentRequest(chipClusterPtr, callback, arg1, null); } public void testStructArgumentRequest( BooleanResponseCallback callback, - Integer a, - Boolean b, - Integer c, - byte[] d, - String e, - Integer f, - Float g, - Double h, + ChipStructs.TestClusterClusterSimpleStruct arg1, int timedInvokeTimeoutMs) { - testStructArgumentRequest( - chipClusterPtr, callback, a, b, c, d, e, f, g, h, timedInvokeTimeoutMs); + testStructArgumentRequest(chipClusterPtr, callback, arg1, timedInvokeTimeoutMs); } public void testUnknownCommand(DefaultClusterCallback callback) { @@ -12054,24 +12250,19 @@ public void testUnknownCommand(DefaultClusterCallback callback) { } public void testUnknownCommand(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + testUnknownCommand(chipClusterPtr, callback, timedInvokeTimeoutMs); } public void timedInvokeRequest(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + timedInvokeRequest(chipClusterPtr, callback, timedInvokeTimeoutMs); } private native void simpleStructEchoRequest( long chipClusterPtr, SimpleStructResponseCallback Callback, - Integer a, - Boolean b, - Integer c, - byte[] d, - String e, - Integer f, - Float g, - Double h, + ChipStructs.TestClusterClusterSimpleStruct arg1, @Nullable Integer timedInvokeTimeoutMs); private native void test( @@ -12104,53 +12295,37 @@ private native void testEnumsRequest( private native void testListInt8UArgumentRequest( long chipClusterPtr, BooleanResponseCallback Callback, - Integer arg1, + ArrayList arg1, @Nullable Integer timedInvokeTimeoutMs); private native void testListInt8UReverseRequest( long chipClusterPtr, TestListInt8UReverseResponseCallback Callback, - Integer arg1, + ArrayList arg1, @Nullable Integer timedInvokeTimeoutMs); private native void testListNestedStructListArgumentRequest( long chipClusterPtr, BooleanResponseCallback Callback, - Integer a, - Boolean b, - Long e, - byte[] f, - Integer g, + ArrayList arg1, @Nullable Integer timedInvokeTimeoutMs); private native void testListStructArgumentRequest( long chipClusterPtr, BooleanResponseCallback Callback, - Integer a, - Boolean b, - Integer c, - byte[] d, - String e, - Integer f, - Float g, - Double h, + ArrayList arg1, @Nullable Integer timedInvokeTimeoutMs); private native void testNestedStructArgumentRequest( long chipClusterPtr, BooleanResponseCallback Callback, - Integer a, - Boolean b, + ChipStructs.TestClusterClusterNestedStruct arg1, @Nullable Integer timedInvokeTimeoutMs); private native void testNestedStructListArgumentRequest( long chipClusterPtr, BooleanResponseCallback Callback, - Integer a, - Boolean b, - Long e, - byte[] f, - Integer g, + ChipStructs.TestClusterClusterNestedStructList arg1, @Nullable Integer timedInvokeTimeoutMs); private native void testNotHandled( @@ -12161,7 +12336,7 @@ private native void testNotHandled( private native void testNullableOptionalRequest( long chipClusterPtr, TestNullableOptionalResponseCallback Callback, - Optional arg1, + @Nullable Optional arg1, @Nullable Integer timedInvokeTimeoutMs); private native void testSimpleOptionalArgumentRequest( @@ -12178,14 +12353,7 @@ private native void testSpecific( private native void testStructArgumentRequest( long chipClusterPtr, BooleanResponseCallback Callback, - Integer a, - Boolean b, - Integer c, - byte[] d, - String e, - Integer f, - Float g, - Double h, + ChipStructs.TestClusterClusterSimpleStruct arg1, @Nullable Integer timedInvokeTimeoutMs); private native void testUnknownCommand( @@ -12205,9 +12373,7 @@ public interface BooleanResponseCallback { } public interface SimpleStructResponseCallback { - void onSuccess( // arg1: Struct SimpleStruct - // Conversion from this type to Java is not properly implemented yet - ); + void onSuccess(ChipStructs.TestClusterClusterSimpleStruct arg1); void onError(Exception error); } @@ -12231,9 +12397,7 @@ public interface TestEnumsResponseCallback { } public interface TestListInt8UReverseResponseCallback { - void onSuccess( // arg1: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - ); + void onSuccess(ArrayList arg1); void onError(Exception error); } @@ -12243,7 +12407,7 @@ void onSuccess( Boolean wasPresent, Optional wasNull, Optional value, - Optional originalValue); + @Nullable Optional originalValue); void onError(Exception error); } @@ -12255,7 +12419,7 @@ public interface TestSpecificResponseCallback { } public interface ListInt8uAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -12263,39 +12427,15 @@ default void onSubscriptionEstablished() {} } public interface ListOctetStringAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); default void onSubscriptionEstablished() {} } - public static class ListStructOctetStringAttribute { - public Long fabricIndex; - public byte[] operationalCert; - - public ListStructOctetStringAttribute(Long fabricIndex, byte[] operationalCert) { - this.fabricIndex = fabricIndex; - this.operationalCert = operationalCert; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("long fabricIndex: "); - output.append(this.fabricIndex); - output.append("\n"); - - output.append("byte[] "); - output.append(Arrays.toString(operationalCert)); - output.append("\n"); - - return output.toString(); - } - } - public interface ListStructOctetStringAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -12310,39 +12450,8 @@ public interface VendorIdAttributeCallback { default void onSubscriptionEstablished() {} } - public static class ListNullablesAndOptionalsStructAttribute { - @Nullable public Integer nullableInt; - public Optional optionalInt; - @Nullable public Optional nullableOptionalInt; - @Nullable public String nullableString; - public Optional optionalString; - @Nullable public Optional nullableOptionalString; - - public ListNullablesAndOptionalsStructAttribute( - @Nullable Integer nullableInt, - Optional optionalInt, - @Nullable Optional nullableOptionalInt, - @Nullable String nullableString, - Optional optionalString, - @Nullable Optional nullableOptionalString) { - this.nullableInt = nullableInt; - this.optionalInt = optionalInt; - this.nullableOptionalInt = nullableOptionalInt; - this.nullableString = nullableString; - this.optionalString = optionalString; - this.nullableOptionalString = nullableOptionalString; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - - return output.toString(); - } - } - public interface ListNullablesAndOptionalsStructAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -12350,7 +12459,7 @@ default void onSubscriptionEstablished() {} } public interface ListLongOctetStringAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -12614,7 +12723,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -13093,15 +13202,62 @@ public void readListInt8uAttribute(ListInt8uAttributeCallback callback) { readListInt8uAttribute(chipClusterPtr, callback); } + public void writeListInt8uAttribute(DefaultClusterCallback callback, ArrayList value) { + writeListInt8uAttribute(chipClusterPtr, callback, value, null); + } + + public void writeListInt8uAttribute( + DefaultClusterCallback callback, ArrayList value, int timedWriteTimeoutMs) { + writeListInt8uAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); + } + + public void subscribeListInt8uAttribute( + ListInt8uAttributeCallback callback, int minInterval, int maxInterval) { + subscribeListInt8uAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readListOctetStringAttribute(ListOctetStringAttributeCallback callback) { readListOctetStringAttribute(chipClusterPtr, callback); } + public void writeListOctetStringAttribute( + DefaultClusterCallback callback, ArrayList value) { + writeListOctetStringAttribute(chipClusterPtr, callback, value, null); + } + + public void writeListOctetStringAttribute( + DefaultClusterCallback callback, ArrayList value, int timedWriteTimeoutMs) { + writeListOctetStringAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); + } + + public void subscribeListOctetStringAttribute( + ListOctetStringAttributeCallback callback, int minInterval, int maxInterval) { + subscribeListOctetStringAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readListStructOctetStringAttribute( ListStructOctetStringAttributeCallback callback) { readListStructOctetStringAttribute(chipClusterPtr, callback); } + public void writeListStructOctetStringAttribute( + DefaultClusterCallback callback, + ArrayList value) { + writeListStructOctetStringAttribute(chipClusterPtr, callback, value, null); + } + + public void writeListStructOctetStringAttribute( + DefaultClusterCallback callback, + ArrayList value, + int timedWriteTimeoutMs) { + writeListStructOctetStringAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); + } + + public void subscribeListStructOctetStringAttribute( + ListStructOctetStringAttributeCallback callback, int minInterval, int maxInterval) { + subscribeListStructOctetStringAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readLongOctetStringAttribute(OctetStringAttributeCallback callback) { readLongOctetStringAttribute(chipClusterPtr, callback); } @@ -13215,6 +13371,28 @@ public void readListNullablesAndOptionalsStructAttribute( readListNullablesAndOptionalsStructAttribute(chipClusterPtr, callback); } + public void writeListNullablesAndOptionalsStructAttribute( + DefaultClusterCallback callback, + ArrayList value) { + writeListNullablesAndOptionalsStructAttribute(chipClusterPtr, callback, value, null); + } + + public void writeListNullablesAndOptionalsStructAttribute( + DefaultClusterCallback callback, + ArrayList value, + int timedWriteTimeoutMs) { + writeListNullablesAndOptionalsStructAttribute( + chipClusterPtr, callback, value, timedWriteTimeoutMs); + } + + public void subscribeListNullablesAndOptionalsStructAttribute( + ListNullablesAndOptionalsStructAttributeCallback callback, + int minInterval, + int maxInterval) { + subscribeListNullablesAndOptionalsStructAttribute( + chipClusterPtr, callback, minInterval, maxInterval); + } + public void readEnumAttrAttribute(IntegerAttributeCallback callback) { readEnumAttrAttribute(chipClusterPtr, callback); } @@ -13311,6 +13489,11 @@ public void readListLongOctetStringAttribute(ListLongOctetStringAttributeCallbac readListLongOctetStringAttribute(chipClusterPtr, callback); } + public void subscribeListLongOctetStringAttribute( + ListLongOctetStringAttributeCallback callback, int minInterval, int maxInterval) { + subscribeListLongOctetStringAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readTimedWriteBooleanAttribute(BooleanAttributeCallback callback) { readTimedWriteBooleanAttribute(chipClusterPtr, callback); } @@ -13347,13 +13530,12 @@ public void readNullableBooleanAttribute(NullableBooleanAttributeCallback callba readNullableBooleanAttribute(chipClusterPtr, callback); } - public void writeNullableBooleanAttribute( - DefaultClusterCallback callback, @Nullable Boolean value) { + public void writeNullableBooleanAttribute(DefaultClusterCallback callback, Boolean value) { writeNullableBooleanAttribute(chipClusterPtr, callback, value, null); } public void writeNullableBooleanAttribute( - DefaultClusterCallback callback, @Nullable Boolean value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Boolean value, int timedWriteTimeoutMs) { writeNullableBooleanAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13366,13 +13548,12 @@ public void readNullableBitmap8Attribute(NullableBitmap8AttributeCallback callba readNullableBitmap8Attribute(chipClusterPtr, callback); } - public void writeNullableBitmap8Attribute( - DefaultClusterCallback callback, @Nullable Integer value) { + public void writeNullableBitmap8Attribute(DefaultClusterCallback callback, Integer value) { writeNullableBitmap8Attribute(chipClusterPtr, callback, value, null); } public void writeNullableBitmap8Attribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeNullableBitmap8Attribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13385,13 +13566,12 @@ public void readNullableBitmap16Attribute(NullableBitmap16AttributeCallback call readNullableBitmap16Attribute(chipClusterPtr, callback); } - public void writeNullableBitmap16Attribute( - DefaultClusterCallback callback, @Nullable Integer value) { + public void writeNullableBitmap16Attribute(DefaultClusterCallback callback, Integer value) { writeNullableBitmap16Attribute(chipClusterPtr, callback, value, null); } public void writeNullableBitmap16Attribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeNullableBitmap16Attribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13404,13 +13584,12 @@ public void readNullableBitmap32Attribute(NullableBitmap32AttributeCallback call readNullableBitmap32Attribute(chipClusterPtr, callback); } - public void writeNullableBitmap32Attribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeNullableBitmap32Attribute(DefaultClusterCallback callback, Long value) { writeNullableBitmap32Attribute(chipClusterPtr, callback, value, null); } public void writeNullableBitmap32Attribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeNullableBitmap32Attribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13423,13 +13602,12 @@ public void readNullableBitmap64Attribute(NullableBitmap64AttributeCallback call readNullableBitmap64Attribute(chipClusterPtr, callback); } - public void writeNullableBitmap64Attribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeNullableBitmap64Attribute(DefaultClusterCallback callback, Long value) { writeNullableBitmap64Attribute(chipClusterPtr, callback, value, null); } public void writeNullableBitmap64Attribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeNullableBitmap64Attribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13442,13 +13620,12 @@ public void readNullableInt8uAttribute(NullableInt8uAttributeCallback callback) readNullableInt8uAttribute(chipClusterPtr, callback); } - public void writeNullableInt8uAttribute( - DefaultClusterCallback callback, @Nullable Integer value) { + public void writeNullableInt8uAttribute(DefaultClusterCallback callback, Integer value) { writeNullableInt8uAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt8uAttribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeNullableInt8uAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13461,13 +13638,12 @@ public void readNullableInt16uAttribute(NullableInt16uAttributeCallback callback readNullableInt16uAttribute(chipClusterPtr, callback); } - public void writeNullableInt16uAttribute( - DefaultClusterCallback callback, @Nullable Integer value) { + public void writeNullableInt16uAttribute(DefaultClusterCallback callback, Integer value) { writeNullableInt16uAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt16uAttribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeNullableInt16uAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13480,13 +13656,12 @@ public void readNullableInt24uAttribute(NullableInt24uAttributeCallback callback readNullableInt24uAttribute(chipClusterPtr, callback); } - public void writeNullableInt24uAttribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeNullableInt24uAttribute(DefaultClusterCallback callback, Long value) { writeNullableInt24uAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt24uAttribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeNullableInt24uAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13499,13 +13674,12 @@ public void readNullableInt32uAttribute(NullableInt32uAttributeCallback callback readNullableInt32uAttribute(chipClusterPtr, callback); } - public void writeNullableInt32uAttribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeNullableInt32uAttribute(DefaultClusterCallback callback, Long value) { writeNullableInt32uAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt32uAttribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeNullableInt32uAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13518,13 +13692,12 @@ public void readNullableInt40uAttribute(NullableInt40uAttributeCallback callback readNullableInt40uAttribute(chipClusterPtr, callback); } - public void writeNullableInt40uAttribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeNullableInt40uAttribute(DefaultClusterCallback callback, Long value) { writeNullableInt40uAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt40uAttribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeNullableInt40uAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13537,13 +13710,12 @@ public void readNullableInt48uAttribute(NullableInt48uAttributeCallback callback readNullableInt48uAttribute(chipClusterPtr, callback); } - public void writeNullableInt48uAttribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeNullableInt48uAttribute(DefaultClusterCallback callback, Long value) { writeNullableInt48uAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt48uAttribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeNullableInt48uAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13556,13 +13728,12 @@ public void readNullableInt56uAttribute(NullableInt56uAttributeCallback callback readNullableInt56uAttribute(chipClusterPtr, callback); } - public void writeNullableInt56uAttribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeNullableInt56uAttribute(DefaultClusterCallback callback, Long value) { writeNullableInt56uAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt56uAttribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeNullableInt56uAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13575,13 +13746,12 @@ public void readNullableInt64uAttribute(NullableInt64uAttributeCallback callback readNullableInt64uAttribute(chipClusterPtr, callback); } - public void writeNullableInt64uAttribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeNullableInt64uAttribute(DefaultClusterCallback callback, Long value) { writeNullableInt64uAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt64uAttribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeNullableInt64uAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13594,13 +13764,12 @@ public void readNullableInt8sAttribute(NullableInt8sAttributeCallback callback) readNullableInt8sAttribute(chipClusterPtr, callback); } - public void writeNullableInt8sAttribute( - DefaultClusterCallback callback, @Nullable Integer value) { + public void writeNullableInt8sAttribute(DefaultClusterCallback callback, Integer value) { writeNullableInt8sAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt8sAttribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeNullableInt8sAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13613,13 +13782,12 @@ public void readNullableInt16sAttribute(NullableInt16sAttributeCallback callback readNullableInt16sAttribute(chipClusterPtr, callback); } - public void writeNullableInt16sAttribute( - DefaultClusterCallback callback, @Nullable Integer value) { + public void writeNullableInt16sAttribute(DefaultClusterCallback callback, Integer value) { writeNullableInt16sAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt16sAttribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeNullableInt16sAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13632,13 +13800,12 @@ public void readNullableInt24sAttribute(NullableInt24sAttributeCallback callback readNullableInt24sAttribute(chipClusterPtr, callback); } - public void writeNullableInt24sAttribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeNullableInt24sAttribute(DefaultClusterCallback callback, Long value) { writeNullableInt24sAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt24sAttribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeNullableInt24sAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13651,13 +13818,12 @@ public void readNullableInt32sAttribute(NullableInt32sAttributeCallback callback readNullableInt32sAttribute(chipClusterPtr, callback); } - public void writeNullableInt32sAttribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeNullableInt32sAttribute(DefaultClusterCallback callback, Long value) { writeNullableInt32sAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt32sAttribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeNullableInt32sAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13670,13 +13836,12 @@ public void readNullableInt40sAttribute(NullableInt40sAttributeCallback callback readNullableInt40sAttribute(chipClusterPtr, callback); } - public void writeNullableInt40sAttribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeNullableInt40sAttribute(DefaultClusterCallback callback, Long value) { writeNullableInt40sAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt40sAttribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeNullableInt40sAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13689,13 +13854,12 @@ public void readNullableInt48sAttribute(NullableInt48sAttributeCallback callback readNullableInt48sAttribute(chipClusterPtr, callback); } - public void writeNullableInt48sAttribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeNullableInt48sAttribute(DefaultClusterCallback callback, Long value) { writeNullableInt48sAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt48sAttribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeNullableInt48sAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13708,13 +13872,12 @@ public void readNullableInt56sAttribute(NullableInt56sAttributeCallback callback readNullableInt56sAttribute(chipClusterPtr, callback); } - public void writeNullableInt56sAttribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeNullableInt56sAttribute(DefaultClusterCallback callback, Long value) { writeNullableInt56sAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt56sAttribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeNullableInt56sAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13727,13 +13890,12 @@ public void readNullableInt64sAttribute(NullableInt64sAttributeCallback callback readNullableInt64sAttribute(chipClusterPtr, callback); } - public void writeNullableInt64sAttribute( - DefaultClusterCallback callback, @Nullable Long value) { + public void writeNullableInt64sAttribute(DefaultClusterCallback callback, Long value) { writeNullableInt64sAttribute(chipClusterPtr, callback, value, null); } public void writeNullableInt64sAttribute( - DefaultClusterCallback callback, @Nullable Long value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { writeNullableInt64sAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13746,13 +13908,12 @@ public void readNullableEnum8Attribute(NullableEnum8AttributeCallback callback) readNullableEnum8Attribute(chipClusterPtr, callback); } - public void writeNullableEnum8Attribute( - DefaultClusterCallback callback, @Nullable Integer value) { + public void writeNullableEnum8Attribute(DefaultClusterCallback callback, Integer value) { writeNullableEnum8Attribute(chipClusterPtr, callback, value, null); } public void writeNullableEnum8Attribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeNullableEnum8Attribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13765,13 +13926,12 @@ public void readNullableEnum16Attribute(NullableEnum16AttributeCallback callback readNullableEnum16Attribute(chipClusterPtr, callback); } - public void writeNullableEnum16Attribute( - DefaultClusterCallback callback, @Nullable Integer value) { + public void writeNullableEnum16Attribute(DefaultClusterCallback callback, Integer value) { writeNullableEnum16Attribute(chipClusterPtr, callback, value, null); } public void writeNullableEnum16Attribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeNullableEnum16Attribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13784,13 +13944,12 @@ public void readNullableFloatSingleAttribute(NullableFloatSingleAttributeCallbac readNullableFloatSingleAttribute(chipClusterPtr, callback); } - public void writeNullableFloatSingleAttribute( - DefaultClusterCallback callback, @Nullable Float value) { + public void writeNullableFloatSingleAttribute(DefaultClusterCallback callback, Float value) { writeNullableFloatSingleAttribute(chipClusterPtr, callback, value, null); } public void writeNullableFloatSingleAttribute( - DefaultClusterCallback callback, @Nullable Float value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Float value, int timedWriteTimeoutMs) { writeNullableFloatSingleAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13803,13 +13962,12 @@ public void readNullableFloatDoubleAttribute(NullableFloatDoubleAttributeCallbac readNullableFloatDoubleAttribute(chipClusterPtr, callback); } - public void writeNullableFloatDoubleAttribute( - DefaultClusterCallback callback, @Nullable Double value) { + public void writeNullableFloatDoubleAttribute(DefaultClusterCallback callback, Double value) { writeNullableFloatDoubleAttribute(chipClusterPtr, callback, value, null); } public void writeNullableFloatDoubleAttribute( - DefaultClusterCallback callback, @Nullable Double value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Double value, int timedWriteTimeoutMs) { writeNullableFloatDoubleAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13822,13 +13980,12 @@ public void readNullableOctetStringAttribute(NullableOctetStringAttributeCallbac readNullableOctetStringAttribute(chipClusterPtr, callback); } - public void writeNullableOctetStringAttribute( - DefaultClusterCallback callback, @Nullable byte[] value) { + public void writeNullableOctetStringAttribute(DefaultClusterCallback callback, byte[] value) { writeNullableOctetStringAttribute(chipClusterPtr, callback, value, null); } public void writeNullableOctetStringAttribute( - DefaultClusterCallback callback, @Nullable byte[] value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, byte[] value, int timedWriteTimeoutMs) { writeNullableOctetStringAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13841,13 +13998,12 @@ public void readNullableCharStringAttribute(NullableCharStringAttributeCallback readNullableCharStringAttribute(chipClusterPtr, callback); } - public void writeNullableCharStringAttribute( - DefaultClusterCallback callback, @Nullable String value) { + public void writeNullableCharStringAttribute(DefaultClusterCallback callback, String value) { writeNullableCharStringAttribute(chipClusterPtr, callback, value, null); } public void writeNullableCharStringAttribute( - DefaultClusterCallback callback, @Nullable String value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, String value, int timedWriteTimeoutMs) { writeNullableCharStringAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13860,13 +14016,12 @@ public void readNullableEnumAttrAttribute(NullableEnumAttrAttributeCallback call readNullableEnumAttrAttribute(chipClusterPtr, callback); } - public void writeNullableEnumAttrAttribute( - DefaultClusterCallback callback, @Nullable Integer value) { + public void writeNullableEnumAttrAttribute(DefaultClusterCallback callback, Integer value) { writeNullableEnumAttrAttribute(chipClusterPtr, callback, value, null); } public void writeNullableEnumAttrAttribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeNullableEnumAttrAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13881,12 +14036,12 @@ public void readNullableRangeRestrictedInt8uAttribute( } public void writeNullableRangeRestrictedInt8uAttribute( - DefaultClusterCallback callback, @Nullable Integer value) { + DefaultClusterCallback callback, Integer value) { writeNullableRangeRestrictedInt8uAttribute(chipClusterPtr, callback, value, null); } public void writeNullableRangeRestrictedInt8uAttribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeNullableRangeRestrictedInt8uAttribute( chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13903,12 +14058,12 @@ public void readNullableRangeRestrictedInt8sAttribute( } public void writeNullableRangeRestrictedInt8sAttribute( - DefaultClusterCallback callback, @Nullable Integer value) { + DefaultClusterCallback callback, Integer value) { writeNullableRangeRestrictedInt8sAttribute(chipClusterPtr, callback, value, null); } public void writeNullableRangeRestrictedInt8sAttribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeNullableRangeRestrictedInt8sAttribute( chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13925,12 +14080,12 @@ public void readNullableRangeRestrictedInt16uAttribute( } public void writeNullableRangeRestrictedInt16uAttribute( - DefaultClusterCallback callback, @Nullable Integer value) { + DefaultClusterCallback callback, Integer value) { writeNullableRangeRestrictedInt16uAttribute(chipClusterPtr, callback, value, null); } public void writeNullableRangeRestrictedInt16uAttribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeNullableRangeRestrictedInt16uAttribute( chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13947,12 +14102,12 @@ public void readNullableRangeRestrictedInt16sAttribute( } public void writeNullableRangeRestrictedInt16sAttribute( - DefaultClusterCallback callback, @Nullable Integer value) { + DefaultClusterCallback callback, Integer value) { writeNullableRangeRestrictedInt16sAttribute(chipClusterPtr, callback, value, null); } public void writeNullableRangeRestrictedInt16sAttribute( - DefaultClusterCallback callback, @Nullable Integer value, int timedWriteTimeoutMs) { + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { writeNullableRangeRestrictedInt16sAttribute( chipClusterPtr, callback, value, timedWriteTimeoutMs); } @@ -13967,6 +14122,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -14274,12 +14434,45 @@ private native void subscribeOctetStringAttribute( private native void readListInt8uAttribute( long chipClusterPtr, ListInt8uAttributeCallback callback); + private native void writeListInt8uAttribute( + long chipClusterPtr, + DefaultClusterCallback callback, + ArrayList value, + @Nullable Integer timedWriteTimeoutMs); + + private native void subscribeListInt8uAttribute( + long chipClusterPtr, ListInt8uAttributeCallback callback, int minInterval, int maxInterval); + private native void readListOctetStringAttribute( long chipClusterPtr, ListOctetStringAttributeCallback callback); + private native void writeListOctetStringAttribute( + long chipClusterPtr, + DefaultClusterCallback callback, + ArrayList value, + @Nullable Integer timedWriteTimeoutMs); + + private native void subscribeListOctetStringAttribute( + long chipClusterPtr, + ListOctetStringAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readListStructOctetStringAttribute( long chipClusterPtr, ListStructOctetStringAttributeCallback callback); + private native void writeListStructOctetStringAttribute( + long chipClusterPtr, + DefaultClusterCallback callback, + ArrayList value, + @Nullable Integer timedWriteTimeoutMs); + + private native void subscribeListStructOctetStringAttribute( + long chipClusterPtr, + ListStructOctetStringAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readLongOctetStringAttribute( long chipClusterPtr, OctetStringAttributeCallback callback); @@ -14362,6 +14555,18 @@ private native void subscribeVendorIdAttribute( private native void readListNullablesAndOptionalsStructAttribute( long chipClusterPtr, ListNullablesAndOptionalsStructAttributeCallback callback); + private native void writeListNullablesAndOptionalsStructAttribute( + long chipClusterPtr, + DefaultClusterCallback callback, + ArrayList value, + @Nullable Integer timedWriteTimeoutMs); + + private native void subscribeListNullablesAndOptionalsStructAttribute( + long chipClusterPtr, + ListNullablesAndOptionalsStructAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readEnumAttrAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -14425,6 +14630,12 @@ private native void subscribeRangeRestrictedInt16sAttribute( private native void readListLongOctetStringAttribute( long chipClusterPtr, ListLongOctetStringAttributeCallback callback); + private native void subscribeListLongOctetStringAttribute( + long chipClusterPtr, + ListLongOctetStringAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readTimedWriteBooleanAttribute( long chipClusterPtr, BooleanAttributeCallback callback); @@ -14455,7 +14666,7 @@ private native void readNullableBooleanAttribute( private native void writeNullableBooleanAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Boolean value, + Boolean value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableBooleanAttribute( @@ -14470,7 +14681,7 @@ private native void readNullableBitmap8Attribute( private native void writeNullableBitmap8Attribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableBitmap8Attribute( @@ -14485,7 +14696,7 @@ private native void readNullableBitmap16Attribute( private native void writeNullableBitmap16Attribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableBitmap16Attribute( @@ -14500,7 +14711,7 @@ private native void readNullableBitmap32Attribute( private native void writeNullableBitmap32Attribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableBitmap32Attribute( @@ -14515,7 +14726,7 @@ private native void readNullableBitmap64Attribute( private native void writeNullableBitmap64Attribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableBitmap64Attribute( @@ -14530,7 +14741,7 @@ private native void readNullableInt8uAttribute( private native void writeNullableInt8uAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt8uAttribute( @@ -14545,7 +14756,7 @@ private native void readNullableInt16uAttribute( private native void writeNullableInt16uAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt16uAttribute( @@ -14560,7 +14771,7 @@ private native void readNullableInt24uAttribute( private native void writeNullableInt24uAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt24uAttribute( @@ -14575,7 +14786,7 @@ private native void readNullableInt32uAttribute( private native void writeNullableInt32uAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt32uAttribute( @@ -14590,7 +14801,7 @@ private native void readNullableInt40uAttribute( private native void writeNullableInt40uAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt40uAttribute( @@ -14605,7 +14816,7 @@ private native void readNullableInt48uAttribute( private native void writeNullableInt48uAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt48uAttribute( @@ -14620,7 +14831,7 @@ private native void readNullableInt56uAttribute( private native void writeNullableInt56uAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt56uAttribute( @@ -14635,7 +14846,7 @@ private native void readNullableInt64uAttribute( private native void writeNullableInt64uAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt64uAttribute( @@ -14650,7 +14861,7 @@ private native void readNullableInt8sAttribute( private native void writeNullableInt8sAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt8sAttribute( @@ -14665,7 +14876,7 @@ private native void readNullableInt16sAttribute( private native void writeNullableInt16sAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt16sAttribute( @@ -14680,7 +14891,7 @@ private native void readNullableInt24sAttribute( private native void writeNullableInt24sAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt24sAttribute( @@ -14695,7 +14906,7 @@ private native void readNullableInt32sAttribute( private native void writeNullableInt32sAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt32sAttribute( @@ -14710,7 +14921,7 @@ private native void readNullableInt40sAttribute( private native void writeNullableInt40sAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt40sAttribute( @@ -14725,7 +14936,7 @@ private native void readNullableInt48sAttribute( private native void writeNullableInt48sAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt48sAttribute( @@ -14740,7 +14951,7 @@ private native void readNullableInt56sAttribute( private native void writeNullableInt56sAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt56sAttribute( @@ -14755,7 +14966,7 @@ private native void readNullableInt64sAttribute( private native void writeNullableInt64sAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Long value, + Long value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableInt64sAttribute( @@ -14770,7 +14981,7 @@ private native void readNullableEnum8Attribute( private native void writeNullableEnum8Attribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableEnum8Attribute( @@ -14785,7 +14996,7 @@ private native void readNullableEnum16Attribute( private native void writeNullableEnum16Attribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableEnum16Attribute( @@ -14800,7 +15011,7 @@ private native void readNullableFloatSingleAttribute( private native void writeNullableFloatSingleAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Float value, + Float value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableFloatSingleAttribute( @@ -14815,7 +15026,7 @@ private native void readNullableFloatDoubleAttribute( private native void writeNullableFloatDoubleAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Double value, + Double value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableFloatDoubleAttribute( @@ -14830,7 +15041,7 @@ private native void readNullableOctetStringAttribute( private native void writeNullableOctetStringAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable byte[] value, + byte[] value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableOctetStringAttribute( @@ -14845,7 +15056,7 @@ private native void readNullableCharStringAttribute( private native void writeNullableCharStringAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable String value, + String value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableCharStringAttribute( @@ -14860,7 +15071,7 @@ private native void readNullableEnumAttrAttribute( private native void writeNullableEnumAttrAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableEnumAttrAttribute( @@ -14875,7 +15086,7 @@ private native void readNullableRangeRestrictedInt8uAttribute( private native void writeNullableRangeRestrictedInt8uAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableRangeRestrictedInt8uAttribute( @@ -14890,7 +15101,7 @@ private native void readNullableRangeRestrictedInt8sAttribute( private native void writeNullableRangeRestrictedInt8sAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableRangeRestrictedInt8sAttribute( @@ -14905,7 +15116,7 @@ private native void readNullableRangeRestrictedInt16uAttribute( private native void writeNullableRangeRestrictedInt16uAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableRangeRestrictedInt16uAttribute( @@ -14920,7 +15131,7 @@ private native void readNullableRangeRestrictedInt16sAttribute( private native void writeNullableRangeRestrictedInt16sAttribute( long chipClusterPtr, DefaultClusterCallback callback, - @Nullable Integer value, + Integer value, @Nullable Integer timedWriteTimeoutMs); private native void subscribeNullableRangeRestrictedInt16sAttribute( @@ -14932,6 +15143,12 @@ private native void subscribeNullableRangeRestrictedInt16sAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -14954,6 +15171,7 @@ public void clearWeeklySchedule(DefaultClusterCallback callback) { } public void clearWeeklySchedule(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + clearWeeklySchedule(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -14963,6 +15181,7 @@ public void getRelayStatusLog(GetRelayStatusLogResponseCallback callback) { public void getRelayStatusLog( GetRelayStatusLogResponseCallback callback, int timedInvokeTimeoutMs) { + getRelayStatusLog(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -14984,7 +15203,7 @@ public void setWeeklySchedule( Integer numberOfTransitionsForSequence, Integer dayOfWeekForSequence, Integer modeForSequence, - Integer payload) { + ArrayList payload) { setWeeklySchedule( chipClusterPtr, callback, @@ -15000,7 +15219,7 @@ public void setWeeklySchedule( Integer numberOfTransitionsForSequence, Integer dayOfWeekForSequence, Integer modeForSequence, - Integer payload, + ArrayList payload, int timedInvokeTimeoutMs) { setWeeklySchedule( chipClusterPtr, @@ -15044,7 +15263,7 @@ private native void setWeeklySchedule( Integer numberOfTransitionsForSequence, Integer dayOfWeekForSequence, Integer modeForSequence, - Integer payload, + ArrayList payload, @Nullable Integer timedInvokeTimeoutMs); private native void setpointRaiseLower( @@ -15070,16 +15289,14 @@ public interface GetWeeklyScheduleResponseCallback { void onSuccess( Integer numberOfTransitionsForSequence, Integer dayOfWeekForSequence, - Integer modeForSequence - // payload: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - ); + Integer modeForSequence, + ArrayList payload); void onError(Exception error); } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -15331,6 +15548,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readFeatureMapAttribute(LongAttributeCallback callback) { readFeatureMapAttribute(chipClusterPtr, callback); } @@ -15508,6 +15730,12 @@ private native void subscribeNumberOfDailyTransitionsAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readFeatureMapAttribute( long chipClusterPtr, LongAttributeCallback callback); @@ -15532,7 +15760,7 @@ public ThermostatUserInterfaceConfigurationCluster(long devicePtr, int endpointI public native long initWithDevice(long devicePtr, int endpointId); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -15601,6 +15829,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -15649,6 +15882,12 @@ private native void subscribeScheduleProgrammingVisibilityAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -15671,6 +15910,7 @@ public void resetCounts(DefaultClusterCallback callback) { } public void resetCounts(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + resetCounts(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -15679,344 +15919,33 @@ private native void resetCounts( DefaultClusterCallback Callback, @Nullable Integer timedInvokeTimeoutMs); - public static class NeighborTableListAttribute { - public Long extAddress; - public Long age; - public Integer rloc16; - public Long linkFrameCounter; - public Long mleFrameCounter; - public Integer lqi; - public Integer averageRssi; - public Integer lastRssi; - public Integer frameErrorRate; - public Integer messageErrorRate; - public Boolean rxOnWhenIdle; - public Boolean fullThreadDevice; - public Boolean fullNetworkData; - public Boolean isChild; - - public NeighborTableListAttribute( - Long extAddress, - Long age, - Integer rloc16, - Long linkFrameCounter, - Long mleFrameCounter, - Integer lqi, - Integer averageRssi, - Integer lastRssi, - Integer frameErrorRate, - Integer messageErrorRate, - Boolean rxOnWhenIdle, - Boolean fullThreadDevice, - Boolean fullNetworkData, - Boolean isChild) { - this.extAddress = extAddress; - this.age = age; - this.rloc16 = rloc16; - this.linkFrameCounter = linkFrameCounter; - this.mleFrameCounter = mleFrameCounter; - this.lqi = lqi; - this.averageRssi = averageRssi; - this.lastRssi = lastRssi; - this.frameErrorRate = frameErrorRate; - this.messageErrorRate = messageErrorRate; - this.rxOnWhenIdle = rxOnWhenIdle; - this.fullThreadDevice = fullThreadDevice; - this.fullNetworkData = fullNetworkData; - this.isChild = isChild; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("long extAddress: "); - output.append(this.extAddress); - output.append("\n"); - - output.append("long age: "); - output.append(this.age); - output.append("\n"); - - output.append("int rloc16: "); - output.append(this.rloc16); - output.append("\n"); - - output.append("long linkFrameCounter: "); - output.append(this.linkFrameCounter); - output.append("\n"); - - output.append("long mleFrameCounter: "); - output.append(this.mleFrameCounter); - output.append("\n"); - - output.append("int lqi: "); - output.append(this.lqi); - output.append("\n"); - - output.append("int averageRssi: "); - output.append(this.averageRssi); - output.append("\n"); - - output.append("int lastRssi: "); - output.append(this.lastRssi); - output.append("\n"); - - output.append("int frameErrorRate: "); - output.append(this.frameErrorRate); - output.append("\n"); - - output.append("int messageErrorRate: "); - output.append(this.messageErrorRate); - output.append("\n"); - - output.append("boolean rxOnWhenIdle: "); - output.append(this.rxOnWhenIdle); - output.append("\n"); - - output.append("boolean fullThreadDevice: "); - output.append(this.fullThreadDevice); - output.append("\n"); - - output.append("boolean fullNetworkData: "); - output.append(this.fullNetworkData); - output.append("\n"); - - output.append("boolean isChild: "); - output.append(this.isChild); - output.append("\n"); - - return output.toString(); - } - } - public interface NeighborTableListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); default void onSubscriptionEstablished() {} } - public static class RouteTableListAttribute { - public Long extAddress; - public Integer rloc16; - public Integer routerId; - public Integer nextHop; - public Integer pathCost; - public Integer LQIIn; - public Integer LQIOut; - public Integer age; - public Boolean allocated; - public Boolean linkEstablished; - - public RouteTableListAttribute( - Long extAddress, - Integer rloc16, - Integer routerId, - Integer nextHop, - Integer pathCost, - Integer LQIIn, - Integer LQIOut, - Integer age, - Boolean allocated, - Boolean linkEstablished) { - this.extAddress = extAddress; - this.rloc16 = rloc16; - this.routerId = routerId; - this.nextHop = nextHop; - this.pathCost = pathCost; - this.LQIIn = LQIIn; - this.LQIOut = LQIOut; - this.age = age; - this.allocated = allocated; - this.linkEstablished = linkEstablished; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("long extAddress: "); - output.append(this.extAddress); - output.append("\n"); - - output.append("int rloc16: "); - output.append(this.rloc16); - output.append("\n"); - - output.append("int routerId: "); - output.append(this.routerId); - output.append("\n"); - - output.append("int nextHop: "); - output.append(this.nextHop); - output.append("\n"); - - output.append("int pathCost: "); - output.append(this.pathCost); - output.append("\n"); - - output.append("int LQIIn: "); - output.append(this.LQIIn); - output.append("\n"); - - output.append("int LQIOut: "); - output.append(this.LQIOut); - output.append("\n"); - - output.append("int age: "); - output.append(this.age); - output.append("\n"); - - output.append("boolean allocated: "); - output.append(this.allocated); - output.append("\n"); - - output.append("boolean linkEstablished: "); - output.append(this.linkEstablished); - output.append("\n"); - - return output.toString(); - } - } - public interface RouteTableListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); default void onSubscriptionEstablished() {} } - public static class SecurityPolicyAttribute { - public Integer rotationTime; - public Integer flags; - - public SecurityPolicyAttribute(Integer rotationTime, Integer flags) { - this.rotationTime = rotationTime; - this.flags = flags; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("int rotationTime: "); - output.append(this.rotationTime); - output.append("\n"); - - output.append("int flags: "); - output.append(this.flags); - output.append("\n"); - - return output.toString(); - } - } - public interface SecurityPolicyAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); default void onSubscriptionEstablished() {} } - public static class OperationalDatasetComponentsAttribute { - public Boolean activeTimestampPresent; - public Boolean pendingTimestampPresent; - public Boolean masterKeyPresent; - public Boolean networkNamePresent; - public Boolean extendedPanIdPresent; - public Boolean meshLocalPrefixPresent; - public Boolean delayPresent; - public Boolean panIdPresent; - public Boolean channelPresent; - public Boolean pskcPresent; - public Boolean securityPolicyPresent; - public Boolean channelMaskPresent; - - public OperationalDatasetComponentsAttribute( - Boolean activeTimestampPresent, - Boolean pendingTimestampPresent, - Boolean masterKeyPresent, - Boolean networkNamePresent, - Boolean extendedPanIdPresent, - Boolean meshLocalPrefixPresent, - Boolean delayPresent, - Boolean panIdPresent, - Boolean channelPresent, - Boolean pskcPresent, - Boolean securityPolicyPresent, - Boolean channelMaskPresent) { - this.activeTimestampPresent = activeTimestampPresent; - this.pendingTimestampPresent = pendingTimestampPresent; - this.masterKeyPresent = masterKeyPresent; - this.networkNamePresent = networkNamePresent; - this.extendedPanIdPresent = extendedPanIdPresent; - this.meshLocalPrefixPresent = meshLocalPrefixPresent; - this.delayPresent = delayPresent; - this.panIdPresent = panIdPresent; - this.channelPresent = channelPresent; - this.pskcPresent = pskcPresent; - this.securityPolicyPresent = securityPolicyPresent; - this.channelMaskPresent = channelMaskPresent; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("boolean activeTimestampPresent: "); - output.append(this.activeTimestampPresent); - output.append("\n"); - - output.append("boolean pendingTimestampPresent: "); - output.append(this.pendingTimestampPresent); - output.append("\n"); - - output.append("boolean masterKeyPresent: "); - output.append(this.masterKeyPresent); - output.append("\n"); - - output.append("boolean networkNamePresent: "); - output.append(this.networkNamePresent); - output.append("\n"); - - output.append("boolean extendedPanIdPresent: "); - output.append(this.extendedPanIdPresent); - output.append("\n"); - - output.append("boolean meshLocalPrefixPresent: "); - output.append(this.meshLocalPrefixPresent); - output.append("\n"); - - output.append("boolean delayPresent: "); - output.append(this.delayPresent); - output.append("\n"); - - output.append("boolean panIdPresent: "); - output.append(this.panIdPresent); - output.append("\n"); - - output.append("boolean channelPresent: "); - output.append(this.channelPresent); - output.append("\n"); - - output.append("boolean pskcPresent: "); - output.append(this.pskcPresent); - output.append("\n"); - - output.append("boolean securityPolicyPresent: "); - output.append(this.securityPolicyPresent); - output.append("\n"); - - output.append("boolean channelMaskPresent: "); - output.append(this.channelMaskPresent); - output.append("\n"); - - return output.toString(); - } - } - public interface OperationalDatasetComponentsAttributeCallback { - void onSuccess(List valueList); + void onSuccess( + List valueList); void onError(Exception ex); @@ -16024,7 +15953,7 @@ default void onSubscriptionEstablished() {} } public interface ActiveNetworkFaultsListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -16032,7 +15961,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -16106,10 +16035,20 @@ public void readNeighborTableListAttribute(NeighborTableListAttributeCallback ca readNeighborTableListAttribute(chipClusterPtr, callback); } + public void subscribeNeighborTableListAttribute( + NeighborTableListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeNeighborTableListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readRouteTableListAttribute(RouteTableListAttributeCallback callback) { readRouteTableListAttribute(chipClusterPtr, callback); } + public void subscribeRouteTableListAttribute( + RouteTableListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeRouteTableListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readPartitionIdAttribute(LongAttributeCallback callback) { readPartitionIdAttribute(chipClusterPtr, callback); } @@ -16569,6 +16508,11 @@ public void readSecurityPolicyAttribute(SecurityPolicyAttributeCallback callback readSecurityPolicyAttribute(chipClusterPtr, callback); } + public void subscribeSecurityPolicyAttribute( + SecurityPolicyAttributeCallback callback, int minInterval, int maxInterval) { + subscribeSecurityPolicyAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readChannelMaskAttribute(OctetStringAttributeCallback callback) { readChannelMaskAttribute(chipClusterPtr, callback); } @@ -16583,15 +16527,31 @@ public void readOperationalDatasetComponentsAttribute( readOperationalDatasetComponentsAttribute(chipClusterPtr, callback); } + public void subscribeOperationalDatasetComponentsAttribute( + OperationalDatasetComponentsAttributeCallback callback, int minInterval, int maxInterval) { + subscribeOperationalDatasetComponentsAttribute( + chipClusterPtr, callback, minInterval, maxInterval); + } + public void readActiveNetworkFaultsListAttribute( ActiveNetworkFaultsListAttributeCallback callback) { readActiveNetworkFaultsListAttribute(chipClusterPtr, callback); } + public void subscribeActiveNetworkFaultsListAttribute( + ActiveNetworkFaultsListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeActiveNetworkFaultsListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readAttributeListAttribute(AttributeListAttributeCallback callback) { readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readFeatureMapAttribute(LongAttributeCallback callback) { readFeatureMapAttribute(chipClusterPtr, callback); } @@ -16660,9 +16620,21 @@ private native void subscribeOverrunCountAttribute( private native void readNeighborTableListAttribute( long chipClusterPtr, NeighborTableListAttributeCallback callback); + private native void subscribeNeighborTableListAttribute( + long chipClusterPtr, + NeighborTableListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readRouteTableListAttribute( long chipClusterPtr, RouteTableListAttributeCallback callback); + private native void subscribeRouteTableListAttribute( + long chipClusterPtr, + RouteTableListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readPartitionIdAttribute( long chipClusterPtr, LongAttributeCallback callback); @@ -16965,6 +16937,12 @@ private native void subscribeDelayAttribute( private native void readSecurityPolicyAttribute( long chipClusterPtr, SecurityPolicyAttributeCallback callback); + private native void subscribeSecurityPolicyAttribute( + long chipClusterPtr, + SecurityPolicyAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readChannelMaskAttribute( long chipClusterPtr, OctetStringAttributeCallback callback); @@ -16977,12 +16955,30 @@ private native void subscribeChannelMaskAttribute( private native void readOperationalDatasetComponentsAttribute( long chipClusterPtr, OperationalDatasetComponentsAttributeCallback callback); + private native void subscribeOperationalDatasetComponentsAttribute( + long chipClusterPtr, + OperationalDatasetComponentsAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readActiveNetworkFaultsListAttribute( long chipClusterPtr, ActiveNetworkFaultsListAttributeCallback callback); + private native void subscribeActiveNetworkFaultsListAttribute( + long chipClusterPtr, + ActiveNetworkFaultsListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readFeatureMapAttribute( long chipClusterPtr, LongAttributeCallback callback); @@ -17006,32 +17002,8 @@ public UserLabelCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); - public static class LabelListAttribute { - public String label; - public String value; - - public LabelListAttribute(String label, String value) { - this.label = label; - this.value = value; - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(""); - output.append("String label: "); - output.append(this.label); - output.append("\n"); - - output.append("String value: "); - output.append(this.value); - output.append("\n"); - - return output.toString(); - } - } - public interface LabelListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -17042,6 +17014,23 @@ public void readLabelListAttribute(LabelListAttributeCallback callback) { readLabelListAttribute(chipClusterPtr, callback); } + public void writeLabelListAttribute( + DefaultClusterCallback callback, ArrayList value) { + writeLabelListAttribute(chipClusterPtr, callback, value, null); + } + + public void writeLabelListAttribute( + DefaultClusterCallback callback, + ArrayList value, + int timedWriteTimeoutMs) { + writeLabelListAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); + } + + public void subscribeLabelListAttribute( + LabelListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeLabelListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -17054,6 +17043,15 @@ public void subscribeClusterRevisionAttribute( private native void readLabelListAttribute( long chipClusterPtr, LabelListAttributeCallback callback); + private native void writeLabelListAttribute( + long chipClusterPtr, + DefaultClusterCallback callback, + ArrayList value, + @Nullable Integer timedWriteTimeoutMs); + + private native void subscribeLabelListAttribute( + long chipClusterPtr, LabelListAttributeCallback callback, int minInterval, int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -17072,7 +17070,7 @@ public WakeOnLanCluster(long devicePtr, int endpointId) { public native long initWithDevice(long devicePtr, int endpointId); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -17092,6 +17090,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -17113,6 +17116,12 @@ private native void subscribeWakeOnLanMacAddressAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -17135,6 +17144,7 @@ public void resetCounts(DefaultClusterCallback callback) { } public void resetCounts(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + resetCounts(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -17144,7 +17154,7 @@ private native void resetCounts( @Nullable Integer timedInvokeTimeoutMs); public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -17272,6 +17282,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readFeatureMapAttribute(LongAttributeCallback callback) { readFeatureMapAttribute(chipClusterPtr, callback); } @@ -17373,6 +17388,12 @@ private native void subscribeOverrunCountAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readFeatureMapAttribute( long chipClusterPtr, LongAttributeCallback callback); @@ -17401,6 +17422,7 @@ public void downOrClose(DefaultClusterCallback callback) { } public void downOrClose(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + downOrClose(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -17469,6 +17491,7 @@ public void stopMotion(DefaultClusterCallback callback) { } public void stopMotion(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + stopMotion(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -17477,6 +17500,7 @@ public void upOrOpen(DefaultClusterCallback callback) { } public void upOrOpen(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + upOrOpen(chipClusterPtr, callback, timedInvokeTimeoutMs); } @@ -17586,7 +17610,7 @@ default void onSubscriptionEstablished() {} } public interface AttributeListAttributeCallback { - void onSuccess(List valueList); + void onSuccess(List valueList); void onError(Exception ex); @@ -17790,6 +17814,11 @@ public void readAttributeListAttribute(AttributeListAttributeCallback callback) readAttributeListAttribute(chipClusterPtr, callback); } + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readFeatureMapAttribute(LongAttributeCallback callback) { readFeatureMapAttribute(chipClusterPtr, callback); } @@ -17947,6 +17976,12 @@ private native void subscribeSafetyStatusAttribute( private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + private native void readFeatureMapAttribute( long chipClusterPtr, LongAttributeCallback callback); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java new file mode 100644 index 00000000000000..5dea7656e77dbf --- /dev/null +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java @@ -0,0 +1,2039 @@ +/* + * + * Copyright (c) 2022 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 +package chip.devicecontroller; + +import androidx.annotation.Nullable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Optional; + +public class ChipStructs { + + public static class ScenesClusterSceneExtensionFieldSet { + public Long clusterId; + public Integer length; + public Integer value; + + public ScenesClusterSceneExtensionFieldSet(Long clusterId, Integer length, Integer value) { + this.clusterId = clusterId; + this.length = length; + this.value = value; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ScenesClusterSceneExtensionFieldSet {\n"); + output.append("\tclusterId: "); + output.append(clusterId); + output.append("\n"); + output.append("\tlength: "); + output.append(length); + output.append("\n"); + output.append("\tvalue: "); + output.append(value); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class PowerProfileClusterPowerProfileRecord { + public Integer powerProfileId; + public Integer energyPhaseId; + public Boolean powerProfileRemoteControl; + public Integer powerProfileState; + + public PowerProfileClusterPowerProfileRecord( + Integer powerProfileId, + Integer energyPhaseId, + Boolean powerProfileRemoteControl, + Integer powerProfileState) { + this.powerProfileId = powerProfileId; + this.energyPhaseId = energyPhaseId; + this.powerProfileRemoteControl = powerProfileRemoteControl; + this.powerProfileState = powerProfileState; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("PowerProfileClusterPowerProfileRecord {\n"); + output.append("\tpowerProfileId: "); + output.append(powerProfileId); + output.append("\n"); + output.append("\tenergyPhaseId: "); + output.append(energyPhaseId); + output.append("\n"); + output.append("\tpowerProfileRemoteControl: "); + output.append(powerProfileRemoteControl); + output.append("\n"); + output.append("\tpowerProfileState: "); + output.append(powerProfileState); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class PowerProfileClusterScheduledPhase { + public Integer energyPhaseId; + public Integer scheduledTime; + + public PowerProfileClusterScheduledPhase(Integer energyPhaseId, Integer scheduledTime) { + this.energyPhaseId = energyPhaseId; + this.scheduledTime = scheduledTime; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("PowerProfileClusterScheduledPhase {\n"); + output.append("\tenergyPhaseId: "); + output.append(energyPhaseId); + output.append("\n"); + output.append("\tscheduledTime: "); + output.append(scheduledTime); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class PowerProfileClusterTransferredPhase { + public Integer energyPhaseId; + public Integer macroPhaseId; + public Integer expectedDuration; + public Integer peakPower; + public Integer energy; + public Integer maxActivationDelay; + + public PowerProfileClusterTransferredPhase( + Integer energyPhaseId, + Integer macroPhaseId, + Integer expectedDuration, + Integer peakPower, + Integer energy, + Integer maxActivationDelay) { + this.energyPhaseId = energyPhaseId; + this.macroPhaseId = macroPhaseId; + this.expectedDuration = expectedDuration; + this.peakPower = peakPower; + this.energy = energy; + this.maxActivationDelay = maxActivationDelay; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("PowerProfileClusterTransferredPhase {\n"); + output.append("\tenergyPhaseId: "); + output.append(energyPhaseId); + output.append("\n"); + output.append("\tmacroPhaseId: "); + output.append(macroPhaseId); + output.append("\n"); + output.append("\texpectedDuration: "); + output.append(expectedDuration); + output.append("\n"); + output.append("\tpeakPower: "); + output.append(peakPower); + output.append("\n"); + output.append("\tenergy: "); + output.append(energy); + output.append("\n"); + output.append("\tmaxActivationDelay: "); + output.append(maxActivationDelay); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class DescriptorClusterDeviceType { + public Long type; + public Integer revision; + + public DescriptorClusterDeviceType(Long type, Integer revision) { + this.type = type; + this.revision = revision; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("DescriptorClusterDeviceType {\n"); + output.append("\ttype: "); + output.append(type); + output.append("\n"); + output.append("\trevision: "); + output.append(revision); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class AccessControlClusterTarget { + public @Nullable Long cluster; + public @Nullable Integer endpoint; + public @Nullable Long deviceType; + + public AccessControlClusterTarget( + @Nullable Long cluster, @Nullable Integer endpoint, @Nullable Long deviceType) { + this.cluster = cluster; + this.endpoint = endpoint; + this.deviceType = deviceType; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("AccessControlClusterTarget {\n"); + output.append("\tcluster: "); + output.append(cluster); + output.append("\n"); + output.append("\tendpoint: "); + output.append(endpoint); + output.append("\n"); + output.append("\tdeviceType: "); + output.append(deviceType); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class AccessControlClusterAccessControlEntry { + public Integer fabricIndex; + public Integer privilege; + public Integer authMode; + public @Nullable ArrayList subjects; + public @Nullable ArrayList targets; + + public AccessControlClusterAccessControlEntry( + Integer fabricIndex, + Integer privilege, + Integer authMode, + @Nullable ArrayList subjects, + @Nullable ArrayList targets) { + this.fabricIndex = fabricIndex; + this.privilege = privilege; + this.authMode = authMode; + this.subjects = subjects; + this.targets = targets; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("AccessControlClusterAccessControlEntry {\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("\tprivilege: "); + output.append(privilege); + output.append("\n"); + output.append("\tauthMode: "); + output.append(authMode); + output.append("\n"); + output.append("\tsubjects: "); + output.append(subjects); + output.append("\n"); + output.append("\ttargets: "); + output.append(targets); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class AccessControlClusterExtensionEntry { + public Integer fabricIndex; + public byte[] data; + + public AccessControlClusterExtensionEntry(Integer fabricIndex, byte[] data) { + this.fabricIndex = fabricIndex; + this.data = data; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("AccessControlClusterExtensionEntry {\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("\tdata: "); + output.append(Arrays.toString(data)); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class BridgedActionsClusterActionStruct { + public Integer actionID; + public String name; + public Integer type; + public Integer endpointListID; + public Integer supportedCommands; + public Integer status; + + public BridgedActionsClusterActionStruct( + Integer actionID, + String name, + Integer type, + Integer endpointListID, + Integer supportedCommands, + Integer status) { + this.actionID = actionID; + this.name = name; + this.type = type; + this.endpointListID = endpointListID; + this.supportedCommands = supportedCommands; + this.status = status; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("BridgedActionsClusterActionStruct {\n"); + output.append("\tactionID: "); + output.append(actionID); + output.append("\n"); + output.append("\tname: "); + output.append(name); + output.append("\n"); + output.append("\ttype: "); + output.append(type); + output.append("\n"); + output.append("\tendpointListID: "); + output.append(endpointListID); + output.append("\n"); + output.append("\tsupportedCommands: "); + output.append(supportedCommands); + output.append("\n"); + output.append("\tstatus: "); + output.append(status); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class BridgedActionsClusterEndpointListStruct { + public Integer endpointListID; + public String name; + public Integer type; + public ArrayList endpoints; + + public BridgedActionsClusterEndpointListStruct( + Integer endpointListID, String name, Integer type, ArrayList endpoints) { + this.endpointListID = endpointListID; + this.name = name; + this.type = type; + this.endpoints = endpoints; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("BridgedActionsClusterEndpointListStruct {\n"); + output.append("\tendpointListID: "); + output.append(endpointListID); + output.append("\n"); + output.append("\tname: "); + output.append(name); + output.append("\n"); + output.append("\ttype: "); + output.append(type); + output.append("\n"); + output.append("\tendpoints: "); + output.append(endpoints); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class OtaSoftwareUpdateRequestorClusterProviderLocation { + public Integer fabricIndex; + public Long providerNodeID; + public Integer endpoint; + + public OtaSoftwareUpdateRequestorClusterProviderLocation( + Integer fabricIndex, Long providerNodeID, Integer endpoint) { + this.fabricIndex = fabricIndex; + this.providerNodeID = providerNodeID; + this.endpoint = endpoint; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("OtaSoftwareUpdateRequestorClusterProviderLocation {\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("\tproviderNodeID: "); + output.append(providerNodeID); + output.append("\n"); + output.append("\tendpoint: "); + output.append(endpoint); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class GeneralCommissioningClusterBasicCommissioningInfoType { + public Long failSafeExpiryLengthMs; + + public GeneralCommissioningClusterBasicCommissioningInfoType(Long failSafeExpiryLengthMs) { + this.failSafeExpiryLengthMs = failSafeExpiryLengthMs; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("GeneralCommissioningClusterBasicCommissioningInfoType {\n"); + output.append("\tfailSafeExpiryLengthMs: "); + output.append(failSafeExpiryLengthMs); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class NetworkCommissioningClusterNetworkInfo { + public byte[] networkID; + public Boolean connected; + + public NetworkCommissioningClusterNetworkInfo(byte[] networkID, Boolean connected) { + this.networkID = networkID; + this.connected = connected; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("NetworkCommissioningClusterNetworkInfo {\n"); + output.append("\tnetworkID: "); + output.append(Arrays.toString(networkID)); + output.append("\n"); + output.append("\tconnected: "); + output.append(connected); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class NetworkCommissioningClusterThreadInterfaceScanResult { + public Long panId; + public Long extendedPanId; + public String networkName; + public Integer channel; + public Integer version; + public Long extendedAddress; + public Integer rssi; + public Integer lqi; + + public NetworkCommissioningClusterThreadInterfaceScanResult( + Long panId, + Long extendedPanId, + String networkName, + Integer channel, + Integer version, + Long extendedAddress, + Integer rssi, + Integer lqi) { + this.panId = panId; + this.extendedPanId = extendedPanId; + this.networkName = networkName; + this.channel = channel; + this.version = version; + this.extendedAddress = extendedAddress; + this.rssi = rssi; + this.lqi = lqi; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("NetworkCommissioningClusterThreadInterfaceScanResult {\n"); + output.append("\tpanId: "); + output.append(panId); + output.append("\n"); + output.append("\textendedPanId: "); + output.append(extendedPanId); + output.append("\n"); + output.append("\tnetworkName: "); + output.append(networkName); + output.append("\n"); + output.append("\tchannel: "); + output.append(channel); + output.append("\n"); + output.append("\tversion: "); + output.append(version); + output.append("\n"); + output.append("\textendedAddress: "); + output.append(extendedAddress); + output.append("\n"); + output.append("\trssi: "); + output.append(rssi); + output.append("\n"); + output.append("\tlqi: "); + output.append(lqi); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class NetworkCommissioningClusterWiFiInterfaceScanResult { + public Integer security; + public byte[] ssid; + public byte[] bssid; + public Integer channel; + public Integer wiFiBand; + public Integer rssi; + + public NetworkCommissioningClusterWiFiInterfaceScanResult( + Integer security, + byte[] ssid, + byte[] bssid, + Integer channel, + Integer wiFiBand, + Integer rssi) { + this.security = security; + this.ssid = ssid; + this.bssid = bssid; + this.channel = channel; + this.wiFiBand = wiFiBand; + this.rssi = rssi; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("NetworkCommissioningClusterWiFiInterfaceScanResult {\n"); + output.append("\tsecurity: "); + output.append(security); + output.append("\n"); + output.append("\tssid: "); + output.append(Arrays.toString(ssid)); + output.append("\n"); + output.append("\tbssid: "); + output.append(Arrays.toString(bssid)); + output.append("\n"); + output.append("\tchannel: "); + output.append(channel); + output.append("\n"); + output.append("\twiFiBand: "); + output.append(wiFiBand); + output.append("\n"); + output.append("\trssi: "); + output.append(rssi); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class GeneralDiagnosticsClusterNetworkInterfaceType { + public String name; + public Boolean fabricConnected; + public Boolean offPremiseServicesReachableIPv4; + public Boolean offPremiseServicesReachableIPv6; + public byte[] hardwareAddress; + public Integer type; + + public GeneralDiagnosticsClusterNetworkInterfaceType( + String name, + Boolean fabricConnected, + Boolean offPremiseServicesReachableIPv4, + Boolean offPremiseServicesReachableIPv6, + byte[] hardwareAddress, + Integer type) { + this.name = name; + this.fabricConnected = fabricConnected; + this.offPremiseServicesReachableIPv4 = offPremiseServicesReachableIPv4; + this.offPremiseServicesReachableIPv6 = offPremiseServicesReachableIPv6; + this.hardwareAddress = hardwareAddress; + this.type = type; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("GeneralDiagnosticsClusterNetworkInterfaceType {\n"); + output.append("\tname: "); + output.append(name); + output.append("\n"); + output.append("\tfabricConnected: "); + output.append(fabricConnected); + output.append("\n"); + output.append("\toffPremiseServicesReachableIPv4: "); + output.append(offPremiseServicesReachableIPv4); + output.append("\n"); + output.append("\toffPremiseServicesReachableIPv6: "); + output.append(offPremiseServicesReachableIPv6); + output.append("\n"); + output.append("\thardwareAddress: "); + output.append(Arrays.toString(hardwareAddress)); + output.append("\n"); + output.append("\ttype: "); + output.append(type); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class SoftwareDiagnosticsClusterSoftwareFault { + public Long id; + public String name; + public byte[] faultRecording; + + public SoftwareDiagnosticsClusterSoftwareFault(Long id, String name, byte[] faultRecording) { + this.id = id; + this.name = name; + this.faultRecording = faultRecording; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("SoftwareDiagnosticsClusterSoftwareFault {\n"); + output.append("\tid: "); + output.append(id); + output.append("\n"); + output.append("\tname: "); + output.append(name); + output.append("\n"); + output.append("\tfaultRecording: "); + output.append(Arrays.toString(faultRecording)); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class SoftwareDiagnosticsClusterThreadMetrics { + public Long id; + public String name; + public Long stackFreeCurrent; + public Long stackFreeMinimum; + public Long stackSize; + + public SoftwareDiagnosticsClusterThreadMetrics( + Long id, String name, Long stackFreeCurrent, Long stackFreeMinimum, Long stackSize) { + this.id = id; + this.name = name; + this.stackFreeCurrent = stackFreeCurrent; + this.stackFreeMinimum = stackFreeMinimum; + this.stackSize = stackSize; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("SoftwareDiagnosticsClusterThreadMetrics {\n"); + output.append("\tid: "); + output.append(id); + output.append("\n"); + output.append("\tname: "); + output.append(name); + output.append("\n"); + output.append("\tstackFreeCurrent: "); + output.append(stackFreeCurrent); + output.append("\n"); + output.append("\tstackFreeMinimum: "); + output.append(stackFreeMinimum); + output.append("\n"); + output.append("\tstackSize: "); + output.append(stackSize); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ThreadNetworkDiagnosticsClusterNeighborTable { + public Long extAddress; + public Long age; + public Integer rloc16; + public Long linkFrameCounter; + public Long mleFrameCounter; + public Integer lqi; + public Integer averageRssi; + public Integer lastRssi; + public Integer frameErrorRate; + public Integer messageErrorRate; + public Boolean rxOnWhenIdle; + public Boolean fullThreadDevice; + public Boolean fullNetworkData; + public Boolean isChild; + + public ThreadNetworkDiagnosticsClusterNeighborTable( + Long extAddress, + Long age, + Integer rloc16, + Long linkFrameCounter, + Long mleFrameCounter, + Integer lqi, + Integer averageRssi, + Integer lastRssi, + Integer frameErrorRate, + Integer messageErrorRate, + Boolean rxOnWhenIdle, + Boolean fullThreadDevice, + Boolean fullNetworkData, + Boolean isChild) { + this.extAddress = extAddress; + this.age = age; + this.rloc16 = rloc16; + this.linkFrameCounter = linkFrameCounter; + this.mleFrameCounter = mleFrameCounter; + this.lqi = lqi; + this.averageRssi = averageRssi; + this.lastRssi = lastRssi; + this.frameErrorRate = frameErrorRate; + this.messageErrorRate = messageErrorRate; + this.rxOnWhenIdle = rxOnWhenIdle; + this.fullThreadDevice = fullThreadDevice; + this.fullNetworkData = fullNetworkData; + this.isChild = isChild; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ThreadNetworkDiagnosticsClusterNeighborTable {\n"); + output.append("\textAddress: "); + output.append(extAddress); + output.append("\n"); + output.append("\tage: "); + output.append(age); + output.append("\n"); + output.append("\trloc16: "); + output.append(rloc16); + output.append("\n"); + output.append("\tlinkFrameCounter: "); + output.append(linkFrameCounter); + output.append("\n"); + output.append("\tmleFrameCounter: "); + output.append(mleFrameCounter); + output.append("\n"); + output.append("\tlqi: "); + output.append(lqi); + output.append("\n"); + output.append("\taverageRssi: "); + output.append(averageRssi); + output.append("\n"); + output.append("\tlastRssi: "); + output.append(lastRssi); + output.append("\n"); + output.append("\tframeErrorRate: "); + output.append(frameErrorRate); + output.append("\n"); + output.append("\tmessageErrorRate: "); + output.append(messageErrorRate); + output.append("\n"); + output.append("\trxOnWhenIdle: "); + output.append(rxOnWhenIdle); + output.append("\n"); + output.append("\tfullThreadDevice: "); + output.append(fullThreadDevice); + output.append("\n"); + output.append("\tfullNetworkData: "); + output.append(fullNetworkData); + output.append("\n"); + output.append("\tisChild: "); + output.append(isChild); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ThreadNetworkDiagnosticsClusterOperationalDatasetComponents { + public Boolean activeTimestampPresent; + public Boolean pendingTimestampPresent; + public Boolean masterKeyPresent; + public Boolean networkNamePresent; + public Boolean extendedPanIdPresent; + public Boolean meshLocalPrefixPresent; + public Boolean delayPresent; + public Boolean panIdPresent; + public Boolean channelPresent; + public Boolean pskcPresent; + public Boolean securityPolicyPresent; + public Boolean channelMaskPresent; + + public ThreadNetworkDiagnosticsClusterOperationalDatasetComponents( + Boolean activeTimestampPresent, + Boolean pendingTimestampPresent, + Boolean masterKeyPresent, + Boolean networkNamePresent, + Boolean extendedPanIdPresent, + Boolean meshLocalPrefixPresent, + Boolean delayPresent, + Boolean panIdPresent, + Boolean channelPresent, + Boolean pskcPresent, + Boolean securityPolicyPresent, + Boolean channelMaskPresent) { + this.activeTimestampPresent = activeTimestampPresent; + this.pendingTimestampPresent = pendingTimestampPresent; + this.masterKeyPresent = masterKeyPresent; + this.networkNamePresent = networkNamePresent; + this.extendedPanIdPresent = extendedPanIdPresent; + this.meshLocalPrefixPresent = meshLocalPrefixPresent; + this.delayPresent = delayPresent; + this.panIdPresent = panIdPresent; + this.channelPresent = channelPresent; + this.pskcPresent = pskcPresent; + this.securityPolicyPresent = securityPolicyPresent; + this.channelMaskPresent = channelMaskPresent; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ThreadNetworkDiagnosticsClusterOperationalDatasetComponents {\n"); + output.append("\tactiveTimestampPresent: "); + output.append(activeTimestampPresent); + output.append("\n"); + output.append("\tpendingTimestampPresent: "); + output.append(pendingTimestampPresent); + output.append("\n"); + output.append("\tmasterKeyPresent: "); + output.append(masterKeyPresent); + output.append("\n"); + output.append("\tnetworkNamePresent: "); + output.append(networkNamePresent); + output.append("\n"); + output.append("\textendedPanIdPresent: "); + output.append(extendedPanIdPresent); + output.append("\n"); + output.append("\tmeshLocalPrefixPresent: "); + output.append(meshLocalPrefixPresent); + output.append("\n"); + output.append("\tdelayPresent: "); + output.append(delayPresent); + output.append("\n"); + output.append("\tpanIdPresent: "); + output.append(panIdPresent); + output.append("\n"); + output.append("\tchannelPresent: "); + output.append(channelPresent); + output.append("\n"); + output.append("\tpskcPresent: "); + output.append(pskcPresent); + output.append("\n"); + output.append("\tsecurityPolicyPresent: "); + output.append(securityPolicyPresent); + output.append("\n"); + output.append("\tchannelMaskPresent: "); + output.append(channelMaskPresent); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ThreadNetworkDiagnosticsClusterRouteTable { + public Long extAddress; + public Integer rloc16; + public Integer routerId; + public Integer nextHop; + public Integer pathCost; + public Integer LQIIn; + public Integer LQIOut; + public Integer age; + public Boolean allocated; + public Boolean linkEstablished; + + public ThreadNetworkDiagnosticsClusterRouteTable( + Long extAddress, + Integer rloc16, + Integer routerId, + Integer nextHop, + Integer pathCost, + Integer LQIIn, + Integer LQIOut, + Integer age, + Boolean allocated, + Boolean linkEstablished) { + this.extAddress = extAddress; + this.rloc16 = rloc16; + this.routerId = routerId; + this.nextHop = nextHop; + this.pathCost = pathCost; + this.LQIIn = LQIIn; + this.LQIOut = LQIOut; + this.age = age; + this.allocated = allocated; + this.linkEstablished = linkEstablished; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ThreadNetworkDiagnosticsClusterRouteTable {\n"); + output.append("\textAddress: "); + output.append(extAddress); + output.append("\n"); + output.append("\trloc16: "); + output.append(rloc16); + output.append("\n"); + output.append("\trouterId: "); + output.append(routerId); + output.append("\n"); + output.append("\tnextHop: "); + output.append(nextHop); + output.append("\n"); + output.append("\tpathCost: "); + output.append(pathCost); + output.append("\n"); + output.append("\tLQIIn: "); + output.append(LQIIn); + output.append("\n"); + output.append("\tLQIOut: "); + output.append(LQIOut); + output.append("\n"); + output.append("\tage: "); + output.append(age); + output.append("\n"); + output.append("\tallocated: "); + output.append(allocated); + output.append("\n"); + output.append("\tlinkEstablished: "); + output.append(linkEstablished); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ThreadNetworkDiagnosticsClusterSecurityPolicy { + public Integer rotationTime; + public Integer flags; + + public ThreadNetworkDiagnosticsClusterSecurityPolicy(Integer rotationTime, Integer flags) { + this.rotationTime = rotationTime; + this.flags = flags; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ThreadNetworkDiagnosticsClusterSecurityPolicy {\n"); + output.append("\trotationTime: "); + output.append(rotationTime); + output.append("\n"); + output.append("\tflags: "); + output.append(flags); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class OperationalCredentialsClusterFabricDescriptor { + public Integer fabricIndex; + public byte[] rootPublicKey; + public Integer vendorId; + public Long fabricId; + public Long nodeId; + public String label; + + public OperationalCredentialsClusterFabricDescriptor( + Integer fabricIndex, + byte[] rootPublicKey, + Integer vendorId, + Long fabricId, + Long nodeId, + String label) { + this.fabricIndex = fabricIndex; + this.rootPublicKey = rootPublicKey; + this.vendorId = vendorId; + this.fabricId = fabricId; + this.nodeId = nodeId; + this.label = label; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("OperationalCredentialsClusterFabricDescriptor {\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("\trootPublicKey: "); + output.append(Arrays.toString(rootPublicKey)); + output.append("\n"); + output.append("\tvendorId: "); + output.append(vendorId); + output.append("\n"); + output.append("\tfabricId: "); + output.append(fabricId); + output.append("\n"); + output.append("\tnodeId: "); + output.append(nodeId); + output.append("\n"); + output.append("\tlabel: "); + output.append(label); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class OperationalCredentialsClusterNOCStruct { + public Integer fabricIndex; + public byte[] noc; + public byte[] icac; + + public OperationalCredentialsClusterNOCStruct(Integer fabricIndex, byte[] noc, byte[] icac) { + this.fabricIndex = fabricIndex; + this.noc = noc; + this.icac = icac; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("OperationalCredentialsClusterNOCStruct {\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("\tnoc: "); + output.append(Arrays.toString(noc)); + output.append("\n"); + output.append("\ticac: "); + output.append(Arrays.toString(icac)); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class GroupKeyManagementClusterGroupInfo { + public Integer fabricIndex; + public Integer groupId; + public ArrayList endpoints; + public String groupName; + + public GroupKeyManagementClusterGroupInfo( + Integer fabricIndex, Integer groupId, ArrayList endpoints, String groupName) { + this.fabricIndex = fabricIndex; + this.groupId = groupId; + this.endpoints = endpoints; + this.groupName = groupName; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("GroupKeyManagementClusterGroupInfo {\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("\tgroupId: "); + output.append(groupId); + output.append("\n"); + output.append("\tendpoints: "); + output.append(endpoints); + output.append("\n"); + output.append("\tgroupName: "); + output.append(groupName); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class GroupKeyManagementClusterGroupKey { + public Integer fabricIndex; + public Integer groupId; + public Integer groupKeySetID; + + public GroupKeyManagementClusterGroupKey( + Integer fabricIndex, Integer groupId, Integer groupKeySetID) { + this.fabricIndex = fabricIndex; + this.groupId = groupId; + this.groupKeySetID = groupKeySetID; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("GroupKeyManagementClusterGroupKey {\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("\tgroupId: "); + output.append(groupId); + output.append("\n"); + output.append("\tgroupKeySetID: "); + output.append(groupKeySetID); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class GroupKeyManagementClusterGroupKeySet { + public Integer groupKeySetID; + public Integer securityPolicy; + public byte[] epochKey0; + public Long epochStartTime0; + public byte[] epochKey1; + public Long epochStartTime1; + public byte[] epochKey2; + public Long epochStartTime2; + + public GroupKeyManagementClusterGroupKeySet( + Integer groupKeySetID, + Integer securityPolicy, + byte[] epochKey0, + Long epochStartTime0, + byte[] epochKey1, + Long epochStartTime1, + byte[] epochKey2, + Long epochStartTime2) { + this.groupKeySetID = groupKeySetID; + this.securityPolicy = securityPolicy; + this.epochKey0 = epochKey0; + this.epochStartTime0 = epochStartTime0; + this.epochKey1 = epochKey1; + this.epochStartTime1 = epochStartTime1; + this.epochKey2 = epochKey2; + this.epochStartTime2 = epochStartTime2; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("GroupKeyManagementClusterGroupKeySet {\n"); + output.append("\tgroupKeySetID: "); + output.append(groupKeySetID); + output.append("\n"); + output.append("\tsecurityPolicy: "); + output.append(securityPolicy); + output.append("\n"); + output.append("\tepochKey0: "); + output.append(Arrays.toString(epochKey0)); + output.append("\n"); + output.append("\tepochStartTime0: "); + output.append(epochStartTime0); + output.append("\n"); + output.append("\tepochKey1: "); + output.append(Arrays.toString(epochKey1)); + output.append("\n"); + output.append("\tepochStartTime1: "); + output.append(epochStartTime1); + output.append("\n"); + output.append("\tepochKey2: "); + output.append(Arrays.toString(epochKey2)); + output.append("\n"); + output.append("\tepochStartTime2: "); + output.append(epochStartTime2); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class FixedLabelClusterLabelStruct { + public String label; + public String value; + + public FixedLabelClusterLabelStruct(String label, String value) { + this.label = label; + this.value = value; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("FixedLabelClusterLabelStruct {\n"); + output.append("\tlabel: "); + output.append(label); + output.append("\n"); + output.append("\tvalue: "); + output.append(value); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class UserLabelClusterLabelStruct { + public String label; + public String value; + + public UserLabelClusterLabelStruct(String label, String value) { + this.label = label; + this.value = value; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("UserLabelClusterLabelStruct {\n"); + output.append("\tlabel: "); + output.append(label); + output.append("\n"); + output.append("\tvalue: "); + output.append(value); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ModeSelectClusterModeOptionStruct { + public String label; + public Integer mode; + public Long semanticTag; + + public ModeSelectClusterModeOptionStruct(String label, Integer mode, Long semanticTag) { + this.label = label; + this.mode = mode; + this.semanticTag = semanticTag; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ModeSelectClusterModeOptionStruct {\n"); + output.append("\tlabel: "); + output.append(label); + output.append("\n"); + output.append("\tmode: "); + output.append(mode); + output.append("\n"); + output.append("\tsemanticTag: "); + output.append(semanticTag); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ModeSelectClusterSemanticTag { + public Integer mfgCode; + public Integer value; + + public ModeSelectClusterSemanticTag(Integer mfgCode, Integer value) { + this.mfgCode = mfgCode; + this.value = value; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ModeSelectClusterSemanticTag {\n"); + output.append("\tmfgCode: "); + output.append(mfgCode); + output.append("\n"); + output.append("\tvalue: "); + output.append(value); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class DoorLockClusterDlCredential { + public Integer credentialType; + public Integer credentialIndex; + + public DoorLockClusterDlCredential(Integer credentialType, Integer credentialIndex) { + this.credentialType = credentialType; + this.credentialIndex = credentialIndex; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("DoorLockClusterDlCredential {\n"); + output.append("\tcredentialType: "); + output.append(credentialType); + output.append("\n"); + output.append("\tcredentialIndex: "); + output.append(credentialIndex); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class IasAceClusterIasAceZoneStatusResult { + public Integer zoneId; + public Integer zoneStatus; + + public IasAceClusterIasAceZoneStatusResult(Integer zoneId, Integer zoneStatus) { + this.zoneId = zoneId; + this.zoneStatus = zoneStatus; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("IasAceClusterIasAceZoneStatusResult {\n"); + output.append("\tzoneId: "); + output.append(zoneId); + output.append("\n"); + output.append("\tzoneStatus: "); + output.append(zoneStatus); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ChannelClusterChannelInfo { + public Integer majorNumber; + public Integer minorNumber; + public String name; + public String callSign; + public String affiliateCallSign; + + public ChannelClusterChannelInfo( + Integer majorNumber, + Integer minorNumber, + String name, + String callSign, + String affiliateCallSign) { + this.majorNumber = majorNumber; + this.minorNumber = minorNumber; + this.name = name; + this.callSign = callSign; + this.affiliateCallSign = affiliateCallSign; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ChannelClusterChannelInfo {\n"); + output.append("\tmajorNumber: "); + output.append(majorNumber); + output.append("\n"); + output.append("\tminorNumber: "); + output.append(minorNumber); + output.append("\n"); + output.append("\tname: "); + output.append(name); + output.append("\n"); + output.append("\tcallSign: "); + output.append(callSign); + output.append("\n"); + output.append("\taffiliateCallSign: "); + output.append(affiliateCallSign); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ChannelClusterLineupInfo { + public String operatorName; + public String lineupName; + public String postalCode; + public Integer lineupInfoType; + + public ChannelClusterLineupInfo( + String operatorName, String lineupName, String postalCode, Integer lineupInfoType) { + this.operatorName = operatorName; + this.lineupName = lineupName; + this.postalCode = postalCode; + this.lineupInfoType = lineupInfoType; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ChannelClusterLineupInfo {\n"); + output.append("\toperatorName: "); + output.append(operatorName); + output.append("\n"); + output.append("\tlineupName: "); + output.append(lineupName); + output.append("\n"); + output.append("\tpostalCode: "); + output.append(postalCode); + output.append("\n"); + output.append("\tlineupInfoType: "); + output.append(lineupInfoType); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class TargetNavigatorClusterTargetInfo { + public Integer identifier; + public String name; + + public TargetNavigatorClusterTargetInfo(Integer identifier, String name) { + this.identifier = identifier; + this.name = name; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("TargetNavigatorClusterTargetInfo {\n"); + output.append("\tidentifier: "); + output.append(identifier); + output.append("\n"); + output.append("\tname: "); + output.append(name); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class MediaPlaybackClusterPlaybackPosition { + public Long updatedAt; + public Long position; + + public MediaPlaybackClusterPlaybackPosition(Long updatedAt, Long position) { + this.updatedAt = updatedAt; + this.position = position; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("MediaPlaybackClusterPlaybackPosition {\n"); + output.append("\tupdatedAt: "); + output.append(updatedAt); + output.append("\n"); + output.append("\tposition: "); + output.append(position); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class MediaInputClusterInputInfo { + public Integer index; + public Integer inputType; + public String name; + public String description; + + public MediaInputClusterInputInfo( + Integer index, Integer inputType, String name, String description) { + this.index = index; + this.inputType = inputType; + this.name = name; + this.description = description; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("MediaInputClusterInputInfo {\n"); + output.append("\tindex: "); + output.append(index); + output.append("\n"); + output.append("\tinputType: "); + output.append(inputType); + output.append("\n"); + output.append("\tname: "); + output.append(name); + output.append("\n"); + output.append("\tdescription: "); + output.append(description); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ContentLauncherClusterDimension { + public Double width; + public Double height; + public Integer metric; + + public ContentLauncherClusterDimension(Double width, Double height, Integer metric) { + this.width = width; + this.height = height; + this.metric = metric; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ContentLauncherClusterDimension {\n"); + output.append("\twidth: "); + output.append(width); + output.append("\n"); + output.append("\theight: "); + output.append(height); + output.append("\n"); + output.append("\tmetric: "); + output.append(metric); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ContentLauncherClusterAdditionalInfo { + public String name; + public String value; + + public ContentLauncherClusterAdditionalInfo(String name, String value) { + this.name = name; + this.value = value; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ContentLauncherClusterAdditionalInfo {\n"); + output.append("\tname: "); + output.append(name); + output.append("\n"); + output.append("\tvalue: "); + output.append(value); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ContentLauncherClusterParameter { + public Integer type; + public String value; + public ArrayList externalIDList; + + public ContentLauncherClusterParameter( + Integer type, + String value, + ArrayList externalIDList) { + this.type = type; + this.value = value; + this.externalIDList = externalIDList; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ContentLauncherClusterParameter {\n"); + output.append("\ttype: "); + output.append(type); + output.append("\n"); + output.append("\tvalue: "); + output.append(value); + output.append("\n"); + output.append("\texternalIDList: "); + output.append(externalIDList); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ContentLauncherClusterContentSearch { + public ArrayList parameterList; + + public ContentLauncherClusterContentSearch( + ArrayList parameterList) { + this.parameterList = parameterList; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ContentLauncherClusterContentSearch {\n"); + output.append("\tparameterList: "); + output.append(parameterList); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ContentLauncherClusterStyleInformation { + public String imageUrl; + public String color; + public ChipStructs.ContentLauncherClusterDimension size; + + public ContentLauncherClusterStyleInformation( + String imageUrl, String color, ChipStructs.ContentLauncherClusterDimension size) { + this.imageUrl = imageUrl; + this.color = color; + this.size = size; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ContentLauncherClusterStyleInformation {\n"); + output.append("\timageUrl: "); + output.append(imageUrl); + output.append("\n"); + output.append("\tcolor: "); + output.append(color); + output.append("\n"); + output.append("\tsize: "); + output.append(size); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ContentLauncherClusterBrandingInformation { + public String providerName; + public ChipStructs.ContentLauncherClusterStyleInformation background; + public ChipStructs.ContentLauncherClusterStyleInformation logo; + public ChipStructs.ContentLauncherClusterStyleInformation progressBar; + public ChipStructs.ContentLauncherClusterStyleInformation splash; + public ChipStructs.ContentLauncherClusterStyleInformation waterMark; + + public ContentLauncherClusterBrandingInformation( + String providerName, + ChipStructs.ContentLauncherClusterStyleInformation background, + ChipStructs.ContentLauncherClusterStyleInformation logo, + ChipStructs.ContentLauncherClusterStyleInformation progressBar, + ChipStructs.ContentLauncherClusterStyleInformation splash, + ChipStructs.ContentLauncherClusterStyleInformation waterMark) { + this.providerName = providerName; + this.background = background; + this.logo = logo; + this.progressBar = progressBar; + this.splash = splash; + this.waterMark = waterMark; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ContentLauncherClusterBrandingInformation {\n"); + output.append("\tproviderName: "); + output.append(providerName); + output.append("\n"); + output.append("\tbackground: "); + output.append(background); + output.append("\n"); + output.append("\tlogo: "); + output.append(logo); + output.append("\n"); + output.append("\tprogressBar: "); + output.append(progressBar); + output.append("\n"); + output.append("\tsplash: "); + output.append(splash); + output.append("\n"); + output.append("\twaterMark: "); + output.append(waterMark); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class AudioOutputClusterOutputInfo { + public Integer index; + public Integer outputType; + public String name; + + public AudioOutputClusterOutputInfo(Integer index, Integer outputType, String name) { + this.index = index; + this.outputType = outputType; + this.name = name; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("AudioOutputClusterOutputInfo {\n"); + output.append("\tindex: "); + output.append(index); + output.append("\n"); + output.append("\toutputType: "); + output.append(outputType); + output.append("\n"); + output.append("\tname: "); + output.append(name); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ApplicationLauncherClusterApplicationLauncherApplication { + public Integer catalogVendorId; + public String applicationId; + + public ApplicationLauncherClusterApplicationLauncherApplication( + Integer catalogVendorId, String applicationId) { + this.catalogVendorId = catalogVendorId; + this.applicationId = applicationId; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ApplicationLauncherClusterApplicationLauncherApplication {\n"); + output.append("\tcatalogVendorId: "); + output.append(catalogVendorId); + output.append("\n"); + output.append("\tapplicationId: "); + output.append(applicationId); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ApplicationLauncherClusterApplicationEP { + public ChipStructs.ApplicationLauncherClusterApplicationLauncherApplication application; + public String endpoint; + + public ApplicationLauncherClusterApplicationEP( + ChipStructs.ApplicationLauncherClusterApplicationLauncherApplication application, + String endpoint) { + this.application = application; + this.endpoint = endpoint; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ApplicationLauncherClusterApplicationEP {\n"); + output.append("\tapplication: "); + output.append(application); + output.append("\n"); + output.append("\tendpoint: "); + output.append(endpoint); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ApplicationBasicClusterApplicationBasicApplication { + public Integer catalogVendorId; + public String applicationId; + + public ApplicationBasicClusterApplicationBasicApplication( + Integer catalogVendorId, String applicationId) { + this.catalogVendorId = catalogVendorId; + this.applicationId = applicationId; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ApplicationBasicClusterApplicationBasicApplication {\n"); + output.append("\tcatalogVendorId: "); + output.append(catalogVendorId); + output.append("\n"); + output.append("\tapplicationId: "); + output.append(applicationId); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class TestClusterClusterSimpleStruct { + public Integer a; + public Boolean b; + public Integer c; + public byte[] d; + public String e; + public Integer f; + public Float g; + public Double h; + + public TestClusterClusterSimpleStruct( + Integer a, Boolean b, Integer c, byte[] d, String e, Integer f, Float g, Double h) { + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.e = e; + this.f = f; + this.g = g; + this.h = h; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("TestClusterClusterSimpleStruct {\n"); + output.append("\ta: "); + output.append(a); + output.append("\n"); + output.append("\tb: "); + output.append(b); + output.append("\n"); + output.append("\tc: "); + output.append(c); + output.append("\n"); + output.append("\td: "); + output.append(Arrays.toString(d)); + output.append("\n"); + output.append("\te: "); + output.append(e); + output.append("\n"); + output.append("\tf: "); + output.append(f); + output.append("\n"); + output.append("\tg: "); + output.append(g); + output.append("\n"); + output.append("\th: "); + output.append(h); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class TestClusterClusterNullablesAndOptionalsStruct { + public @Nullable Integer nullableInt; + public Optional optionalInt; + public @Nullable Optional nullableOptionalInt; + public @Nullable String nullableString; + public Optional optionalString; + public @Nullable Optional nullableOptionalString; + public @Nullable ChipStructs.TestClusterClusterSimpleStruct nullableStruct; + public Optional optionalStruct; + public @Nullable Optional nullableOptionalStruct; + public @Nullable ArrayList nullableList; + public Optional> optionalList; + public @Nullable Optional> nullableOptionalList; + + public TestClusterClusterNullablesAndOptionalsStruct( + @Nullable Integer nullableInt, + Optional optionalInt, + @Nullable Optional nullableOptionalInt, + @Nullable String nullableString, + Optional optionalString, + @Nullable Optional nullableOptionalString, + @Nullable ChipStructs.TestClusterClusterSimpleStruct nullableStruct, + Optional optionalStruct, + @Nullable Optional nullableOptionalStruct, + @Nullable ArrayList nullableList, + Optional> optionalList, + @Nullable Optional> nullableOptionalList) { + this.nullableInt = nullableInt; + this.optionalInt = optionalInt; + this.nullableOptionalInt = nullableOptionalInt; + this.nullableString = nullableString; + this.optionalString = optionalString; + this.nullableOptionalString = nullableOptionalString; + this.nullableStruct = nullableStruct; + this.optionalStruct = optionalStruct; + this.nullableOptionalStruct = nullableOptionalStruct; + this.nullableList = nullableList; + this.optionalList = optionalList; + this.nullableOptionalList = nullableOptionalList; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("TestClusterClusterNullablesAndOptionalsStruct {\n"); + output.append("\tnullableInt: "); + output.append(nullableInt); + output.append("\n"); + output.append("\toptionalInt: "); + output.append(optionalInt); + output.append("\n"); + output.append("\tnullableOptionalInt: "); + output.append(nullableOptionalInt); + output.append("\n"); + output.append("\tnullableString: "); + output.append(nullableString); + output.append("\n"); + output.append("\toptionalString: "); + output.append(optionalString); + output.append("\n"); + output.append("\tnullableOptionalString: "); + output.append(nullableOptionalString); + output.append("\n"); + output.append("\tnullableStruct: "); + output.append(nullableStruct); + output.append("\n"); + output.append("\toptionalStruct: "); + output.append(optionalStruct); + output.append("\n"); + output.append("\tnullableOptionalStruct: "); + output.append(nullableOptionalStruct); + output.append("\n"); + output.append("\tnullableList: "); + output.append(nullableList); + output.append("\n"); + output.append("\toptionalList: "); + output.append(optionalList); + output.append("\n"); + output.append("\tnullableOptionalList: "); + output.append(nullableOptionalList); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class TestClusterClusterNestedStruct { + public Integer a; + public Boolean b; + public ChipStructs.TestClusterClusterSimpleStruct c; + + public TestClusterClusterNestedStruct( + Integer a, Boolean b, ChipStructs.TestClusterClusterSimpleStruct c) { + this.a = a; + this.b = b; + this.c = c; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("TestClusterClusterNestedStruct {\n"); + output.append("\ta: "); + output.append(a); + output.append("\n"); + output.append("\tb: "); + output.append(b); + output.append("\n"); + output.append("\tc: "); + output.append(c); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class TestClusterClusterNestedStructList { + public Integer a; + public Boolean b; + public ChipStructs.TestClusterClusterSimpleStruct c; + public ArrayList d; + public ArrayList e; + public ArrayList f; + public ArrayList g; + + public TestClusterClusterNestedStructList( + Integer a, + Boolean b, + ChipStructs.TestClusterClusterSimpleStruct c, + ArrayList d, + ArrayList e, + ArrayList f, + ArrayList g) { + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.e = e; + this.f = f; + this.g = g; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("TestClusterClusterNestedStructList {\n"); + output.append("\ta: "); + output.append(a); + output.append("\n"); + output.append("\tb: "); + output.append(b); + output.append("\n"); + output.append("\tc: "); + output.append(c); + output.append("\n"); + output.append("\td: "); + output.append(d); + output.append("\n"); + output.append("\te: "); + output.append(e); + output.append("\n"); + output.append("\tf: "); + output.append(f); + output.append("\n"); + output.append("\tg: "); + output.append(g); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class TestClusterClusterDoubleNestedStructList { + public ArrayList a; + + public TestClusterClusterDoubleNestedStructList( + ArrayList a) { + this.a = a; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("TestClusterClusterDoubleNestedStructList {\n"); + output.append("\ta: "); + output.append(a); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class TestClusterClusterTestListStructOctet { + public Long fabricIndex; + public byte[] operationalCert; + + public TestClusterClusterTestListStructOctet(Long fabricIndex, byte[] operationalCert) { + this.fabricIndex = fabricIndex; + this.operationalCert = operationalCert; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("TestClusterClusterTestListStructOctet {\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("\toperationalCert: "); + output.append(Arrays.toString(operationalCert)); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } +} diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java index 200d72746744e9..837cbd060bafd3 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java @@ -27,6 +27,7 @@ import chip.clusterinfo.DelegatedClusterCallback; import chip.clusterinfo.InteractionInfo; import chip.devicecontroller.ChipClusters.DefaultClusterCallback; +import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; @@ -231,12 +232,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -258,12 +258,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -285,10 +284,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -334,10 +332,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -359,10 +356,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -384,11 +380,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -410,10 +405,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -437,7 +431,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer status, String data) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); CommandResponseInfo dataResponseValue = new CommandResponseInfo("data", "String"); responseValues.put(dataResponseValue, data); @@ -461,11 +455,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -487,10 +480,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -512,13 +504,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( - List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = - new CommandResponseInfo( - "valueList", "List"); - + new CommandResponseInfo("valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -540,10 +529,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -565,10 +553,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -590,10 +577,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -615,10 +601,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -640,10 +625,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -665,10 +649,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -690,12 +673,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -717,13 +699,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( - List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -745,10 +725,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -770,10 +749,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -795,13 +773,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( // channelMatch: Struct ChannelInfo - // Conversion from this type to Java is not properly implemented yet - Integer errorType) { + public void onSuccess(ChipStructs.ChannelClusterChannelInfo channelMatch, Integer errorType) { Map responseValues = new LinkedHashMap<>(); // channelMatch: Struct ChannelInfo // Conversion from this type to Java is not properly implemented yet - CommandResponseInfo errorTypeResponseValue = new CommandResponseInfo("errorType", "int"); + CommandResponseInfo errorTypeResponseValue = new CommandResponseInfo("errorType", "Integer"); responseValues.put(errorTypeResponseValue, errorType); callback.onSuccess(responseValues); } @@ -823,12 +799,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = - new CommandResponseInfo( - "valueList", "List"); - + new CommandResponseInfo("valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -850,10 +824,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -875,10 +848,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -902,7 +874,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer status, String data) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); CommandResponseInfo dataResponseValue = new CommandResponseInfo("data", "String"); responseValues.put(dataResponseValue, data); @@ -926,11 +898,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -952,10 +923,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -977,12 +947,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = - new CommandResponseInfo( - "valueList", "List"); - + new CommandResponseInfo("valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1004,10 +972,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1029,10 +996,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1054,11 +1020,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1080,10 +1045,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1107,14 +1071,14 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer status, byte[] content, Long timeStamp, Long timeSinceBoot) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); CommandResponseInfo contentResponseValue = new CommandResponseInfo("content", "byte[]"); responseValues.put(contentResponseValue, content); - CommandResponseInfo timeStampResponseValue = new CommandResponseInfo("timeStamp", "long"); + CommandResponseInfo timeStampResponseValue = new CommandResponseInfo("timeStamp", "Long"); responseValues.put(timeStampResponseValue, timeStamp); CommandResponseInfo timeSinceBootResponseValue = - new CommandResponseInfo("timeSinceBoot", "long"); + new CommandResponseInfo("timeSinceBoot", "Long"); responseValues.put(timeSinceBootResponseValue, timeSinceBoot); callback.onSuccess(responseValues); } @@ -1136,10 +1100,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1167,12 +1130,12 @@ public void onSuccess( @Nullable Integer nextCredentialIndex) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo credentialExistsResponseValue = - new CommandResponseInfo("credentialExists", "boolean"); + new CommandResponseInfo("credentialExists", "Boolean"); responseValues.put(credentialExistsResponseValue, credentialExists); - CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "int"); + CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); responseValues.put(userIndexResponseValue, userIndex); CommandResponseInfo nextCredentialIndexResponseValue = - new CommandResponseInfo("nextCredentialIndex", "int"); + new CommandResponseInfo("nextCredentialIndex", "Integer"); responseValues.put(nextCredentialIndexResponseValue, nextCredentialIndex); callback.onSuccess(responseValues); } @@ -1200,36 +1163,36 @@ public void onSuccess( @Nullable Integer userStatus, @Nullable Integer userType, @Nullable Integer credentialRule, - // credentials: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet + @Nullable ArrayList credentials, @Nullable Integer creatorFabricIndex, @Nullable Integer lastModifiedFabricIndex, Integer nextUserIndex) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "int"); + CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); responseValues.put(userIndexResponseValue, userIndex); CommandResponseInfo userNameResponseValue = new CommandResponseInfo("userName", "String"); responseValues.put(userNameResponseValue, userName); CommandResponseInfo userUniqueIdResponseValue = - new CommandResponseInfo("userUniqueId", "long"); + new CommandResponseInfo("userUniqueId", "Long"); responseValues.put(userUniqueIdResponseValue, userUniqueId); - CommandResponseInfo userStatusResponseValue = new CommandResponseInfo("userStatus", "int"); + CommandResponseInfo userStatusResponseValue = + new CommandResponseInfo("userStatus", "Integer"); responseValues.put(userStatusResponseValue, userStatus); - CommandResponseInfo userTypeResponseValue = new CommandResponseInfo("userType", "int"); + CommandResponseInfo userTypeResponseValue = new CommandResponseInfo("userType", "Integer"); responseValues.put(userTypeResponseValue, userType); CommandResponseInfo credentialRuleResponseValue = - new CommandResponseInfo("credentialRule", "int"); + new CommandResponseInfo("credentialRule", "Integer"); responseValues.put(credentialRuleResponseValue, credentialRule); // credentials: /* TYPE WARNING: array array defaults to */ uint8_t * // Conversion from this type to Java is not properly implemented yet CommandResponseInfo creatorFabricIndexResponseValue = - new CommandResponseInfo("creatorFabricIndex", "int"); + new CommandResponseInfo("creatorFabricIndex", "Integer"); responseValues.put(creatorFabricIndexResponseValue, creatorFabricIndex); CommandResponseInfo lastModifiedFabricIndexResponseValue = - new CommandResponseInfo("lastModifiedFabricIndex", "int"); + new CommandResponseInfo("lastModifiedFabricIndex", "Integer"); responseValues.put(lastModifiedFabricIndexResponseValue, lastModifiedFabricIndex); CommandResponseInfo nextUserIndexResponseValue = - new CommandResponseInfo("nextUserIndex", "int"); + new CommandResponseInfo("nextUserIndex", "Integer"); responseValues.put(nextUserIndexResponseValue, nextUserIndex); callback.onSuccess(responseValues); } @@ -1254,12 +1217,12 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { public void onSuccess( Integer status, @Nullable Integer userIndex, @Nullable Integer nextCredentialIndex) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); - CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "int"); + CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); responseValues.put(userIndexResponseValue, userIndex); CommandResponseInfo nextCredentialIndexResponseValue = - new CommandResponseInfo("nextCredentialIndex", "int"); + new CommandResponseInfo("nextCredentialIndex", "Integer"); responseValues.put(nextCredentialIndexResponseValue, nextCredentialIndex); callback.onSuccess(responseValues); } @@ -1281,10 +1244,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1306,10 +1268,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1331,10 +1292,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1356,12 +1316,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = - new CommandResponseInfo( - "valueList", "List"); - + new CommandResponseInfo("valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1383,10 +1341,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1408,10 +1365,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1435,7 +1391,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer errorCode, String debugText) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo errorCodeResponseValue = new CommandResponseInfo("errorCode", "int"); + CommandResponseInfo errorCodeResponseValue = new CommandResponseInfo("errorCode", "Integer"); responseValues.put(errorCodeResponseValue, errorCode); CommandResponseInfo debugTextResponseValue = new CommandResponseInfo("debugText", "String"); responseValues.put(debugTextResponseValue, debugText); @@ -1461,7 +1417,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer errorCode, String debugText) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo errorCodeResponseValue = new CommandResponseInfo("errorCode", "int"); + CommandResponseInfo errorCodeResponseValue = new CommandResponseInfo("errorCode", "Integer"); responseValues.put(errorCodeResponseValue, errorCode); CommandResponseInfo debugTextResponseValue = new CommandResponseInfo("debugText", "String"); responseValues.put(debugTextResponseValue, debugText); @@ -1487,7 +1443,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer errorCode, String debugText) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo errorCodeResponseValue = new CommandResponseInfo("errorCode", "int"); + CommandResponseInfo errorCodeResponseValue = new CommandResponseInfo("errorCode", "Integer"); responseValues.put(errorCodeResponseValue, errorCode); CommandResponseInfo debugTextResponseValue = new CommandResponseInfo("debugText", "String"); responseValues.put(debugTextResponseValue, debugText); @@ -1514,14 +1470,12 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess( - List - valueList) { + List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( "valueList", - "List"); - + "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1543,10 +1497,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1569,13 +1522,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess( - List valueList) { + List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", - "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1597,11 +1548,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1623,11 +1573,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1649,11 +1598,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1675,10 +1623,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1700,9 +1647,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( // groupKeySetIDs: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - ) { + public void onSuccess(ArrayList groupKeySetIDs) { Map responseValues = new LinkedHashMap<>(); // groupKeySetIDs: /* TYPE WARNING: array array defaults to */ uint8_t * // Conversion from this type to Java is not properly implemented yet @@ -1726,9 +1671,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( // groupKeySet: Struct GroupKeySet - // Conversion from this type to Java is not properly implemented yet - ) { + public void onSuccess(ChipStructs.GroupKeyManagementClusterGroupKeySet groupKeySet) { Map responseValues = new LinkedHashMap<>(); // groupKeySet: Struct GroupKeySet // Conversion from this type to Java is not properly implemented yet @@ -1752,13 +1695,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( - List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1780,13 +1721,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( - List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1808,10 +1747,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1834,9 +1772,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer status, Integer groupId) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); - CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "int"); + CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "Integer"); responseValues.put(groupIdResponseValue, groupId); callback.onSuccess(responseValues); } @@ -1858,12 +1796,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Integer capacity - // groupList: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - ) { + public void onSuccess(Integer capacity, ArrayList groupList) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo capacityResponseValue = new CommandResponseInfo("capacity", "int"); + CommandResponseInfo capacityResponseValue = new CommandResponseInfo("capacity", "Integer"); responseValues.put(capacityResponseValue, capacity); // groupList: /* TYPE WARNING: array array defaults to */ uint8_t * // Conversion from this type to Java is not properly implemented yet @@ -1888,9 +1823,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer status, Integer groupId) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); - CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "int"); + CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "Integer"); responseValues.put(groupIdResponseValue, groupId); callback.onSuccess(responseValues); } @@ -1913,9 +1848,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer status, Integer groupId, String groupName) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); - CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "int"); + CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "Integer"); responseValues.put(groupIdResponseValue, groupId); CommandResponseInfo groupNameResponseValue = new CommandResponseInfo("groupName", "String"); responseValues.put(groupNameResponseValue, groupName); @@ -1939,10 +1874,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -1966,7 +1900,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer timeout) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo timeoutResponseValue = new CommandResponseInfo("timeout", "int"); + CommandResponseInfo timeoutResponseValue = new CommandResponseInfo("timeout", "Integer"); responseValues.put(timeoutResponseValue, timeout); callback.onSuccess(responseValues); } @@ -1988,10 +1922,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2013,10 +1946,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2039,7 +1971,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer status) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); callback.onSuccess(responseValues); } @@ -2061,10 +1993,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2086,10 +2017,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2111,11 +2041,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2137,10 +2066,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2162,12 +2090,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = - new CommandResponseInfo( - "valueList", "List"); - + new CommandResponseInfo("valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2189,10 +2115,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2216,7 +2141,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer status) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); callback.onSuccess(responseValues); } @@ -2238,10 +2163,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2263,12 +2187,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2290,10 +2213,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2318,11 +2240,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { public void onSuccess(Integer NetworkingStatus, String DebugText, Long ErrorValue) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo NetworkingStatusResponseValue = - new CommandResponseInfo("NetworkingStatus", "int"); + new CommandResponseInfo("NetworkingStatus", "Integer"); responseValues.put(NetworkingStatusResponseValue, NetworkingStatus); CommandResponseInfo DebugTextResponseValue = new CommandResponseInfo("DebugText", "String"); responseValues.put(DebugTextResponseValue, DebugText); - CommandResponseInfo ErrorValueResponseValue = new CommandResponseInfo("ErrorValue", "long"); + CommandResponseInfo ErrorValueResponseValue = new CommandResponseInfo("ErrorValue", "Long"); responseValues.put(ErrorValueResponseValue, ErrorValue); callback.onSuccess(responseValues); } @@ -2347,7 +2269,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { public void onSuccess(Integer NetworkingStatus, String DebugText) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo NetworkingStatusResponseValue = - new CommandResponseInfo("NetworkingStatus", "int"); + new CommandResponseInfo("NetworkingStatus", "Integer"); responseValues.put(NetworkingStatusResponseValue, NetworkingStatus); CommandResponseInfo DebugTextResponseValue = new CommandResponseInfo("DebugText", "String"); responseValues.put(DebugTextResponseValue, DebugText); @@ -2371,15 +2293,16 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Integer NetworkingStatus, String DebugText - // WiFiScanResults: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - // ThreadScanResults: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - ) { + public void onSuccess( + Integer NetworkingStatus, + String DebugText, + Optional> + WiFiScanResults, + Optional> + ThreadScanResults) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo NetworkingStatusResponseValue = - new CommandResponseInfo("NetworkingStatus", "int"); + new CommandResponseInfo("NetworkingStatus", "Integer"); responseValues.put(NetworkingStatusResponseValue, NetworkingStatus); CommandResponseInfo DebugTextResponseValue = new CommandResponseInfo("DebugText", "String"); responseValues.put(DebugTextResponseValue, DebugText); @@ -2407,13 +2330,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( - List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2437,10 +2358,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer action, Long delayedActionTime) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo actionResponseValue = new CommandResponseInfo("action", "int"); + CommandResponseInfo actionResponseValue = new CommandResponseInfo("action", "Integer"); responseValues.put(actionResponseValue, action); CommandResponseInfo delayedActionTimeResponseValue = - new CommandResponseInfo("delayedActionTime", "long"); + new CommandResponseInfo("delayedActionTime", "Long"); responseValues.put(delayedActionTimeResponseValue, delayedActionTime); callback.onSuccess(responseValues); } @@ -2472,27 +2393,28 @@ public void onSuccess( Optional userConsentNeeded, Optional metadataForRequestor) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); CommandResponseInfo delayedActionTimeResponseValue = - new CommandResponseInfo("delayedActionTime", "long"); + new CommandResponseInfo("delayedActionTime", "Optional"); responseValues.put(delayedActionTimeResponseValue, delayedActionTime); - CommandResponseInfo imageURIResponseValue = new CommandResponseInfo("imageURI", "String"); + CommandResponseInfo imageURIResponseValue = + new CommandResponseInfo("imageURI", "Optional"); responseValues.put(imageURIResponseValue, imageURI); CommandResponseInfo softwareVersionResponseValue = - new CommandResponseInfo("softwareVersion", "long"); + new CommandResponseInfo("softwareVersion", "Optional"); responseValues.put(softwareVersionResponseValue, softwareVersion); CommandResponseInfo softwareVersionStringResponseValue = - new CommandResponseInfo("softwareVersionString", "String"); + new CommandResponseInfo("softwareVersionString", "Optional"); responseValues.put(softwareVersionStringResponseValue, softwareVersionString); CommandResponseInfo updateTokenResponseValue = - new CommandResponseInfo("updateToken", "byte[]"); + new CommandResponseInfo("updateToken", "Optional"); responseValues.put(updateTokenResponseValue, updateToken); CommandResponseInfo userConsentNeededResponseValue = - new CommandResponseInfo("userConsentNeeded", "boolean"); + new CommandResponseInfo("userConsentNeeded", "Optional"); responseValues.put(userConsentNeededResponseValue, userConsentNeeded); CommandResponseInfo metadataForRequestorResponseValue = - new CommandResponseInfo("metadataForRequestor", "byte[]"); + new CommandResponseInfo("metadataForRequestor", "Optional"); responseValues.put(metadataForRequestorResponseValue, metadataForRequestor); callback.onSuccess(responseValues); } @@ -2514,10 +2436,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2541,14 +2462,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess( - List - valueList) { + List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", - "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2570,10 +2488,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2595,10 +2512,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2620,10 +2536,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2645,10 +2560,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2724,9 +2638,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer StatusCode, Integer FabricIndex, String DebugText) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo StatusCodeResponseValue = new CommandResponseInfo("StatusCode", "int"); + CommandResponseInfo StatusCodeResponseValue = + new CommandResponseInfo("StatusCode", "Integer"); responseValues.put(StatusCodeResponseValue, StatusCode); - CommandResponseInfo FabricIndexResponseValue = new CommandResponseInfo("FabricIndex", "int"); + CommandResponseInfo FabricIndexResponseValue = + new CommandResponseInfo("FabricIndex", "Integer"); responseValues.put(FabricIndexResponseValue, FabricIndex); CommandResponseInfo DebugTextResponseValue = new CommandResponseInfo("DebugText", "String"); responseValues.put(DebugTextResponseValue, DebugText); @@ -2778,13 +2694,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( - List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2807,12 +2721,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess( - List valueList) { + List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2835,11 +2748,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2861,10 +2773,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2886,11 +2797,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2912,10 +2822,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2937,11 +2846,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2963,10 +2871,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -2988,10 +2895,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3013,10 +2919,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3038,10 +2943,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3064,11 +2968,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer status, Integer groupId, Integer sceneId) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); - CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "int"); + CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "Integer"); responseValues.put(groupIdResponseValue, groupId); - CommandResponseInfo sceneIdResponseValue = new CommandResponseInfo("sceneId", "int"); + CommandResponseInfo sceneIdResponseValue = new CommandResponseInfo("sceneId", "Integer"); responseValues.put(sceneIdResponseValue, sceneId); callback.onSuccess(responseValues); } @@ -3090,18 +2994,21 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Integer status, Integer capacity, Integer groupId, Integer sceneCount - // sceneList: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - ) { + public void onSuccess( + Integer status, + Integer capacity, + Integer groupId, + Integer sceneCount, + ArrayList sceneList) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); - CommandResponseInfo capacityResponseValue = new CommandResponseInfo("capacity", "int"); + CommandResponseInfo capacityResponseValue = new CommandResponseInfo("capacity", "Integer"); responseValues.put(capacityResponseValue, capacity); - CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "int"); + CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "Integer"); responseValues.put(groupIdResponseValue, groupId); - CommandResponseInfo sceneCountResponseValue = new CommandResponseInfo("sceneCount", "int"); + CommandResponseInfo sceneCountResponseValue = + new CommandResponseInfo("sceneCount", "Integer"); responseValues.put(sceneCountResponseValue, sceneCount); // sceneList: /* TYPE WARNING: array array defaults to */ uint8_t * // Conversion from this type to Java is not properly implemented yet @@ -3127,9 +3034,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer status, Integer groupId) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); - CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "int"); + CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "Integer"); responseValues.put(groupIdResponseValue, groupId); callback.onSuccess(responseValues); } @@ -3152,11 +3059,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer status, Integer groupId, Integer sceneId) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); - CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "int"); + CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "Integer"); responseValues.put(groupIdResponseValue, groupId); - CommandResponseInfo sceneIdResponseValue = new CommandResponseInfo("sceneId", "int"); + CommandResponseInfo sceneIdResponseValue = new CommandResponseInfo("sceneId", "Integer"); responseValues.put(sceneIdResponseValue, sceneId); callback.onSuccess(responseValues); } @@ -3179,11 +3086,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer status, Integer groupId, Integer sceneId) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); - CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "int"); + CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "Integer"); responseValues.put(groupIdResponseValue, groupId); - CommandResponseInfo sceneIdResponseValue = new CommandResponseInfo("sceneId", "int"); + CommandResponseInfo sceneIdResponseValue = new CommandResponseInfo("sceneId", "Integer"); responseValues.put(sceneIdResponseValue, sceneId); callback.onSuccess(responseValues); } @@ -3205,19 +3112,21 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess( - Integer status, Integer groupId, Integer sceneId, Integer transitionTime, String sceneName - // extensionFieldSets: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - ) { + Integer status, + Integer groupId, + Integer sceneId, + Integer transitionTime, + String sceneName, + ArrayList extensionFieldSets) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); - CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "int"); + CommandResponseInfo groupIdResponseValue = new CommandResponseInfo("groupId", "Integer"); responseValues.put(groupIdResponseValue, groupId); - CommandResponseInfo sceneIdResponseValue = new CommandResponseInfo("sceneId", "int"); + CommandResponseInfo sceneIdResponseValue = new CommandResponseInfo("sceneId", "Integer"); responseValues.put(sceneIdResponseValue, sceneId); CommandResponseInfo transitionTimeResponseValue = - new CommandResponseInfo("transitionTime", "int"); + new CommandResponseInfo("transitionTime", "Integer"); responseValues.put(transitionTimeResponseValue, transitionTime); CommandResponseInfo sceneNameResponseValue = new CommandResponseInfo("sceneName", "String"); responseValues.put(sceneNameResponseValue, sceneName); @@ -3243,10 +3152,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3268,13 +3176,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( - List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3296,10 +3202,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3321,10 +3226,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3348,7 +3252,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer status, String data) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "int"); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); CommandResponseInfo dataResponseValue = new CommandResponseInfo("data", "String"); responseValues.put(dataResponseValue, data); @@ -3372,14 +3276,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( - List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", - "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3401,10 +3302,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3426,10 +3326,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3452,7 +3351,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Boolean value) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo valueResponseValue = new CommandResponseInfo("value", "boolean"); + CommandResponseInfo valueResponseValue = new CommandResponseInfo("value", "Boolean"); responseValues.put(valueResponseValue, value); callback.onSuccess(responseValues); } @@ -3474,9 +3373,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( // arg1: Struct SimpleStruct - // Conversion from this type to Java is not properly implemented yet - ) { + public void onSuccess(ChipStructs.TestClusterClusterSimpleStruct arg1) { Map responseValues = new LinkedHashMap<>(); // arg1: Struct SimpleStruct // Conversion from this type to Java is not properly implemented yet @@ -3502,7 +3399,8 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer returnValue) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo returnValueResponseValue = new CommandResponseInfo("returnValue", "int"); + CommandResponseInfo returnValueResponseValue = + new CommandResponseInfo("returnValue", "Integer"); responseValues.put(returnValueResponseValue, returnValue); callback.onSuccess(responseValues); } @@ -3526,7 +3424,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Long value) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo valueResponseValue = new CommandResponseInfo("value", "long"); + CommandResponseInfo valueResponseValue = new CommandResponseInfo("value", "Long"); responseValues.put(valueResponseValue, value); callback.onSuccess(responseValues); } @@ -3550,9 +3448,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer arg1, Integer arg2) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo arg1ResponseValue = new CommandResponseInfo("arg1", "int"); + CommandResponseInfo arg1ResponseValue = new CommandResponseInfo("arg1", "Integer"); responseValues.put(arg1ResponseValue, arg1); - CommandResponseInfo arg2ResponseValue = new CommandResponseInfo("arg2", "int"); + CommandResponseInfo arg2ResponseValue = new CommandResponseInfo("arg2", "Integer"); responseValues.put(arg2ResponseValue, arg2); callback.onSuccess(responseValues); } @@ -3574,9 +3472,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( // arg1: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - ) { + public void onSuccess(ArrayList arg1) { Map responseValues = new LinkedHashMap<>(); // arg1: /* TYPE WARNING: array array defaults to */ uint8_t * // Conversion from this type to Java is not properly implemented yet @@ -3604,17 +3500,19 @@ public void onSuccess( Boolean wasPresent, Optional wasNull, Optional value, - Optional originalValue) { + @Nullable Optional originalValue) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo wasPresentResponseValue = - new CommandResponseInfo("wasPresent", "boolean"); + new CommandResponseInfo("wasPresent", "Boolean"); responseValues.put(wasPresentResponseValue, wasPresent); - CommandResponseInfo wasNullResponseValue = new CommandResponseInfo("wasNull", "boolean"); + CommandResponseInfo wasNullResponseValue = + new CommandResponseInfo("wasNull", "Optional"); responseValues.put(wasNullResponseValue, wasNull); - CommandResponseInfo valueResponseValue = new CommandResponseInfo("value", "int"); + CommandResponseInfo valueResponseValue = + new CommandResponseInfo("value", "Optional"); responseValues.put(valueResponseValue, value); CommandResponseInfo originalValueResponseValue = - new CommandResponseInfo("originalValue", "int"); + new CommandResponseInfo("originalValue", "Optional"); responseValues.put(originalValueResponseValue, originalValue); callback.onSuccess(responseValues); } @@ -3638,7 +3536,8 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess(Integer returnValue) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo returnValueResponseValue = new CommandResponseInfo("returnValue", "int"); + CommandResponseInfo returnValueResponseValue = + new CommandResponseInfo("returnValue", "Integer"); responseValues.put(returnValueResponseValue, returnValue); callback.onSuccess(responseValues); } @@ -3660,11 +3559,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3686,11 +3584,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3712,13 +3609,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( - List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3741,13 +3636,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess( - List valueList) { + List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", - "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3769,11 +3662,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3795,10 +3687,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3828,20 +3719,21 @@ public void onSuccess( Integer setpoint, Integer unreadEntries) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo timeOfDayResponseValue = new CommandResponseInfo("timeOfDay", "int"); + CommandResponseInfo timeOfDayResponseValue = new CommandResponseInfo("timeOfDay", "Integer"); responseValues.put(timeOfDayResponseValue, timeOfDay); - CommandResponseInfo relayStatusResponseValue = new CommandResponseInfo("relayStatus", "int"); + CommandResponseInfo relayStatusResponseValue = + new CommandResponseInfo("relayStatus", "Integer"); responseValues.put(relayStatusResponseValue, relayStatus); CommandResponseInfo localTemperatureResponseValue = - new CommandResponseInfo("localTemperature", "int"); + new CommandResponseInfo("localTemperature", "Integer"); responseValues.put(localTemperatureResponseValue, localTemperature); CommandResponseInfo humidityInPercentageResponseValue = - new CommandResponseInfo("humidityInPercentage", "int"); + new CommandResponseInfo("humidityInPercentage", "Integer"); responseValues.put(humidityInPercentageResponseValue, humidityInPercentage); - CommandResponseInfo setpointResponseValue = new CommandResponseInfo("setpoint", "int"); + CommandResponseInfo setpointResponseValue = new CommandResponseInfo("setpoint", "Integer"); responseValues.put(setpointResponseValue, setpoint); CommandResponseInfo unreadEntriesResponseValue = - new CommandResponseInfo("unreadEntries", "int"); + new CommandResponseInfo("unreadEntries", "Integer"); responseValues.put(unreadEntriesResponseValue, unreadEntries); callback.onSuccess(responseValues); } @@ -3866,20 +3758,18 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { public void onSuccess( Integer numberOfTransitionsForSequence, Integer dayOfWeekForSequence, - Integer modeForSequence - // payload: /* TYPE WARNING: array array defaults to */ uint8_t * - // Conversion from this type to Java is not properly implemented yet - ) { + Integer modeForSequence, + ArrayList payload) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo numberOfTransitionsForSequenceResponseValue = - new CommandResponseInfo("numberOfTransitionsForSequence", "int"); + new CommandResponseInfo("numberOfTransitionsForSequence", "Integer"); responseValues.put( numberOfTransitionsForSequenceResponseValue, numberOfTransitionsForSequence); CommandResponseInfo dayOfWeekForSequenceResponseValue = - new CommandResponseInfo("dayOfWeekForSequence", "int"); + new CommandResponseInfo("dayOfWeekForSequence", "Integer"); responseValues.put(dayOfWeekForSequenceResponseValue, dayOfWeekForSequence); CommandResponseInfo modeForSequenceResponseValue = - new CommandResponseInfo("modeForSequence", "int"); + new CommandResponseInfo("modeForSequence", "Integer"); responseValues.put(modeForSequenceResponseValue, modeForSequence); // payload: /* TYPE WARNING: array array defaults to */ uint8_t * // Conversion from this type to Java is not properly implemented yet @@ -3903,10 +3793,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3930,10 +3819,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3956,13 +3844,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess( - List valueList) { + List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", - "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -3984,14 +3870,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess( - List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", - "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -4014,13 +3897,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess( - List valueList) { + List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", - "List"); - + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -4045,14 +3926,12 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess( - List - valueList) { + List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( "valueList", - "List"); - + "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -4076,11 +3955,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -4102,10 +3980,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -4127,12 +4004,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = - new CommandResponseInfo( - "valueList", "List"); - + new CommandResponseInfo("valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -4154,10 +4029,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -4179,10 +4053,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -4204,10 +4077,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -4642,7 +4514,6 @@ public Map> getCommandMap() { "tempAccountIdentifier", accountLogingetSetupPINRequesttempAccountIdentifierCommandParameterInfo); - // Populate commands InteractionInfo accountLogingetSetupPINRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -4668,7 +4539,6 @@ public Map> getCommandMap() { accountLoginloginRequestCommandParams.put( "setupPIN", accountLoginloginRequestsetupPINCommandParameterInfo); - // Populate commands InteractionInfo accountLoginloginRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -4684,7 +4554,6 @@ public Map> getCommandMap() { "loginRequest", accountLoginloginRequestInteractionInfo); Map accountLoginlogoutRequestCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo accountLoginlogoutRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -4703,12 +4572,11 @@ public Map> getCommandMap() { new LinkedHashMap(); CommandParameterInfo administratorCommissioningopenBasicCommissioningWindowcommissioningTimeoutCommandParameterInfo = - new CommandParameterInfo("commissioningTimeout", int.class); + new CommandParameterInfo("commissioningTimeout", Integer.class); administratorCommissioningopenBasicCommissioningWindowCommandParams.put( "commissioningTimeout", administratorCommissioningopenBasicCommissioningWindowcommissioningTimeoutCommandParameterInfo); - // Populate commands InteractionInfo administratorCommissioningopenBasicCommissioningWindowInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -4727,7 +4595,7 @@ public Map> getCommandMap() { new LinkedHashMap(); CommandParameterInfo administratorCommissioningopenCommissioningWindowcommissioningTimeoutCommandParameterInfo = - new CommandParameterInfo("commissioningTimeout", int.class); + new CommandParameterInfo("commissioningTimeout", Integer.class); administratorCommissioningopenCommissioningWindowCommandParams.put( "commissioningTimeout", administratorCommissioningopenCommissioningWindowcommissioningTimeoutCommandParameterInfo); @@ -4741,14 +4609,14 @@ public Map> getCommandMap() { CommandParameterInfo administratorCommissioningopenCommissioningWindowdiscriminatorCommandParameterInfo = - new CommandParameterInfo("discriminator", int.class); + new CommandParameterInfo("discriminator", Integer.class); administratorCommissioningopenCommissioningWindowCommandParams.put( "discriminator", administratorCommissioningopenCommissioningWindowdiscriminatorCommandParameterInfo); CommandParameterInfo administratorCommissioningopenCommissioningWindowiterationsCommandParameterInfo = - new CommandParameterInfo("iterations", long.class); + new CommandParameterInfo("iterations", Long.class); administratorCommissioningopenCommissioningWindowCommandParams.put( "iterations", administratorCommissioningopenCommissioningWindowiterationsCommandParameterInfo); @@ -4760,12 +4628,11 @@ public Map> getCommandMap() { CommandParameterInfo administratorCommissioningopenCommissioningWindowpasscodeIDCommandParameterInfo = - new CommandParameterInfo("passcodeID", int.class); + new CommandParameterInfo("passcodeID", Integer.class); administratorCommissioningopenCommissioningWindowCommandParams.put( "passcodeID", administratorCommissioningopenCommissioningWindowpasscodeIDCommandParameterInfo); - // Populate commands InteractionInfo administratorCommissioningopenCommissioningWindowInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -4786,7 +4653,6 @@ public Map> getCommandMap() { administratorCommissioningopenCommissioningWindowInteractionInfo); Map administratorCommissioningrevokeCommissioningCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo administratorCommissioningrevokeCommissioningInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -4805,25 +4671,14 @@ public Map> getCommandMap() { new LinkedHashMap<>(); Map applicationLauncherhideAppRequestCommandParams = new LinkedHashMap(); - CommandParameterInfo applicationLauncherhideAppRequestcatalogVendorIdCommandParameterInfo = - new CommandParameterInfo("catalogVendorId", int.class); - applicationLauncherhideAppRequestCommandParams.put( - "catalogVendorId", applicationLauncherhideAppRequestcatalogVendorIdCommandParameterInfo); - - CommandParameterInfo applicationLauncherhideAppRequestapplicationIdCommandParameterInfo = - new CommandParameterInfo("applicationId", String.class); - applicationLauncherhideAppRequestCommandParams.put( - "applicationId", applicationLauncherhideAppRequestapplicationIdCommandParameterInfo); - - // Populate commands InteractionInfo applicationLauncherhideAppRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ApplicationLauncherCluster) cluster) .hideAppRequest( (ChipClusters.ApplicationLauncherCluster.LauncherResponseCallback) callback, - (Integer) commandArguments.get("catalogVendorId"), - (String) commandArguments.get("applicationId")); + (ChipStructs.ApplicationLauncherClusterApplicationLauncherApplication) + commandArguments.get("application")); }, () -> new DelegatedLauncherResponseCallback(), applicationLauncherhideAppRequestCommandParams); @@ -4836,17 +4691,6 @@ public Map> getCommandMap() { applicationLauncherlaunchAppRequestCommandParams.put( "data", applicationLauncherlaunchAppRequestdataCommandParameterInfo); - CommandParameterInfo applicationLauncherlaunchAppRequestcatalogVendorIdCommandParameterInfo = - new CommandParameterInfo("catalogVendorId", int.class); - applicationLauncherlaunchAppRequestCommandParams.put( - "catalogVendorId", applicationLauncherlaunchAppRequestcatalogVendorIdCommandParameterInfo); - - CommandParameterInfo applicationLauncherlaunchAppRequestapplicationIdCommandParameterInfo = - new CommandParameterInfo("applicationId", String.class); - applicationLauncherlaunchAppRequestCommandParams.put( - "applicationId", applicationLauncherlaunchAppRequestapplicationIdCommandParameterInfo); - - // Populate commands InteractionInfo applicationLauncherlaunchAppRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -4854,8 +4698,8 @@ public Map> getCommandMap() { .launchAppRequest( (ChipClusters.ApplicationLauncherCluster.LauncherResponseCallback) callback, (String) commandArguments.get("data"), - (Integer) commandArguments.get("catalogVendorId"), - (String) commandArguments.get("applicationId")); + (ChipStructs.ApplicationLauncherClusterApplicationLauncherApplication) + commandArguments.get("application")); }, () -> new DelegatedLauncherResponseCallback(), applicationLauncherlaunchAppRequestCommandParams); @@ -4863,25 +4707,14 @@ public Map> getCommandMap() { "launchAppRequest", applicationLauncherlaunchAppRequestInteractionInfo); Map applicationLauncherstopAppRequestCommandParams = new LinkedHashMap(); - CommandParameterInfo applicationLauncherstopAppRequestcatalogVendorIdCommandParameterInfo = - new CommandParameterInfo("catalogVendorId", int.class); - applicationLauncherstopAppRequestCommandParams.put( - "catalogVendorId", applicationLauncherstopAppRequestcatalogVendorIdCommandParameterInfo); - - CommandParameterInfo applicationLauncherstopAppRequestapplicationIdCommandParameterInfo = - new CommandParameterInfo("applicationId", String.class); - applicationLauncherstopAppRequestCommandParams.put( - "applicationId", applicationLauncherstopAppRequestapplicationIdCommandParameterInfo); - - // Populate commands InteractionInfo applicationLauncherstopAppRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ApplicationLauncherCluster) cluster) .stopAppRequest( (ChipClusters.ApplicationLauncherCluster.LauncherResponseCallback) callback, - (Integer) commandArguments.get("catalogVendorId"), - (String) commandArguments.get("applicationId")); + (ChipStructs.ApplicationLauncherClusterApplicationLauncherApplication) + commandArguments.get("application")); }, () -> new DelegatedLauncherResponseCallback(), applicationLauncherstopAppRequestCommandParams); @@ -4892,7 +4725,7 @@ public Map> getCommandMap() { Map audioOutputrenameOutputRequestCommandParams = new LinkedHashMap(); CommandParameterInfo audioOutputrenameOutputRequestindexCommandParameterInfo = - new CommandParameterInfo("index", int.class); + new CommandParameterInfo("index", Integer.class); audioOutputrenameOutputRequestCommandParams.put( "index", audioOutputrenameOutputRequestindexCommandParameterInfo); @@ -4901,7 +4734,6 @@ public Map> getCommandMap() { audioOutputrenameOutputRequestCommandParams.put( "name", audioOutputrenameOutputRequestnameCommandParameterInfo); - // Populate commands InteractionInfo audioOutputrenameOutputRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -4918,11 +4750,10 @@ public Map> getCommandMap() { Map audioOutputselectOutputRequestCommandParams = new LinkedHashMap(); CommandParameterInfo audioOutputselectOutputRequestindexCommandParameterInfo = - new CommandParameterInfo("index", int.class); + new CommandParameterInfo("index", Integer.class); audioOutputselectOutputRequestCommandParams.put( "index", audioOutputselectOutputRequestindexCommandParameterInfo); - // Populate commands InteractionInfo audioOutputselectOutputRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -4939,11 +4770,10 @@ public Map> getCommandMap() { Map barrierControlbarrierControlGoToPercentCommandParams = new LinkedHashMap(); CommandParameterInfo barrierControlbarrierControlGoToPercentpercentOpenCommandParameterInfo = - new CommandParameterInfo("percentOpen", int.class); + new CommandParameterInfo("percentOpen", Integer.class); barrierControlbarrierControlGoToPercentCommandParams.put( "percentOpen", barrierControlbarrierControlGoToPercentpercentOpenCommandParameterInfo); - // Populate commands InteractionInfo barrierControlbarrierControlGoToPercentInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -4958,7 +4788,6 @@ public Map> getCommandMap() { "barrierControlGoToPercent", barrierControlbarrierControlGoToPercentInteractionInfo); Map barrierControlbarrierControlStopCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo barrierControlbarrierControlStopInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -4973,7 +4802,6 @@ public Map> getCommandMap() { Map basicClusterInteractionInfoMap = new LinkedHashMap<>(); Map basicmfgSpecificPingCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo basicmfgSpecificPingInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -4990,22 +4818,21 @@ public Map> getCommandMap() { Map bindingbindCommandParams = new LinkedHashMap(); CommandParameterInfo bindingbindnodeIdCommandParameterInfo = - new CommandParameterInfo("nodeId", long.class); + new CommandParameterInfo("nodeId", Long.class); bindingbindCommandParams.put("nodeId", bindingbindnodeIdCommandParameterInfo); CommandParameterInfo bindingbindgroupIdCommandParameterInfo = - new CommandParameterInfo("groupId", int.class); + new CommandParameterInfo("groupId", Integer.class); bindingbindCommandParams.put("groupId", bindingbindgroupIdCommandParameterInfo); CommandParameterInfo bindingbindendpointIdCommandParameterInfo = - new CommandParameterInfo("endpointId", int.class); + new CommandParameterInfo("endpointId", Integer.class); bindingbindCommandParams.put("endpointId", bindingbindendpointIdCommandParameterInfo); CommandParameterInfo bindingbindclusterIdCommandParameterInfo = - new CommandParameterInfo("clusterId", long.class); + new CommandParameterInfo("clusterId", Long.class); bindingbindCommandParams.put("clusterId", bindingbindclusterIdCommandParameterInfo); - // Populate commands InteractionInfo bindingbindInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5023,22 +4850,21 @@ public Map> getCommandMap() { Map bindingunbindCommandParams = new LinkedHashMap(); CommandParameterInfo bindingunbindnodeIdCommandParameterInfo = - new CommandParameterInfo("nodeId", long.class); + new CommandParameterInfo("nodeId", Long.class); bindingunbindCommandParams.put("nodeId", bindingunbindnodeIdCommandParameterInfo); CommandParameterInfo bindingunbindgroupIdCommandParameterInfo = - new CommandParameterInfo("groupId", int.class); + new CommandParameterInfo("groupId", Integer.class); bindingunbindCommandParams.put("groupId", bindingunbindgroupIdCommandParameterInfo); CommandParameterInfo bindingunbindendpointIdCommandParameterInfo = - new CommandParameterInfo("endpointId", int.class); + new CommandParameterInfo("endpointId", Integer.class); bindingunbindCommandParams.put("endpointId", bindingunbindendpointIdCommandParameterInfo); CommandParameterInfo bindingunbindclusterIdCommandParameterInfo = - new CommandParameterInfo("clusterId", long.class); + new CommandParameterInfo("clusterId", Long.class); bindingunbindCommandParams.put("clusterId", bindingunbindclusterIdCommandParameterInfo); - // Populate commands InteractionInfo bindingunbindInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5060,16 +4886,15 @@ public Map> getCommandMap() { Map bridgedActionsdisableActionCommandParams = new LinkedHashMap(); CommandParameterInfo bridgedActionsdisableActionactionIDCommandParameterInfo = - new CommandParameterInfo("actionID", int.class); + new CommandParameterInfo("actionID", Integer.class); bridgedActionsdisableActionCommandParams.put( "actionID", bridgedActionsdisableActionactionIDCommandParameterInfo); CommandParameterInfo bridgedActionsdisableActioninvokeIDCommandParameterInfo = - new CommandParameterInfo("invokeID", long.class); + new CommandParameterInfo("invokeID", Optional.class); bridgedActionsdisableActionCommandParams.put( "invokeID", bridgedActionsdisableActioninvokeIDCommandParameterInfo); - // Populate commands InteractionInfo bridgedActionsdisableActionInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5086,21 +4911,20 @@ public Map> getCommandMap() { Map bridgedActionsdisableActionWithDurationCommandParams = new LinkedHashMap(); CommandParameterInfo bridgedActionsdisableActionWithDurationactionIDCommandParameterInfo = - new CommandParameterInfo("actionID", int.class); + new CommandParameterInfo("actionID", Integer.class); bridgedActionsdisableActionWithDurationCommandParams.put( "actionID", bridgedActionsdisableActionWithDurationactionIDCommandParameterInfo); CommandParameterInfo bridgedActionsdisableActionWithDurationinvokeIDCommandParameterInfo = - new CommandParameterInfo("invokeID", long.class); + new CommandParameterInfo("invokeID", Optional.class); bridgedActionsdisableActionWithDurationCommandParams.put( "invokeID", bridgedActionsdisableActionWithDurationinvokeIDCommandParameterInfo); CommandParameterInfo bridgedActionsdisableActionWithDurationdurationCommandParameterInfo = - new CommandParameterInfo("duration", long.class); + new CommandParameterInfo("duration", Long.class); bridgedActionsdisableActionWithDurationCommandParams.put( "duration", bridgedActionsdisableActionWithDurationdurationCommandParameterInfo); - // Populate commands InteractionInfo bridgedActionsdisableActionWithDurationInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5118,16 +4942,15 @@ public Map> getCommandMap() { Map bridgedActionsenableActionCommandParams = new LinkedHashMap(); CommandParameterInfo bridgedActionsenableActionactionIDCommandParameterInfo = - new CommandParameterInfo("actionID", int.class); + new CommandParameterInfo("actionID", Integer.class); bridgedActionsenableActionCommandParams.put( "actionID", bridgedActionsenableActionactionIDCommandParameterInfo); CommandParameterInfo bridgedActionsenableActioninvokeIDCommandParameterInfo = - new CommandParameterInfo("invokeID", long.class); + new CommandParameterInfo("invokeID", Optional.class); bridgedActionsenableActionCommandParams.put( "invokeID", bridgedActionsenableActioninvokeIDCommandParameterInfo); - // Populate commands InteractionInfo bridgedActionsenableActionInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5144,21 +4967,20 @@ public Map> getCommandMap() { Map bridgedActionsenableActionWithDurationCommandParams = new LinkedHashMap(); CommandParameterInfo bridgedActionsenableActionWithDurationactionIDCommandParameterInfo = - new CommandParameterInfo("actionID", int.class); + new CommandParameterInfo("actionID", Integer.class); bridgedActionsenableActionWithDurationCommandParams.put( "actionID", bridgedActionsenableActionWithDurationactionIDCommandParameterInfo); CommandParameterInfo bridgedActionsenableActionWithDurationinvokeIDCommandParameterInfo = - new CommandParameterInfo("invokeID", long.class); + new CommandParameterInfo("invokeID", Optional.class); bridgedActionsenableActionWithDurationCommandParams.put( "invokeID", bridgedActionsenableActionWithDurationinvokeIDCommandParameterInfo); CommandParameterInfo bridgedActionsenableActionWithDurationdurationCommandParameterInfo = - new CommandParameterInfo("duration", long.class); + new CommandParameterInfo("duration", Long.class); bridgedActionsenableActionWithDurationCommandParams.put( "duration", bridgedActionsenableActionWithDurationdurationCommandParameterInfo); - // Populate commands InteractionInfo bridgedActionsenableActionWithDurationInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5176,16 +4998,15 @@ public Map> getCommandMap() { Map bridgedActionsinstantActionCommandParams = new LinkedHashMap(); CommandParameterInfo bridgedActionsinstantActionactionIDCommandParameterInfo = - new CommandParameterInfo("actionID", int.class); + new CommandParameterInfo("actionID", Integer.class); bridgedActionsinstantActionCommandParams.put( "actionID", bridgedActionsinstantActionactionIDCommandParameterInfo); CommandParameterInfo bridgedActionsinstantActioninvokeIDCommandParameterInfo = - new CommandParameterInfo("invokeID", long.class); + new CommandParameterInfo("invokeID", Optional.class); bridgedActionsinstantActionCommandParams.put( "invokeID", bridgedActionsinstantActioninvokeIDCommandParameterInfo); - // Populate commands InteractionInfo bridgedActionsinstantActionInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5202,23 +5023,22 @@ public Map> getCommandMap() { Map bridgedActionsinstantActionWithTransitionCommandParams = new LinkedHashMap(); CommandParameterInfo bridgedActionsinstantActionWithTransitionactionIDCommandParameterInfo = - new CommandParameterInfo("actionID", int.class); + new CommandParameterInfo("actionID", Integer.class); bridgedActionsinstantActionWithTransitionCommandParams.put( "actionID", bridgedActionsinstantActionWithTransitionactionIDCommandParameterInfo); CommandParameterInfo bridgedActionsinstantActionWithTransitioninvokeIDCommandParameterInfo = - new CommandParameterInfo("invokeID", long.class); + new CommandParameterInfo("invokeID", Optional.class); bridgedActionsinstantActionWithTransitionCommandParams.put( "invokeID", bridgedActionsinstantActionWithTransitioninvokeIDCommandParameterInfo); CommandParameterInfo bridgedActionsinstantActionWithTransitiontransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); bridgedActionsinstantActionWithTransitionCommandParams.put( "transitionTime", bridgedActionsinstantActionWithTransitiontransitionTimeCommandParameterInfo); - // Populate commands InteractionInfo bridgedActionsinstantActionWithTransitionInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5236,16 +5056,15 @@ public Map> getCommandMap() { Map bridgedActionspauseActionCommandParams = new LinkedHashMap(); CommandParameterInfo bridgedActionspauseActionactionIDCommandParameterInfo = - new CommandParameterInfo("actionID", int.class); + new CommandParameterInfo("actionID", Integer.class); bridgedActionspauseActionCommandParams.put( "actionID", bridgedActionspauseActionactionIDCommandParameterInfo); CommandParameterInfo bridgedActionspauseActioninvokeIDCommandParameterInfo = - new CommandParameterInfo("invokeID", long.class); + new CommandParameterInfo("invokeID", Optional.class); bridgedActionspauseActionCommandParams.put( "invokeID", bridgedActionspauseActioninvokeIDCommandParameterInfo); - // Populate commands InteractionInfo bridgedActionspauseActionInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5262,21 +5081,20 @@ public Map> getCommandMap() { Map bridgedActionspauseActionWithDurationCommandParams = new LinkedHashMap(); CommandParameterInfo bridgedActionspauseActionWithDurationactionIDCommandParameterInfo = - new CommandParameterInfo("actionID", int.class); + new CommandParameterInfo("actionID", Integer.class); bridgedActionspauseActionWithDurationCommandParams.put( "actionID", bridgedActionspauseActionWithDurationactionIDCommandParameterInfo); CommandParameterInfo bridgedActionspauseActionWithDurationinvokeIDCommandParameterInfo = - new CommandParameterInfo("invokeID", long.class); + new CommandParameterInfo("invokeID", Optional.class); bridgedActionspauseActionWithDurationCommandParams.put( "invokeID", bridgedActionspauseActionWithDurationinvokeIDCommandParameterInfo); CommandParameterInfo bridgedActionspauseActionWithDurationdurationCommandParameterInfo = - new CommandParameterInfo("duration", long.class); + new CommandParameterInfo("duration", Long.class); bridgedActionspauseActionWithDurationCommandParams.put( "duration", bridgedActionspauseActionWithDurationdurationCommandParameterInfo); - // Populate commands InteractionInfo bridgedActionspauseActionWithDurationInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5294,16 +5112,15 @@ public Map> getCommandMap() { Map bridgedActionsresumeActionCommandParams = new LinkedHashMap(); CommandParameterInfo bridgedActionsresumeActionactionIDCommandParameterInfo = - new CommandParameterInfo("actionID", int.class); + new CommandParameterInfo("actionID", Integer.class); bridgedActionsresumeActionCommandParams.put( "actionID", bridgedActionsresumeActionactionIDCommandParameterInfo); CommandParameterInfo bridgedActionsresumeActioninvokeIDCommandParameterInfo = - new CommandParameterInfo("invokeID", long.class); + new CommandParameterInfo("invokeID", Optional.class); bridgedActionsresumeActionCommandParams.put( "invokeID", bridgedActionsresumeActioninvokeIDCommandParameterInfo); - // Populate commands InteractionInfo bridgedActionsresumeActionInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5320,16 +5137,15 @@ public Map> getCommandMap() { Map bridgedActionsstartActionCommandParams = new LinkedHashMap(); CommandParameterInfo bridgedActionsstartActionactionIDCommandParameterInfo = - new CommandParameterInfo("actionID", int.class); + new CommandParameterInfo("actionID", Integer.class); bridgedActionsstartActionCommandParams.put( "actionID", bridgedActionsstartActionactionIDCommandParameterInfo); CommandParameterInfo bridgedActionsstartActioninvokeIDCommandParameterInfo = - new CommandParameterInfo("invokeID", long.class); + new CommandParameterInfo("invokeID", Optional.class); bridgedActionsstartActionCommandParams.put( "invokeID", bridgedActionsstartActioninvokeIDCommandParameterInfo); - // Populate commands InteractionInfo bridgedActionsstartActionInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5346,21 +5162,20 @@ public Map> getCommandMap() { Map bridgedActionsstartActionWithDurationCommandParams = new LinkedHashMap(); CommandParameterInfo bridgedActionsstartActionWithDurationactionIDCommandParameterInfo = - new CommandParameterInfo("actionID", int.class); + new CommandParameterInfo("actionID", Integer.class); bridgedActionsstartActionWithDurationCommandParams.put( "actionID", bridgedActionsstartActionWithDurationactionIDCommandParameterInfo); CommandParameterInfo bridgedActionsstartActionWithDurationinvokeIDCommandParameterInfo = - new CommandParameterInfo("invokeID", long.class); + new CommandParameterInfo("invokeID", Optional.class); bridgedActionsstartActionWithDurationCommandParams.put( "invokeID", bridgedActionsstartActionWithDurationinvokeIDCommandParameterInfo); CommandParameterInfo bridgedActionsstartActionWithDurationdurationCommandParameterInfo = - new CommandParameterInfo("duration", long.class); + new CommandParameterInfo("duration", Long.class); bridgedActionsstartActionWithDurationCommandParams.put( "duration", bridgedActionsstartActionWithDurationdurationCommandParameterInfo); - // Populate commands InteractionInfo bridgedActionsstartActionWithDurationInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5378,16 +5193,15 @@ public Map> getCommandMap() { Map bridgedActionsstopActionCommandParams = new LinkedHashMap(); CommandParameterInfo bridgedActionsstopActionactionIDCommandParameterInfo = - new CommandParameterInfo("actionID", int.class); + new CommandParameterInfo("actionID", Integer.class); bridgedActionsstopActionCommandParams.put( "actionID", bridgedActionsstopActionactionIDCommandParameterInfo); CommandParameterInfo bridgedActionsstopActioninvokeIDCommandParameterInfo = - new CommandParameterInfo("invokeID", long.class); + new CommandParameterInfo("invokeID", Optional.class); bridgedActionsstopActionCommandParams.put( "invokeID", bridgedActionsstopActioninvokeIDCommandParameterInfo); - // Populate commands InteractionInfo bridgedActionsstopActionInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5409,16 +5223,15 @@ public Map> getCommandMap() { Map channelchangeChannelByNumberRequestCommandParams = new LinkedHashMap(); CommandParameterInfo channelchangeChannelByNumberRequestmajorNumberCommandParameterInfo = - new CommandParameterInfo("majorNumber", int.class); + new CommandParameterInfo("majorNumber", Integer.class); channelchangeChannelByNumberRequestCommandParams.put( "majorNumber", channelchangeChannelByNumberRequestmajorNumberCommandParameterInfo); CommandParameterInfo channelchangeChannelByNumberRequestminorNumberCommandParameterInfo = - new CommandParameterInfo("minorNumber", int.class); + new CommandParameterInfo("minorNumber", Integer.class); channelchangeChannelByNumberRequestCommandParams.put( "minorNumber", channelchangeChannelByNumberRequestminorNumberCommandParameterInfo); - // Populate commands InteractionInfo channelchangeChannelByNumberRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5439,7 +5252,6 @@ public Map> getCommandMap() { channelchangeChannelRequestCommandParams.put( "match", channelchangeChannelRequestmatchCommandParameterInfo); - // Populate commands InteractionInfo channelchangeChannelRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5455,11 +5267,10 @@ public Map> getCommandMap() { Map channelskipChannelRequestCommandParams = new LinkedHashMap(); CommandParameterInfo channelskipChannelRequestcountCommandParameterInfo = - new CommandParameterInfo("count", int.class); + new CommandParameterInfo("count", Integer.class); channelskipChannelRequestCommandParams.put( "count", channelskipChannelRequestcountCommandParameterInfo); - // Populate commands InteractionInfo channelskipChannelRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5476,41 +5287,40 @@ public Map> getCommandMap() { Map colorControlcolorLoopSetCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlcolorLoopSetupdateFlagsCommandParameterInfo = - new CommandParameterInfo("updateFlags", int.class); + new CommandParameterInfo("updateFlags", Integer.class); colorControlcolorLoopSetCommandParams.put( "updateFlags", colorControlcolorLoopSetupdateFlagsCommandParameterInfo); CommandParameterInfo colorControlcolorLoopSetactionCommandParameterInfo = - new CommandParameterInfo("action", int.class); + new CommandParameterInfo("action", Integer.class); colorControlcolorLoopSetCommandParams.put( "action", colorControlcolorLoopSetactionCommandParameterInfo); CommandParameterInfo colorControlcolorLoopSetdirectionCommandParameterInfo = - new CommandParameterInfo("direction", int.class); + new CommandParameterInfo("direction", Integer.class); colorControlcolorLoopSetCommandParams.put( "direction", colorControlcolorLoopSetdirectionCommandParameterInfo); CommandParameterInfo colorControlcolorLoopSettimeCommandParameterInfo = - new CommandParameterInfo("time", int.class); + new CommandParameterInfo("time", Integer.class); colorControlcolorLoopSetCommandParams.put( "time", colorControlcolorLoopSettimeCommandParameterInfo); CommandParameterInfo colorControlcolorLoopSetstartHueCommandParameterInfo = - new CommandParameterInfo("startHue", int.class); + new CommandParameterInfo("startHue", Integer.class); colorControlcolorLoopSetCommandParams.put( "startHue", colorControlcolorLoopSetstartHueCommandParameterInfo); CommandParameterInfo colorControlcolorLoopSetoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlcolorLoopSetCommandParams.put( "optionsMask", colorControlcolorLoopSetoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlcolorLoopSetoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlcolorLoopSetCommandParams.put( "optionsOverride", colorControlcolorLoopSetoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlcolorLoopSetInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5532,26 +5342,25 @@ public Map> getCommandMap() { Map colorControlenhancedMoveHueCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlenhancedMoveHuemoveModeCommandParameterInfo = - new CommandParameterInfo("moveMode", int.class); + new CommandParameterInfo("moveMode", Integer.class); colorControlenhancedMoveHueCommandParams.put( "moveMode", colorControlenhancedMoveHuemoveModeCommandParameterInfo); CommandParameterInfo colorControlenhancedMoveHuerateCommandParameterInfo = - new CommandParameterInfo("rate", int.class); + new CommandParameterInfo("rate", Integer.class); colorControlenhancedMoveHueCommandParams.put( "rate", colorControlenhancedMoveHuerateCommandParameterInfo); CommandParameterInfo colorControlenhancedMoveHueoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlenhancedMoveHueCommandParams.put( "optionsMask", colorControlenhancedMoveHueoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlenhancedMoveHueoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlenhancedMoveHueCommandParams.put( "optionsOverride", colorControlenhancedMoveHueoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlenhancedMoveHueInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5570,31 +5379,30 @@ public Map> getCommandMap() { Map colorControlenhancedMoveToHueCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlenhancedMoveToHueenhancedHueCommandParameterInfo = - new CommandParameterInfo("enhancedHue", int.class); + new CommandParameterInfo("enhancedHue", Integer.class); colorControlenhancedMoveToHueCommandParams.put( "enhancedHue", colorControlenhancedMoveToHueenhancedHueCommandParameterInfo); CommandParameterInfo colorControlenhancedMoveToHuedirectionCommandParameterInfo = - new CommandParameterInfo("direction", int.class); + new CommandParameterInfo("direction", Integer.class); colorControlenhancedMoveToHueCommandParams.put( "direction", colorControlenhancedMoveToHuedirectionCommandParameterInfo); CommandParameterInfo colorControlenhancedMoveToHuetransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); colorControlenhancedMoveToHueCommandParams.put( "transitionTime", colorControlenhancedMoveToHuetransitionTimeCommandParameterInfo); CommandParameterInfo colorControlenhancedMoveToHueoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlenhancedMoveToHueCommandParams.put( "optionsMask", colorControlenhancedMoveToHueoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlenhancedMoveToHueoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlenhancedMoveToHueCommandParams.put( "optionsOverride", colorControlenhancedMoveToHueoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlenhancedMoveToHueInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5614,35 +5422,34 @@ public Map> getCommandMap() { Map colorControlenhancedMoveToHueAndSaturationCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlenhancedMoveToHueAndSaturationenhancedHueCommandParameterInfo = - new CommandParameterInfo("enhancedHue", int.class); + new CommandParameterInfo("enhancedHue", Integer.class); colorControlenhancedMoveToHueAndSaturationCommandParams.put( "enhancedHue", colorControlenhancedMoveToHueAndSaturationenhancedHueCommandParameterInfo); CommandParameterInfo colorControlenhancedMoveToHueAndSaturationsaturationCommandParameterInfo = - new CommandParameterInfo("saturation", int.class); + new CommandParameterInfo("saturation", Integer.class); colorControlenhancedMoveToHueAndSaturationCommandParams.put( "saturation", colorControlenhancedMoveToHueAndSaturationsaturationCommandParameterInfo); CommandParameterInfo colorControlenhancedMoveToHueAndSaturationtransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); colorControlenhancedMoveToHueAndSaturationCommandParams.put( "transitionTime", colorControlenhancedMoveToHueAndSaturationtransitionTimeCommandParameterInfo); CommandParameterInfo colorControlenhancedMoveToHueAndSaturationoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlenhancedMoveToHueAndSaturationCommandParams.put( "optionsMask", colorControlenhancedMoveToHueAndSaturationoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlenhancedMoveToHueAndSaturationoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlenhancedMoveToHueAndSaturationCommandParams.put( "optionsOverride", colorControlenhancedMoveToHueAndSaturationoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlenhancedMoveToHueAndSaturationInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5663,31 +5470,30 @@ public Map> getCommandMap() { Map colorControlenhancedStepHueCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlenhancedStepHuestepModeCommandParameterInfo = - new CommandParameterInfo("stepMode", int.class); + new CommandParameterInfo("stepMode", Integer.class); colorControlenhancedStepHueCommandParams.put( "stepMode", colorControlenhancedStepHuestepModeCommandParameterInfo); CommandParameterInfo colorControlenhancedStepHuestepSizeCommandParameterInfo = - new CommandParameterInfo("stepSize", int.class); + new CommandParameterInfo("stepSize", Integer.class); colorControlenhancedStepHueCommandParams.put( "stepSize", colorControlenhancedStepHuestepSizeCommandParameterInfo); CommandParameterInfo colorControlenhancedStepHuetransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); colorControlenhancedStepHueCommandParams.put( "transitionTime", colorControlenhancedStepHuetransitionTimeCommandParameterInfo); CommandParameterInfo colorControlenhancedStepHueoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlenhancedStepHueCommandParams.put( "optionsMask", colorControlenhancedStepHueoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlenhancedStepHueoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlenhancedStepHueCommandParams.put( "optionsOverride", colorControlenhancedStepHueoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlenhancedStepHueInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5707,24 +5513,23 @@ public Map> getCommandMap() { Map colorControlmoveColorCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlmoveColorrateXCommandParameterInfo = - new CommandParameterInfo("rateX", int.class); + new CommandParameterInfo("rateX", Integer.class); colorControlmoveColorCommandParams.put("rateX", colorControlmoveColorrateXCommandParameterInfo); CommandParameterInfo colorControlmoveColorrateYCommandParameterInfo = - new CommandParameterInfo("rateY", int.class); + new CommandParameterInfo("rateY", Integer.class); colorControlmoveColorCommandParams.put("rateY", colorControlmoveColorrateYCommandParameterInfo); CommandParameterInfo colorControlmoveColoroptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlmoveColorCommandParams.put( "optionsMask", colorControlmoveColoroptionsMaskCommandParameterInfo); CommandParameterInfo colorControlmoveColoroptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlmoveColorCommandParams.put( "optionsOverride", colorControlmoveColoroptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlmoveColorInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5742,40 +5547,39 @@ public Map> getCommandMap() { Map colorControlmoveColorTemperatureCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlmoveColorTemperaturemoveModeCommandParameterInfo = - new CommandParameterInfo("moveMode", int.class); + new CommandParameterInfo("moveMode", Integer.class); colorControlmoveColorTemperatureCommandParams.put( "moveMode", colorControlmoveColorTemperaturemoveModeCommandParameterInfo); CommandParameterInfo colorControlmoveColorTemperaturerateCommandParameterInfo = - new CommandParameterInfo("rate", int.class); + new CommandParameterInfo("rate", Integer.class); colorControlmoveColorTemperatureCommandParams.put( "rate", colorControlmoveColorTemperaturerateCommandParameterInfo); CommandParameterInfo colorControlmoveColorTemperaturecolorTemperatureMinimumCommandParameterInfo = - new CommandParameterInfo("colorTemperatureMinimum", int.class); + new CommandParameterInfo("colorTemperatureMinimum", Integer.class); colorControlmoveColorTemperatureCommandParams.put( "colorTemperatureMinimum", colorControlmoveColorTemperaturecolorTemperatureMinimumCommandParameterInfo); CommandParameterInfo colorControlmoveColorTemperaturecolorTemperatureMaximumCommandParameterInfo = - new CommandParameterInfo("colorTemperatureMaximum", int.class); + new CommandParameterInfo("colorTemperatureMaximum", Integer.class); colorControlmoveColorTemperatureCommandParams.put( "colorTemperatureMaximum", colorControlmoveColorTemperaturecolorTemperatureMaximumCommandParameterInfo); CommandParameterInfo colorControlmoveColorTemperatureoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlmoveColorTemperatureCommandParams.put( "optionsMask", colorControlmoveColorTemperatureoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlmoveColorTemperatureoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlmoveColorTemperatureCommandParams.put( "optionsOverride", colorControlmoveColorTemperatureoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlmoveColorTemperatureInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5796,25 +5600,24 @@ public Map> getCommandMap() { Map colorControlmoveHueCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlmoveHuemoveModeCommandParameterInfo = - new CommandParameterInfo("moveMode", int.class); + new CommandParameterInfo("moveMode", Integer.class); colorControlmoveHueCommandParams.put( "moveMode", colorControlmoveHuemoveModeCommandParameterInfo); CommandParameterInfo colorControlmoveHuerateCommandParameterInfo = - new CommandParameterInfo("rate", int.class); + new CommandParameterInfo("rate", Integer.class); colorControlmoveHueCommandParams.put("rate", colorControlmoveHuerateCommandParameterInfo); CommandParameterInfo colorControlmoveHueoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlmoveHueCommandParams.put( "optionsMask", colorControlmoveHueoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlmoveHueoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlmoveHueCommandParams.put( "optionsOverride", colorControlmoveHueoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlmoveHueInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5832,26 +5635,25 @@ public Map> getCommandMap() { Map colorControlmoveSaturationCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlmoveSaturationmoveModeCommandParameterInfo = - new CommandParameterInfo("moveMode", int.class); + new CommandParameterInfo("moveMode", Integer.class); colorControlmoveSaturationCommandParams.put( "moveMode", colorControlmoveSaturationmoveModeCommandParameterInfo); CommandParameterInfo colorControlmoveSaturationrateCommandParameterInfo = - new CommandParameterInfo("rate", int.class); + new CommandParameterInfo("rate", Integer.class); colorControlmoveSaturationCommandParams.put( "rate", colorControlmoveSaturationrateCommandParameterInfo); CommandParameterInfo colorControlmoveSaturationoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlmoveSaturationCommandParams.put( "optionsMask", colorControlmoveSaturationoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlmoveSaturationoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlmoveSaturationCommandParams.put( "optionsOverride", colorControlmoveSaturationoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlmoveSaturationInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5870,31 +5672,30 @@ public Map> getCommandMap() { Map colorControlmoveToColorCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlmoveToColorcolorXCommandParameterInfo = - new CommandParameterInfo("colorX", int.class); + new CommandParameterInfo("colorX", Integer.class); colorControlmoveToColorCommandParams.put( "colorX", colorControlmoveToColorcolorXCommandParameterInfo); CommandParameterInfo colorControlmoveToColorcolorYCommandParameterInfo = - new CommandParameterInfo("colorY", int.class); + new CommandParameterInfo("colorY", Integer.class); colorControlmoveToColorCommandParams.put( "colorY", colorControlmoveToColorcolorYCommandParameterInfo); CommandParameterInfo colorControlmoveToColortransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); colorControlmoveToColorCommandParams.put( "transitionTime", colorControlmoveToColortransitionTimeCommandParameterInfo); CommandParameterInfo colorControlmoveToColoroptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlmoveToColorCommandParams.put( "optionsMask", colorControlmoveToColoroptionsMaskCommandParameterInfo); CommandParameterInfo colorControlmoveToColoroptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlmoveToColorCommandParams.put( "optionsOverride", colorControlmoveToColoroptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlmoveToColorInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5914,26 +5715,25 @@ public Map> getCommandMap() { Map colorControlmoveToColorTemperatureCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlmoveToColorTemperaturecolorTemperatureCommandParameterInfo = - new CommandParameterInfo("colorTemperature", int.class); + new CommandParameterInfo("colorTemperature", Integer.class); colorControlmoveToColorTemperatureCommandParams.put( "colorTemperature", colorControlmoveToColorTemperaturecolorTemperatureCommandParameterInfo); CommandParameterInfo colorControlmoveToColorTemperaturetransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); colorControlmoveToColorTemperatureCommandParams.put( "transitionTime", colorControlmoveToColorTemperaturetransitionTimeCommandParameterInfo); CommandParameterInfo colorControlmoveToColorTemperatureoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlmoveToColorTemperatureCommandParams.put( "optionsMask", colorControlmoveToColorTemperatureoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlmoveToColorTemperatureoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlmoveToColorTemperatureCommandParams.put( "optionsOverride", colorControlmoveToColorTemperatureoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlmoveToColorTemperatureInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5952,30 +5752,29 @@ public Map> getCommandMap() { Map colorControlmoveToHueCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlmoveToHuehueCommandParameterInfo = - new CommandParameterInfo("hue", int.class); + new CommandParameterInfo("hue", Integer.class); colorControlmoveToHueCommandParams.put("hue", colorControlmoveToHuehueCommandParameterInfo); CommandParameterInfo colorControlmoveToHuedirectionCommandParameterInfo = - new CommandParameterInfo("direction", int.class); + new CommandParameterInfo("direction", Integer.class); colorControlmoveToHueCommandParams.put( "direction", colorControlmoveToHuedirectionCommandParameterInfo); CommandParameterInfo colorControlmoveToHuetransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); colorControlmoveToHueCommandParams.put( "transitionTime", colorControlmoveToHuetransitionTimeCommandParameterInfo); CommandParameterInfo colorControlmoveToHueoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlmoveToHueCommandParams.put( "optionsMask", colorControlmoveToHueoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlmoveToHueoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlmoveToHueCommandParams.put( "optionsOverride", colorControlmoveToHueoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlmoveToHueInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5994,31 +5793,30 @@ public Map> getCommandMap() { Map colorControlmoveToHueAndSaturationCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlmoveToHueAndSaturationhueCommandParameterInfo = - new CommandParameterInfo("hue", int.class); + new CommandParameterInfo("hue", Integer.class); colorControlmoveToHueAndSaturationCommandParams.put( "hue", colorControlmoveToHueAndSaturationhueCommandParameterInfo); CommandParameterInfo colorControlmoveToHueAndSaturationsaturationCommandParameterInfo = - new CommandParameterInfo("saturation", int.class); + new CommandParameterInfo("saturation", Integer.class); colorControlmoveToHueAndSaturationCommandParams.put( "saturation", colorControlmoveToHueAndSaturationsaturationCommandParameterInfo); CommandParameterInfo colorControlmoveToHueAndSaturationtransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); colorControlmoveToHueAndSaturationCommandParams.put( "transitionTime", colorControlmoveToHueAndSaturationtransitionTimeCommandParameterInfo); CommandParameterInfo colorControlmoveToHueAndSaturationoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlmoveToHueAndSaturationCommandParams.put( "optionsMask", colorControlmoveToHueAndSaturationoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlmoveToHueAndSaturationoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlmoveToHueAndSaturationCommandParams.put( "optionsOverride", colorControlmoveToHueAndSaturationoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlmoveToHueAndSaturationInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6038,26 +5836,25 @@ public Map> getCommandMap() { Map colorControlmoveToSaturationCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlmoveToSaturationsaturationCommandParameterInfo = - new CommandParameterInfo("saturation", int.class); + new CommandParameterInfo("saturation", Integer.class); colorControlmoveToSaturationCommandParams.put( "saturation", colorControlmoveToSaturationsaturationCommandParameterInfo); CommandParameterInfo colorControlmoveToSaturationtransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); colorControlmoveToSaturationCommandParams.put( "transitionTime", colorControlmoveToSaturationtransitionTimeCommandParameterInfo); CommandParameterInfo colorControlmoveToSaturationoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlmoveToSaturationCommandParams.put( "optionsMask", colorControlmoveToSaturationoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlmoveToSaturationoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlmoveToSaturationCommandParams.put( "optionsOverride", colorControlmoveToSaturationoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlmoveToSaturationInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6076,29 +5873,28 @@ public Map> getCommandMap() { Map colorControlstepColorCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlstepColorstepXCommandParameterInfo = - new CommandParameterInfo("stepX", int.class); + new CommandParameterInfo("stepX", Integer.class); colorControlstepColorCommandParams.put("stepX", colorControlstepColorstepXCommandParameterInfo); CommandParameterInfo colorControlstepColorstepYCommandParameterInfo = - new CommandParameterInfo("stepY", int.class); + new CommandParameterInfo("stepY", Integer.class); colorControlstepColorCommandParams.put("stepY", colorControlstepColorstepYCommandParameterInfo); CommandParameterInfo colorControlstepColortransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); colorControlstepColorCommandParams.put( "transitionTime", colorControlstepColortransitionTimeCommandParameterInfo); CommandParameterInfo colorControlstepColoroptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlstepColorCommandParams.put( "optionsMask", colorControlstepColoroptionsMaskCommandParameterInfo); CommandParameterInfo colorControlstepColoroptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlstepColorCommandParams.put( "optionsOverride", colorControlstepColoroptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlstepColorInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6117,45 +5913,44 @@ public Map> getCommandMap() { Map colorControlstepColorTemperatureCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlstepColorTemperaturestepModeCommandParameterInfo = - new CommandParameterInfo("stepMode", int.class); + new CommandParameterInfo("stepMode", Integer.class); colorControlstepColorTemperatureCommandParams.put( "stepMode", colorControlstepColorTemperaturestepModeCommandParameterInfo); CommandParameterInfo colorControlstepColorTemperaturestepSizeCommandParameterInfo = - new CommandParameterInfo("stepSize", int.class); + new CommandParameterInfo("stepSize", Integer.class); colorControlstepColorTemperatureCommandParams.put( "stepSize", colorControlstepColorTemperaturestepSizeCommandParameterInfo); CommandParameterInfo colorControlstepColorTemperaturetransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); colorControlstepColorTemperatureCommandParams.put( "transitionTime", colorControlstepColorTemperaturetransitionTimeCommandParameterInfo); CommandParameterInfo colorControlstepColorTemperaturecolorTemperatureMinimumCommandParameterInfo = - new CommandParameterInfo("colorTemperatureMinimum", int.class); + new CommandParameterInfo("colorTemperatureMinimum", Integer.class); colorControlstepColorTemperatureCommandParams.put( "colorTemperatureMinimum", colorControlstepColorTemperaturecolorTemperatureMinimumCommandParameterInfo); CommandParameterInfo colorControlstepColorTemperaturecolorTemperatureMaximumCommandParameterInfo = - new CommandParameterInfo("colorTemperatureMaximum", int.class); + new CommandParameterInfo("colorTemperatureMaximum", Integer.class); colorControlstepColorTemperatureCommandParams.put( "colorTemperatureMaximum", colorControlstepColorTemperaturecolorTemperatureMaximumCommandParameterInfo); CommandParameterInfo colorControlstepColorTemperatureoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlstepColorTemperatureCommandParams.put( "optionsMask", colorControlstepColorTemperatureoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlstepColorTemperatureoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlstepColorTemperatureCommandParams.put( "optionsOverride", colorControlstepColorTemperatureoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlstepColorTemperatureInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6177,31 +5972,30 @@ public Map> getCommandMap() { Map colorControlstepHueCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlstepHuestepModeCommandParameterInfo = - new CommandParameterInfo("stepMode", int.class); + new CommandParameterInfo("stepMode", Integer.class); colorControlstepHueCommandParams.put( "stepMode", colorControlstepHuestepModeCommandParameterInfo); CommandParameterInfo colorControlstepHuestepSizeCommandParameterInfo = - new CommandParameterInfo("stepSize", int.class); + new CommandParameterInfo("stepSize", Integer.class); colorControlstepHueCommandParams.put( "stepSize", colorControlstepHuestepSizeCommandParameterInfo); CommandParameterInfo colorControlstepHuetransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); colorControlstepHueCommandParams.put( "transitionTime", colorControlstepHuetransitionTimeCommandParameterInfo); CommandParameterInfo colorControlstepHueoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlstepHueCommandParams.put( "optionsMask", colorControlstepHueoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlstepHueoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlstepHueCommandParams.put( "optionsOverride", colorControlstepHueoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlstepHueInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6220,31 +6014,30 @@ public Map> getCommandMap() { Map colorControlstepSaturationCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlstepSaturationstepModeCommandParameterInfo = - new CommandParameterInfo("stepMode", int.class); + new CommandParameterInfo("stepMode", Integer.class); colorControlstepSaturationCommandParams.put( "stepMode", colorControlstepSaturationstepModeCommandParameterInfo); CommandParameterInfo colorControlstepSaturationstepSizeCommandParameterInfo = - new CommandParameterInfo("stepSize", int.class); + new CommandParameterInfo("stepSize", Integer.class); colorControlstepSaturationCommandParams.put( "stepSize", colorControlstepSaturationstepSizeCommandParameterInfo); CommandParameterInfo colorControlstepSaturationtransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); colorControlstepSaturationCommandParams.put( "transitionTime", colorControlstepSaturationtransitionTimeCommandParameterInfo); CommandParameterInfo colorControlstepSaturationoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlstepSaturationCommandParams.put( "optionsMask", colorControlstepSaturationoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlstepSaturationoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlstepSaturationCommandParams.put( "optionsOverride", colorControlstepSaturationoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlstepSaturationInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6264,16 +6057,15 @@ public Map> getCommandMap() { Map colorControlstopMoveStepCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlstopMoveStepoptionsMaskCommandParameterInfo = - new CommandParameterInfo("optionsMask", int.class); + new CommandParameterInfo("optionsMask", Integer.class); colorControlstopMoveStepCommandParams.put( "optionsMask", colorControlstopMoveStepoptionsMaskCommandParameterInfo); CommandParameterInfo colorControlstopMoveStepoptionsOverrideCommandParameterInfo = - new CommandParameterInfo("optionsOverride", int.class); + new CommandParameterInfo("optionsOverride", Integer.class); colorControlstopMoveStepCommandParams.put( "optionsOverride", colorControlstopMoveStepoptionsOverrideCommandParameterInfo); - // Populate commands InteractionInfo colorControlstopMoveStepInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6292,7 +6084,7 @@ public Map> getCommandMap() { Map contentLauncherlaunchContentRequestCommandParams = new LinkedHashMap(); CommandParameterInfo contentLauncherlaunchContentRequestautoPlayCommandParameterInfo = - new CommandParameterInfo("autoPlay", boolean.class); + new CommandParameterInfo("autoPlay", Boolean.class); contentLauncherlaunchContentRequestCommandParams.put( "autoPlay", contentLauncherlaunchContentRequestautoPlayCommandParameterInfo); @@ -6301,7 +6093,6 @@ public Map> getCommandMap() { contentLauncherlaunchContentRequestCommandParams.put( "data", contentLauncherlaunchContentRequestdataCommandParameterInfo); - // Populate commands InteractionInfo contentLauncherlaunchContentRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6309,7 +6100,9 @@ public Map> getCommandMap() { .launchContentRequest( (ChipClusters.ContentLauncherCluster.LaunchResponseCallback) callback, (Boolean) commandArguments.get("autoPlay"), - (String) commandArguments.get("data")); + (String) commandArguments.get("data"), + (ArrayList) + commandArguments.get("search")); }, () -> new DelegatedLaunchResponseCallback(), contentLauncherlaunchContentRequestCommandParams); @@ -6327,12 +6120,6 @@ public Map> getCommandMap() { contentLauncherlaunchURLRequestCommandParams.put( "displayString", contentLauncherlaunchURLRequestdisplayStringCommandParameterInfo); - CommandParameterInfo contentLauncherlaunchURLRequestproviderNameCommandParameterInfo = - new CommandParameterInfo("providerName", String.class); - contentLauncherlaunchURLRequestCommandParams.put( - "providerName", contentLauncherlaunchURLRequestproviderNameCommandParameterInfo); - - // Populate commands InteractionInfo contentLauncherlaunchURLRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6341,7 +6128,8 @@ public Map> getCommandMap() { (ChipClusters.ContentLauncherCluster.LaunchResponseCallback) callback, (String) commandArguments.get("contentURL"), (String) commandArguments.get("displayString"), - (String) commandArguments.get("providerName")); + (ChipStructs.ContentLauncherClusterBrandingInformation) + commandArguments.get("brandingInformation")); }, () -> new DelegatedLaunchResponseCallback(), contentLauncherlaunchURLRequestCommandParams); @@ -6354,12 +6142,12 @@ public Map> getCommandMap() { Map diagnosticLogsretrieveLogsRequestCommandParams = new LinkedHashMap(); CommandParameterInfo diagnosticLogsretrieveLogsRequestintentCommandParameterInfo = - new CommandParameterInfo("intent", int.class); + new CommandParameterInfo("intent", Integer.class); diagnosticLogsretrieveLogsRequestCommandParams.put( "intent", diagnosticLogsretrieveLogsRequestintentCommandParameterInfo); CommandParameterInfo diagnosticLogsretrieveLogsRequestrequestedProtocolCommandParameterInfo = - new CommandParameterInfo("requestedProtocol", int.class); + new CommandParameterInfo("requestedProtocol", Integer.class); diagnosticLogsretrieveLogsRequestCommandParams.put( "requestedProtocol", diagnosticLogsretrieveLogsRequestrequestedProtocolCommandParameterInfo); @@ -6371,7 +6159,6 @@ public Map> getCommandMap() { "transferFileDesignator", diagnosticLogsretrieveLogsRequesttransferFileDesignatorCommandParameterInfo); - // Populate commands InteractionInfo diagnosticLogsretrieveLogsRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6390,25 +6177,13 @@ public Map> getCommandMap() { Map doorLockClusterInteractionInfoMap = new LinkedHashMap<>(); Map doorLockclearCredentialCommandParams = new LinkedHashMap(); - CommandParameterInfo doorLockclearCredentialcredentialTypeCommandParameterInfo = - new CommandParameterInfo("credentialType", int.class); - doorLockclearCredentialCommandParams.put( - "credentialType", doorLockclearCredentialcredentialTypeCommandParameterInfo); - - CommandParameterInfo doorLockclearCredentialcredentialIndexCommandParameterInfo = - new CommandParameterInfo("credentialIndex", int.class); - doorLockclearCredentialCommandParams.put( - "credentialIndex", doorLockclearCredentialcredentialIndexCommandParameterInfo); - - // Populate commands InteractionInfo doorLockclearCredentialInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.DoorLockCluster) cluster) .clearCredential( (DefaultClusterCallback) callback, - (Integer) commandArguments.get("credentialType"), - (Integer) commandArguments.get("credentialIndex")); + (ChipStructs.DoorLockClusterDlCredential) commandArguments.get("credential")); }, () -> new DelegatedDefaultClusterCallback(), doorLockclearCredentialCommandParams); @@ -6417,10 +6192,9 @@ public Map> getCommandMap() { Map doorLockclearUserCommandParams = new LinkedHashMap(); CommandParameterInfo doorLockclearUseruserIndexCommandParameterInfo = - new CommandParameterInfo("userIndex", int.class); + new CommandParameterInfo("userIndex", Integer.class); doorLockclearUserCommandParams.put("userIndex", doorLockclearUseruserIndexCommandParameterInfo); - // Populate commands InteractionInfo doorLockclearUserInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6434,25 +6208,13 @@ public Map> getCommandMap() { doorLockClusterInteractionInfoMap.put("clearUser", doorLockclearUserInteractionInfo); Map doorLockgetCredentialStatusCommandParams = new LinkedHashMap(); - CommandParameterInfo doorLockgetCredentialStatuscredentialTypeCommandParameterInfo = - new CommandParameterInfo("credentialType", int.class); - doorLockgetCredentialStatusCommandParams.put( - "credentialType", doorLockgetCredentialStatuscredentialTypeCommandParameterInfo); - - CommandParameterInfo doorLockgetCredentialStatuscredentialIndexCommandParameterInfo = - new CommandParameterInfo("credentialIndex", int.class); - doorLockgetCredentialStatusCommandParams.put( - "credentialIndex", doorLockgetCredentialStatuscredentialIndexCommandParameterInfo); - - // Populate commands InteractionInfo doorLockgetCredentialStatusInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.DoorLockCluster) cluster) .getCredentialStatus( (ChipClusters.DoorLockCluster.GetCredentialStatusResponseCallback) callback, - (Integer) commandArguments.get("credentialType"), - (Integer) commandArguments.get("credentialIndex")); + (ChipStructs.DoorLockClusterDlCredential) commandArguments.get("credential")); }, () -> new DelegatedGetCredentialStatusResponseCallback(), doorLockgetCredentialStatusCommandParams); @@ -6461,10 +6223,9 @@ public Map> getCommandMap() { Map doorLockgetUserCommandParams = new LinkedHashMap(); CommandParameterInfo doorLockgetUseruserIndexCommandParameterInfo = - new CommandParameterInfo("userIndex", int.class); + new CommandParameterInfo("userIndex", Integer.class); doorLockgetUserCommandParams.put("userIndex", doorLockgetUseruserIndexCommandParameterInfo); - // Populate commands InteractionInfo doorLockgetUserInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6479,10 +6240,9 @@ public Map> getCommandMap() { Map doorLocklockDoorCommandParams = new LinkedHashMap(); CommandParameterInfo doorLocklockDoorpinCodeCommandParameterInfo = - new CommandParameterInfo("pinCode", byte[].class); + new CommandParameterInfo("pinCode", Optional.class); doorLocklockDoorCommandParams.put("pinCode", doorLocklockDoorpinCodeCommandParameterInfo); - // Populate commands InteractionInfo doorLocklockDoorInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6497,36 +6257,25 @@ public Map> getCommandMap() { Map doorLocksetCredentialCommandParams = new LinkedHashMap(); CommandParameterInfo doorLocksetCredentialoperationTypeCommandParameterInfo = - new CommandParameterInfo("operationType", int.class); + new CommandParameterInfo("operationType", Integer.class); doorLocksetCredentialCommandParams.put( "operationType", doorLocksetCredentialoperationTypeCommandParameterInfo); - CommandParameterInfo doorLocksetCredentialcredentialTypeCommandParameterInfo = - new CommandParameterInfo("credentialType", int.class); - doorLocksetCredentialCommandParams.put( - "credentialType", doorLocksetCredentialcredentialTypeCommandParameterInfo); - - CommandParameterInfo doorLocksetCredentialcredentialIndexCommandParameterInfo = - new CommandParameterInfo("credentialIndex", int.class); - doorLocksetCredentialCommandParams.put( - "credentialIndex", doorLocksetCredentialcredentialIndexCommandParameterInfo); - CommandParameterInfo doorLocksetCredentialcredentialDataCommandParameterInfo = new CommandParameterInfo("credentialData", byte[].class); doorLocksetCredentialCommandParams.put( "credentialData", doorLocksetCredentialcredentialDataCommandParameterInfo); CommandParameterInfo doorLocksetCredentialuserIndexCommandParameterInfo = - new CommandParameterInfo("userIndex", int.class); + new CommandParameterInfo("userIndex", Integer.class); doorLocksetCredentialCommandParams.put( "userIndex", doorLocksetCredentialuserIndexCommandParameterInfo); CommandParameterInfo doorLocksetCredentialuserStatusCommandParameterInfo = - new CommandParameterInfo("userStatus", int.class); + new CommandParameterInfo("userStatus", Integer.class); doorLocksetCredentialCommandParams.put( "userStatus", doorLocksetCredentialuserStatusCommandParameterInfo); - // Populate commands InteractionInfo doorLocksetCredentialInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6534,8 +6283,7 @@ public Map> getCommandMap() { .setCredential( (ChipClusters.DoorLockCluster.SetCredentialResponseCallback) callback, (Integer) commandArguments.get("operationType"), - (Integer) commandArguments.get("credentialType"), - (Integer) commandArguments.get("credentialIndex"), + (ChipStructs.DoorLockClusterDlCredential) commandArguments.get("credential"), (byte[]) commandArguments.get("credentialData"), (Integer) commandArguments.get("userIndex"), (Integer) commandArguments.get("userStatus")); @@ -6546,12 +6294,12 @@ public Map> getCommandMap() { Map doorLocksetUserCommandParams = new LinkedHashMap(); CommandParameterInfo doorLocksetUseroperationTypeCommandParameterInfo = - new CommandParameterInfo("operationType", int.class); + new CommandParameterInfo("operationType", Integer.class); doorLocksetUserCommandParams.put( "operationType", doorLocksetUseroperationTypeCommandParameterInfo); CommandParameterInfo doorLocksetUseruserIndexCommandParameterInfo = - new CommandParameterInfo("userIndex", int.class); + new CommandParameterInfo("userIndex", Integer.class); doorLocksetUserCommandParams.put("userIndex", doorLocksetUseruserIndexCommandParameterInfo); CommandParameterInfo doorLocksetUseruserNameCommandParameterInfo = @@ -6559,24 +6307,23 @@ public Map> getCommandMap() { doorLocksetUserCommandParams.put("userName", doorLocksetUseruserNameCommandParameterInfo); CommandParameterInfo doorLocksetUseruserUniqueIdCommandParameterInfo = - new CommandParameterInfo("userUniqueId", long.class); + new CommandParameterInfo("userUniqueId", Long.class); doorLocksetUserCommandParams.put( "userUniqueId", doorLocksetUseruserUniqueIdCommandParameterInfo); CommandParameterInfo doorLocksetUseruserStatusCommandParameterInfo = - new CommandParameterInfo("userStatus", int.class); + new CommandParameterInfo("userStatus", Integer.class); doorLocksetUserCommandParams.put("userStatus", doorLocksetUseruserStatusCommandParameterInfo); CommandParameterInfo doorLocksetUseruserTypeCommandParameterInfo = - new CommandParameterInfo("userType", int.class); + new CommandParameterInfo("userType", Integer.class); doorLocksetUserCommandParams.put("userType", doorLocksetUseruserTypeCommandParameterInfo); CommandParameterInfo doorLocksetUsercredentialRuleCommandParameterInfo = - new CommandParameterInfo("credentialRule", int.class); + new CommandParameterInfo("credentialRule", Integer.class); doorLocksetUserCommandParams.put( "credentialRule", doorLocksetUsercredentialRuleCommandParameterInfo); - // Populate commands InteractionInfo doorLocksetUserInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6597,10 +6344,9 @@ public Map> getCommandMap() { Map doorLockunlockDoorCommandParams = new LinkedHashMap(); CommandParameterInfo doorLockunlockDoorpinCodeCommandParameterInfo = - new CommandParameterInfo("pinCode", byte[].class); + new CommandParameterInfo("pinCode", Optional.class); doorLockunlockDoorCommandParams.put("pinCode", doorLockunlockDoorpinCodeCommandParameterInfo); - // Populate commands InteractionInfo doorLockunlockDoorInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6620,7 +6366,6 @@ public Map> getCommandMap() { new LinkedHashMap<>(); Map ethernetNetworkDiagnosticsresetCountsCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo ethernetNetworkDiagnosticsresetCountsInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6642,22 +6387,21 @@ public Map> getCommandMap() { Map generalCommissioningarmFailSafeCommandParams = new LinkedHashMap(); CommandParameterInfo generalCommissioningarmFailSafeexpiryLengthSecondsCommandParameterInfo = - new CommandParameterInfo("expiryLengthSeconds", int.class); + new CommandParameterInfo("expiryLengthSeconds", Integer.class); generalCommissioningarmFailSafeCommandParams.put( "expiryLengthSeconds", generalCommissioningarmFailSafeexpiryLengthSecondsCommandParameterInfo); CommandParameterInfo generalCommissioningarmFailSafebreadcrumbCommandParameterInfo = - new CommandParameterInfo("breadcrumb", long.class); + new CommandParameterInfo("breadcrumb", Long.class); generalCommissioningarmFailSafeCommandParams.put( "breadcrumb", generalCommissioningarmFailSafebreadcrumbCommandParameterInfo); CommandParameterInfo generalCommissioningarmFailSafetimeoutMsCommandParameterInfo = - new CommandParameterInfo("timeoutMs", long.class); + new CommandParameterInfo("timeoutMs", Long.class); generalCommissioningarmFailSafeCommandParams.put( "timeoutMs", generalCommissioningarmFailSafetimeoutMsCommandParameterInfo); - // Populate commands InteractionInfo generalCommissioningarmFailSafeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6675,7 +6419,6 @@ public Map> getCommandMap() { "armFailSafe", generalCommissioningarmFailSafeInteractionInfo); Map generalCommissioningcommissioningCompleteCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo generalCommissioningcommissioningCompleteInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6692,7 +6435,7 @@ public Map> getCommandMap() { Map generalCommissioningsetRegulatoryConfigCommandParams = new LinkedHashMap(); CommandParameterInfo generalCommissioningsetRegulatoryConfiglocationCommandParameterInfo = - new CommandParameterInfo("location", int.class); + new CommandParameterInfo("location", Integer.class); generalCommissioningsetRegulatoryConfigCommandParams.put( "location", generalCommissioningsetRegulatoryConfiglocationCommandParameterInfo); @@ -6702,16 +6445,15 @@ public Map> getCommandMap() { "countryCode", generalCommissioningsetRegulatoryConfigcountryCodeCommandParameterInfo); CommandParameterInfo generalCommissioningsetRegulatoryConfigbreadcrumbCommandParameterInfo = - new CommandParameterInfo("breadcrumb", long.class); + new CommandParameterInfo("breadcrumb", Long.class); generalCommissioningsetRegulatoryConfigCommandParams.put( "breadcrumb", generalCommissioningsetRegulatoryConfigbreadcrumbCommandParameterInfo); CommandParameterInfo generalCommissioningsetRegulatoryConfigtimeoutMsCommandParameterInfo = - new CommandParameterInfo("timeoutMs", long.class); + new CommandParameterInfo("timeoutMs", Long.class); generalCommissioningsetRegulatoryConfigCommandParams.put( "timeoutMs", generalCommissioningsetRegulatoryConfigtimeoutMsCommandParameterInfo); - // Populate commands InteractionInfo generalCommissioningsetRegulatoryConfigInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6737,11 +6479,10 @@ public Map> getCommandMap() { Map groupKeyManagementkeySetReadCommandParams = new LinkedHashMap(); CommandParameterInfo groupKeyManagementkeySetReadgroupKeySetIDCommandParameterInfo = - new CommandParameterInfo("groupKeySetID", int.class); + new CommandParameterInfo("groupKeySetID", Integer.class); groupKeyManagementkeySetReadCommandParams.put( "groupKeySetID", groupKeyManagementkeySetReadgroupKeySetIDCommandParameterInfo); - // Populate commands InteractionInfo groupKeyManagementkeySetReadInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6757,11 +6498,10 @@ public Map> getCommandMap() { Map groupKeyManagementkeySetReadAllIndicesCommandParams = new LinkedHashMap(); CommandParameterInfo groupKeyManagementkeySetReadAllIndicesgroupKeySetIDsCommandParameterInfo = - new CommandParameterInfo("groupKeySetIDs", int.class); + new CommandParameterInfo("groupKeySetIDs", ArrayList.class); groupKeyManagementkeySetReadAllIndicesCommandParams.put( "groupKeySetIDs", groupKeyManagementkeySetReadAllIndicesgroupKeySetIDsCommandParameterInfo); - // Populate commands InteractionInfo groupKeyManagementkeySetReadAllIndicesInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6769,7 +6509,7 @@ public Map> getCommandMap() { .keySetReadAllIndices( (ChipClusters.GroupKeyManagementCluster.KeySetReadAllIndicesResponseCallback) callback, - (Integer) commandArguments.get("groupKeySetIDs")); + (ArrayList) commandArguments.get("groupKeySetIDs")); }, () -> new DelegatedKeySetReadAllIndicesResponseCallback(), groupKeyManagementkeySetReadAllIndicesCommandParams); @@ -6778,11 +6518,10 @@ public Map> getCommandMap() { Map groupKeyManagementkeySetRemoveCommandParams = new LinkedHashMap(); CommandParameterInfo groupKeyManagementkeySetRemovegroupKeySetIDCommandParameterInfo = - new CommandParameterInfo("groupKeySetID", int.class); + new CommandParameterInfo("groupKeySetID", Integer.class); groupKeyManagementkeySetRemoveCommandParams.put( "groupKeySetID", groupKeyManagementkeySetRemovegroupKeySetIDCommandParameterInfo); - // Populate commands InteractionInfo groupKeyManagementkeySetRemoveInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6797,61 +6536,14 @@ public Map> getCommandMap() { "keySetRemove", groupKeyManagementkeySetRemoveInteractionInfo); Map groupKeyManagementkeySetWriteCommandParams = new LinkedHashMap(); - CommandParameterInfo groupKeyManagementkeySetWritegroupKeySetIDCommandParameterInfo = - new CommandParameterInfo("groupKeySetID", int.class); - groupKeyManagementkeySetWriteCommandParams.put( - "groupKeySetID", groupKeyManagementkeySetWritegroupKeySetIDCommandParameterInfo); - - CommandParameterInfo groupKeyManagementkeySetWritesecurityPolicyCommandParameterInfo = - new CommandParameterInfo("securityPolicy", int.class); - groupKeyManagementkeySetWriteCommandParams.put( - "securityPolicy", groupKeyManagementkeySetWritesecurityPolicyCommandParameterInfo); - - CommandParameterInfo groupKeyManagementkeySetWriteepochKey0CommandParameterInfo = - new CommandParameterInfo("epochKey0", byte[].class); - groupKeyManagementkeySetWriteCommandParams.put( - "epochKey0", groupKeyManagementkeySetWriteepochKey0CommandParameterInfo); - - CommandParameterInfo groupKeyManagementkeySetWriteepochStartTime0CommandParameterInfo = - new CommandParameterInfo("epochStartTime0", long.class); - groupKeyManagementkeySetWriteCommandParams.put( - "epochStartTime0", groupKeyManagementkeySetWriteepochStartTime0CommandParameterInfo); - - CommandParameterInfo groupKeyManagementkeySetWriteepochKey1CommandParameterInfo = - new CommandParameterInfo("epochKey1", byte[].class); - groupKeyManagementkeySetWriteCommandParams.put( - "epochKey1", groupKeyManagementkeySetWriteepochKey1CommandParameterInfo); - - CommandParameterInfo groupKeyManagementkeySetWriteepochStartTime1CommandParameterInfo = - new CommandParameterInfo("epochStartTime1", long.class); - groupKeyManagementkeySetWriteCommandParams.put( - "epochStartTime1", groupKeyManagementkeySetWriteepochStartTime1CommandParameterInfo); - - CommandParameterInfo groupKeyManagementkeySetWriteepochKey2CommandParameterInfo = - new CommandParameterInfo("epochKey2", byte[].class); - groupKeyManagementkeySetWriteCommandParams.put( - "epochKey2", groupKeyManagementkeySetWriteepochKey2CommandParameterInfo); - - CommandParameterInfo groupKeyManagementkeySetWriteepochStartTime2CommandParameterInfo = - new CommandParameterInfo("epochStartTime2", long.class); - groupKeyManagementkeySetWriteCommandParams.put( - "epochStartTime2", groupKeyManagementkeySetWriteepochStartTime2CommandParameterInfo); - - // Populate commands InteractionInfo groupKeyManagementkeySetWriteInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.GroupKeyManagementCluster) cluster) .keySetWrite( (DefaultClusterCallback) callback, - (Integer) commandArguments.get("groupKeySetID"), - (Integer) commandArguments.get("securityPolicy"), - (byte[]) commandArguments.get("epochKey0"), - (Long) commandArguments.get("epochStartTime0"), - (byte[]) commandArguments.get("epochKey1"), - (Long) commandArguments.get("epochStartTime1"), - (byte[]) commandArguments.get("epochKey2"), - (Long) commandArguments.get("epochStartTime2")); + (ChipStructs.GroupKeyManagementClusterGroupKeySet) + commandArguments.get("groupKeySet")); }, () -> new DelegatedDefaultClusterCallback(), groupKeyManagementkeySetWriteCommandParams); @@ -6862,14 +6554,13 @@ public Map> getCommandMap() { Map groupsaddGroupCommandParams = new LinkedHashMap(); CommandParameterInfo groupsaddGroupgroupIdCommandParameterInfo = - new CommandParameterInfo("groupId", int.class); + new CommandParameterInfo("groupId", Integer.class); groupsaddGroupCommandParams.put("groupId", groupsaddGroupgroupIdCommandParameterInfo); CommandParameterInfo groupsaddGroupgroupNameCommandParameterInfo = new CommandParameterInfo("groupName", String.class); groupsaddGroupCommandParams.put("groupName", groupsaddGroupgroupNameCommandParameterInfo); - // Populate commands InteractionInfo groupsaddGroupInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6885,7 +6576,7 @@ public Map> getCommandMap() { Map groupsaddGroupIfIdentifyingCommandParams = new LinkedHashMap(); CommandParameterInfo groupsaddGroupIfIdentifyinggroupIdCommandParameterInfo = - new CommandParameterInfo("groupId", int.class); + new CommandParameterInfo("groupId", Integer.class); groupsaddGroupIfIdentifyingCommandParams.put( "groupId", groupsaddGroupIfIdentifyinggroupIdCommandParameterInfo); @@ -6894,7 +6585,6 @@ public Map> getCommandMap() { groupsaddGroupIfIdentifyingCommandParams.put( "groupName", groupsaddGroupIfIdentifyinggroupNameCommandParameterInfo); - // Populate commands InteractionInfo groupsaddGroupIfIdentifyingInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6911,18 +6601,17 @@ public Map> getCommandMap() { Map groupsgetGroupMembershipCommandParams = new LinkedHashMap(); CommandParameterInfo groupsgetGroupMembershipgroupListCommandParameterInfo = - new CommandParameterInfo("groupList", int.class); + new CommandParameterInfo("groupList", ArrayList.class); groupsgetGroupMembershipCommandParams.put( "groupList", groupsgetGroupMembershipgroupListCommandParameterInfo); - // Populate commands InteractionInfo groupsgetGroupMembershipInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.GroupsCluster) cluster) .getGroupMembership( (ChipClusters.GroupsCluster.GetGroupMembershipResponseCallback) callback, - (Integer) commandArguments.get("groupList")); + (ArrayList) commandArguments.get("groupList")); }, () -> new DelegatedGetGroupMembershipResponseCallback(), groupsgetGroupMembershipCommandParams); @@ -6930,7 +6619,6 @@ public Map> getCommandMap() { "getGroupMembership", groupsgetGroupMembershipInteractionInfo); Map groupsremoveAllGroupsCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo groupsremoveAllGroupsInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6943,10 +6631,9 @@ public Map> getCommandMap() { Map groupsremoveGroupCommandParams = new LinkedHashMap(); CommandParameterInfo groupsremoveGroupgroupIdCommandParameterInfo = - new CommandParameterInfo("groupId", int.class); + new CommandParameterInfo("groupId", Integer.class); groupsremoveGroupCommandParams.put("groupId", groupsremoveGroupgroupIdCommandParameterInfo); - // Populate commands InteractionInfo groupsremoveGroupInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6961,10 +6648,9 @@ public Map> getCommandMap() { Map groupsviewGroupCommandParams = new LinkedHashMap(); CommandParameterInfo groupsviewGroupgroupIdCommandParameterInfo = - new CommandParameterInfo("groupId", int.class); + new CommandParameterInfo("groupId", Integer.class); groupsviewGroupCommandParams.put("groupId", groupsviewGroupgroupIdCommandParameterInfo); - // Populate commands InteractionInfo groupsviewGroupInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6981,11 +6667,10 @@ public Map> getCommandMap() { Map identifyidentifyCommandParams = new LinkedHashMap(); CommandParameterInfo identifyidentifyidentifyTimeCommandParameterInfo = - new CommandParameterInfo("identifyTime", int.class); + new CommandParameterInfo("identifyTime", Integer.class); identifyidentifyCommandParams.put( "identifyTime", identifyidentifyidentifyTimeCommandParameterInfo); - // Populate commands InteractionInfo identifyidentifyInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -6999,7 +6684,6 @@ public Map> getCommandMap() { identifyClusterInteractionInfoMap.put("identify", identifyidentifyInteractionInfo); Map identifyidentifyQueryCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo identifyidentifyQueryInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7013,16 +6697,15 @@ public Map> getCommandMap() { Map identifytriggerEffectCommandParams = new LinkedHashMap(); CommandParameterInfo identifytriggerEffecteffectIdentifierCommandParameterInfo = - new CommandParameterInfo("effectIdentifier", int.class); + new CommandParameterInfo("effectIdentifier", Integer.class); identifytriggerEffectCommandParams.put( "effectIdentifier", identifytriggerEffecteffectIdentifierCommandParameterInfo); CommandParameterInfo identifytriggerEffecteffectVariantCommandParameterInfo = - new CommandParameterInfo("effectVariant", int.class); + new CommandParameterInfo("effectVariant", Integer.class); identifytriggerEffectCommandParams.put( "effectVariant", identifytriggerEffecteffectVariantCommandParameterInfo); - // Populate commands InteractionInfo identifytriggerEffectInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7043,11 +6726,10 @@ public Map> getCommandMap() { Map keypadInputsendKeyRequestCommandParams = new LinkedHashMap(); CommandParameterInfo keypadInputsendKeyRequestkeyCodeCommandParameterInfo = - new CommandParameterInfo("keyCode", int.class); + new CommandParameterInfo("keyCode", Integer.class); keypadInputsendKeyRequestCommandParams.put( "keyCode", keypadInputsendKeyRequestkeyCodeCommandParameterInfo); - // Populate commands InteractionInfo keypadInputsendKeyRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7065,23 +6747,22 @@ public Map> getCommandMap() { Map levelControlmoveCommandParams = new LinkedHashMap(); CommandParameterInfo levelControlmovemoveModeCommandParameterInfo = - new CommandParameterInfo("moveMode", int.class); + new CommandParameterInfo("moveMode", Integer.class); levelControlmoveCommandParams.put("moveMode", levelControlmovemoveModeCommandParameterInfo); CommandParameterInfo levelControlmoverateCommandParameterInfo = - new CommandParameterInfo("rate", int.class); + new CommandParameterInfo("rate", Integer.class); levelControlmoveCommandParams.put("rate", levelControlmoverateCommandParameterInfo); CommandParameterInfo levelControlmoveoptionMaskCommandParameterInfo = - new CommandParameterInfo("optionMask", int.class); + new CommandParameterInfo("optionMask", Integer.class); levelControlmoveCommandParams.put("optionMask", levelControlmoveoptionMaskCommandParameterInfo); CommandParameterInfo levelControlmoveoptionOverrideCommandParameterInfo = - new CommandParameterInfo("optionOverride", int.class); + new CommandParameterInfo("optionOverride", Integer.class); levelControlmoveCommandParams.put( "optionOverride", levelControlmoveoptionOverrideCommandParameterInfo); - // Populate commands InteractionInfo levelControlmoveInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7099,26 +6780,25 @@ public Map> getCommandMap() { Map levelControlmoveToLevelCommandParams = new LinkedHashMap(); CommandParameterInfo levelControlmoveToLevellevelCommandParameterInfo = - new CommandParameterInfo("level", int.class); + new CommandParameterInfo("level", Integer.class); levelControlmoveToLevelCommandParams.put( "level", levelControlmoveToLevellevelCommandParameterInfo); CommandParameterInfo levelControlmoveToLeveltransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); levelControlmoveToLevelCommandParams.put( "transitionTime", levelControlmoveToLeveltransitionTimeCommandParameterInfo); CommandParameterInfo levelControlmoveToLeveloptionMaskCommandParameterInfo = - new CommandParameterInfo("optionMask", int.class); + new CommandParameterInfo("optionMask", Integer.class); levelControlmoveToLevelCommandParams.put( "optionMask", levelControlmoveToLeveloptionMaskCommandParameterInfo); CommandParameterInfo levelControlmoveToLeveloptionOverrideCommandParameterInfo = - new CommandParameterInfo("optionOverride", int.class); + new CommandParameterInfo("optionOverride", Integer.class); levelControlmoveToLevelCommandParams.put( "optionOverride", levelControlmoveToLeveloptionOverrideCommandParameterInfo); - // Populate commands InteractionInfo levelControlmoveToLevelInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7137,16 +6817,15 @@ public Map> getCommandMap() { Map levelControlmoveToLevelWithOnOffCommandParams = new LinkedHashMap(); CommandParameterInfo levelControlmoveToLevelWithOnOfflevelCommandParameterInfo = - new CommandParameterInfo("level", int.class); + new CommandParameterInfo("level", Integer.class); levelControlmoveToLevelWithOnOffCommandParams.put( "level", levelControlmoveToLevelWithOnOfflevelCommandParameterInfo); CommandParameterInfo levelControlmoveToLevelWithOnOfftransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); levelControlmoveToLevelWithOnOffCommandParams.put( "transitionTime", levelControlmoveToLevelWithOnOfftransitionTimeCommandParameterInfo); - // Populate commands InteractionInfo levelControlmoveToLevelWithOnOffInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7163,16 +6842,15 @@ public Map> getCommandMap() { Map levelControlmoveWithOnOffCommandParams = new LinkedHashMap(); CommandParameterInfo levelControlmoveWithOnOffmoveModeCommandParameterInfo = - new CommandParameterInfo("moveMode", int.class); + new CommandParameterInfo("moveMode", Integer.class); levelControlmoveWithOnOffCommandParams.put( "moveMode", levelControlmoveWithOnOffmoveModeCommandParameterInfo); CommandParameterInfo levelControlmoveWithOnOffrateCommandParameterInfo = - new CommandParameterInfo("rate", int.class); + new CommandParameterInfo("rate", Integer.class); levelControlmoveWithOnOffCommandParams.put( "rate", levelControlmoveWithOnOffrateCommandParameterInfo); - // Populate commands InteractionInfo levelControlmoveWithOnOffInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7189,28 +6867,27 @@ public Map> getCommandMap() { Map levelControlstepCommandParams = new LinkedHashMap(); CommandParameterInfo levelControlstepstepModeCommandParameterInfo = - new CommandParameterInfo("stepMode", int.class); + new CommandParameterInfo("stepMode", Integer.class); levelControlstepCommandParams.put("stepMode", levelControlstepstepModeCommandParameterInfo); CommandParameterInfo levelControlstepstepSizeCommandParameterInfo = - new CommandParameterInfo("stepSize", int.class); + new CommandParameterInfo("stepSize", Integer.class); levelControlstepCommandParams.put("stepSize", levelControlstepstepSizeCommandParameterInfo); CommandParameterInfo levelControlsteptransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); levelControlstepCommandParams.put( "transitionTime", levelControlsteptransitionTimeCommandParameterInfo); CommandParameterInfo levelControlstepoptionMaskCommandParameterInfo = - new CommandParameterInfo("optionMask", int.class); + new CommandParameterInfo("optionMask", Integer.class); levelControlstepCommandParams.put("optionMask", levelControlstepoptionMaskCommandParameterInfo); CommandParameterInfo levelControlstepoptionOverrideCommandParameterInfo = - new CommandParameterInfo("optionOverride", int.class); + new CommandParameterInfo("optionOverride", Integer.class); levelControlstepCommandParams.put( "optionOverride", levelControlstepoptionOverrideCommandParameterInfo); - // Populate commands InteractionInfo levelControlstepInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7229,21 +6906,20 @@ public Map> getCommandMap() { Map levelControlstepWithOnOffCommandParams = new LinkedHashMap(); CommandParameterInfo levelControlstepWithOnOffstepModeCommandParameterInfo = - new CommandParameterInfo("stepMode", int.class); + new CommandParameterInfo("stepMode", Integer.class); levelControlstepWithOnOffCommandParams.put( "stepMode", levelControlstepWithOnOffstepModeCommandParameterInfo); CommandParameterInfo levelControlstepWithOnOffstepSizeCommandParameterInfo = - new CommandParameterInfo("stepSize", int.class); + new CommandParameterInfo("stepSize", Integer.class); levelControlstepWithOnOffCommandParams.put( "stepSize", levelControlstepWithOnOffstepSizeCommandParameterInfo); CommandParameterInfo levelControlstepWithOnOfftransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); levelControlstepWithOnOffCommandParams.put( "transitionTime", levelControlstepWithOnOfftransitionTimeCommandParameterInfo); - // Populate commands InteractionInfo levelControlstepWithOnOffInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7261,15 +6937,14 @@ public Map> getCommandMap() { Map levelControlstopCommandParams = new LinkedHashMap(); CommandParameterInfo levelControlstopoptionMaskCommandParameterInfo = - new CommandParameterInfo("optionMask", int.class); + new CommandParameterInfo("optionMask", Integer.class); levelControlstopCommandParams.put("optionMask", levelControlstopoptionMaskCommandParameterInfo); CommandParameterInfo levelControlstopoptionOverrideCommandParameterInfo = - new CommandParameterInfo("optionOverride", int.class); + new CommandParameterInfo("optionOverride", Integer.class); levelControlstopCommandParams.put( "optionOverride", levelControlstopoptionOverrideCommandParameterInfo); - // Populate commands InteractionInfo levelControlstopInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7284,7 +6959,6 @@ public Map> getCommandMap() { levelControlClusterInteractionInfoMap.put("stop", levelControlstopInteractionInfo); Map levelControlstopWithOnOffCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo levelControlstopWithOnOffInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7302,7 +6976,6 @@ public Map> getCommandMap() { Map lowPowerClusterInteractionInfoMap = new LinkedHashMap<>(); Map lowPowersleepCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo lowPowersleepInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7315,7 +6988,6 @@ public Map> getCommandMap() { Map mediaInputClusterInteractionInfoMap = new LinkedHashMap<>(); Map mediaInputhideInputStatusRequestCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo mediaInputhideInputStatusRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7329,7 +7001,7 @@ public Map> getCommandMap() { Map mediaInputrenameInputRequestCommandParams = new LinkedHashMap(); CommandParameterInfo mediaInputrenameInputRequestindexCommandParameterInfo = - new CommandParameterInfo("index", int.class); + new CommandParameterInfo("index", Integer.class); mediaInputrenameInputRequestCommandParams.put( "index", mediaInputrenameInputRequestindexCommandParameterInfo); @@ -7338,7 +7010,6 @@ public Map> getCommandMap() { mediaInputrenameInputRequestCommandParams.put( "name", mediaInputrenameInputRequestnameCommandParameterInfo); - // Populate commands InteractionInfo mediaInputrenameInputRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7355,11 +7026,10 @@ public Map> getCommandMap() { Map mediaInputselectInputRequestCommandParams = new LinkedHashMap(); CommandParameterInfo mediaInputselectInputRequestindexCommandParameterInfo = - new CommandParameterInfo("index", int.class); + new CommandParameterInfo("index", Integer.class); mediaInputselectInputRequestCommandParams.put( "index", mediaInputselectInputRequestindexCommandParameterInfo); - // Populate commands InteractionInfo mediaInputselectInputRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7373,7 +7043,6 @@ public Map> getCommandMap() { "selectInputRequest", mediaInputselectInputRequestInteractionInfo); Map mediaInputshowInputStatusRequestCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo mediaInputshowInputStatusRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7388,7 +7057,6 @@ public Map> getCommandMap() { Map mediaPlaybackClusterInteractionInfoMap = new LinkedHashMap<>(); Map mediaPlaybackfastForwardRequestCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo mediaPlaybackfastForwardRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7402,7 +7070,6 @@ public Map> getCommandMap() { "fastForwardRequest", mediaPlaybackfastForwardRequestInteractionInfo); Map mediaPlaybacknextRequestCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo mediaPlaybacknextRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7416,7 +7083,6 @@ public Map> getCommandMap() { "nextRequest", mediaPlaybacknextRequestInteractionInfo); Map mediaPlaybackpauseRequestCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo mediaPlaybackpauseRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7430,7 +7096,6 @@ public Map> getCommandMap() { "pauseRequest", mediaPlaybackpauseRequestInteractionInfo); Map mediaPlaybackplayRequestCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo mediaPlaybackplayRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7444,7 +7109,6 @@ public Map> getCommandMap() { "playRequest", mediaPlaybackplayRequestInteractionInfo); Map mediaPlaybackpreviousRequestCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo mediaPlaybackpreviousRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7458,7 +7122,6 @@ public Map> getCommandMap() { "previousRequest", mediaPlaybackpreviousRequestInteractionInfo); Map mediaPlaybackrewindRequestCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo mediaPlaybackrewindRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7473,11 +7136,10 @@ public Map> getCommandMap() { Map mediaPlaybackseekRequestCommandParams = new LinkedHashMap(); CommandParameterInfo mediaPlaybackseekRequestpositionCommandParameterInfo = - new CommandParameterInfo("position", long.class); + new CommandParameterInfo("position", Long.class); mediaPlaybackseekRequestCommandParams.put( "position", mediaPlaybackseekRequestpositionCommandParameterInfo); - // Populate commands InteractionInfo mediaPlaybackseekRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7494,12 +7156,11 @@ public Map> getCommandMap() { new LinkedHashMap(); CommandParameterInfo mediaPlaybackskipBackwardRequestdeltaPositionMillisecondsCommandParameterInfo = - new CommandParameterInfo("deltaPositionMilliseconds", long.class); + new CommandParameterInfo("deltaPositionMilliseconds", Long.class); mediaPlaybackskipBackwardRequestCommandParams.put( "deltaPositionMilliseconds", mediaPlaybackskipBackwardRequestdeltaPositionMillisecondsCommandParameterInfo); - // Populate commands InteractionInfo mediaPlaybackskipBackwardRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7516,12 +7177,11 @@ public Map> getCommandMap() { new LinkedHashMap(); CommandParameterInfo mediaPlaybackskipForwardRequestdeltaPositionMillisecondsCommandParameterInfo = - new CommandParameterInfo("deltaPositionMilliseconds", long.class); + new CommandParameterInfo("deltaPositionMilliseconds", Long.class); mediaPlaybackskipForwardRequestCommandParams.put( "deltaPositionMilliseconds", mediaPlaybackskipForwardRequestdeltaPositionMillisecondsCommandParameterInfo); - // Populate commands InteractionInfo mediaPlaybackskipForwardRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7536,7 +7196,6 @@ public Map> getCommandMap() { "skipForwardRequest", mediaPlaybackskipForwardRequestInteractionInfo); Map mediaPlaybackstartOverRequestCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo mediaPlaybackstartOverRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7550,7 +7209,6 @@ public Map> getCommandMap() { "startOverRequest", mediaPlaybackstartOverRequestInteractionInfo); Map mediaPlaybackstopRequestCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo mediaPlaybackstopRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7567,11 +7225,10 @@ public Map> getCommandMap() { Map modeSelectchangeToModeCommandParams = new LinkedHashMap(); CommandParameterInfo modeSelectchangeToModenewModeCommandParameterInfo = - new CommandParameterInfo("newMode", int.class); + new CommandParameterInfo("newMode", Integer.class); modeSelectchangeToModeCommandParams.put( "newMode", modeSelectchangeToModenewModeCommandParameterInfo); - // Populate commands InteractionInfo modeSelectchangeToModeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7596,11 +7253,10 @@ public Map> getCommandMap() { CommandParameterInfo networkCommissioningaddOrUpdateThreadNetworkbreadcrumbCommandParameterInfo = - new CommandParameterInfo("breadcrumb", long.class); + new CommandParameterInfo("breadcrumb", Long.class); networkCommissioningaddOrUpdateThreadNetworkCommandParams.put( "breadcrumb", networkCommissioningaddOrUpdateThreadNetworkbreadcrumbCommandParameterInfo); - // Populate commands InteractionInfo networkCommissioningaddOrUpdateThreadNetworkInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7628,11 +7284,10 @@ public Map> getCommandMap() { "credentials", networkCommissioningaddOrUpdateWiFiNetworkcredentialsCommandParameterInfo); CommandParameterInfo networkCommissioningaddOrUpdateWiFiNetworkbreadcrumbCommandParameterInfo = - new CommandParameterInfo("breadcrumb", long.class); + new CommandParameterInfo("breadcrumb", Long.class); networkCommissioningaddOrUpdateWiFiNetworkCommandParams.put( "breadcrumb", networkCommissioningaddOrUpdateWiFiNetworkbreadcrumbCommandParameterInfo); - // Populate commands InteractionInfo networkCommissioningaddOrUpdateWiFiNetworkInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7656,11 +7311,10 @@ public Map> getCommandMap() { "networkID", networkCommissioningconnectNetworknetworkIDCommandParameterInfo); CommandParameterInfo networkCommissioningconnectNetworkbreadcrumbCommandParameterInfo = - new CommandParameterInfo("breadcrumb", long.class); + new CommandParameterInfo("breadcrumb", Long.class); networkCommissioningconnectNetworkCommandParams.put( "breadcrumb", networkCommissioningconnectNetworkbreadcrumbCommandParameterInfo); - // Populate commands InteractionInfo networkCommissioningconnectNetworkInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7683,11 +7337,10 @@ public Map> getCommandMap() { "networkID", networkCommissioningremoveNetworknetworkIDCommandParameterInfo); CommandParameterInfo networkCommissioningremoveNetworkbreadcrumbCommandParameterInfo = - new CommandParameterInfo("breadcrumb", long.class); + new CommandParameterInfo("breadcrumb", Long.class); networkCommissioningremoveNetworkCommandParams.put( "breadcrumb", networkCommissioningremoveNetworkbreadcrumbCommandParameterInfo); - // Populate commands InteractionInfo networkCommissioningremoveNetworkInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7710,16 +7363,15 @@ public Map> getCommandMap() { "networkID", networkCommissioningreorderNetworknetworkIDCommandParameterInfo); CommandParameterInfo networkCommissioningreorderNetworknetworkIndexCommandParameterInfo = - new CommandParameterInfo("networkIndex", int.class); + new CommandParameterInfo("networkIndex", Integer.class); networkCommissioningreorderNetworkCommandParams.put( "networkIndex", networkCommissioningreorderNetworknetworkIndexCommandParameterInfo); CommandParameterInfo networkCommissioningreorderNetworkbreadcrumbCommandParameterInfo = - new CommandParameterInfo("breadcrumb", long.class); + new CommandParameterInfo("breadcrumb", Long.class); networkCommissioningreorderNetworkCommandParams.put( "breadcrumb", networkCommissioningreorderNetworkbreadcrumbCommandParameterInfo); - // Populate commands InteractionInfo networkCommissioningreorderNetworkInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7743,11 +7395,10 @@ public Map> getCommandMap() { "ssid", networkCommissioningscanNetworksssidCommandParameterInfo); CommandParameterInfo networkCommissioningscanNetworksbreadcrumbCommandParameterInfo = - new CommandParameterInfo("breadcrumb", long.class); + new CommandParameterInfo("breadcrumb", Long.class); networkCommissioningscanNetworksCommandParams.put( "breadcrumb", networkCommissioningscanNetworksbreadcrumbCommandParameterInfo); - // Populate commands InteractionInfo networkCommissioningscanNetworksInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7774,11 +7425,10 @@ public Map> getCommandMap() { "updateToken", otaSoftwareUpdateProviderapplyUpdateRequestupdateTokenCommandParameterInfo); CommandParameterInfo otaSoftwareUpdateProviderapplyUpdateRequestnewVersionCommandParameterInfo = - new CommandParameterInfo("newVersion", long.class); + new CommandParameterInfo("newVersion", Long.class); otaSoftwareUpdateProviderapplyUpdateRequestCommandParams.put( "newVersion", otaSoftwareUpdateProviderapplyUpdateRequestnewVersionCommandParameterInfo); - // Populate commands InteractionInfo otaSoftwareUpdateProviderapplyUpdateRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7803,12 +7453,11 @@ public Map> getCommandMap() { CommandParameterInfo otaSoftwareUpdateProvidernotifyUpdateAppliedsoftwareVersionCommandParameterInfo = - new CommandParameterInfo("softwareVersion", long.class); + new CommandParameterInfo("softwareVersion", Long.class); otaSoftwareUpdateProvidernotifyUpdateAppliedCommandParams.put( "softwareVersion", otaSoftwareUpdateProvidernotifyUpdateAppliedsoftwareVersionCommandParameterInfo); - // Populate commands InteractionInfo otaSoftwareUpdateProvidernotifyUpdateAppliedInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7825,51 +7474,50 @@ public Map> getCommandMap() { Map otaSoftwareUpdateProviderqueryImageCommandParams = new LinkedHashMap(); CommandParameterInfo otaSoftwareUpdateProviderqueryImagevendorIdCommandParameterInfo = - new CommandParameterInfo("vendorId", int.class); + new CommandParameterInfo("vendorId", Integer.class); otaSoftwareUpdateProviderqueryImageCommandParams.put( "vendorId", otaSoftwareUpdateProviderqueryImagevendorIdCommandParameterInfo); CommandParameterInfo otaSoftwareUpdateProviderqueryImageproductIdCommandParameterInfo = - new CommandParameterInfo("productId", int.class); + new CommandParameterInfo("productId", Integer.class); otaSoftwareUpdateProviderqueryImageCommandParams.put( "productId", otaSoftwareUpdateProviderqueryImageproductIdCommandParameterInfo); CommandParameterInfo otaSoftwareUpdateProviderqueryImagesoftwareVersionCommandParameterInfo = - new CommandParameterInfo("softwareVersion", long.class); + new CommandParameterInfo("softwareVersion", Long.class); otaSoftwareUpdateProviderqueryImageCommandParams.put( "softwareVersion", otaSoftwareUpdateProviderqueryImagesoftwareVersionCommandParameterInfo); CommandParameterInfo otaSoftwareUpdateProviderqueryImageprotocolsSupportedCommandParameterInfo = - new CommandParameterInfo("protocolsSupported", int.class); + new CommandParameterInfo("protocolsSupported", ArrayList.class); otaSoftwareUpdateProviderqueryImageCommandParams.put( "protocolsSupported", otaSoftwareUpdateProviderqueryImageprotocolsSupportedCommandParameterInfo); CommandParameterInfo otaSoftwareUpdateProviderqueryImagehardwareVersionCommandParameterInfo = - new CommandParameterInfo("hardwareVersion", int.class); + new CommandParameterInfo("hardwareVersion", Optional.class); otaSoftwareUpdateProviderqueryImageCommandParams.put( "hardwareVersion", otaSoftwareUpdateProviderqueryImagehardwareVersionCommandParameterInfo); CommandParameterInfo otaSoftwareUpdateProviderqueryImagelocationCommandParameterInfo = - new CommandParameterInfo("location", String.class); + new CommandParameterInfo("location", Optional.class); otaSoftwareUpdateProviderqueryImageCommandParams.put( "location", otaSoftwareUpdateProviderqueryImagelocationCommandParameterInfo); CommandParameterInfo otaSoftwareUpdateProviderqueryImagerequestorCanConsentCommandParameterInfo = - new CommandParameterInfo("requestorCanConsent", boolean.class); + new CommandParameterInfo("requestorCanConsent", Optional.class); otaSoftwareUpdateProviderqueryImageCommandParams.put( "requestorCanConsent", otaSoftwareUpdateProviderqueryImagerequestorCanConsentCommandParameterInfo); CommandParameterInfo otaSoftwareUpdateProviderqueryImagemetadataForProviderCommandParameterInfo = - new CommandParameterInfo("metadataForProvider", byte[].class); + new CommandParameterInfo("metadataForProvider", Optional.class); otaSoftwareUpdateProviderqueryImageCommandParams.put( "metadataForProvider", otaSoftwareUpdateProviderqueryImagemetadataForProviderCommandParameterInfo); - // Populate commands InteractionInfo otaSoftwareUpdateProviderqueryImageInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7880,7 +7528,7 @@ public Map> getCommandMap() { (Integer) commandArguments.get("vendorId"), (Integer) commandArguments.get("productId"), (Long) commandArguments.get("softwareVersion"), - (Integer) commandArguments.get("protocolsSupported"), + (ArrayList) commandArguments.get("protocolsSupported"), (Optional) commandArguments.get("hardwareVersion"), (Optional) commandArguments.get("location"), (Optional) commandArguments.get("requestorCanConsent"), @@ -7897,36 +7545,35 @@ public Map> getCommandMap() { new LinkedHashMap(); CommandParameterInfo otaSoftwareUpdateRequestorannounceOtaProviderproviderNodeIdCommandParameterInfo = - new CommandParameterInfo("providerNodeId", long.class); + new CommandParameterInfo("providerNodeId", Long.class); otaSoftwareUpdateRequestorannounceOtaProviderCommandParams.put( "providerNodeId", otaSoftwareUpdateRequestorannounceOtaProviderproviderNodeIdCommandParameterInfo); CommandParameterInfo otaSoftwareUpdateRequestorannounceOtaProvidervendorIdCommandParameterInfo = - new CommandParameterInfo("vendorId", int.class); + new CommandParameterInfo("vendorId", Integer.class); otaSoftwareUpdateRequestorannounceOtaProviderCommandParams.put( "vendorId", otaSoftwareUpdateRequestorannounceOtaProvidervendorIdCommandParameterInfo); CommandParameterInfo otaSoftwareUpdateRequestorannounceOtaProviderannouncementReasonCommandParameterInfo = - new CommandParameterInfo("announcementReason", int.class); + new CommandParameterInfo("announcementReason", Integer.class); otaSoftwareUpdateRequestorannounceOtaProviderCommandParams.put( "announcementReason", otaSoftwareUpdateRequestorannounceOtaProviderannouncementReasonCommandParameterInfo); CommandParameterInfo otaSoftwareUpdateRequestorannounceOtaProvidermetadataForNodeCommandParameterInfo = - new CommandParameterInfo("metadataForNode", byte[].class); + new CommandParameterInfo("metadataForNode", Optional.class); otaSoftwareUpdateRequestorannounceOtaProviderCommandParams.put( "metadataForNode", otaSoftwareUpdateRequestorannounceOtaProvidermetadataForNodeCommandParameterInfo); CommandParameterInfo otaSoftwareUpdateRequestorannounceOtaProviderendpointCommandParameterInfo = - new CommandParameterInfo("endpoint", int.class); + new CommandParameterInfo("endpoint", Integer.class); otaSoftwareUpdateRequestorannounceOtaProviderCommandParams.put( "endpoint", otaSoftwareUpdateRequestorannounceOtaProviderendpointCommandParameterInfo); - // Populate commands InteractionInfo otaSoftwareUpdateRequestorannounceOtaProviderInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7950,7 +7597,6 @@ public Map> getCommandMap() { Map onOffClusterInteractionInfoMap = new LinkedHashMap<>(); Map onOffoffCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo onOffoffInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7962,15 +7608,14 @@ public Map> getCommandMap() { Map onOffoffWithEffectCommandParams = new LinkedHashMap(); CommandParameterInfo onOffoffWithEffecteffectIdCommandParameterInfo = - new CommandParameterInfo("effectId", int.class); + new CommandParameterInfo("effectId", Integer.class); onOffoffWithEffectCommandParams.put("effectId", onOffoffWithEffecteffectIdCommandParameterInfo); CommandParameterInfo onOffoffWithEffecteffectVariantCommandParameterInfo = - new CommandParameterInfo("effectVariant", int.class); + new CommandParameterInfo("effectVariant", Integer.class); onOffoffWithEffectCommandParams.put( "effectVariant", onOffoffWithEffecteffectVariantCommandParameterInfo); - // Populate commands InteractionInfo onOffoffWithEffectInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7985,7 +7630,6 @@ public Map> getCommandMap() { onOffClusterInteractionInfoMap.put("offWithEffect", onOffoffWithEffectInteractionInfo); Map onOffonCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo onOffonInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7996,7 +7640,6 @@ public Map> getCommandMap() { onOffClusterInteractionInfoMap.put("on", onOffonInteractionInfo); Map onOffonWithRecallGlobalSceneCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo onOffonWithRecallGlobalSceneInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8010,20 +7653,19 @@ public Map> getCommandMap() { Map onOffonWithTimedOffCommandParams = new LinkedHashMap(); CommandParameterInfo onOffonWithTimedOffonOffControlCommandParameterInfo = - new CommandParameterInfo("onOffControl", int.class); + new CommandParameterInfo("onOffControl", Integer.class); onOffonWithTimedOffCommandParams.put( "onOffControl", onOffonWithTimedOffonOffControlCommandParameterInfo); CommandParameterInfo onOffonWithTimedOffonTimeCommandParameterInfo = - new CommandParameterInfo("onTime", int.class); + new CommandParameterInfo("onTime", Integer.class); onOffonWithTimedOffCommandParams.put("onTime", onOffonWithTimedOffonTimeCommandParameterInfo); CommandParameterInfo onOffonWithTimedOffoffWaitTimeCommandParameterInfo = - new CommandParameterInfo("offWaitTime", int.class); + new CommandParameterInfo("offWaitTime", Integer.class); onOffonWithTimedOffCommandParams.put( "offWaitTime", onOffonWithTimedOffoffWaitTimeCommandParameterInfo); - // Populate commands InteractionInfo onOffonWithTimedOffInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8039,7 +7681,6 @@ public Map> getCommandMap() { onOffClusterInteractionInfoMap.put("onWithTimedOff", onOffonWithTimedOffInteractionInfo); Map onOfftoggleCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo onOfftoggleInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8062,7 +7703,7 @@ public Map> getCommandMap() { "NOCValue", operationalCredentialsaddNOCNOCValueCommandParameterInfo); CommandParameterInfo operationalCredentialsaddNOCICACValueCommandParameterInfo = - new CommandParameterInfo("ICACValue", byte[].class); + new CommandParameterInfo("ICACValue", Optional.class); operationalCredentialsaddNOCCommandParams.put( "ICACValue", operationalCredentialsaddNOCICACValueCommandParameterInfo); @@ -8072,16 +7713,15 @@ public Map> getCommandMap() { "IPKValue", operationalCredentialsaddNOCIPKValueCommandParameterInfo); CommandParameterInfo operationalCredentialsaddNOCcaseAdminNodeCommandParameterInfo = - new CommandParameterInfo("caseAdminNode", long.class); + new CommandParameterInfo("caseAdminNode", Long.class); operationalCredentialsaddNOCCommandParams.put( "caseAdminNode", operationalCredentialsaddNOCcaseAdminNodeCommandParameterInfo); CommandParameterInfo operationalCredentialsaddNOCadminVendorIdCommandParameterInfo = - new CommandParameterInfo("adminVendorId", int.class); + new CommandParameterInfo("adminVendorId", Integer.class); operationalCredentialsaddNOCCommandParams.put( "adminVendorId", operationalCredentialsaddNOCadminVendorIdCommandParameterInfo); - // Populate commands InteractionInfo operationalCredentialsaddNOCInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8107,7 +7747,6 @@ public Map> getCommandMap() { "rootCertificate", operationalCredentialsaddTrustedRootCertificaterootCertificateCommandParameterInfo); - // Populate commands InteractionInfo operationalCredentialsaddTrustedRootCertificateInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8130,7 +7769,6 @@ public Map> getCommandMap() { "attestationNonce", operationalCredentialsattestationRequestattestationNonceCommandParameterInfo); - // Populate commands InteractionInfo operationalCredentialsattestationRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8148,12 +7786,11 @@ public Map> getCommandMap() { new LinkedHashMap(); CommandParameterInfo operationalCredentialscertificateChainRequestcertificateTypeCommandParameterInfo = - new CommandParameterInfo("certificateType", int.class); + new CommandParameterInfo("certificateType", Integer.class); operationalCredentialscertificateChainRequestCommandParams.put( "certificateType", operationalCredentialscertificateChainRequestcertificateTypeCommandParameterInfo); - // Populate commands InteractionInfo operationalCredentialscertificateChainRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8174,7 +7811,6 @@ public Map> getCommandMap() { operationalCredentialsopCSRRequestCommandParams.put( "CSRNonce", operationalCredentialsopCSRRequestCSRNonceCommandParameterInfo); - // Populate commands InteractionInfo operationalCredentialsopCSRRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8190,11 +7826,10 @@ public Map> getCommandMap() { Map operationalCredentialsremoveFabricCommandParams = new LinkedHashMap(); CommandParameterInfo operationalCredentialsremoveFabricfabricIndexCommandParameterInfo = - new CommandParameterInfo("fabricIndex", int.class); + new CommandParameterInfo("fabricIndex", Integer.class); operationalCredentialsremoveFabricCommandParams.put( "fabricIndex", operationalCredentialsremoveFabricfabricIndexCommandParameterInfo); - // Populate commands InteractionInfo operationalCredentialsremoveFabricInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8217,7 +7852,6 @@ public Map> getCommandMap() { "trustedRootIdentifier", operationalCredentialsremoveTrustedRootCertificatetrustedRootIdentifierCommandParameterInfo); - // Populate commands InteractionInfo operationalCredentialsremoveTrustedRootCertificateInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8238,7 +7872,6 @@ public Map> getCommandMap() { operationalCredentialsupdateFabricLabelCommandParams.put( "label", operationalCredentialsupdateFabricLabellabelCommandParameterInfo); - // Populate commands InteractionInfo operationalCredentialsupdateFabricLabelInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8259,11 +7892,10 @@ public Map> getCommandMap() { "NOCValue", operationalCredentialsupdateNOCNOCValueCommandParameterInfo); CommandParameterInfo operationalCredentialsupdateNOCICACValueCommandParameterInfo = - new CommandParameterInfo("ICACValue", byte[].class); + new CommandParameterInfo("ICACValue", Optional.class); operationalCredentialsupdateNOCCommandParams.put( "ICACValue", operationalCredentialsupdateNOCICACValueCommandParameterInfo); - // Populate commands InteractionInfo operationalCredentialsupdateNOCInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8298,15 +7930,15 @@ public Map> getCommandMap() { Map scenesaddSceneCommandParams = new LinkedHashMap(); CommandParameterInfo scenesaddScenegroupIdCommandParameterInfo = - new CommandParameterInfo("groupId", int.class); + new CommandParameterInfo("groupId", Integer.class); scenesaddSceneCommandParams.put("groupId", scenesaddScenegroupIdCommandParameterInfo); CommandParameterInfo scenesaddScenesceneIdCommandParameterInfo = - new CommandParameterInfo("sceneId", int.class); + new CommandParameterInfo("sceneId", Integer.class); scenesaddSceneCommandParams.put("sceneId", scenesaddScenesceneIdCommandParameterInfo); CommandParameterInfo scenesaddScenetransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); scenesaddSceneCommandParams.put( "transitionTime", scenesaddScenetransitionTimeCommandParameterInfo); @@ -8314,19 +7946,6 @@ public Map> getCommandMap() { new CommandParameterInfo("sceneName", String.class); scenesaddSceneCommandParams.put("sceneName", scenesaddScenesceneNameCommandParameterInfo); - CommandParameterInfo scenesaddSceneclusterIdCommandParameterInfo = - new CommandParameterInfo("clusterId", long.class); - scenesaddSceneCommandParams.put("clusterId", scenesaddSceneclusterIdCommandParameterInfo); - - CommandParameterInfo scenesaddScenelengthCommandParameterInfo = - new CommandParameterInfo("length", int.class); - scenesaddSceneCommandParams.put("length", scenesaddScenelengthCommandParameterInfo); - - CommandParameterInfo scenesaddScenevalueCommandParameterInfo = - new CommandParameterInfo("value", int.class); - scenesaddSceneCommandParams.put("value", scenesaddScenevalueCommandParameterInfo); - - // Populate commands InteractionInfo scenesaddSceneInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8337,9 +7956,8 @@ public Map> getCommandMap() { (Integer) commandArguments.get("sceneId"), (Integer) commandArguments.get("transitionTime"), (String) commandArguments.get("sceneName"), - (Long) commandArguments.get("clusterId"), - (Integer) commandArguments.get("length"), - (Integer) commandArguments.get("value")); + (ArrayList) + commandArguments.get("extensionFieldSets")); }, () -> new DelegatedAddSceneResponseCallback(), scenesaddSceneCommandParams); @@ -8347,11 +7965,10 @@ public Map> getCommandMap() { Map scenesgetSceneMembershipCommandParams = new LinkedHashMap(); CommandParameterInfo scenesgetSceneMembershipgroupIdCommandParameterInfo = - new CommandParameterInfo("groupId", int.class); + new CommandParameterInfo("groupId", Integer.class); scenesgetSceneMembershipCommandParams.put( "groupId", scenesgetSceneMembershipgroupIdCommandParameterInfo); - // Populate commands InteractionInfo scenesgetSceneMembershipInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8367,19 +7984,18 @@ public Map> getCommandMap() { Map scenesrecallSceneCommandParams = new LinkedHashMap(); CommandParameterInfo scenesrecallScenegroupIdCommandParameterInfo = - new CommandParameterInfo("groupId", int.class); + new CommandParameterInfo("groupId", Integer.class); scenesrecallSceneCommandParams.put("groupId", scenesrecallScenegroupIdCommandParameterInfo); CommandParameterInfo scenesrecallScenesceneIdCommandParameterInfo = - new CommandParameterInfo("sceneId", int.class); + new CommandParameterInfo("sceneId", Integer.class); scenesrecallSceneCommandParams.put("sceneId", scenesrecallScenesceneIdCommandParameterInfo); CommandParameterInfo scenesrecallScenetransitionTimeCommandParameterInfo = - new CommandParameterInfo("transitionTime", int.class); + new CommandParameterInfo("transitionTime", Integer.class); scenesrecallSceneCommandParams.put( "transitionTime", scenesrecallScenetransitionTimeCommandParameterInfo); - // Populate commands InteractionInfo scenesrecallSceneInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8396,11 +8012,10 @@ public Map> getCommandMap() { Map scenesremoveAllScenesCommandParams = new LinkedHashMap(); CommandParameterInfo scenesremoveAllScenesgroupIdCommandParameterInfo = - new CommandParameterInfo("groupId", int.class); + new CommandParameterInfo("groupId", Integer.class); scenesremoveAllScenesCommandParams.put( "groupId", scenesremoveAllScenesgroupIdCommandParameterInfo); - // Populate commands InteractionInfo scenesremoveAllScenesInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8415,14 +8030,13 @@ public Map> getCommandMap() { Map scenesremoveSceneCommandParams = new LinkedHashMap(); CommandParameterInfo scenesremoveScenegroupIdCommandParameterInfo = - new CommandParameterInfo("groupId", int.class); + new CommandParameterInfo("groupId", Integer.class); scenesremoveSceneCommandParams.put("groupId", scenesremoveScenegroupIdCommandParameterInfo); CommandParameterInfo scenesremoveScenesceneIdCommandParameterInfo = - new CommandParameterInfo("sceneId", int.class); + new CommandParameterInfo("sceneId", Integer.class); scenesremoveSceneCommandParams.put("sceneId", scenesremoveScenesceneIdCommandParameterInfo); - // Populate commands InteractionInfo scenesremoveSceneInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8438,14 +8052,13 @@ public Map> getCommandMap() { Map scenesstoreSceneCommandParams = new LinkedHashMap(); CommandParameterInfo scenesstoreScenegroupIdCommandParameterInfo = - new CommandParameterInfo("groupId", int.class); + new CommandParameterInfo("groupId", Integer.class); scenesstoreSceneCommandParams.put("groupId", scenesstoreScenegroupIdCommandParameterInfo); CommandParameterInfo scenesstoreScenesceneIdCommandParameterInfo = - new CommandParameterInfo("sceneId", int.class); + new CommandParameterInfo("sceneId", Integer.class); scenesstoreSceneCommandParams.put("sceneId", scenesstoreScenesceneIdCommandParameterInfo); - // Populate commands InteractionInfo scenesstoreSceneInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8461,14 +8074,13 @@ public Map> getCommandMap() { Map scenesviewSceneCommandParams = new LinkedHashMap(); CommandParameterInfo scenesviewScenegroupIdCommandParameterInfo = - new CommandParameterInfo("groupId", int.class); + new CommandParameterInfo("groupId", Integer.class); scenesviewSceneCommandParams.put("groupId", scenesviewScenegroupIdCommandParameterInfo); CommandParameterInfo scenesviewScenesceneIdCommandParameterInfo = - new CommandParameterInfo("sceneId", int.class); + new CommandParameterInfo("sceneId", Integer.class); scenesviewSceneCommandParams.put("sceneId", scenesviewScenesceneIdCommandParameterInfo); - // Populate commands InteractionInfo scenesviewSceneInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8486,7 +8098,6 @@ public Map> getCommandMap() { new LinkedHashMap<>(); Map softwareDiagnosticsresetWatermarksCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo softwareDiagnosticsresetWatermarksInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8504,7 +8115,7 @@ public Map> getCommandMap() { Map targetNavigatornavigateTargetRequestCommandParams = new LinkedHashMap(); CommandParameterInfo targetNavigatornavigateTargetRequesttargetCommandParameterInfo = - new CommandParameterInfo("target", int.class); + new CommandParameterInfo("target", Integer.class); targetNavigatornavigateTargetRequestCommandParams.put( "target", targetNavigatornavigateTargetRequesttargetCommandParameterInfo); @@ -8513,7 +8124,6 @@ public Map> getCommandMap() { targetNavigatornavigateTargetRequestCommandParams.put( "data", targetNavigatornavigateTargetRequestdataCommandParameterInfo); - // Populate commands InteractionInfo targetNavigatornavigateTargetRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8534,61 +8144,13 @@ public Map> getCommandMap() { Map testClusterClusterInteractionInfoMap = new LinkedHashMap<>(); Map testClustersimpleStructEchoRequestCommandParams = new LinkedHashMap(); - CommandParameterInfo testClustersimpleStructEchoRequestaCommandParameterInfo = - new CommandParameterInfo("a", int.class); - testClustersimpleStructEchoRequestCommandParams.put( - "a", testClustersimpleStructEchoRequestaCommandParameterInfo); - - CommandParameterInfo testClustersimpleStructEchoRequestbCommandParameterInfo = - new CommandParameterInfo("b", boolean.class); - testClustersimpleStructEchoRequestCommandParams.put( - "b", testClustersimpleStructEchoRequestbCommandParameterInfo); - - CommandParameterInfo testClustersimpleStructEchoRequestcCommandParameterInfo = - new CommandParameterInfo("c", int.class); - testClustersimpleStructEchoRequestCommandParams.put( - "c", testClustersimpleStructEchoRequestcCommandParameterInfo); - - CommandParameterInfo testClustersimpleStructEchoRequestdCommandParameterInfo = - new CommandParameterInfo("d", byte[].class); - testClustersimpleStructEchoRequestCommandParams.put( - "d", testClustersimpleStructEchoRequestdCommandParameterInfo); - - CommandParameterInfo testClustersimpleStructEchoRequesteCommandParameterInfo = - new CommandParameterInfo("e", String.class); - testClustersimpleStructEchoRequestCommandParams.put( - "e", testClustersimpleStructEchoRequesteCommandParameterInfo); - - CommandParameterInfo testClustersimpleStructEchoRequestfCommandParameterInfo = - new CommandParameterInfo("f", int.class); - testClustersimpleStructEchoRequestCommandParams.put( - "f", testClustersimpleStructEchoRequestfCommandParameterInfo); - - CommandParameterInfo testClustersimpleStructEchoRequestgCommandParameterInfo = - new CommandParameterInfo("g", float.class); - testClustersimpleStructEchoRequestCommandParams.put( - "g", testClustersimpleStructEchoRequestgCommandParameterInfo); - - CommandParameterInfo testClustersimpleStructEchoRequesthCommandParameterInfo = - new CommandParameterInfo("h", double.class); - testClustersimpleStructEchoRequestCommandParams.put( - "h", testClustersimpleStructEchoRequesthCommandParameterInfo); - - // Populate commands InteractionInfo testClustersimpleStructEchoRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .simpleStructEchoRequest( (ChipClusters.TestClusterCluster.SimpleStructResponseCallback) callback, - (Integer) commandArguments.get("a"), - (Boolean) commandArguments.get("b"), - (Integer) commandArguments.get("c"), - (byte[]) commandArguments.get("d"), - (String) commandArguments.get("e"), - (Integer) commandArguments.get("f"), - (Float) commandArguments.get("g"), - (Double) commandArguments.get("h")); + (ChipStructs.TestClusterClusterSimpleStruct) commandArguments.get("arg1")); }, () -> new DelegatedSimpleStructResponseCallback(), testClustersimpleStructEchoRequestCommandParams); @@ -8596,7 +8158,6 @@ public Map> getCommandMap() { "simpleStructEchoRequest", testClustersimpleStructEchoRequestInteractionInfo); Map testClustertestCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo testClustertestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8608,16 +8169,15 @@ public Map> getCommandMap() { Map testClustertestAddArgumentsCommandParams = new LinkedHashMap(); CommandParameterInfo testClustertestAddArgumentsarg1CommandParameterInfo = - new CommandParameterInfo("arg1", int.class); + new CommandParameterInfo("arg1", Integer.class); testClustertestAddArgumentsCommandParams.put( "arg1", testClustertestAddArgumentsarg1CommandParameterInfo); CommandParameterInfo testClustertestAddArgumentsarg2CommandParameterInfo = - new CommandParameterInfo("arg2", int.class); + new CommandParameterInfo("arg2", Integer.class); testClustertestAddArgumentsCommandParams.put( "arg2", testClustertestAddArgumentsarg2CommandParameterInfo); - // Populate commands InteractionInfo testClustertestAddArgumentsInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8634,21 +8194,20 @@ public Map> getCommandMap() { Map testClustertestEmitTestEventRequestCommandParams = new LinkedHashMap(); CommandParameterInfo testClustertestEmitTestEventRequestarg1CommandParameterInfo = - new CommandParameterInfo("arg1", int.class); + new CommandParameterInfo("arg1", Integer.class); testClustertestEmitTestEventRequestCommandParams.put( "arg1", testClustertestEmitTestEventRequestarg1CommandParameterInfo); CommandParameterInfo testClustertestEmitTestEventRequestarg2CommandParameterInfo = - new CommandParameterInfo("arg2", int.class); + new CommandParameterInfo("arg2", Integer.class); testClustertestEmitTestEventRequestCommandParams.put( "arg2", testClustertestEmitTestEventRequestarg2CommandParameterInfo); CommandParameterInfo testClustertestEmitTestEventRequestarg3CommandParameterInfo = - new CommandParameterInfo("arg3", boolean.class); + new CommandParameterInfo("arg3", Boolean.class); testClustertestEmitTestEventRequestCommandParams.put( "arg3", testClustertestEmitTestEventRequestarg3CommandParameterInfo); - // Populate commands InteractionInfo testClustertestEmitTestEventRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8666,16 +8225,15 @@ public Map> getCommandMap() { Map testClustertestEnumsRequestCommandParams = new LinkedHashMap(); CommandParameterInfo testClustertestEnumsRequestarg1CommandParameterInfo = - new CommandParameterInfo("arg1", int.class); + new CommandParameterInfo("arg1", Integer.class); testClustertestEnumsRequestCommandParams.put( "arg1", testClustertestEnumsRequestarg1CommandParameterInfo); CommandParameterInfo testClustertestEnumsRequestarg2CommandParameterInfo = - new CommandParameterInfo("arg2", int.class); + new CommandParameterInfo("arg2", Integer.class); testClustertestEnumsRequestCommandParams.put( "arg2", testClustertestEnumsRequestarg2CommandParameterInfo); - // Populate commands InteractionInfo testClustertestEnumsRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8692,18 +8250,17 @@ public Map> getCommandMap() { Map testClustertestListInt8UArgumentRequestCommandParams = new LinkedHashMap(); CommandParameterInfo testClustertestListInt8UArgumentRequestarg1CommandParameterInfo = - new CommandParameterInfo("arg1", int.class); + new CommandParameterInfo("arg1", ArrayList.class); testClustertestListInt8UArgumentRequestCommandParams.put( "arg1", testClustertestListInt8UArgumentRequestarg1CommandParameterInfo); - // Populate commands InteractionInfo testClustertestListInt8UArgumentRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .testListInt8UArgumentRequest( (ChipClusters.TestClusterCluster.BooleanResponseCallback) callback, - (Integer) commandArguments.get("arg1")); + (ArrayList) commandArguments.get("arg1")); }, () -> new DelegatedBooleanResponseCallback(), testClustertestListInt8UArgumentRequestCommandParams); @@ -8712,11 +8269,10 @@ public Map> getCommandMap() { Map testClustertestListInt8UReverseRequestCommandParams = new LinkedHashMap(); CommandParameterInfo testClustertestListInt8UReverseRequestarg1CommandParameterInfo = - new CommandParameterInfo("arg1", int.class); + new CommandParameterInfo("arg1", ArrayList.class); testClustertestListInt8UReverseRequestCommandParams.put( "arg1", testClustertestListInt8UReverseRequestarg1CommandParameterInfo); - // Populate commands InteractionInfo testClustertestListInt8UReverseRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8724,7 +8280,7 @@ public Map> getCommandMap() { .testListInt8UReverseRequest( (ChipClusters.TestClusterCluster.TestListInt8UReverseResponseCallback) callback, - (Integer) commandArguments.get("arg1")); + (ArrayList) commandArguments.get("arg1")); }, () -> new DelegatedTestListInt8UReverseResponseCallback(), testClustertestListInt8UReverseRequestCommandParams); @@ -8733,43 +8289,14 @@ public Map> getCommandMap() { Map testClustertestListNestedStructListArgumentRequestCommandParams = new LinkedHashMap(); - CommandParameterInfo testClustertestListNestedStructListArgumentRequestaCommandParameterInfo = - new CommandParameterInfo("a", int.class); - testClustertestListNestedStructListArgumentRequestCommandParams.put( - "a", testClustertestListNestedStructListArgumentRequestaCommandParameterInfo); - - CommandParameterInfo testClustertestListNestedStructListArgumentRequestbCommandParameterInfo = - new CommandParameterInfo("b", boolean.class); - testClustertestListNestedStructListArgumentRequestCommandParams.put( - "b", testClustertestListNestedStructListArgumentRequestbCommandParameterInfo); - - CommandParameterInfo testClustertestListNestedStructListArgumentRequesteCommandParameterInfo = - new CommandParameterInfo("e", long.class); - testClustertestListNestedStructListArgumentRequestCommandParams.put( - "e", testClustertestListNestedStructListArgumentRequesteCommandParameterInfo); - - CommandParameterInfo testClustertestListNestedStructListArgumentRequestfCommandParameterInfo = - new CommandParameterInfo("f", byte[].class); - testClustertestListNestedStructListArgumentRequestCommandParams.put( - "f", testClustertestListNestedStructListArgumentRequestfCommandParameterInfo); - - CommandParameterInfo testClustertestListNestedStructListArgumentRequestgCommandParameterInfo = - new CommandParameterInfo("g", int.class); - testClustertestListNestedStructListArgumentRequestCommandParams.put( - "g", testClustertestListNestedStructListArgumentRequestgCommandParameterInfo); - - // Populate commands InteractionInfo testClustertestListNestedStructListArgumentRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .testListNestedStructListArgumentRequest( (ChipClusters.TestClusterCluster.BooleanResponseCallback) callback, - (Integer) commandArguments.get("a"), - (Boolean) commandArguments.get("b"), - (Long) commandArguments.get("e"), - (byte[]) commandArguments.get("f"), - (Integer) commandArguments.get("g")); + (ArrayList) + commandArguments.get("arg1")); }, () -> new DelegatedBooleanResponseCallback(), testClustertestListNestedStructListArgumentRequestCommandParams); @@ -8778,61 +8305,14 @@ public Map> getCommandMap() { testClustertestListNestedStructListArgumentRequestInteractionInfo); Map testClustertestListStructArgumentRequestCommandParams = new LinkedHashMap(); - CommandParameterInfo testClustertestListStructArgumentRequestaCommandParameterInfo = - new CommandParameterInfo("a", int.class); - testClustertestListStructArgumentRequestCommandParams.put( - "a", testClustertestListStructArgumentRequestaCommandParameterInfo); - - CommandParameterInfo testClustertestListStructArgumentRequestbCommandParameterInfo = - new CommandParameterInfo("b", boolean.class); - testClustertestListStructArgumentRequestCommandParams.put( - "b", testClustertestListStructArgumentRequestbCommandParameterInfo); - - CommandParameterInfo testClustertestListStructArgumentRequestcCommandParameterInfo = - new CommandParameterInfo("c", int.class); - testClustertestListStructArgumentRequestCommandParams.put( - "c", testClustertestListStructArgumentRequestcCommandParameterInfo); - - CommandParameterInfo testClustertestListStructArgumentRequestdCommandParameterInfo = - new CommandParameterInfo("d", byte[].class); - testClustertestListStructArgumentRequestCommandParams.put( - "d", testClustertestListStructArgumentRequestdCommandParameterInfo); - - CommandParameterInfo testClustertestListStructArgumentRequesteCommandParameterInfo = - new CommandParameterInfo("e", String.class); - testClustertestListStructArgumentRequestCommandParams.put( - "e", testClustertestListStructArgumentRequesteCommandParameterInfo); - - CommandParameterInfo testClustertestListStructArgumentRequestfCommandParameterInfo = - new CommandParameterInfo("f", int.class); - testClustertestListStructArgumentRequestCommandParams.put( - "f", testClustertestListStructArgumentRequestfCommandParameterInfo); - - CommandParameterInfo testClustertestListStructArgumentRequestgCommandParameterInfo = - new CommandParameterInfo("g", float.class); - testClustertestListStructArgumentRequestCommandParams.put( - "g", testClustertestListStructArgumentRequestgCommandParameterInfo); - - CommandParameterInfo testClustertestListStructArgumentRequesthCommandParameterInfo = - new CommandParameterInfo("h", double.class); - testClustertestListStructArgumentRequestCommandParams.put( - "h", testClustertestListStructArgumentRequesthCommandParameterInfo); - - // Populate commands InteractionInfo testClustertestListStructArgumentRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .testListStructArgumentRequest( (ChipClusters.TestClusterCluster.BooleanResponseCallback) callback, - (Integer) commandArguments.get("a"), - (Boolean) commandArguments.get("b"), - (Integer) commandArguments.get("c"), - (byte[]) commandArguments.get("d"), - (String) commandArguments.get("e"), - (Integer) commandArguments.get("f"), - (Float) commandArguments.get("g"), - (Double) commandArguments.get("h")); + (ArrayList) + commandArguments.get("arg1")); }, () -> new DelegatedBooleanResponseCallback(), testClustertestListStructArgumentRequestCommandParams); @@ -8840,25 +8320,13 @@ public Map> getCommandMap() { "testListStructArgumentRequest", testClustertestListStructArgumentRequestInteractionInfo); Map testClustertestNestedStructArgumentRequestCommandParams = new LinkedHashMap(); - CommandParameterInfo testClustertestNestedStructArgumentRequestaCommandParameterInfo = - new CommandParameterInfo("a", int.class); - testClustertestNestedStructArgumentRequestCommandParams.put( - "a", testClustertestNestedStructArgumentRequestaCommandParameterInfo); - - CommandParameterInfo testClustertestNestedStructArgumentRequestbCommandParameterInfo = - new CommandParameterInfo("b", boolean.class); - testClustertestNestedStructArgumentRequestCommandParams.put( - "b", testClustertestNestedStructArgumentRequestbCommandParameterInfo); - - // Populate commands InteractionInfo testClustertestNestedStructArgumentRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .testNestedStructArgumentRequest( (ChipClusters.TestClusterCluster.BooleanResponseCallback) callback, - (Integer) commandArguments.get("a"), - (Boolean) commandArguments.get("b")); + (ChipStructs.TestClusterClusterNestedStruct) commandArguments.get("arg1")); }, () -> new DelegatedBooleanResponseCallback(), testClustertestNestedStructArgumentRequestCommandParams); @@ -8867,43 +8335,14 @@ public Map> getCommandMap() { testClustertestNestedStructArgumentRequestInteractionInfo); Map testClustertestNestedStructListArgumentRequestCommandParams = new LinkedHashMap(); - CommandParameterInfo testClustertestNestedStructListArgumentRequestaCommandParameterInfo = - new CommandParameterInfo("a", int.class); - testClustertestNestedStructListArgumentRequestCommandParams.put( - "a", testClustertestNestedStructListArgumentRequestaCommandParameterInfo); - - CommandParameterInfo testClustertestNestedStructListArgumentRequestbCommandParameterInfo = - new CommandParameterInfo("b", boolean.class); - testClustertestNestedStructListArgumentRequestCommandParams.put( - "b", testClustertestNestedStructListArgumentRequestbCommandParameterInfo); - - CommandParameterInfo testClustertestNestedStructListArgumentRequesteCommandParameterInfo = - new CommandParameterInfo("e", long.class); - testClustertestNestedStructListArgumentRequestCommandParams.put( - "e", testClustertestNestedStructListArgumentRequesteCommandParameterInfo); - - CommandParameterInfo testClustertestNestedStructListArgumentRequestfCommandParameterInfo = - new CommandParameterInfo("f", byte[].class); - testClustertestNestedStructListArgumentRequestCommandParams.put( - "f", testClustertestNestedStructListArgumentRequestfCommandParameterInfo); - - CommandParameterInfo testClustertestNestedStructListArgumentRequestgCommandParameterInfo = - new CommandParameterInfo("g", int.class); - testClustertestNestedStructListArgumentRequestCommandParams.put( - "g", testClustertestNestedStructListArgumentRequestgCommandParameterInfo); - - // Populate commands InteractionInfo testClustertestNestedStructListArgumentRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .testNestedStructListArgumentRequest( (ChipClusters.TestClusterCluster.BooleanResponseCallback) callback, - (Integer) commandArguments.get("a"), - (Boolean) commandArguments.get("b"), - (Long) commandArguments.get("e"), - (byte[]) commandArguments.get("f"), - (Integer) commandArguments.get("g")); + (ChipStructs.TestClusterClusterNestedStructList) + commandArguments.get("arg1")); }, () -> new DelegatedBooleanResponseCallback(), testClustertestNestedStructListArgumentRequestCommandParams); @@ -8912,7 +8351,6 @@ public Map> getCommandMap() { testClustertestNestedStructListArgumentRequestInteractionInfo); Map testClustertestNotHandledCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo testClustertestNotHandledInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8926,11 +8364,10 @@ public Map> getCommandMap() { Map testClustertestNullableOptionalRequestCommandParams = new LinkedHashMap(); CommandParameterInfo testClustertestNullableOptionalRequestarg1CommandParameterInfo = - new CommandParameterInfo("arg1", int.class); + new CommandParameterInfo("arg1", Optional.class); testClustertestNullableOptionalRequestCommandParams.put( "arg1", testClustertestNullableOptionalRequestarg1CommandParameterInfo); - // Populate commands InteractionInfo testClustertestNullableOptionalRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8947,11 +8384,10 @@ public Map> getCommandMap() { Map testClustertestSimpleOptionalArgumentRequestCommandParams = new LinkedHashMap(); CommandParameterInfo testClustertestSimpleOptionalArgumentRequestarg1CommandParameterInfo = - new CommandParameterInfo("arg1", boolean.class); + new CommandParameterInfo("arg1", Optional.class); testClustertestSimpleOptionalArgumentRequestCommandParams.put( "arg1", testClustertestSimpleOptionalArgumentRequestarg1CommandParameterInfo); - // Populate commands InteractionInfo testClustertestSimpleOptionalArgumentRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8967,7 +8403,6 @@ public Map> getCommandMap() { testClustertestSimpleOptionalArgumentRequestInteractionInfo); Map testClustertestSpecificCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo testClustertestSpecificInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8981,61 +8416,13 @@ public Map> getCommandMap() { "testSpecific", testClustertestSpecificInteractionInfo); Map testClustertestStructArgumentRequestCommandParams = new LinkedHashMap(); - CommandParameterInfo testClustertestStructArgumentRequestaCommandParameterInfo = - new CommandParameterInfo("a", int.class); - testClustertestStructArgumentRequestCommandParams.put( - "a", testClustertestStructArgumentRequestaCommandParameterInfo); - - CommandParameterInfo testClustertestStructArgumentRequestbCommandParameterInfo = - new CommandParameterInfo("b", boolean.class); - testClustertestStructArgumentRequestCommandParams.put( - "b", testClustertestStructArgumentRequestbCommandParameterInfo); - - CommandParameterInfo testClustertestStructArgumentRequestcCommandParameterInfo = - new CommandParameterInfo("c", int.class); - testClustertestStructArgumentRequestCommandParams.put( - "c", testClustertestStructArgumentRequestcCommandParameterInfo); - - CommandParameterInfo testClustertestStructArgumentRequestdCommandParameterInfo = - new CommandParameterInfo("d", byte[].class); - testClustertestStructArgumentRequestCommandParams.put( - "d", testClustertestStructArgumentRequestdCommandParameterInfo); - - CommandParameterInfo testClustertestStructArgumentRequesteCommandParameterInfo = - new CommandParameterInfo("e", String.class); - testClustertestStructArgumentRequestCommandParams.put( - "e", testClustertestStructArgumentRequesteCommandParameterInfo); - - CommandParameterInfo testClustertestStructArgumentRequestfCommandParameterInfo = - new CommandParameterInfo("f", int.class); - testClustertestStructArgumentRequestCommandParams.put( - "f", testClustertestStructArgumentRequestfCommandParameterInfo); - - CommandParameterInfo testClustertestStructArgumentRequestgCommandParameterInfo = - new CommandParameterInfo("g", float.class); - testClustertestStructArgumentRequestCommandParams.put( - "g", testClustertestStructArgumentRequestgCommandParameterInfo); - - CommandParameterInfo testClustertestStructArgumentRequesthCommandParameterInfo = - new CommandParameterInfo("h", double.class); - testClustertestStructArgumentRequestCommandParams.put( - "h", testClustertestStructArgumentRequesthCommandParameterInfo); - - // Populate commands InteractionInfo testClustertestStructArgumentRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .testStructArgumentRequest( (ChipClusters.TestClusterCluster.BooleanResponseCallback) callback, - (Integer) commandArguments.get("a"), - (Boolean) commandArguments.get("b"), - (Integer) commandArguments.get("c"), - (byte[]) commandArguments.get("d"), - (String) commandArguments.get("e"), - (Integer) commandArguments.get("f"), - (Float) commandArguments.get("g"), - (Double) commandArguments.get("h")); + (ChipStructs.TestClusterClusterSimpleStruct) commandArguments.get("arg1")); }, () -> new DelegatedBooleanResponseCallback(), testClustertestStructArgumentRequestCommandParams); @@ -9043,7 +8430,6 @@ public Map> getCommandMap() { "testStructArgumentRequest", testClustertestStructArgumentRequestInteractionInfo); Map testClustertestUnknownCommandCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo testClustertestUnknownCommandInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9056,7 +8442,6 @@ public Map> getCommandMap() { "testUnknownCommand", testClustertestUnknownCommandInteractionInfo); Map testClustertimedInvokeRequestCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo testClustertimedInvokeRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9071,7 +8456,6 @@ public Map> getCommandMap() { Map thermostatClusterInteractionInfoMap = new LinkedHashMap<>(); Map thermostatclearWeeklyScheduleCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo thermostatclearWeeklyScheduleInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9084,7 +8468,6 @@ public Map> getCommandMap() { "clearWeeklySchedule", thermostatclearWeeklyScheduleInteractionInfo); Map thermostatgetRelayStatusLogCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo thermostatgetRelayStatusLogInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9099,16 +8482,15 @@ public Map> getCommandMap() { Map thermostatgetWeeklyScheduleCommandParams = new LinkedHashMap(); CommandParameterInfo thermostatgetWeeklyScheduledaysToReturnCommandParameterInfo = - new CommandParameterInfo("daysToReturn", int.class); + new CommandParameterInfo("daysToReturn", Integer.class); thermostatgetWeeklyScheduleCommandParams.put( "daysToReturn", thermostatgetWeeklyScheduledaysToReturnCommandParameterInfo); CommandParameterInfo thermostatgetWeeklySchedulemodeToReturnCommandParameterInfo = - new CommandParameterInfo("modeToReturn", int.class); + new CommandParameterInfo("modeToReturn", Integer.class); thermostatgetWeeklyScheduleCommandParams.put( "modeToReturn", thermostatgetWeeklySchedulemodeToReturnCommandParameterInfo); - // Populate commands InteractionInfo thermostatgetWeeklyScheduleInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9126,28 +8508,27 @@ public Map> getCommandMap() { new LinkedHashMap(); CommandParameterInfo thermostatsetWeeklySchedulenumberOfTransitionsForSequenceCommandParameterInfo = - new CommandParameterInfo("numberOfTransitionsForSequence", int.class); + new CommandParameterInfo("numberOfTransitionsForSequence", Integer.class); thermostatsetWeeklyScheduleCommandParams.put( "numberOfTransitionsForSequence", thermostatsetWeeklySchedulenumberOfTransitionsForSequenceCommandParameterInfo); CommandParameterInfo thermostatsetWeeklyScheduledayOfWeekForSequenceCommandParameterInfo = - new CommandParameterInfo("dayOfWeekForSequence", int.class); + new CommandParameterInfo("dayOfWeekForSequence", Integer.class); thermostatsetWeeklyScheduleCommandParams.put( "dayOfWeekForSequence", thermostatsetWeeklyScheduledayOfWeekForSequenceCommandParameterInfo); CommandParameterInfo thermostatsetWeeklySchedulemodeForSequenceCommandParameterInfo = - new CommandParameterInfo("modeForSequence", int.class); + new CommandParameterInfo("modeForSequence", Integer.class); thermostatsetWeeklyScheduleCommandParams.put( "modeForSequence", thermostatsetWeeklySchedulemodeForSequenceCommandParameterInfo); CommandParameterInfo thermostatsetWeeklySchedulepayloadCommandParameterInfo = - new CommandParameterInfo("payload", int.class); + new CommandParameterInfo("payload", ArrayList.class); thermostatsetWeeklyScheduleCommandParams.put( "payload", thermostatsetWeeklySchedulepayloadCommandParameterInfo); - // Populate commands InteractionInfo thermostatsetWeeklyScheduleInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9157,7 +8538,7 @@ public Map> getCommandMap() { (Integer) commandArguments.get("numberOfTransitionsForSequence"), (Integer) commandArguments.get("dayOfWeekForSequence"), (Integer) commandArguments.get("modeForSequence"), - (Integer) commandArguments.get("payload")); + (ArrayList) commandArguments.get("payload")); }, () -> new DelegatedDefaultClusterCallback(), thermostatsetWeeklyScheduleCommandParams); @@ -9166,16 +8547,15 @@ public Map> getCommandMap() { Map thermostatsetpointRaiseLowerCommandParams = new LinkedHashMap(); CommandParameterInfo thermostatsetpointRaiseLowermodeCommandParameterInfo = - new CommandParameterInfo("mode", int.class); + new CommandParameterInfo("mode", Integer.class); thermostatsetpointRaiseLowerCommandParams.put( "mode", thermostatsetpointRaiseLowermodeCommandParameterInfo); CommandParameterInfo thermostatsetpointRaiseLoweramountCommandParameterInfo = - new CommandParameterInfo("amount", int.class); + new CommandParameterInfo("amount", Integer.class); thermostatsetpointRaiseLowerCommandParams.put( "amount", thermostatsetpointRaiseLoweramountCommandParameterInfo); - // Populate commands InteractionInfo thermostatsetpointRaiseLowerInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9199,7 +8579,6 @@ public Map> getCommandMap() { new LinkedHashMap<>(); Map threadNetworkDiagnosticsresetCountsCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo threadNetworkDiagnosticsresetCountsInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9219,7 +8598,6 @@ public Map> getCommandMap() { new LinkedHashMap<>(); Map wiFiNetworkDiagnosticsresetCountsCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo wiFiNetworkDiagnosticsresetCountsInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9234,7 +8612,6 @@ public Map> getCommandMap() { Map windowCoveringClusterInteractionInfoMap = new LinkedHashMap<>(); Map windowCoveringdownOrCloseCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo windowCoveringdownOrCloseInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9248,19 +8625,18 @@ public Map> getCommandMap() { Map windowCoveringgoToLiftPercentageCommandParams = new LinkedHashMap(); CommandParameterInfo windowCoveringgoToLiftPercentageliftPercentageValueCommandParameterInfo = - new CommandParameterInfo("liftPercentageValue", int.class); + new CommandParameterInfo("liftPercentageValue", Integer.class); windowCoveringgoToLiftPercentageCommandParams.put( "liftPercentageValue", windowCoveringgoToLiftPercentageliftPercentageValueCommandParameterInfo); CommandParameterInfo windowCoveringgoToLiftPercentageliftPercent100thsValueCommandParameterInfo = - new CommandParameterInfo("liftPercent100thsValue", int.class); + new CommandParameterInfo("liftPercent100thsValue", Integer.class); windowCoveringgoToLiftPercentageCommandParams.put( "liftPercent100thsValue", windowCoveringgoToLiftPercentageliftPercent100thsValueCommandParameterInfo); - // Populate commands InteractionInfo windowCoveringgoToLiftPercentageInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9277,11 +8653,10 @@ public Map> getCommandMap() { Map windowCoveringgoToLiftValueCommandParams = new LinkedHashMap(); CommandParameterInfo windowCoveringgoToLiftValueliftValueCommandParameterInfo = - new CommandParameterInfo("liftValue", int.class); + new CommandParameterInfo("liftValue", Integer.class); windowCoveringgoToLiftValueCommandParams.put( "liftValue", windowCoveringgoToLiftValueliftValueCommandParameterInfo); - // Populate commands InteractionInfo windowCoveringgoToLiftValueInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9297,19 +8672,18 @@ public Map> getCommandMap() { Map windowCoveringgoToTiltPercentageCommandParams = new LinkedHashMap(); CommandParameterInfo windowCoveringgoToTiltPercentagetiltPercentageValueCommandParameterInfo = - new CommandParameterInfo("tiltPercentageValue", int.class); + new CommandParameterInfo("tiltPercentageValue", Integer.class); windowCoveringgoToTiltPercentageCommandParams.put( "tiltPercentageValue", windowCoveringgoToTiltPercentagetiltPercentageValueCommandParameterInfo); CommandParameterInfo windowCoveringgoToTiltPercentagetiltPercent100thsValueCommandParameterInfo = - new CommandParameterInfo("tiltPercent100thsValue", int.class); + new CommandParameterInfo("tiltPercent100thsValue", Integer.class); windowCoveringgoToTiltPercentageCommandParams.put( "tiltPercent100thsValue", windowCoveringgoToTiltPercentagetiltPercent100thsValueCommandParameterInfo); - // Populate commands InteractionInfo windowCoveringgoToTiltPercentageInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9326,11 +8700,10 @@ public Map> getCommandMap() { Map windowCoveringgoToTiltValueCommandParams = new LinkedHashMap(); CommandParameterInfo windowCoveringgoToTiltValuetiltValueCommandParameterInfo = - new CommandParameterInfo("tiltValue", int.class); + new CommandParameterInfo("tiltValue", Integer.class); windowCoveringgoToTiltValueCommandParams.put( "tiltValue", windowCoveringgoToTiltValuetiltValueCommandParameterInfo); - // Populate commands InteractionInfo windowCoveringgoToTiltValueInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9345,7 +8718,6 @@ public Map> getCommandMap() { "goToTiltValue", windowCoveringgoToTiltValueInteractionInfo); Map windowCoveringstopMotionCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo windowCoveringstopMotionInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9358,7 +8730,6 @@ public Map> getCommandMap() { "stopMotion", windowCoveringstopMotionInteractionInfo); Map windowCoveringupOrOpenCommandParams = new LinkedHashMap(); - // Populate commands InteractionInfo windowCoveringupOrOpenInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java index 220f7e5df0429d..9301765e8f8668 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java @@ -81,7 +81,7 @@ public Map> getWriteAttributeMap() { Map writeBasicLocalConfigDisabledCommandParams = new LinkedHashMap(); CommandParameterInfo basiclocalConfigDisabledCommandParameterInfo = - new CommandParameterInfo("value", boolean.class); + new CommandParameterInfo("value", Boolean.class); writeBasicLocalConfigDisabledCommandParams.put( "value", basiclocalConfigDisabledCommandParameterInfo); InteractionInfo writeBasicLocalConfigDisabledAttributeInteractionInfo = @@ -100,7 +100,7 @@ public Map> getWriteAttributeMap() { Map writeBinaryInputBasicOutOfServiceCommandParams = new LinkedHashMap(); CommandParameterInfo binaryInputBasicoutOfServiceCommandParameterInfo = - new CommandParameterInfo("value", boolean.class); + new CommandParameterInfo("value", Boolean.class); writeBinaryInputBasicOutOfServiceCommandParams.put( "value", binaryInputBasicoutOfServiceCommandParameterInfo); InteractionInfo writeBinaryInputBasicOutOfServiceAttributeInteractionInfo = @@ -117,7 +117,7 @@ public Map> getWriteAttributeMap() { Map writeBinaryInputBasicPresentValueCommandParams = new LinkedHashMap(); CommandParameterInfo binaryInputBasicpresentValueCommandParameterInfo = - new CommandParameterInfo("value", boolean.class); + new CommandParameterInfo("value", Boolean.class); writeBinaryInputBasicPresentValueCommandParams.put( "value", binaryInputBasicpresentValueCommandParameterInfo); InteractionInfo writeBinaryInputBasicPresentValueAttributeInteractionInfo = @@ -146,7 +146,7 @@ public Map> getWriteAttributeMap() { Map writeColorControlColorControlOptionsCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlcolorControlOptionsCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeColorControlColorControlOptionsCommandParams.put( "value", colorControlcolorControlOptionsCommandParameterInfo); InteractionInfo writeColorControlColorControlOptionsAttributeInteractionInfo = @@ -164,7 +164,7 @@ public Map> getWriteAttributeMap() { Map writeColorControlWhitePointXCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlwhitePointXCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeColorControlWhitePointXCommandParams.put( "value", colorControlwhitePointXCommandParameterInfo); InteractionInfo writeColorControlWhitePointXAttributeInteractionInfo = @@ -181,7 +181,7 @@ public Map> getWriteAttributeMap() { Map writeColorControlWhitePointYCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlwhitePointYCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeColorControlWhitePointYCommandParams.put( "value", colorControlwhitePointYCommandParameterInfo); InteractionInfo writeColorControlWhitePointYAttributeInteractionInfo = @@ -198,7 +198,7 @@ public Map> getWriteAttributeMap() { Map writeColorControlColorPointRXCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlcolorPointRXCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeColorControlColorPointRXCommandParams.put( "value", colorControlcolorPointRXCommandParameterInfo); InteractionInfo writeColorControlColorPointRXAttributeInteractionInfo = @@ -215,7 +215,7 @@ public Map> getWriteAttributeMap() { Map writeColorControlColorPointRYCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlcolorPointRYCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeColorControlColorPointRYCommandParams.put( "value", colorControlcolorPointRYCommandParameterInfo); InteractionInfo writeColorControlColorPointRYAttributeInteractionInfo = @@ -232,7 +232,7 @@ public Map> getWriteAttributeMap() { Map writeColorControlColorPointRIntensityCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlcolorPointRIntensityCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeColorControlColorPointRIntensityCommandParams.put( "value", colorControlcolorPointRIntensityCommandParameterInfo); InteractionInfo writeColorControlColorPointRIntensityAttributeInteractionInfo = @@ -250,7 +250,7 @@ public Map> getWriteAttributeMap() { Map writeColorControlColorPointGXCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlcolorPointGXCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeColorControlColorPointGXCommandParams.put( "value", colorControlcolorPointGXCommandParameterInfo); InteractionInfo writeColorControlColorPointGXAttributeInteractionInfo = @@ -267,7 +267,7 @@ public Map> getWriteAttributeMap() { Map writeColorControlColorPointGYCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlcolorPointGYCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeColorControlColorPointGYCommandParams.put( "value", colorControlcolorPointGYCommandParameterInfo); InteractionInfo writeColorControlColorPointGYAttributeInteractionInfo = @@ -284,7 +284,7 @@ public Map> getWriteAttributeMap() { Map writeColorControlColorPointGIntensityCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlcolorPointGIntensityCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeColorControlColorPointGIntensityCommandParams.put( "value", colorControlcolorPointGIntensityCommandParameterInfo); InteractionInfo writeColorControlColorPointGIntensityAttributeInteractionInfo = @@ -302,7 +302,7 @@ public Map> getWriteAttributeMap() { Map writeColorControlColorPointBXCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlcolorPointBXCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeColorControlColorPointBXCommandParams.put( "value", colorControlcolorPointBXCommandParameterInfo); InteractionInfo writeColorControlColorPointBXAttributeInteractionInfo = @@ -319,7 +319,7 @@ public Map> getWriteAttributeMap() { Map writeColorControlColorPointBYCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlcolorPointBYCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeColorControlColorPointBYCommandParams.put( "value", colorControlcolorPointBYCommandParameterInfo); InteractionInfo writeColorControlColorPointBYAttributeInteractionInfo = @@ -336,7 +336,7 @@ public Map> getWriteAttributeMap() { Map writeColorControlColorPointBIntensityCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlcolorPointBIntensityCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeColorControlColorPointBIntensityCommandParams.put( "value", colorControlcolorPointBIntensityCommandParameterInfo); InteractionInfo writeColorControlColorPointBIntensityAttributeInteractionInfo = @@ -354,7 +354,7 @@ public Map> getWriteAttributeMap() { Map writeColorControlStartUpColorTemperatureMiredsCommandParams = new LinkedHashMap(); CommandParameterInfo colorControlstartUpColorTemperatureMiredsCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeColorControlStartUpColorTemperatureMiredsCommandParams.put( "value", colorControlstartUpColorTemperatureMiredsCommandParameterInfo); InteractionInfo writeColorControlStartUpColorTemperatureMiredsAttributeInteractionInfo = @@ -374,7 +374,7 @@ public Map> getWriteAttributeMap() { Map writeContentLauncherSupportedStreamingProtocolsCommandParams = new LinkedHashMap(); CommandParameterInfo contentLaunchersupportedStreamingProtocolsCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeContentLauncherSupportedStreamingProtocolsCommandParams.put( "value", contentLaunchersupportedStreamingProtocolsCommandParameterInfo); InteractionInfo writeContentLauncherSupportedStreamingProtocolsAttributeInteractionInfo = @@ -414,7 +414,7 @@ public Map> getWriteAttributeMap() { Map writeDoorLockAutoRelockTimeCommandParams = new LinkedHashMap(); CommandParameterInfo doorLockautoRelockTimeCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeDoorLockAutoRelockTimeCommandParams.put( "value", doorLockautoRelockTimeCommandParameterInfo); InteractionInfo writeDoorLockAutoRelockTimeAttributeInteractionInfo = @@ -431,7 +431,7 @@ public Map> getWriteAttributeMap() { Map writeDoorLockSoundVolumeCommandParams = new LinkedHashMap(); CommandParameterInfo doorLocksoundVolumeCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeDoorLockSoundVolumeCommandParams.put("value", doorLocksoundVolumeCommandParameterInfo); InteractionInfo writeDoorLockSoundVolumeAttributeInteractionInfo = new InteractionInfo( @@ -447,7 +447,7 @@ public Map> getWriteAttributeMap() { Map writeDoorLockOperatingModeCommandParams = new LinkedHashMap(); CommandParameterInfo doorLockoperatingModeCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeDoorLockOperatingModeCommandParams.put("value", doorLockoperatingModeCommandParameterInfo); InteractionInfo writeDoorLockOperatingModeAttributeInteractionInfo = new InteractionInfo( @@ -463,7 +463,7 @@ public Map> getWriteAttributeMap() { Map writeDoorLockEnableOneTouchLockingCommandParams = new LinkedHashMap(); CommandParameterInfo doorLockenableOneTouchLockingCommandParameterInfo = - new CommandParameterInfo("value", boolean.class); + new CommandParameterInfo("value", Boolean.class); writeDoorLockEnableOneTouchLockingCommandParams.put( "value", doorLockenableOneTouchLockingCommandParameterInfo); InteractionInfo writeDoorLockEnableOneTouchLockingAttributeInteractionInfo = @@ -481,7 +481,7 @@ public Map> getWriteAttributeMap() { Map writeDoorLockEnablePrivacyModeButtonCommandParams = new LinkedHashMap(); CommandParameterInfo doorLockenablePrivacyModeButtonCommandParameterInfo = - new CommandParameterInfo("value", boolean.class); + new CommandParameterInfo("value", Boolean.class); writeDoorLockEnablePrivacyModeButtonCommandParams.put( "value", doorLockenablePrivacyModeButtonCommandParameterInfo); InteractionInfo writeDoorLockEnablePrivacyModeButtonAttributeInteractionInfo = @@ -499,7 +499,7 @@ public Map> getWriteAttributeMap() { Map writeDoorLockWrongCodeEntryLimitCommandParams = new LinkedHashMap(); CommandParameterInfo doorLockwrongCodeEntryLimitCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeDoorLockWrongCodeEntryLimitCommandParams.put( "value", doorLockwrongCodeEntryLimitCommandParameterInfo); InteractionInfo writeDoorLockWrongCodeEntryLimitAttributeInteractionInfo = @@ -529,7 +529,7 @@ public Map> getWriteAttributeMap() { Map writeGeneralCommissioningBreadcrumbCommandParams = new LinkedHashMap(); CommandParameterInfo generalCommissioningbreadcrumbCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeGeneralCommissioningBreadcrumbCommandParams.put( "value", generalCommissioningbreadcrumbCommandParameterInfo); InteractionInfo writeGeneralCommissioningBreadcrumbAttributeInteractionInfo = @@ -554,7 +554,7 @@ public Map> getWriteAttributeMap() { Map writeIdentifyIdentifyTimeCommandParams = new LinkedHashMap(); CommandParameterInfo identifyidentifyTimeCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeIdentifyIdentifyTimeCommandParams.put("value", identifyidentifyTimeCommandParameterInfo); InteractionInfo writeIdentifyIdentifyTimeAttributeInteractionInfo = new InteractionInfo( @@ -576,7 +576,7 @@ public Map> getWriteAttributeMap() { Map writeLevelControlOptionsCommandParams = new LinkedHashMap(); CommandParameterInfo levelControloptionsCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeLevelControlOptionsCommandParams.put("value", levelControloptionsCommandParameterInfo); InteractionInfo writeLevelControlOptionsAttributeInteractionInfo = new InteractionInfo( @@ -592,7 +592,7 @@ public Map> getWriteAttributeMap() { Map writeLevelControlOnOffTransitionTimeCommandParams = new LinkedHashMap(); CommandParameterInfo levelControlonOffTransitionTimeCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeLevelControlOnOffTransitionTimeCommandParams.put( "value", levelControlonOffTransitionTimeCommandParameterInfo); InteractionInfo writeLevelControlOnOffTransitionTimeAttributeInteractionInfo = @@ -610,7 +610,7 @@ public Map> getWriteAttributeMap() { Map writeLevelControlOnLevelCommandParams = new LinkedHashMap(); CommandParameterInfo levelControlonLevelCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeLevelControlOnLevelCommandParams.put("value", levelControlonLevelCommandParameterInfo); InteractionInfo writeLevelControlOnLevelAttributeInteractionInfo = new InteractionInfo( @@ -626,7 +626,7 @@ public Map> getWriteAttributeMap() { Map writeLevelControlOnTransitionTimeCommandParams = new LinkedHashMap(); CommandParameterInfo levelControlonTransitionTimeCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeLevelControlOnTransitionTimeCommandParams.put( "value", levelControlonTransitionTimeCommandParameterInfo); InteractionInfo writeLevelControlOnTransitionTimeAttributeInteractionInfo = @@ -644,7 +644,7 @@ public Map> getWriteAttributeMap() { Map writeLevelControlOffTransitionTimeCommandParams = new LinkedHashMap(); CommandParameterInfo levelControloffTransitionTimeCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeLevelControlOffTransitionTimeCommandParams.put( "value", levelControloffTransitionTimeCommandParameterInfo); InteractionInfo writeLevelControlOffTransitionTimeAttributeInteractionInfo = @@ -662,7 +662,7 @@ public Map> getWriteAttributeMap() { Map writeLevelControlDefaultMoveRateCommandParams = new LinkedHashMap(); CommandParameterInfo levelControldefaultMoveRateCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeLevelControlDefaultMoveRateCommandParams.put( "value", levelControldefaultMoveRateCommandParameterInfo); InteractionInfo writeLevelControlDefaultMoveRateAttributeInteractionInfo = @@ -679,7 +679,7 @@ public Map> getWriteAttributeMap() { Map writeLevelControlStartUpCurrentLevelCommandParams = new LinkedHashMap(); CommandParameterInfo levelControlstartUpCurrentLevelCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeLevelControlStartUpCurrentLevelCommandParams.put( "value", levelControlstartUpCurrentLevelCommandParameterInfo); InteractionInfo writeLevelControlStartUpCurrentLevelAttributeInteractionInfo = @@ -727,7 +727,7 @@ public Map> getWriteAttributeMap() { Map writeModeSelectOnModeCommandParams = new LinkedHashMap(); CommandParameterInfo modeSelectonModeCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeModeSelectOnModeCommandParams.put("value", modeSelectonModeCommandParameterInfo); InteractionInfo writeModeSelectOnModeAttributeInteractionInfo = new InteractionInfo( @@ -745,7 +745,7 @@ public Map> getWriteAttributeMap() { Map writeNetworkCommissioningInterfaceEnabledCommandParams = new LinkedHashMap(); CommandParameterInfo networkCommissioninginterfaceEnabledCommandParameterInfo = - new CommandParameterInfo("value", boolean.class); + new CommandParameterInfo("value", Boolean.class); writeNetworkCommissioningInterfaceEnabledCommandParams.put( "value", networkCommissioninginterfaceEnabledCommandParameterInfo); InteractionInfo writeNetworkCommissioningInterfaceEnabledAttributeInteractionInfo = @@ -775,7 +775,7 @@ public Map> getWriteAttributeMap() { Map writeOnOffOnTimeCommandParams = new LinkedHashMap(); CommandParameterInfo onOffonTimeCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeOnOffOnTimeCommandParams.put("value", onOffonTimeCommandParameterInfo); InteractionInfo writeOnOffOnTimeAttributeInteractionInfo = new InteractionInfo( @@ -790,7 +790,7 @@ public Map> getWriteAttributeMap() { Map writeOnOffOffWaitTimeCommandParams = new LinkedHashMap(); CommandParameterInfo onOffoffWaitTimeCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeOnOffOffWaitTimeCommandParams.put("value", onOffoffWaitTimeCommandParameterInfo); InteractionInfo writeOnOffOffWaitTimeAttributeInteractionInfo = new InteractionInfo( @@ -806,7 +806,7 @@ public Map> getWriteAttributeMap() { Map writeOnOffStartUpOnOffCommandParams = new LinkedHashMap(); CommandParameterInfo onOffstartUpOnOffCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeOnOffStartUpOnOffCommandParams.put("value", onOffstartUpOnOffCommandParameterInfo); InteractionInfo writeOnOffStartUpOnOffAttributeInteractionInfo = new InteractionInfo( @@ -825,7 +825,7 @@ public Map> getWriteAttributeMap() { Map writeOnOffSwitchConfigurationSwitchActionsCommandParams = new LinkedHashMap(); CommandParameterInfo onOffSwitchConfigurationswitchActionsCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeOnOffSwitchConfigurationSwitchActionsCommandParams.put( "value", onOffSwitchConfigurationswitchActionsCommandParameterInfo); InteractionInfo writeOnOffSwitchConfigurationSwitchActionsAttributeInteractionInfo = @@ -856,7 +856,7 @@ public Map> getWriteAttributeMap() { writePumpConfigurationAndControlLifetimeRunningHoursCommandParams = new LinkedHashMap(); CommandParameterInfo pumpConfigurationAndControllifetimeRunningHoursCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writePumpConfigurationAndControlLifetimeRunningHoursCommandParams.put( "value", pumpConfigurationAndControllifetimeRunningHoursCommandParameterInfo); InteractionInfo writePumpConfigurationAndControlLifetimeRunningHoursAttributeInteractionInfo = @@ -875,7 +875,7 @@ public Map> getWriteAttributeMap() { writePumpConfigurationAndControlLifetimeEnergyConsumedCommandParams = new LinkedHashMap(); CommandParameterInfo pumpConfigurationAndControllifetimeEnergyConsumedCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writePumpConfigurationAndControlLifetimeEnergyConsumedCommandParams.put( "value", pumpConfigurationAndControllifetimeEnergyConsumedCommandParameterInfo); InteractionInfo writePumpConfigurationAndControlLifetimeEnergyConsumedAttributeInteractionInfo = @@ -893,7 +893,7 @@ public Map> getWriteAttributeMap() { Map writePumpConfigurationAndControlOperationModeCommandParams = new LinkedHashMap(); CommandParameterInfo pumpConfigurationAndControloperationModeCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writePumpConfigurationAndControlOperationModeCommandParams.put( "value", pumpConfigurationAndControloperationModeCommandParameterInfo); InteractionInfo writePumpConfigurationAndControlOperationModeAttributeInteractionInfo = @@ -911,7 +911,7 @@ public Map> getWriteAttributeMap() { Map writePumpConfigurationAndControlControlModeCommandParams = new LinkedHashMap(); CommandParameterInfo pumpConfigurationAndControlcontrolModeCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writePumpConfigurationAndControlControlModeCommandParams.put( "value", pumpConfigurationAndControlcontrolModeCommandParameterInfo); InteractionInfo writePumpConfigurationAndControlControlModeAttributeInteractionInfo = @@ -946,7 +946,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterBooleanCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterbooleanCommandParameterInfo = - new CommandParameterInfo("value", boolean.class); + new CommandParameterInfo("value", Boolean.class); writeTestClusterBooleanCommandParams.put("value", testClusterbooleanCommandParameterInfo); InteractionInfo writeTestClusterBooleanAttributeInteractionInfo = new InteractionInfo( @@ -962,7 +962,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterBitmap8CommandParams = new LinkedHashMap(); CommandParameterInfo testClusterbitmap8CommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterBitmap8CommandParams.put("value", testClusterbitmap8CommandParameterInfo); InteractionInfo writeTestClusterBitmap8AttributeInteractionInfo = new InteractionInfo( @@ -978,7 +978,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterBitmap16CommandParams = new LinkedHashMap(); CommandParameterInfo testClusterbitmap16CommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterBitmap16CommandParams.put("value", testClusterbitmap16CommandParameterInfo); InteractionInfo writeTestClusterBitmap16AttributeInteractionInfo = new InteractionInfo( @@ -994,7 +994,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterBitmap32CommandParams = new LinkedHashMap(); CommandParameterInfo testClusterbitmap32CommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterBitmap32CommandParams.put("value", testClusterbitmap32CommandParameterInfo); InteractionInfo writeTestClusterBitmap32AttributeInteractionInfo = new InteractionInfo( @@ -1010,7 +1010,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterBitmap64CommandParams = new LinkedHashMap(); CommandParameterInfo testClusterbitmap64CommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterBitmap64CommandParams.put("value", testClusterbitmap64CommandParameterInfo); InteractionInfo writeTestClusterBitmap64AttributeInteractionInfo = new InteractionInfo( @@ -1026,7 +1026,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt8uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint8uCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterInt8uCommandParams.put("value", testClusterint8uCommandParameterInfo); InteractionInfo writeTestClusterInt8uAttributeInteractionInfo = new InteractionInfo( @@ -1042,7 +1042,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt16uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint16uCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterInt16uCommandParams.put("value", testClusterint16uCommandParameterInfo); InteractionInfo writeTestClusterInt16uAttributeInteractionInfo = new InteractionInfo( @@ -1058,7 +1058,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt24uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint24uCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterInt24uCommandParams.put("value", testClusterint24uCommandParameterInfo); InteractionInfo writeTestClusterInt24uAttributeInteractionInfo = new InteractionInfo( @@ -1074,7 +1074,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt32uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint32uCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterInt32uCommandParams.put("value", testClusterint32uCommandParameterInfo); InteractionInfo writeTestClusterInt32uAttributeInteractionInfo = new InteractionInfo( @@ -1090,7 +1090,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt40uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint40uCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterInt40uCommandParams.put("value", testClusterint40uCommandParameterInfo); InteractionInfo writeTestClusterInt40uAttributeInteractionInfo = new InteractionInfo( @@ -1106,7 +1106,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt48uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint48uCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterInt48uCommandParams.put("value", testClusterint48uCommandParameterInfo); InteractionInfo writeTestClusterInt48uAttributeInteractionInfo = new InteractionInfo( @@ -1122,7 +1122,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt56uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint56uCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterInt56uCommandParams.put("value", testClusterint56uCommandParameterInfo); InteractionInfo writeTestClusterInt56uAttributeInteractionInfo = new InteractionInfo( @@ -1138,7 +1138,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt64uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint64uCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterInt64uCommandParams.put("value", testClusterint64uCommandParameterInfo); InteractionInfo writeTestClusterInt64uAttributeInteractionInfo = new InteractionInfo( @@ -1154,7 +1154,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt8sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint8sCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterInt8sCommandParams.put("value", testClusterint8sCommandParameterInfo); InteractionInfo writeTestClusterInt8sAttributeInteractionInfo = new InteractionInfo( @@ -1170,7 +1170,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt16sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint16sCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterInt16sCommandParams.put("value", testClusterint16sCommandParameterInfo); InteractionInfo writeTestClusterInt16sAttributeInteractionInfo = new InteractionInfo( @@ -1186,7 +1186,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt24sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint24sCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterInt24sCommandParams.put("value", testClusterint24sCommandParameterInfo); InteractionInfo writeTestClusterInt24sAttributeInteractionInfo = new InteractionInfo( @@ -1202,7 +1202,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt32sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint32sCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterInt32sCommandParams.put("value", testClusterint32sCommandParameterInfo); InteractionInfo writeTestClusterInt32sAttributeInteractionInfo = new InteractionInfo( @@ -1218,7 +1218,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt40sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint40sCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterInt40sCommandParams.put("value", testClusterint40sCommandParameterInfo); InteractionInfo writeTestClusterInt40sAttributeInteractionInfo = new InteractionInfo( @@ -1234,7 +1234,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt48sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint48sCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterInt48sCommandParams.put("value", testClusterint48sCommandParameterInfo); InteractionInfo writeTestClusterInt48sAttributeInteractionInfo = new InteractionInfo( @@ -1250,7 +1250,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt56sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint56sCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterInt56sCommandParams.put("value", testClusterint56sCommandParameterInfo); InteractionInfo writeTestClusterInt56sAttributeInteractionInfo = new InteractionInfo( @@ -1266,7 +1266,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterInt64sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterint64sCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterInt64sCommandParams.put("value", testClusterint64sCommandParameterInfo); InteractionInfo writeTestClusterInt64sAttributeInteractionInfo = new InteractionInfo( @@ -1282,7 +1282,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterEnum8CommandParams = new LinkedHashMap(); CommandParameterInfo testClusterenum8CommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterEnum8CommandParams.put("value", testClusterenum8CommandParameterInfo); InteractionInfo writeTestClusterEnum8AttributeInteractionInfo = new InteractionInfo( @@ -1298,7 +1298,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterEnum16CommandParams = new LinkedHashMap(); CommandParameterInfo testClusterenum16CommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterEnum16CommandParams.put("value", testClusterenum16CommandParameterInfo); InteractionInfo writeTestClusterEnum16AttributeInteractionInfo = new InteractionInfo( @@ -1314,7 +1314,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterFloatSingleCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterfloatSingleCommandParameterInfo = - new CommandParameterInfo("value", float.class); + new CommandParameterInfo("value", Float.class); writeTestClusterFloatSingleCommandParams.put( "value", testClusterfloatSingleCommandParameterInfo); InteractionInfo writeTestClusterFloatSingleAttributeInteractionInfo = @@ -1331,7 +1331,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterFloatDoubleCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterfloatDoubleCommandParameterInfo = - new CommandParameterInfo("value", double.class); + new CommandParameterInfo("value", Double.class); writeTestClusterFloatDoubleCommandParams.put( "value", testClusterfloatDoubleCommandParameterInfo); InteractionInfo writeTestClusterFloatDoubleAttributeInteractionInfo = @@ -1415,7 +1415,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterEpochUsCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterepochUsCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterEpochUsCommandParams.put("value", testClusterepochUsCommandParameterInfo); InteractionInfo writeTestClusterEpochUsAttributeInteractionInfo = new InteractionInfo( @@ -1431,7 +1431,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterEpochSCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterepochSCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterEpochSCommandParams.put("value", testClusterepochSCommandParameterInfo); InteractionInfo writeTestClusterEpochSAttributeInteractionInfo = new InteractionInfo( @@ -1447,7 +1447,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterVendorIdCommandParams = new LinkedHashMap(); CommandParameterInfo testClustervendorIdCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterVendorIdCommandParams.put("value", testClustervendorIdCommandParameterInfo); InteractionInfo writeTestClusterVendorIdAttributeInteractionInfo = new InteractionInfo( @@ -1463,7 +1463,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterEnumAttrCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterenumAttrCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterEnumAttrCommandParams.put("value", testClusterenumAttrCommandParameterInfo); InteractionInfo writeTestClusterEnumAttrAttributeInteractionInfo = new InteractionInfo( @@ -1479,7 +1479,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterRangeRestrictedInt8uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterrangeRestrictedInt8uCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterRangeRestrictedInt8uCommandParams.put( "value", testClusterrangeRestrictedInt8uCommandParameterInfo); InteractionInfo writeTestClusterRangeRestrictedInt8uAttributeInteractionInfo = @@ -1497,7 +1497,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterRangeRestrictedInt8sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterrangeRestrictedInt8sCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterRangeRestrictedInt8sCommandParams.put( "value", testClusterrangeRestrictedInt8sCommandParameterInfo); InteractionInfo writeTestClusterRangeRestrictedInt8sAttributeInteractionInfo = @@ -1515,7 +1515,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterRangeRestrictedInt16uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterrangeRestrictedInt16uCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterRangeRestrictedInt16uCommandParams.put( "value", testClusterrangeRestrictedInt16uCommandParameterInfo); InteractionInfo writeTestClusterRangeRestrictedInt16uAttributeInteractionInfo = @@ -1533,7 +1533,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterRangeRestrictedInt16sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterrangeRestrictedInt16sCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterRangeRestrictedInt16sCommandParams.put( "value", testClusterrangeRestrictedInt16sCommandParameterInfo); InteractionInfo writeTestClusterRangeRestrictedInt16sAttributeInteractionInfo = @@ -1551,7 +1551,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterTimedWriteBooleanCommandParams = new LinkedHashMap(); CommandParameterInfo testClustertimedWriteBooleanCommandParameterInfo = - new CommandParameterInfo("value", boolean.class); + new CommandParameterInfo("value", Boolean.class); writeTestClusterTimedWriteBooleanCommandParams.put( "value", testClustertimedWriteBooleanCommandParameterInfo); InteractionInfo writeTestClusterTimedWriteBooleanAttributeInteractionInfo = @@ -1571,7 +1571,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterUnsupportedCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterunsupportedCommandParameterInfo = - new CommandParameterInfo("value", boolean.class); + new CommandParameterInfo("value", Boolean.class); writeTestClusterUnsupportedCommandParams.put( "value", testClusterunsupportedCommandParameterInfo); InteractionInfo writeTestClusterUnsupportedAttributeInteractionInfo = @@ -1588,7 +1588,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableBooleanCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableBooleanCommandParameterInfo = - new CommandParameterInfo("value", boolean.class); + new CommandParameterInfo("value", Boolean.class); writeTestClusterNullableBooleanCommandParams.put( "value", testClusternullableBooleanCommandParameterInfo); InteractionInfo writeTestClusterNullableBooleanAttributeInteractionInfo = @@ -1605,7 +1605,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableBitmap8CommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableBitmap8CommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterNullableBitmap8CommandParams.put( "value", testClusternullableBitmap8CommandParameterInfo); InteractionInfo writeTestClusterNullableBitmap8AttributeInteractionInfo = @@ -1622,7 +1622,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableBitmap16CommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableBitmap16CommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterNullableBitmap16CommandParams.put( "value", testClusternullableBitmap16CommandParameterInfo); InteractionInfo writeTestClusterNullableBitmap16AttributeInteractionInfo = @@ -1639,7 +1639,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableBitmap32CommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableBitmap32CommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterNullableBitmap32CommandParams.put( "value", testClusternullableBitmap32CommandParameterInfo); InteractionInfo writeTestClusterNullableBitmap32AttributeInteractionInfo = @@ -1656,7 +1656,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableBitmap64CommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableBitmap64CommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterNullableBitmap64CommandParams.put( "value", testClusternullableBitmap64CommandParameterInfo); InteractionInfo writeTestClusterNullableBitmap64AttributeInteractionInfo = @@ -1673,7 +1673,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt8uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt8uCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterNullableInt8uCommandParams.put( "value", testClusternullableInt8uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt8uAttributeInteractionInfo = @@ -1690,7 +1690,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt16uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt16uCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterNullableInt16uCommandParams.put( "value", testClusternullableInt16uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt16uAttributeInteractionInfo = @@ -1707,7 +1707,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt24uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt24uCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterNullableInt24uCommandParams.put( "value", testClusternullableInt24uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt24uAttributeInteractionInfo = @@ -1724,7 +1724,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt32uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt32uCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterNullableInt32uCommandParams.put( "value", testClusternullableInt32uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt32uAttributeInteractionInfo = @@ -1741,7 +1741,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt40uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt40uCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterNullableInt40uCommandParams.put( "value", testClusternullableInt40uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt40uAttributeInteractionInfo = @@ -1758,7 +1758,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt48uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt48uCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterNullableInt48uCommandParams.put( "value", testClusternullableInt48uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt48uAttributeInteractionInfo = @@ -1775,7 +1775,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt56uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt56uCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterNullableInt56uCommandParams.put( "value", testClusternullableInt56uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt56uAttributeInteractionInfo = @@ -1792,7 +1792,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt64uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt64uCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterNullableInt64uCommandParams.put( "value", testClusternullableInt64uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt64uAttributeInteractionInfo = @@ -1809,7 +1809,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt8sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt8sCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterNullableInt8sCommandParams.put( "value", testClusternullableInt8sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt8sAttributeInteractionInfo = @@ -1826,7 +1826,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt16sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt16sCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterNullableInt16sCommandParams.put( "value", testClusternullableInt16sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt16sAttributeInteractionInfo = @@ -1843,7 +1843,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt24sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt24sCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterNullableInt24sCommandParams.put( "value", testClusternullableInt24sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt24sAttributeInteractionInfo = @@ -1860,7 +1860,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt32sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt32sCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterNullableInt32sCommandParams.put( "value", testClusternullableInt32sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt32sAttributeInteractionInfo = @@ -1877,7 +1877,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt40sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt40sCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterNullableInt40sCommandParams.put( "value", testClusternullableInt40sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt40sAttributeInteractionInfo = @@ -1894,7 +1894,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt48sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt48sCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterNullableInt48sCommandParams.put( "value", testClusternullableInt48sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt48sAttributeInteractionInfo = @@ -1911,7 +1911,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt56sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt56sCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterNullableInt56sCommandParams.put( "value", testClusternullableInt56sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt56sAttributeInteractionInfo = @@ -1928,7 +1928,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableInt64sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableInt64sCommandParameterInfo = - new CommandParameterInfo("value", long.class); + new CommandParameterInfo("value", Long.class); writeTestClusterNullableInt64sCommandParams.put( "value", testClusternullableInt64sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt64sAttributeInteractionInfo = @@ -1945,7 +1945,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableEnum8CommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableEnum8CommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterNullableEnum8CommandParams.put( "value", testClusternullableEnum8CommandParameterInfo); InteractionInfo writeTestClusterNullableEnum8AttributeInteractionInfo = @@ -1962,7 +1962,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableEnum16CommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableEnum16CommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterNullableEnum16CommandParams.put( "value", testClusternullableEnum16CommandParameterInfo); InteractionInfo writeTestClusterNullableEnum16AttributeInteractionInfo = @@ -1979,7 +1979,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableFloatSingleCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableFloatSingleCommandParameterInfo = - new CommandParameterInfo("value", float.class); + new CommandParameterInfo("value", Float.class); writeTestClusterNullableFloatSingleCommandParams.put( "value", testClusternullableFloatSingleCommandParameterInfo); InteractionInfo writeTestClusterNullableFloatSingleAttributeInteractionInfo = @@ -1997,7 +1997,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableFloatDoubleCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableFloatDoubleCommandParameterInfo = - new CommandParameterInfo("value", double.class); + new CommandParameterInfo("value", Double.class); writeTestClusterNullableFloatDoubleCommandParams.put( "value", testClusternullableFloatDoubleCommandParameterInfo); InteractionInfo writeTestClusterNullableFloatDoubleAttributeInteractionInfo = @@ -2051,7 +2051,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableEnumAttrCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableEnumAttrCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterNullableEnumAttrCommandParams.put( "value", testClusternullableEnumAttrCommandParameterInfo); InteractionInfo writeTestClusterNullableEnumAttrAttributeInteractionInfo = @@ -2068,7 +2068,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableRangeRestrictedInt8uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableRangeRestrictedInt8uCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterNullableRangeRestrictedInt8uCommandParams.put( "value", testClusternullableRangeRestrictedInt8uCommandParameterInfo); InteractionInfo writeTestClusterNullableRangeRestrictedInt8uAttributeInteractionInfo = @@ -2086,7 +2086,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableRangeRestrictedInt8sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableRangeRestrictedInt8sCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterNullableRangeRestrictedInt8sCommandParams.put( "value", testClusternullableRangeRestrictedInt8sCommandParameterInfo); InteractionInfo writeTestClusterNullableRangeRestrictedInt8sAttributeInteractionInfo = @@ -2104,7 +2104,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableRangeRestrictedInt16uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableRangeRestrictedInt16uCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterNullableRangeRestrictedInt16uCommandParams.put( "value", testClusternullableRangeRestrictedInt16uCommandParameterInfo); InteractionInfo writeTestClusterNullableRangeRestrictedInt16uAttributeInteractionInfo = @@ -2122,7 +2122,7 @@ public Map> getWriteAttributeMap() { Map writeTestClusterNullableRangeRestrictedInt16sCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableRangeRestrictedInt16sCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeTestClusterNullableRangeRestrictedInt16sCommandParams.put( "value", testClusternullableRangeRestrictedInt16sCommandParameterInfo); InteractionInfo writeTestClusterNullableRangeRestrictedInt16sAttributeInteractionInfo = @@ -2142,7 +2142,7 @@ public Map> getWriteAttributeMap() { Map writeThermostatOccupiedCoolingSetpointCommandParams = new LinkedHashMap(); CommandParameterInfo thermostatoccupiedCoolingSetpointCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeThermostatOccupiedCoolingSetpointCommandParams.put( "value", thermostatoccupiedCoolingSetpointCommandParameterInfo); InteractionInfo writeThermostatOccupiedCoolingSetpointAttributeInteractionInfo = @@ -2160,7 +2160,7 @@ public Map> getWriteAttributeMap() { Map writeThermostatOccupiedHeatingSetpointCommandParams = new LinkedHashMap(); CommandParameterInfo thermostatoccupiedHeatingSetpointCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeThermostatOccupiedHeatingSetpointCommandParams.put( "value", thermostatoccupiedHeatingSetpointCommandParameterInfo); InteractionInfo writeThermostatOccupiedHeatingSetpointAttributeInteractionInfo = @@ -2178,7 +2178,7 @@ public Map> getWriteAttributeMap() { Map writeThermostatMinHeatSetpointLimitCommandParams = new LinkedHashMap(); CommandParameterInfo thermostatminHeatSetpointLimitCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeThermostatMinHeatSetpointLimitCommandParams.put( "value", thermostatminHeatSetpointLimitCommandParameterInfo); InteractionInfo writeThermostatMinHeatSetpointLimitAttributeInteractionInfo = @@ -2196,7 +2196,7 @@ public Map> getWriteAttributeMap() { Map writeThermostatMaxHeatSetpointLimitCommandParams = new LinkedHashMap(); CommandParameterInfo thermostatmaxHeatSetpointLimitCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeThermostatMaxHeatSetpointLimitCommandParams.put( "value", thermostatmaxHeatSetpointLimitCommandParameterInfo); InteractionInfo writeThermostatMaxHeatSetpointLimitAttributeInteractionInfo = @@ -2214,7 +2214,7 @@ public Map> getWriteAttributeMap() { Map writeThermostatMinCoolSetpointLimitCommandParams = new LinkedHashMap(); CommandParameterInfo thermostatminCoolSetpointLimitCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeThermostatMinCoolSetpointLimitCommandParams.put( "value", thermostatminCoolSetpointLimitCommandParameterInfo); InteractionInfo writeThermostatMinCoolSetpointLimitAttributeInteractionInfo = @@ -2232,7 +2232,7 @@ public Map> getWriteAttributeMap() { Map writeThermostatMaxCoolSetpointLimitCommandParams = new LinkedHashMap(); CommandParameterInfo thermostatmaxCoolSetpointLimitCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeThermostatMaxCoolSetpointLimitCommandParams.put( "value", thermostatmaxCoolSetpointLimitCommandParameterInfo); InteractionInfo writeThermostatMaxCoolSetpointLimitAttributeInteractionInfo = @@ -2250,7 +2250,7 @@ public Map> getWriteAttributeMap() { Map writeThermostatMinSetpointDeadBandCommandParams = new LinkedHashMap(); CommandParameterInfo thermostatminSetpointDeadBandCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeThermostatMinSetpointDeadBandCommandParams.put( "value", thermostatminSetpointDeadBandCommandParameterInfo); InteractionInfo writeThermostatMinSetpointDeadBandAttributeInteractionInfo = @@ -2268,7 +2268,7 @@ public Map> getWriteAttributeMap() { Map writeThermostatControlSequenceOfOperationCommandParams = new LinkedHashMap(); CommandParameterInfo thermostatcontrolSequenceOfOperationCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeThermostatControlSequenceOfOperationCommandParams.put( "value", thermostatcontrolSequenceOfOperationCommandParameterInfo); InteractionInfo writeThermostatControlSequenceOfOperationAttributeInteractionInfo = @@ -2286,7 +2286,7 @@ public Map> getWriteAttributeMap() { Map writeThermostatSystemModeCommandParams = new LinkedHashMap(); CommandParameterInfo thermostatsystemModeCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeThermostatSystemModeCommandParams.put("value", thermostatsystemModeCommandParameterInfo); InteractionInfo writeThermostatSystemModeAttributeInteractionInfo = new InteractionInfo( @@ -2307,7 +2307,7 @@ public Map> getWriteAttributeMap() { new LinkedHashMap(); CommandParameterInfo thermostatUserInterfaceConfigurationtemperatureDisplayModeCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeThermostatUserInterfaceConfigurationTemperatureDisplayModeCommandParams.put( "value", thermostatUserInterfaceConfigurationtemperatureDisplayModeCommandParameterInfo); InteractionInfo @@ -2328,7 +2328,7 @@ public Map> getWriteAttributeMap() { writeThermostatUserInterfaceConfigurationKeypadLockoutCommandParams = new LinkedHashMap(); CommandParameterInfo thermostatUserInterfaceConfigurationkeypadLockoutCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeThermostatUserInterfaceConfigurationKeypadLockoutCommandParams.put( "value", thermostatUserInterfaceConfigurationkeypadLockoutCommandParameterInfo); InteractionInfo writeThermostatUserInterfaceConfigurationKeypadLockoutAttributeInteractionInfo = @@ -2348,7 +2348,7 @@ public Map> getWriteAttributeMap() { new LinkedHashMap(); CommandParameterInfo thermostatUserInterfaceConfigurationscheduleProgrammingVisibilityCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeThermostatUserInterfaceConfigurationScheduleProgrammingVisibilityCommandParams.put( "value", thermostatUserInterfaceConfigurationscheduleProgrammingVisibilityCommandParameterInfo); @@ -2382,7 +2382,7 @@ public Map> getWriteAttributeMap() { Map writeWindowCoveringModeCommandParams = new LinkedHashMap(); CommandParameterInfo windowCoveringmodeCommandParameterInfo = - new CommandParameterInfo("value", int.class); + new CommandParameterInfo("value", Integer.class); writeWindowCoveringModeCommandParams.put("value", windowCoveringmodeCommandParameterInfo); InteractionInfo writeWindowCoveringModeAttributeInteractionInfo = new InteractionInfo( diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 9eaee739ff51d5..839548c13eb0db 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -25,9 +25,9 @@ #import "CHIPCommandPayloadsObjc.h" #import "CHIPDevice.h" #import "CHIPDevice_Internal.h" -#import "CHIPListUtils_internal.h" #import "CHIPStructsObjc.h" +#include #include using chip::Callback::Callback; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm index b4d1325d837cec..9a8c30cc80110d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm @@ -22,11 +22,11 @@ #import "CHIPCluster_internal.h" #import "CHIPDevice.h" #import "CHIPDevice_Internal.h" -#import "CHIPListUtils_internal.h" #import "zap-generated/CHIPTestClustersObjc.h" #import "zap-generated/tests/CHIPClustersTest.h" +#include #include using chip::Callback::Callback;