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 classWPIUtilJNI.Helper -
Constructor Summary
Constructors Constructor Description WPIUtilJNI() -
Method Summary
Modifier and Type Method Description static voidaddPortForwarder(int port, String remoteHost, int remotePort)static intcreateEvent(boolean manualReset, boolean initialState)static intcreateMulticastServiceAnnouncer(String serviceName, String serviceType, int port, String[] keys, String[] values)static intcreateMulticastServiceResolver(String serviceType)static intcreateSemaphore(int initialCount, int maximumCount)static voiddestroyEvent(int eventHandle)static voiddestroySemaphore(int semHandle)static voiddisableMockTime()static voidenableMockTime()static voidforceLoad()Force load the library.static voidfreeMulticastServiceAnnouncer(int handle)static voidfreeMulticastServiceResolver(int handle)static booleangetMulticastServiceAnnouncerHasImplementation(int handle)static ServiceData[]getMulticastServiceResolverData(int handle)static intgetMulticastServiceResolverEventHandle(int handle)static booleangetMulticastServiceResolverHasImplementation(int handle)static longgetSystemTime()static longnow()static booleanreleaseSemaphore(int semHandle, int releaseCount)static voidremovePortForwarder(int port)static voidresetEvent(int eventHandle)static voidsetEvent(int eventHandle)static voidsetMockTime(long time)static voidstartMulticastServiceAnnouncer(int handle)static voidstartMulticastServiceResolver(int handle)static voidstopMulticastServiceAnnouncer(int handle)static voidstopMulticastServiceResolver(int handle)static voidwaitForObject(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 booleanwaitForObjectTimeout(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
-