[Android] Add controller node ID API (#28791)
* Add controller node ID API
* Restyled by google-java-format
---------
Co-authored-by: Restyled.io <commits@restyled.io>
diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp
index be7bfa6..d4c0dd9 100644
--- a/src/controller/java/CHIPDeviceController-JNI.cpp
+++ b/src/controller/java/CHIPDeviceController-JNI.cpp
@@ -1405,6 +1405,15 @@
return wrapper->Controller()->GetCompressedFabricId();
}
+JNI_METHOD(jlong, getControllerNodeId)(JNIEnv * env, jobject self, jlong handle)
+{
+ chip::DeviceLayer::StackLock lock;
+
+ AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle);
+
+ return wrapper->Controller()->GetNodeId();
+}
+
JNI_METHOD(void, discoverCommissionableNodes)(JNIEnv * env, jobject self, jlong handle)
{
chip::DeviceLayer::StackLock lock;
diff --git a/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java b/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java
index 33cb7a9..d638552 100644
--- a/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java
+++ b/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java
@@ -468,6 +468,11 @@
return getCompressedFabricId(deviceControllerPtr);
}
+ /** Get device Controller's Node ID. */
+ public long getControllerNodeId() {
+ return getControllerNodeId(deviceControllerPtr);
+ }
+
/**
* Returns the compressed fabric ID based on the given root certificate and node operational
* credentials.
@@ -1161,6 +1166,8 @@
private native long getCompressedFabricId(long deviceControllerPtr);
+ private native long getControllerNodeId(long deviceControllerPtr);
+
private native void discoverCommissionableNodes(long deviceControllerPtr);
private native DiscoveredDevice getDiscoveredDevice(long deviceControllerPtr, int idx);