Package com.tccc.kos.core.service.gpio
Class GpioService
java.lang.Object
com.tccc.kos.commons.util.ready.ReadyBean
com.tccc.kos.commons.core.service.AbstractService
com.tccc.kos.core.service.gpio.GpioService
- All Implemented Interfaces:
CtxEventListener
,ContextHandleAware
,HandleAware
,Ready
,ReadyAndReadyListener
,ReadyListener
This service provides a way to interact with GPIO pins on the main cpu board.
The GPIO adapter needs to be spawned which will then connect a session to this
service.
- Version:
- 2025-06-19
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(int pin, GpioListener listener) Add a listener for gpio events, on the local node.void
addListener
(NodeId nodeId, int pin, GpioListener listener) Add a listener for gpio events, on the specified node.createInputPin
(NodeId nodeId, String name, int pin, boolean inverted, GpioInputPinListener listener) Create an input pin with the specified name for the specified node.createInputPin
(String name, int pin, boolean inverted, GpioInputPinListener listener) Create an input pin with the specified name for the local node.createOutputPin
(int pin, boolean inverted, GpioOutputPinListener listener) Create an output pin for the specified pin number, on the local node.createOutputPin
(NodeId nodeId, int pin, boolean inverted, GpioOutputPinListener listener) Create an output pin for the specified pin number, on the specified node.Methods inherited from class com.tccc.kos.commons.core.service.AbstractService
getHandle, getHandlePrefix
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tccc.kos.commons.core.context.CtxEventListener
onCtxAutowiringCompleted, onCtxDestroyed, onCtxPhaseCompleted
Methods inherited from interface com.tccc.kos.commons.core.service.handle.HandleAware
addHandleChild, getName, getPath
Methods inherited from interface com.tccc.kos.commons.util.ready.ReadyAndReadyListener
onBeanReady, onDependenciesReady
Methods inherited from interface com.tccc.kos.commons.util.ready.ReadyListener
onDependenciesGroupReady
-
Method Details
-
createInputPin
public GpioInputPin createInputPin(String name, int pin, boolean inverted, GpioInputPinListener listener) Create an input pin with the specified name for the local node. Allows the physical signal to be inverted to take advantage of the debouncing which is fast on, slow off.- Parameters:
name
- the name of the pin beanpin
- the pin numberinverted
- if true, invert the physical signallistener
- listener for pin change events
-
createInputPin
public GpioInputPin createInputPin(NodeId nodeId, String name, int pin, boolean inverted, GpioInputPinListener listener) Create an input pin with the specified name for the specified node. Allows the physical signal to be inverted to take advantage of the debouncing which is fast on, slow off.- Parameters:
name
- the name of the pin beanpin
- the pin numberinverted
- if true, invert the physical signallistener
- listener for pin change events
-
createOutputPin
Create an output pin for the specified pin number, on the local node.- Parameters:
pin
- the pin numberinverted
- if true, invert the output signallistener
- the output pin listener
-
createOutputPin
public GpioOutputPin createOutputPin(NodeId nodeId, int pin, boolean inverted, GpioOutputPinListener listener) Create an output pin for the specified pin number, on the specified node.- Parameters:
pin
- the pin numberinverted
- if true, invert the output signallistener
- the output pin listener
-
addListener
Add a listener for gpio events, on the local node.- Parameters:
pin
- the pin to get events fromlistener
- the listener to add
-
addListener
Add a listener for gpio events, on the specified node.- Parameters:
pin
- the pin to get events fromlistener
- the listener to add
-
getManifestService
-