Module com.pi4j
Package com.pi4j.io.gpio.digital
Class DigitalBase<DIGITAL_TYPE extends Digital<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>,CONFIG_TYPE extends DigitalConfig<CONFIG_TYPE>,PROVIDER_TYPE extends DigitalProvider>
- java.lang.Object
-
- com.pi4j.common.IdentityBase
-
- com.pi4j.io.IOBase<IO_TYPE,CONFIG_TYPE,PROVIDER_TYPE>
-
- com.pi4j.io.gpio.GpioBase<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>
-
- com.pi4j.io.gpio.digital.DigitalBase<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>
-
- All Implemented Interfaces:
Describable
,Identity
,Lifecycle
,Extension
,Bindable<DIGITAL_TYPE,DigitalBinding>
,Digital<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>
,com.pi4j.io.gpio.Gpio<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>
,IO<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>
,OnOffRead<DIGITAL_TYPE>
- Direct Known Subclasses:
DigitalInputBase
,DigitalOutputBase
public abstract class DigitalBase<DIGITAL_TYPE extends Digital<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>,CONFIG_TYPE extends DigitalConfig<CONFIG_TYPE>,PROVIDER_TYPE extends DigitalProvider> extends com.pi4j.io.gpio.GpioBase<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE> implements Digital<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>, Bindable<DIGITAL_TYPE,DigitalBinding>
Abstract DigitalBase class.
- Version:
- $Id: $Id
- Author:
- Robert Savage (http://www.savagehomeautomation.com)
-
-
Field Summary
Fields Modifier and Type Field Description protected BindingManager<DIGITAL_TYPE,DigitalBinding,DigitalStateChangeEvent>
bindings
protected EventManager<DIGITAL_TYPE,DigitalStateChangeListener,DigitalStateChangeEvent>
stateChangeEventManager
-
Fields inherited from class com.pi4j.common.IdentityBase
description, id, logger, metadata, name
-
-
Constructor Summary
Constructors Constructor Description DigitalBase(PROVIDER_TYPE provider, CONFIG_TYPE config)
Constructor for DigitalBase.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DIGITAL_TYPE
addListener(DigitalStateChangeListener... listener)
addListener.DIGITAL_TYPE
bind(DigitalBinding... binding)
bind.protected void
dispatch(DigitalStateChangeEvent event)
Dispatch DigitalChangeEvent on digital input state changesboolean
isOn()
DIGITAL_TYPE
removeListener(DigitalStateChangeListener... listener)
removeListener.DIGITAL_TYPE
shutdown(Context context)
shutdown.DIGITAL_TYPE
unbind(DigitalBinding... binding)
unbind.-
Methods inherited from class com.pi4j.io.IOBase
config, describe, description, initialize, name, provider
-
Methods inherited from class com.pi4j.common.IdentityBase
description, id, metadata, name
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.pi4j.io.gpio.digital.Digital
equals, equals, equals, equals, equals, equals, equals, equals, equals, isHigh, isLow, state
-
Methods inherited from interface com.pi4j.common.Identity
description, getDescription, getId, getMetadata, getName, id, metadata, name
-
Methods inherited from interface com.pi4j.common.Lifecycle
initialize
-
-
-
-
Field Detail
-
stateChangeEventManager
protected final EventManager<DIGITAL_TYPE extends Digital<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>,DigitalStateChangeListener,DigitalStateChangeEvent> stateChangeEventManager
-
bindings
protected BindingManager<DIGITAL_TYPE extends Digital<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>,DigitalBinding,DigitalStateChangeEvent> bindings
-
-
Constructor Detail
-
DigitalBase
public DigitalBase(PROVIDER_TYPE provider, CONFIG_TYPE config)
Constructor for DigitalBase.
- Parameters:
provider
- a PROVIDER_TYPE object.config
- a CONFIG_TYPE object.
-
-
Method Detail
-
addListener
public DIGITAL_TYPE addListener(DigitalStateChangeListener... listener)
addListener.
- Specified by:
addListener
in interfaceDigital<DIGITAL_TYPE extends Digital<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>,CONFIG_TYPE extends DigitalConfig<CONFIG_TYPE>,PROVIDER_TYPE extends DigitalProvider>
- Parameters:
listener
- aDigitalStateChangeListener
object.- Returns:
- a DIGITAL_TYPE object.
-
removeListener
public DIGITAL_TYPE removeListener(DigitalStateChangeListener... listener)
removeListener.
- Specified by:
removeListener
in interfaceDigital<DIGITAL_TYPE extends Digital<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>,CONFIG_TYPE extends DigitalConfig<CONFIG_TYPE>,PROVIDER_TYPE extends DigitalProvider>
- Parameters:
listener
- aDigitalStateChangeListener
object.- Returns:
- a DIGITAL_TYPE object.
-
bind
public DIGITAL_TYPE bind(DigitalBinding... binding)
bind.
- Specified by:
bind
in interfaceBindable<DIGITAL_TYPE extends Digital<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>,CONFIG_TYPE extends DigitalConfig<CONFIG_TYPE>>
- Parameters:
binding
- aBindable
object.- Returns:
- a DIGITAL_TYPE object.
-
unbind
public DIGITAL_TYPE unbind(DigitalBinding... binding)
unbind.
- Specified by:
unbind
in interfaceBindable<DIGITAL_TYPE extends Digital<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>,CONFIG_TYPE extends DigitalConfig<CONFIG_TYPE>>
- Parameters:
binding
- aBindable
object.- Returns:
- a DIGITAL_TYPE object.
-
dispatch
protected void dispatch(DigitalStateChangeEvent event)
Dispatch DigitalChangeEvent on digital input state changes- Parameters:
event
- DigitalChangeEvent
-
shutdown
public DIGITAL_TYPE shutdown(Context context) throws ShutdownException
shutdown.
- Specified by:
shutdown
in interfaceLifecycle<DIGITAL_TYPE extends Digital<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>>
- Overrides:
shutdown
in classIOBase<DIGITAL_TYPE extends Digital<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>,CONFIG_TYPE extends DigitalConfig<CONFIG_TYPE>,PROVIDER_TYPE extends DigitalProvider>
- Parameters:
context
- aContext
object.- Returns:
- a T object.
- Throws:
ShutdownException
- if an error occurs during shutdown.
-
isOn
public boolean isOn()
- Specified by:
isOn
in interfaceOnOffRead<DIGITAL_TYPE extends Digital<DIGITAL_TYPE,CONFIG_TYPE,PROVIDER_TYPE>>
-
-