public class SerialInterrupt extends Object
This class provides static methods to configure the native Pi4J library to listen to serial interrupts and invoke callbacks into this class. Additionally, this class provides a listener registration allowing Java consumers to subscribe to serial data receive events.
Modifier and Type | Method and Description |
---|---|
static void |
addListener(int fileDescriptor,
SerialInterruptListener listener)
Java consumer code can all this method to register itself as a listener for pin state
changes.
|
static int |
disableSerialDataReceiveCallback(int fileDescriptor)
This method is used to instruct the native code to stop the monitoring thread monitoring
interrupts on the selected serial port.
|
static int |
enableSerialDataReceiveCallback(int fileDescriptor)
This method is used to instruct the native code to setup a monitoring thread to monitor
interrupts that represent changes to the selected serial port.
|
static boolean |
hasListener(int fileDescriptor)
Returns true if the listener is already registered for event callbacks.
|
static void |
removeListener(int fileDescriptor)
Java consumer code can all this method to unregister itself as a listener for pin state
changes.
|
public static int enableSerialDataReceiveCallback(int fileDescriptor)
This method is used to instruct the native code to setup a monitoring thread to monitor interrupts that represent changes to the selected serial port.
fileDescriptor
- the serial file descriptor/handlepublic static int disableSerialDataReceiveCallback(int fileDescriptor)
This method is used to instruct the native code to stop the monitoring thread monitoring interrupts on the selected serial port.
fileDescriptor
- the serial file descriptor/handlepublic static void addListener(int fileDescriptor, SerialInterruptListener listener)
Java consumer code can all this method to register itself as a listener for pin state changes.
fileDescriptor
- the serial file descriptor/handlelistener
- A class instance that implements the GpioInterruptListener interface.SerialInterruptListener
,
SerialInterruptEvent
public static void removeListener(int fileDescriptor)
Java consumer code can all this method to unregister itself as a listener for pin state changes.
fileDescriptor
- the serial file descriptor/handleSerialInterruptListener
,
SerialInterruptEvent
public static boolean hasListener(int fileDescriptor)
Returns true if the listener is already registered for event callbacks.
fileDescriptor
- the serial file descriptor/handleSerialInterruptListener
,
SerialInterruptEvent
Copyright © 2012–2021 Pi4J. All rights reserved.