public class AnalogInputMonitor extends Object
This class provides static methods to configure the native Pi4J library to listen to GPIO analog input value changes and invoke callbacks into this class. Additionally, this class provides a listener registration allowing Java consumers to subscribe to GPIO analog input value changes.
Modifier and Type | Method and Description |
---|---|
static void |
addListener(AnalogInputListener listener)
Java consumer code can all this method to register itself as a listener for pin analog
input value changes.
|
static int |
disablePinValueChangeCallback(int pin)
This method is used to instruct the native code to stop the monitoring thread monitoring
analog input values on the selected GPIO pin.
|
static int |
enablePinValueChangeCallback(int pin,
int pollingRate,
double changeThreshold)
This method is used to instruct the native code to setup a monitoring thread to monitor
analog input values for changes on the selected GPIO pin.
|
static boolean |
hasListener(AnalogInputListener listener)
Returns true if the listener is already registered for event callbacks.
|
static void |
removeListener(AnalogInputListener listener)
Java consumer code can all this method to unregister itself as a listener for pin analog
input value changes.
|
public static int enablePinValueChangeCallback(int pin, int pollingRate, double changeThreshold)
This method is used to instruct the native code to setup a monitoring thread to monitor analog input values for changes on the selected GPIO pin.
pin
- GPIO pin numberpollingRate
- the polling rate in milliseconds for the input monitoring thread to
read analog input values from the hardwarechangeThreshold
- the amount of change (delta) in the analog input value required before a new
analog input change event is dispatched.public static int disablePinValueChangeCallback(int pin)
This method is used to instruct the native code to stop the monitoring thread monitoring analog input values on the selected GPIO pin.
pin
- GPIO pin numberpublic static void addListener(AnalogInputListener listener)
Java consumer code can all this method to register itself as a listener for pin analog input value changes.
listener
- A class instance that implements the AnalogInputListener interface.AnalogInputListener
,
AnalogInputEvent
public static void removeListener(AnalogInputListener listener)
Java consumer code can all this method to unregister itself as a listener for pin analog input value changes.
listener
- A class instance that implements the AnalogInputListener interface.AnalogInputListener
,
AnalogInputEvent
public static boolean hasListener(AnalogInputListener listener)
Returns true if the listener is already registered for event callbacks.
listener
- A class instance that implements the AnalogInputListener interface.AnalogInputListener
,
AnalogInputEvent
Copyright © 2012–2019 Pi4J. All rights reserved.