Skip to content

Commit

Permalink
Give ChipDeviceController.java public method to release connected dev…
Browse files Browse the repository at this point in the history
…ice pointer (#21769)
  • Loading branch information
tehampson authored and pull[bot] committed Sep 14, 2023
1 parent f6a4f1c commit 1122040
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/controller/java/CHIPDeviceController-JNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ JNI_METHOD(void, getConnectedDevicePointer)(JNIEnv * env, jobject self, jlong ha
VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Error invoking GetConnectedDevice"));
}

JNI_METHOD(void, releaseConnectedDevicePointer)(JNIEnv * env, jobject self, jlong devicePtr)
JNI_METHOD(void, releaseOperationalDevicePointer)(JNIEnv * env, jobject self, jlong devicePtr)
{
chip::DeviceLayer::StackLock lock;
OperationalDeviceProxy * device = reinterpret_cast<OperationalDeviceProxy *>(devicePtr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ public void getConnectedDevicePointer(long nodeId, GetConnectedDeviceCallback ca
getConnectedDevicePointer(deviceControllerPtr, nodeId, jniCallback.getCallbackHandle());
}

public void releaseConnectedDevicePointer(long devicePtr) {
releaseOperationalDevicePointer(devicePtr);
}

public boolean disconnectDevice(long deviceId) {
return disconnectDevice(deviceControllerPtr, deviceId);
}
Expand Down Expand Up @@ -630,7 +634,7 @@ private native void commissionDevice(
private native void getConnectedDevicePointer(
long deviceControllerPtr, long deviceId, long callbackHandle);

private native void releaseConnectedDevicePointer(long devicePtr);
private native void releaseOperationalDevicePointer(long devicePtr);

private native boolean disconnectDevice(long deviceControllerPtr, long deviceId);

Expand Down

0 comments on commit 1122040

Please sign in to comment.