Skip to content

Commit

Permalink
[Android] Add controller node ID API (#28791)
Browse files Browse the repository at this point in the history
* Add controller node ID API

* Restyled by google-java-format

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Jan 19, 2024
1 parent aeb846c commit 1587436
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/controller/java/CHIPDeviceController-JNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,15 @@ JNI_METHOD(jlong, getCompressedFabricId)(JNIEnv * env, jobject self, jlong handl
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,11 @@ public long getCompressedFabricId() {
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.
Expand Down Expand Up @@ -1161,6 +1166,8 @@ private native void getConnectedDevicePointer(

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);
Expand Down

0 comments on commit 1587436

Please sign in to comment.