mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Add functionality for getting the current network mode (#202)
Use bit flags to indicate a combination of network mode and status.
This commit is contained in:
committed by
Peter Johnson
parent
417cf33f90
commit
f43675e2bd
@@ -1502,6 +1502,17 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
|
||||
nt::StopClient();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
|
||||
* Method: getNetworkMode
|
||||
* Signature: ()
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getNetworkMode
|
||||
(JNIEnv *, jclass)
|
||||
{
|
||||
return nt::GetNetworkMode();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
|
||||
* Method: setServer
|
||||
|
||||
@@ -67,6 +67,12 @@ public class NetworkTablesJNI {
|
||||
}
|
||||
}
|
||||
|
||||
public static final int NT_NET_MODE_NONE = 0x00;
|
||||
public static final int NT_NET_MODE_SERVER = 0x01;
|
||||
public static final int NT_NET_MODE_CLIENT = 0x02;
|
||||
public static final int NT_NET_MODE_STARTING = 0x04;
|
||||
public static final int NT_NET_MODE_FAILURE = 0x08;
|
||||
|
||||
public static native boolean containsKey(String key);
|
||||
public static native int getType(String key);
|
||||
|
||||
@@ -148,6 +154,7 @@ public class NetworkTablesJNI {
|
||||
// public static native byte[] getRpcResultNonblocking(int callUid) throws RpcNoResponseException;
|
||||
|
||||
public static native void setNetworkIdentity(String name);
|
||||
public static native int getNetworkMode();
|
||||
public static native void startServer(String persistFilename, String listenAddress, int port);
|
||||
public static native void stopServer();
|
||||
public static native void startClient();
|
||||
|
||||
Reference in New Issue
Block a user