diff --git a/scripts/py_matter_idl/matter_idl/generators/java/ChipClusters_java.jinja b/scripts/py_matter_idl/matter_idl/generators/java/ChipClusters_java.jinja index 6c8ad742068684..fb49e5737271b9 100644 --- a/scripts/py_matter_idl/matter_idl/generators/java/ChipClusters_java.jinja +++ b/scripts/py_matter_idl/matter_idl/generators/java/ChipClusters_java.jinja @@ -198,7 +198,7 @@ public class ChipClusters { boolean isFabricFiltered) { ReportCallbackJni jniCallback = new ReportCallbackJni(null, callback, null); ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, attributeId); - ChipDeviceController.read(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, isFabricFiltered, timeoutMillis.orElse(0L).intValue(), null); + ChipInteractionClient.read(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, isFabricFiltered, timeoutMillis.orElse(0L).intValue(), null); } protected void writeAttribute( @@ -209,7 +209,7 @@ public class ChipClusters { WriteAttributesCallbackJni jniCallback = new WriteAttributesCallbackJni(callback); byte[] tlv = encodeToTlv(value); AttributeWriteRequest writeRequest = AttributeWriteRequest.newInstance(endpointId, clusterId, attributeId, tlv); - ChipDeviceController.write(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(writeRequest), timedRequestTimeoutMs, timeoutMillis.orElse(0L).intValue()); + ChipInteractionClient.write(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(writeRequest), timedRequestTimeoutMs, timeoutMillis.orElse(0L).intValue()); } protected void subscribeAttribute( @@ -219,7 +219,7 @@ public class ChipClusters { int maxInterval) { ReportCallbackJni jniCallback = new ReportCallbackJni(callback, callback, null); ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, attributeId); - ChipDeviceController.subscribe(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, minInterval, maxInterval, false, true, timeoutMillis.orElse(0L).intValue(), null); + ChipInteractionClient.subscribe(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, minInterval, maxInterval, false, true, timeoutMillis.orElse(0L).intValue(), null); } protected void invoke( @@ -230,7 +230,7 @@ public class ChipClusters { InvokeCallbackJni jniCallback = new InvokeCallbackJni(callback); byte[] tlv = encodeToTlv(value); InvokeElement element = InvokeElement.newInstance(endpointId, clusterId, commandId, tlv, null); - ChipDeviceController.invoke(0, jniCallback.getCallbackHandle(), devicePtr, element, timedRequestTimeoutMs, timeoutMillis.orElse(0L).intValue()); + ChipInteractionClient.invoke(0, jniCallback.getCallbackHandle(), devicePtr, element, timedRequestTimeoutMs, timeoutMillis.orElse(0L).intValue()); } private static native byte[] encodeToTlv(BaseTLVType value); diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/ChipClusters.java b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/ChipClusters.java index 37c5c031b5c5ae..836940ab4e089f 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/ChipClusters.java +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/ChipClusters.java @@ -121,7 +121,7 @@ protected void readAttribute( boolean isFabricFiltered) { ReportCallbackJni jniCallback = new ReportCallbackJni(null, callback, null); ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, attributeId); - ChipDeviceController.read(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, isFabricFiltered, timeoutMillis.orElse(0L).intValue(), null); + ChipInteractionClient.read(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, isFabricFiltered, timeoutMillis.orElse(0L).intValue(), null); } protected void writeAttribute( @@ -132,7 +132,7 @@ protected void writeAttribute( WriteAttributesCallbackJni jniCallback = new WriteAttributesCallbackJni(callback); byte[] tlv = encodeToTlv(value); AttributeWriteRequest writeRequest = AttributeWriteRequest.newInstance(endpointId, clusterId, attributeId, tlv); - ChipDeviceController.write(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(writeRequest), timedRequestTimeoutMs, timeoutMillis.orElse(0L).intValue()); + ChipInteractionClient.write(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(writeRequest), timedRequestTimeoutMs, timeoutMillis.orElse(0L).intValue()); } protected void subscribeAttribute( @@ -142,7 +142,7 @@ protected void subscribeAttribute( int maxInterval) { ReportCallbackJni jniCallback = new ReportCallbackJni(callback, callback, null); ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, attributeId); - ChipDeviceController.subscribe(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, minInterval, maxInterval, false, true, timeoutMillis.orElse(0L).intValue(), null); + ChipInteractionClient.subscribe(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, minInterval, maxInterval, false, true, timeoutMillis.orElse(0L).intValue(), null); } protected void invoke( @@ -153,7 +153,7 @@ protected void invoke( InvokeCallbackJni jniCallback = new InvokeCallbackJni(callback); byte[] tlv = encodeToTlv(value); InvokeElement element = InvokeElement.newInstance(endpointId, clusterId, commandId, tlv, null); - ChipDeviceController.invoke(0, jniCallback.getCallbackHandle(), devicePtr, element, timedRequestTimeoutMs, timeoutMillis.orElse(0L).intValue()); + ChipInteractionClient.invoke(0, jniCallback.getCallbackHandle(), devicePtr, element, timedRequestTimeoutMs, timeoutMillis.orElse(0L).intValue()); } private static native byte[] encodeToTlv(BaseTLVType value); diff --git a/src/controller/java/AndroidInteractionClient.cpp b/src/controller/java/AndroidInteractionClient.cpp index ec809570bcb1c7..cb59a7bf1718c2 100644 --- a/src/controller/java/AndroidInteractionClient.cpp +++ b/src/controller/java/AndroidInteractionClient.cpp @@ -24,7 +24,6 @@ #include "AndroidInteractionClient.h" #include "AndroidCallbacks.h" -#include "AndroidDeviceControllerWrapper.h" #include diff --git a/src/controller/java/BUILD.gn b/src/controller/java/BUILD.gn index 9342f1330a6b5f..6fd69c09a996ca 100644 --- a/src/controller/java/BUILD.gn +++ b/src/controller/java/BUILD.gn @@ -42,6 +42,42 @@ if (!matter_enable_java_compilation) { import("${build_root}/config/android_abi.gni") } +source_set("android_chip_im") { + sources = [ + "AndroidCallbacks-JNI.cpp", + "AndroidCallbacks.cpp", + "AndroidCallbacks.h", + "AndroidConnectionFailureExceptions.cpp", + "AndroidConnectionFailureExceptions.h", + "AndroidControllerExceptions.cpp", + "AndroidControllerExceptions.h", + "AndroidInteractionClient.cpp", + "AndroidInteractionClient.h", + "BaseCHIPCluster-JNI.cpp", + "CHIPAttributeTLVValueDecoder.h", + "CHIPEventTLVValueDecoder.h", + "CHIPInteractionClient-JNI.cpp", + ] + + if (matter_enable_tlv_decoder_api) { + defines = [ "USE_JAVA_TLV_ENCODE_DECODE" ] + + sources += [ + "CHIPTLVValueDecoder-JNI.cpp", + "zap-generated/CHIPAttributeTLVValueDecoder.cpp", + "zap-generated/CHIPEventTLVValueDecoder.cpp", + ] + } + + public_deps = [ + "${chip_root}/src/app/data-model:heap", + "${chip_root}/src/app/server/java:jni", + "${chip_root}/src/lib", + "${chip_root}/src/lib/support/jsontlv", + "${chip_root}/third_party/inipp", + ] +} + shared_library("jni") { output_name = "libCHIPController" @@ -56,33 +92,21 @@ shared_library("jni") { check_includes = false sources = [ - "AndroidCallbacks-JNI.cpp", - "AndroidCallbacks.cpp", - "AndroidCallbacks.h", "AndroidCheckInDelegate.cpp", "AndroidCheckInDelegate.h", "AndroidClusterExceptions.cpp", "AndroidClusterExceptions.h", "AndroidCommissioningWindowOpener.cpp", "AndroidCommissioningWindowOpener.h", - "AndroidConnectionFailureExceptions.cpp", - "AndroidConnectionFailureExceptions.h", - "AndroidControllerExceptions.cpp", - "AndroidControllerExceptions.h", "AndroidCurrentFabricRemover.cpp", "AndroidCurrentFabricRemover.h", "AndroidDeviceControllerWrapper.cpp", "AndroidDeviceControllerWrapper.h", - "AndroidInteractionClient.cpp", - "AndroidInteractionClient.h", "AndroidOperationalCredentialsIssuer.cpp", "AndroidOperationalCredentialsIssuer.h", "AttestationTrustStoreBridge.cpp", "AttestationTrustStoreBridge.h", - "BaseCHIPCluster-JNI.cpp", - "CHIPAttributeTLVValueDecoder.h", "CHIPDeviceController-JNI.cpp", - "CHIPEventTLVValueDecoder.h", "DeviceAttestation-JNI.cpp", "DeviceAttestationDelegateBridge.cpp", "DeviceAttestationDelegateBridge.h", @@ -92,6 +116,7 @@ shared_library("jni") { ] deps = [ + ":android_chip_im", ":controller_config", "${chip_root}/src/app/icd/client:handler", "${chip_root}/src/app/icd/client:manager", @@ -471,6 +496,7 @@ android_library("java") { "src/chip/devicecontroller/ChipCommandType.java", "src/chip/devicecontroller/ChipDeviceController.java", "src/chip/devicecontroller/ChipDeviceControllerException.java", + "src/chip/devicecontroller/ChipInteractionClient.java", "src/chip/devicecontroller/CommissioningWindowStatus.java", "src/chip/devicecontroller/ConnectionFailureException.java", "src/chip/devicecontroller/ControllerParams.java", diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp index aa1dd41149189e..df3aaf332f2b15 100644 --- a/src/controller/java/CHIPDeviceController-JNI.cpp +++ b/src/controller/java/CHIPDeviceController-JNI.cpp @@ -2260,65 +2260,6 @@ JNI_METHOD(jobject, getICDClientInfo)(JNIEnv * env, jobject self, jlong handle, return jInfo; } -JNI_METHOD(void, subscribe) -(JNIEnv * env, jclass clz, jlong handle, jlong callbackHandle, jlong devicePtr, jobject attributePathList, jobject eventPathList, - jobject dataVersionFilterList, jint minInterval, jint maxInterval, jboolean keepSubscriptions, jboolean isFabricFiltered, - jint imTimeoutMs, jobject eventMin) -{ - CHIP_ERROR err = subscribe(env, handle, callbackHandle, devicePtr, attributePathList, eventPathList, dataVersionFilterList, - minInterval, maxInterval, keepSubscriptions, isFabricFiltered, imTimeoutMs, eventMin); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Controller, "JNI IM Subscribe Error: %" CHIP_ERROR_FORMAT, err.Format()); - } -} - -JNI_METHOD(void, read) -(JNIEnv * env, jclass clz, jlong handle, jlong callbackHandle, jlong devicePtr, jobject attributePathList, jobject eventPathList, - jobject dataVersionFilterList, jboolean isFabricFiltered, jint imTimeoutMs, jobject eventMin) -{ - CHIP_ERROR err = read(env, handle, callbackHandle, devicePtr, attributePathList, eventPathList, dataVersionFilterList, - isFabricFiltered, imTimeoutMs, eventMin); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Controller, "JNI IM Read Error: %" CHIP_ERROR_FORMAT, err.Format()); - } -} - -JNI_METHOD(void, write) -(JNIEnv * env, jclass clz, jlong handle, jlong callbackHandle, jlong devicePtr, jobject attributeList, jint timedRequestTimeoutMs, - jint imTimeoutMs) -{ - CHIP_ERROR err = write(env, handle, callbackHandle, devicePtr, attributeList, timedRequestTimeoutMs, imTimeoutMs); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Controller, "JNI IM Write Error: %" CHIP_ERROR_FORMAT, err.Format()); - } -} - -JNI_METHOD(void, invoke) -(JNIEnv * env, jclass clz, jlong handle, jlong callbackHandle, jlong devicePtr, jobject invokeElement, jint timedRequestTimeoutMs, - jint imTimeoutMs) -{ - CHIP_ERROR err = invoke(env, handle, callbackHandle, devicePtr, invokeElement, timedRequestTimeoutMs, imTimeoutMs); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Controller, "JNI IM Invoke Error: %" CHIP_ERROR_FORMAT, err.Format()); - } -} - -JNI_METHOD(void, extendableInvoke) -(JNIEnv * env, jclass clz, jlong handle, jlong callbackHandle, jlong devicePtr, jobject invokeElementList, - jint timedRequestTimeoutMs, jint imTimeoutMs) -{ - CHIP_ERROR err = - extendableInvoke(env, handle, callbackHandle, devicePtr, invokeElementList, timedRequestTimeoutMs, imTimeoutMs); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Controller, "JNI IM Batch Invoke Error: %" CHIP_ERROR_FORMAT, err.Format()); - } -} - void * IOThreadMain(void * arg) { JNIEnv * env; diff --git a/src/controller/java/CHIPInteractionClient-JNI.cpp b/src/controller/java/CHIPInteractionClient-JNI.cpp new file mode 100644 index 00000000000000..8f2a956b7b58b1 --- /dev/null +++ b/src/controller/java/CHIPInteractionClient-JNI.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "AndroidInteractionClient.h" + +#define JNI_METHOD(RETURN, METHOD_NAME) \ + extern "C" JNIEXPORT RETURN JNICALL Java_chip_devicecontroller_ChipInteractionClient_##METHOD_NAME + +JNI_METHOD(void, subscribe) +(JNIEnv * env, jobject self, jlong handle, jlong callbackHandle, jlong devicePtr, jobject attributePathList, jobject eventPathList, + jint minInterval, jint maxInterval, jboolean keepSubscriptions, jboolean isFabricFiltered, jint imTimeoutMs) +{ + CHIP_ERROR err = subscribe(env, handle, callbackHandle, devicePtr, attributePathList, eventPathList, nullptr, minInterval, + maxInterval, keepSubscriptions, isFabricFiltered, imTimeoutMs, nullptr); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Controller, "JNI IM Subscribe Error: %" CHIP_ERROR_FORMAT, err.Format()); + } +} + +JNI_METHOD(void, read) +(JNIEnv * env, jobject self, jlong handle, jlong callbackHandle, jlong devicePtr, jobject attributePathList, jobject eventPathList, + jboolean isFabricFiltered, jint imTimeoutMs) +{ + CHIP_ERROR err = read(env, handle, callbackHandle, devicePtr, attributePathList, eventPathList, nullptr, isFabricFiltered, + imTimeoutMs, nullptr); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Controller, "JNI IM Read Error: %" CHIP_ERROR_FORMAT, err.Format()); + } +} + +JNI_METHOD(void, write) +(JNIEnv * env, jobject self, jlong handle, jlong callbackHandle, jlong devicePtr, jobject attributeList, jint timedRequestTimeoutMs, + jint imTimeoutMs) +{ + CHIP_ERROR err = write(env, handle, callbackHandle, devicePtr, attributeList, timedRequestTimeoutMs, imTimeoutMs); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Controller, "JNI IM Write Error: %" CHIP_ERROR_FORMAT, err.Format()); + } +} + +JNI_METHOD(void, invoke) +(JNIEnv * env, jobject self, jlong handle, jlong callbackHandle, jlong devicePtr, jobject invokeElement, jint timedRequestTimeoutMs, + jint imTimeoutMs) +{ + CHIP_ERROR err = invoke(env, handle, callbackHandle, devicePtr, invokeElement, timedRequestTimeoutMs, imTimeoutMs); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Controller, "JNI IM Invoke Error: %" CHIP_ERROR_FORMAT, err.Format()); + } +} + +JNI_METHOD(void, extendableInvoke) +(JNIEnv * env, jobject self, jlong handle, jlong callbackHandle, jlong devicePtr, jobject invokeElementList, + jint timedRequestTimeoutMs, jint imTimeoutMs) +{ + CHIP_ERROR err = + extendableInvoke(env, handle, callbackHandle, devicePtr, invokeElementList, timedRequestTimeoutMs, imTimeoutMs); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Controller, "JNI IM Batch Invoke Error: %" CHIP_ERROR_FORMAT, err.Format()); + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index c55a45b77aaca8..66ae0a97ce86a6 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -121,7 +121,7 @@ protected void readAttribute( boolean isFabricFiltered) { ReportCallbackJni jniCallback = new ReportCallbackJni(null, callback, null); ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, attributeId); - ChipDeviceController.read(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, isFabricFiltered, timeoutMillis.orElse(0L).intValue(), null); + ChipInteractionClient.read(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, isFabricFiltered, timeoutMillis.orElse(0L).intValue(), null); } protected void writeAttribute( @@ -132,7 +132,7 @@ protected void writeAttribute( WriteAttributesCallbackJni jniCallback = new WriteAttributesCallbackJni(callback); byte[] tlv = encodeToTlv(value); AttributeWriteRequest writeRequest = AttributeWriteRequest.newInstance(endpointId, clusterId, attributeId, tlv); - ChipDeviceController.write(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(writeRequest), timedRequestTimeoutMs, timeoutMillis.orElse(0L).intValue()); + ChipInteractionClient.write(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(writeRequest), timedRequestTimeoutMs, timeoutMillis.orElse(0L).intValue()); } protected void subscribeAttribute( @@ -142,7 +142,7 @@ protected void subscribeAttribute( int maxInterval) { ReportCallbackJni jniCallback = new ReportCallbackJni(callback, callback, null); ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, attributeId); - ChipDeviceController.subscribe(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, minInterval, maxInterval, false, true, timeoutMillis.orElse(0L).intValue(), null); + ChipInteractionClient.subscribe(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, minInterval, maxInterval, false, true, timeoutMillis.orElse(0L).intValue(), null); } protected void invoke( @@ -153,7 +153,7 @@ protected void invoke( InvokeCallbackJni jniCallback = new InvokeCallbackJni(callback); byte[] tlv = encodeToTlv(value); InvokeElement element = InvokeElement.newInstance(endpointId, clusterId, commandId, tlv, null); - ChipDeviceController.invoke(0, jniCallback.getCallbackHandle(), devicePtr, element, timedRequestTimeoutMs, timeoutMillis.orElse(0L).intValue()); + ChipInteractionClient.invoke(0, jniCallback.getCallbackHandle(), devicePtr, element, timedRequestTimeoutMs, timeoutMillis.orElse(0L).intValue()); } private static native byte[] encodeToTlv(BaseTLVType value); diff --git a/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java b/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java index 3be1a69ca04b41..9c6cd6dc3ed666 100644 --- a/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java +++ b/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java @@ -825,7 +825,7 @@ public void subscribeToAttributePath( int imTimeoutMs) { ReportCallbackJni jniCallback = new ReportCallbackJni(subscriptionEstablishedCallback, reportCallback, null); - subscribe( + ChipInteractionClient.subscribe( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -863,7 +863,7 @@ public void subscribeToEventPath( int imTimeoutMs) { ReportCallbackJni jniCallback = new ReportCallbackJni(subscriptionEstablishedCallback, reportCallback, null); - subscribe( + ChipInteractionClient.subscribe( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -889,7 +889,7 @@ public void subscribeToEventPath( @Nullable Long eventMin) { ReportCallbackJni jniCallback = new ReportCallbackJni(subscriptionEstablishedCallback, reportCallback, null); - subscribe( + ChipInteractionClient.subscribe( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -923,7 +923,7 @@ public void subscribeToPath( ReportCallbackJni jniCallback = new ReportCallbackJni( subscriptionEstablishedCallback, reportCallback, resubscriptionAttemptCallback); - subscribe( + ChipInteractionClient.subscribe( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -975,7 +975,7 @@ public void subscribeToPath( ReportCallbackJni jniCallback = new ReportCallbackJni( subscriptionEstablishedCallback, reportCallback, resubscriptionAttemptCallback); - subscribe( + ChipInteractionClient.subscribe( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -1006,7 +1006,7 @@ public void subscribeToPath( ReportCallbackJni jniCallback = new ReportCallbackJni( subscriptionEstablishedCallback, reportCallback, resubscriptionAttemptCallback); - subscribe( + ChipInteractionClient.subscribe( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -1036,7 +1036,7 @@ public void readAttributePath( List attributePaths, int imTimeoutMs) { ReportCallbackJni jniCallback = new ReportCallbackJni(null, callback, null); - read( + ChipInteractionClient.read( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -1060,7 +1060,7 @@ public void readAttributePath( public void readEventPath( ReportCallback callback, long devicePtr, List eventPaths, int imTimeoutMs) { ReportCallbackJni jniCallback = new ReportCallbackJni(null, callback, null); - read( + ChipInteractionClient.read( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -1080,7 +1080,7 @@ public void readEventPath( int imTimeoutMs, @Nullable Long eventMin) { ReportCallbackJni jniCallback = new ReportCallbackJni(null, callback, null); - read( + ChipInteractionClient.read( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -1101,7 +1101,7 @@ public void readPath( boolean isFabricFiltered, int imTimeoutMs) { ReportCallbackJni jniCallback = new ReportCallbackJni(null, callback, null); - read( + ChipInteractionClient.read( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -1133,7 +1133,7 @@ public void readPath( boolean isFabricFiltered, int imTimeoutMs) { ReportCallbackJni jniCallback = new ReportCallbackJni(null, callback, null); - read( + ChipInteractionClient.read( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -1155,7 +1155,7 @@ public void readPath( int imTimeoutMs, @Nullable Long eventMin) { ReportCallbackJni jniCallback = new ReportCallbackJni(null, callback, null); - read( + ChipInteractionClient.read( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -1184,7 +1184,7 @@ public void write( int timedRequestTimeoutMs, int imTimeoutMs) { WriteAttributesCallbackJni jniCallback = new WriteAttributesCallbackJni(callback); - write( + ChipInteractionClient.write( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -1210,7 +1210,7 @@ public void invoke( int timedRequestTimeoutMs, int imTimeoutMs) { InvokeCallbackJni jniCallback = new InvokeCallbackJni(callback); - invoke( + ChipInteractionClient.invoke( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -1236,7 +1236,7 @@ public void extendableInvoke( int timedRequestTimeoutMs, int imTimeoutMs) { ExtendableInvokeCallbackJni jniCallback = new ExtendableInvokeCallbackJni(callback); - extendableInvoke( + ChipInteractionClient.extendableInvoke( deviceControllerPtr, jniCallback.getCallbackHandle(), devicePtr, @@ -1378,55 +1378,6 @@ public void shutdownCommissioning() { private native PaseVerifierParams computePaseVerifier( long deviceControllerPtr, long devicePtr, long setupPincode, long iterations, byte[] salt); - static native void subscribe( - long deviceControllerPtr, - long callbackHandle, - long devicePtr, - List attributePaths, - List eventPaths, - List dataVersionFilters, - int minInterval, - int maxInterval, - boolean keepSubscriptions, - boolean isFabricFiltered, - int imTimeoutMs, - @Nullable Long eventMin); - - static native void read( - long deviceControllerPtr, - long callbackHandle, - long devicePtr, - List attributePaths, - List eventPaths, - List dataVersionFilters, - boolean isFabricFiltered, - int imTimeoutMs, - @Nullable Long eventMin); - - static native void write( - long deviceControllerPtr, - long callbackHandle, - long devicePtr, - List attributeList, - int timedRequestTimeoutMs, - int imTimeoutMs); - - static native void invoke( - long deviceControllerPtr, - long callbackHandle, - long devicePtr, - InvokeElement invokeElement, - int timedRequestTimeoutMs, - int imTimeoutMs); - - static native void extendableInvoke( - long deviceControllerPtr, - long callbackHandle, - long devicePtr, - List invokeElementList, - int timedRequestTimeoutMs, - int imTimeoutMs); - private native long newDeviceController(ControllerParams params); private native void setDeviceAttestationDelegate( diff --git a/src/controller/java/src/chip/devicecontroller/ChipInteractionClient.java b/src/controller/java/src/chip/devicecontroller/ChipInteractionClient.java new file mode 100644 index 00000000000000..f6ae3c49c441a7 --- /dev/null +++ b/src/controller/java/src/chip/devicecontroller/ChipInteractionClient.java @@ -0,0 +1,60 @@ +package chip.devicecontroller; + +import chip.devicecontroller.model.AttributeWriteRequest; +import chip.devicecontroller.model.ChipAttributePath; +import chip.devicecontroller.model.ChipEventPath; +import chip.devicecontroller.model.DataVersionFilter; +import chip.devicecontroller.model.InvokeElement; +import java.util.List; +import javax.annotation.Nullable; + +public class ChipInteractionClient { + static native void subscribe( + long deviceControllerPtr, + long callbackHandle, + long devicePtr, + List attributePaths, + List eventPaths, + List dataVersionFilters, + int minInterval, + int maxInterval, + boolean keepSubscriptions, + boolean isFabricFiltered, + int imTimeoutMs, + @Nullable Long eventMin); + + static native void read( + long deviceControllerPtr, + long callbackHandle, + long devicePtr, + List attributePaths, + List eventPaths, + List dataVersionFilters, + boolean isFabricFiltered, + int imTimeoutMs, + @Nullable Long eventMin); + + static native void write( + long deviceControllerPtr, + long callbackHandle, + long devicePtr, + List attributeList, + int timedRequestTimeoutMs, + int imTimeoutMs); + + static native void invoke( + long deviceControllerPtr, + long callbackHandle, + long devicePtr, + InvokeElement invokeElement, + int timedRequestTimeoutMs, + int imTimeoutMs); + + static native void extendableInvoke( + long deviceControllerPtr, + long callbackHandle, + long devicePtr, + List invokeElementList, + int timedRequestTimeoutMs, + int imTimeoutMs); +}