Package edu.wpi.first.util
Class WPIUtilJNI
java.lang.Object
edu.wpi.first.util.WPIUtilJNI
public final class WPIUtilJNI extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WPIUtilJNI.Helper
-
Constructor Summary
Constructors Constructor Description WPIUtilJNI()
-
Method Summary
Modifier and Type Method Description static void
addPortForwarder(int port, String remoteHost, int remotePort)
static int
createEvent(boolean manualReset, boolean initialState)
static int
createMulticastServiceAnnouncer(String serviceName, String serviceType, int port, String[] keys, String[] values)
static int
createMulticastServiceResolver(String serviceType)
static int
createSemaphore(int initialCount, int maximumCount)
static void
destroyEvent(int eventHandle)
static void
destroySemaphore(int semHandle)
static void
disableMockTime()
static void
enableMockTime()
static void
forceLoad()
Force load the library.static void
freeMulticastServiceAnnouncer(int handle)
static void
freeMulticastServiceResolver(int handle)
static boolean
getMulticastServiceAnnouncerHasImplementation(int handle)
static ServiceData[]
getMulticastServiceResolverData(int handle)
static int
getMulticastServiceResolverEventHandle(int handle)
static boolean
getMulticastServiceResolverHasImplementation(int handle)
static long
getSystemTime()
static long
now()
static boolean
releaseSemaphore(int semHandle, int releaseCount)
static void
removePortForwarder(int port)
static void
resetEvent(int eventHandle)
static void
setEvent(int eventHandle)
static void
setMockTime(long time)
static void
startMulticastServiceAnnouncer(int handle)
static void
startMulticastServiceResolver(int handle)
static void
stopMulticastServiceAnnouncer(int handle)
static void
stopMulticastServiceResolver(int handle)
static void
waitForObject(int handle)
Waits for an handle to be signaled.static int[]
waitForObjects(int[] handles)
Waits for one or more handles to be signaled.static int[]
waitForObjectsTimeout(int[] handles, double timeout)
Waits for one or more handles to be signaled, with timeout.static boolean
waitForObjectTimeout(int handle, double timeout)
Waits for an handle to be signaled, with timeout.
-
Constructor Details
-
WPIUtilJNI
public WPIUtilJNI()
-
-
Method Details
-
forceLoad
Force load the library.- Throws:
IOException
- if the library failed to load
-
enableMockTime
-
disableMockTime
-
setMockTime
-
now
-
getSystemTime
-
addPortForwarder
-
removePortForwarder
-
createEvent
-
destroyEvent
-
setEvent
-
resetEvent
-
createSemaphore
-
destroySemaphore
-
releaseSemaphore
-
waitForObject
Waits for an handle to be signaled.- Parameters:
handle
- handle to wait on- Throws:
InterruptedException
- on failure (e.g. object was destroyed)
-
waitForObjectTimeout
Waits for an handle to be signaled, with timeout.- Parameters:
handle
- handle to wait ontimeout
- timeout in seconds- Returns:
- True if timeout reached without handle being signaled
- Throws:
InterruptedException
- on failure (e.g. object was destroyed)
-
waitForObjects
Waits for one or more handles to be signaled.Invalid handles are treated as signaled; the returned array will have the handle error bit set for any invalid handles.
- Parameters:
handles
- array of handles to wait on- Returns:
- array of signaled handles
- Throws:
InterruptedException
- on failure (e.g. no objects were signaled)
-
waitForObjectsTimeout
public static int[] waitForObjectsTimeout(int[] handles, double timeout) throws InterruptedExceptionWaits for one or more handles to be signaled, with timeout.Invalid handles are treated as signaled; the returned array will have the handle error bit set for any invalid handles.
- Parameters:
handles
- array of handles to wait ontimeout
- timeout in seconds- Returns:
- array of signaled handles; empty if timeout reached without any handle being signaled
- Throws:
InterruptedException
- on failure (e.g. no objects were signaled and no timeout)
-
createMulticastServiceAnnouncer
public static int createMulticastServiceAnnouncer(String serviceName, String serviceType, int port, String[] keys, String[] values) -
freeMulticastServiceAnnouncer
-
startMulticastServiceAnnouncer
-
stopMulticastServiceAnnouncer
-
getMulticastServiceAnnouncerHasImplementation
-
createMulticastServiceResolver
-
freeMulticastServiceResolver
-
startMulticastServiceResolver
-
stopMulticastServiceResolver
-
getMulticastServiceResolverHasImplementation
-
getMulticastServiceResolverEventHandle
-
getMulticastServiceResolverData
-