Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 6c6aea3

Browse files
committed
Ensure that N2J_NetworkInfo uses Make function with Channel and PAN ID
Currently this JNI conversion is using the NetworkInfo.Make() overload which does not take in a channel and PAN ID. Unfortunately, JNI doesn't complain if you pass too many arguments with the invocation, so the channel and PAN ID were being ignored. Additionally, although the ThreadChannel is only a uint_8, the method is declared in Java as an integer, so changed the cast to a jint instead.
1 parent 7a0d846 commit 6c6aea3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/device-manager/java/WeaveDeviceManager-JNI.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3113,7 +3113,7 @@ WEAVE_ERROR N2J_NetworkInfo(JNIEnv *env, const NetworkInfo& inNetworkInfo, jobje
31133113
SuccessOrExit(err);
31143114
}
31153115

3116-
makeMethod = env->GetStaticMethodID(sNetworkInfoCls, "Make", "(IJLjava/lang/String;III[BLjava/lang/String;[B[BS)Lnl/Weave/DeviceManager/NetworkInfo;");
3116+
makeMethod = env->GetStaticMethodID(sNetworkInfoCls, "Make", "(IJLjava/lang/String;III[BLjava/lang/String;[B[BSII)Lnl/Weave/DeviceManager/NetworkInfo;");
31173117
VerifyOrExit(makeMethod != NULL, err = WDM_JNI_ERROR_METHOD_NOT_FOUND);
31183118

31193119
env->ExceptionClear();
@@ -3130,7 +3130,7 @@ WEAVE_ERROR N2J_NetworkInfo(JNIEnv *env, const NetworkInfo& inNetworkInfo, jobje
31303130
threadKey,
31313131
(jshort)inNetworkInfo.WirelessSignalStrength,
31323132
(jint)inNetworkInfo.ThreadPANId,
3133-
(jbyte)inNetworkInfo.ThreadChannel);
3133+
(jint)inNetworkInfo.ThreadChannel);
31343134
VerifyOrExit(!env->ExceptionCheck(), err = WDM_JNI_ERROR_EXCEPTION_THROWN);
31353135

31363136
exit:

0 commit comments

Comments
 (0)