- 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<DigitalOutput,DigitalOutputConfig,DigitalOutputProvider>
-
- com.pi4j.io.gpio.digital.DigitalOutputBase
-
- All Implemented Interfaces:
Describable
,Identity
,Lifecycle
,Extension
,Bindable<DigitalOutput,DigitalBinding>
,Digital<DigitalOutput,DigitalOutputConfig,DigitalOutputProvider>
,DigitalOutput
,com.pi4j.io.gpio.Gpio<DigitalOutput,DigitalOutputConfig,DigitalOutputProvider>
,IO<DigitalOutput,DigitalOutputConfig,DigitalOutputProvider>
,OnOff<DigitalOutput>
,OnOffRead<DigitalOutput>
,OnOffWrite<DigitalOutput>
,Output
public abstract class DigitalOutputBase extends DigitalBase<DigitalOutput,DigitalOutputConfig,DigitalOutputProvider> implements DigitalOutput
Abstract DigitalOutputBase class.
- Version:
- $Id: $Id
- Author:
- Robert Savage (http://www.savagehomeautomation.com)
-
-
Field Summary
Fields Modifier and Type Field Description protected DigitalState
state
-
Fields inherited from class com.pi4j.io.gpio.digital.DigitalBase
bindings, stateChangeEventManager
-
Fields inherited from class com.pi4j.common.IdentityBase
description, id, logger, metadata, name
-
-
Constructor Summary
Constructors Constructor Description DigitalOutputBase(DigitalOutputProvider provider, DigitalOutputConfig config)
Constructor for DigitalOutputBase.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DigitalOutput
blink(int delay, int duration, TimeUnit unit, DigitalState state, Callable<Void> callback)
blink.Future<?>
blinkAsync(int delay, int duration, TimeUnit unit, DigitalState state, Callable<Void> callback)
blinkAsync.DigitalOutput
initialize(Context context)
initialize.DigitalOutput
off()
DigitalOutput
on()
DigitalOutput
pulse(int interval, TimeUnit unit, DigitalState state, Callable<Void> callback)
pulse.Future<?>
pulseAsync(int interval, TimeUnit unit, DigitalState state, Callable<Void> callback)
pulseAsync.DigitalOutput
shutdown(Context context)
shutdown.DigitalState
state()
state.DigitalOutput
state(DigitalState state)
state.-
Methods inherited from class com.pi4j.io.gpio.digital.DigitalBase
addListener, bind, dispatch, isOn, removeListener, unbind
-
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
addListener, equals, equals, equals, equals, equals, equals, equals, equals, equals, isHigh, isLow, removeListener
-
Methods inherited from interface com.pi4j.io.gpio.digital.DigitalOutput
blink, blink, blink, blinkAsync, blinkAsync, blinkAsync, high, low, pulse, pulse, pulseAsync, pulseAsync, pulseHigh, pulseHighAsync, pulseLow, pulseLowAsync, setState, setState, setState, setState, setState, setState, setState, toggle
-
Methods inherited from interface com.pi4j.common.Identity
description, getDescription, getId, getMetadata, getName, id, metadata, name
-
-
-
-
Field Detail
-
state
protected DigitalState state
-
-
Constructor Detail
-
DigitalOutputBase
public DigitalOutputBase(DigitalOutputProvider provider, DigitalOutputConfig config)
Constructor for DigitalOutputBase.
- Parameters:
provider
- aDigitalOutputProvider
object.config
- aDigitalOutputConfig
object.
-
-
Method Detail
-
initialize
public DigitalOutput initialize(Context context) throws InitializeException
initialize.
- Specified by:
initialize
in interfaceLifecycle
- Overrides:
initialize
in classIOBase<DigitalOutput,DigitalOutputConfig,DigitalOutputProvider>
- Parameters:
context
- aContext
object.- Returns:
- a T object.
- Throws:
InitializeException
- if an error occurs during initialization.
-
state
public DigitalOutput state(DigitalState state) throws IOException
state.
- Specified by:
state
in interfaceDigitalOutput
- Parameters:
state
- aDigitalState
object.- Returns:
- a
DigitalOutput
object. - Throws:
IOException
- if any.
-
pulse
public DigitalOutput pulse(int interval, TimeUnit unit, DigitalState state, Callable<Void> callback) throws IOException
pulse.
- Specified by:
pulse
in interfaceDigitalOutput
- Parameters:
interval
- a int.unit
- aTimeUnit
object.state
- aDigitalState
object.callback
- aCallable
object.- Returns:
- a
DigitalOutput
object. - Throws:
IOException
- if any.
-
pulseAsync
public Future<?> pulseAsync(int interval, TimeUnit unit, DigitalState state, Callable<Void> callback)
pulseAsync.
- Specified by:
pulseAsync
in interfaceDigitalOutput
- Parameters:
interval
- a int.unit
- aTimeUnit
object.state
- aDigitalState
object.callback
- aCallable
object.- Returns:
- a
Future
object.
-
blink
public DigitalOutput blink(int delay, int duration, TimeUnit unit, DigitalState state, Callable<Void> callback)
blink.
- Specified by:
blink
in interfaceDigitalOutput
- Parameters:
delay
- a int.duration
- a int.unit
- aTimeUnit
object.state
- aDigitalState
object.callback
- aCallable
object.- Returns:
- a
DigitalOutput
object.
-
blinkAsync
public Future<?> blinkAsync(int delay, int duration, TimeUnit unit, DigitalState state, Callable<Void> callback)
blinkAsync.
- Specified by:
blinkAsync
in interfaceDigitalOutput
- Parameters:
delay
- a int.duration
- a int.unit
- aTimeUnit
object.state
- aDigitalState
object.callback
- aCallable
object.- Returns:
- a
Future
object.
-
state
public DigitalState state()
state.
- Specified by:
state
in interfaceDigital<DigitalOutput,DigitalOutputConfig,DigitalOutputProvider>
- Returns:
- a
DigitalState
object.
-
shutdown
public DigitalOutput shutdown(Context context) throws ShutdownException
shutdown.
- Specified by:
shutdown
in interfaceLifecycle
- Overrides:
shutdown
in classDigitalBase<DigitalOutput,DigitalOutputConfig,DigitalOutputProvider>
- Parameters:
context
- aContext
object.- Returns:
- a T object.
- Throws:
ShutdownException
- if an error occurs during shutdown.
-
on
public DigitalOutput on() throws IOException
- Specified by:
on
in interfaceOnOffWrite<DigitalOutput>
- Throws:
IOException
-
off
public DigitalOutput off() throws IOException
- Specified by:
off
in interfaceOnOffWrite<DigitalOutput>
- Throws:
IOException
-
-