-
- All Superinterfaces:
Describable,EventProducer,InitializedEventProducer<Context>,com.pi4j.internal.IOCreator,com.pi4j.internal.ProviderAliases,com.pi4j.internal.ProviderProvider,ShutdownEventProducer<Context>
public interface Context extends Describable, com.pi4j.internal.IOCreator, com.pi4j.internal.ProviderProvider, InitializedEventProducer<Context>, ShutdownEventProducer<Context>
Context interface.
- Version:
- $Id: $Id
- Author:
- Robert Savage (http://www.savagehomeautomation.com)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Future<Context>asyncShutdown()ContextConfigconfig()config.default <I extends IO>
Icreate(IOConfig config, IOType ioType)default <T extends IO>
Tcreate(String id)default <T extends IO>
Tcreate(String id, IOType ioType)default <P extends Platform>
PdefaultPlatform()platform.default Descriptordescribe()describe.default <P extends Platform>
PgetDefaultPlatform()platform.default <T extends IO>
TgetIO(String id)default <T extends IO>
TgetIO(String id, Class<T> ioClass)default <P extends Platform>
PgetPlatform()platform.default <P extends Platform>
PgetPlatform(Class<P> platformClass)platform.default <P extends Platform>
PgetPlatform(String id)platform.default booleanhasIO(String id)default booleanhasPlatform(Class<? extends Platform> platformClass)Has platforms.default booleanhasPlatform(String id)platform.default <T extends Provider>
booleanhasProvider(IOType ioType)hasProvider.default <T extends Provider>
booleanhasProvider(Class<T> providerClass)hasProvider.default booleanhasProvider(String providerId)hasProvider.default <T extends IO>
Tio(String id)default <T extends IO>
Tio(String id, Class<T> ioClass)booleanisShutdown()default <P extends Platform>
Pplatform()platform.default <P extends Platform>
Pplatform(Class<P> platformClass)platform.default <P extends Platform>
Pplatform(String id)platform.Platformsplatforms()platforms.ContextPropertiesproperties()properties.default <T extends Provider>
Tprovider(IOType ioType)provider.default <T extends Provider>
Tprovider(Class<T> providerClass)provider.default <T extends Provider>
Tprovider(String providerId)provider.default <T extends Provider>
Tprovider(String providerId, Class<T> providerClass)provider.Providersproviders()providers.Registryregistry()registry.Contextshutdown()shutdown.-
Methods inherited from interface com.pi4j.event.InitializedEventProducer
addListener, removeAllInitializedListeners, removeListener
-
Methods inherited from interface com.pi4j.internal.IOCreator
create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create
-
Methods inherited from interface com.pi4j.internal.ProviderAliases
ain, analogInput, analogOutput, aout, digitalInput, digitalOutput, din, dout, getAnalogInputProvider, getAnalogOutputProvider, getDigitalInputProvider, getDigitalOutputProvider, getI2CProvider, getPwmProvider, getSerialProvider, getSpiProvider, i2c, pwm, serial, spi
-
Methods inherited from interface com.pi4j.internal.ProviderProvider
getProvider, getProvider, getProvider, getProvider
-
Methods inherited from interface com.pi4j.event.ShutdownEventProducer
addListener, removeAllShutdownListeners, removeListener
-
-
-
-
Method Detail
-
config
ContextConfig config()
config.
- Returns:
- a
ContextConfigobject.
-
properties
ContextProperties properties()
properties.
- Returns:
- a
ContextPropertiesobject.
-
shutdown
Context shutdown() throws ShutdownException
shutdown.
- Returns:
- a
Contextobject. - Throws:
ShutdownException- if an error occurs during shutdown.
-
isShutdown
boolean isShutdown()
- Returns:
- Flag indicating if the context has been shutdown
-
platform
default <P extends Platform> P platform()
platform.
- Type Parameters:
P- a P object.- Returns:
- a P object.
-
getPlatform
default <P extends Platform> P getPlatform()
platform.
- Type Parameters:
P- a P object.- Returns:
- a P object.
-
getDefaultPlatform
default <P extends Platform> P getDefaultPlatform()
platform.
- Type Parameters:
P- a P object.- Returns:
- a P object.
-
defaultPlatform
default <P extends Platform> P defaultPlatform()
platform.
- Type Parameters:
P- a P object.- Returns:
- a P object.
-
platform
default <P extends Platform> P platform(String id) throws PlatformNotFoundException
platform.
- Type Parameters:
P- the platform type- Parameters:
id- Id of the platform.- Returns:
- a P object.
- Throws:
PlatformNotFoundException- if platform specified byidis not found.
-
getPlatform
default <P extends Platform> P getPlatform(String id) throws PlatformNotFoundException
platform.
- Type Parameters:
P- the platform type- Parameters:
id- Id of the platform.- Returns:
- a P object.
- Throws:
PlatformNotFoundException- if platform specified byidis not found.
-
hasPlatform
default boolean hasPlatform(String id) throws PlatformNotFoundException
platform.
- Parameters:
id- Id of the platform.- Returns:
- a P object.
- Throws:
PlatformNotFoundException- if platform specified byidis not found.
-
platform
default <P extends Platform> P platform(Class<P> platformClass) throws PlatformNotFoundException
platform.
- Type Parameters:
P- the platform type- Parameters:
platformClass- a P object.- Returns:
- a P object.
- Throws:
PlatformNotFoundException- if platform specified byplatformClassis not found.
-
getPlatform
default <P extends Platform> P getPlatform(Class<P> platformClass) throws PlatformNotFoundException
platform.
- Type Parameters:
P- the platform type- Parameters:
platformClass- a P object.- Returns:
- a P object.
- Throws:
PlatformNotFoundException- if platform specified byplatformClassis not found.
-
hasPlatform
default boolean hasPlatform(Class<? extends Platform> platformClass) throws PlatformNotFoundException
Has platforms.
- Parameters:
platformClass- a P object.- Returns:
boolean- Throws:
PlatformNotFoundException- if platform specified byplatformClassis not found.
-
provider
default <T extends Provider> T provider(String providerId) throws ProviderNotFoundException
provider.
- Specified by:
providerin interfacecom.pi4j.internal.ProviderProvider- Type Parameters:
T- a T object.- Parameters:
providerId- aStringobject.- Returns:
- a T object.
- Throws:
ProviderNotFoundException- if any.
-
provider
default <T extends Provider> T provider(String providerId, Class<T> providerClass) throws ProviderNotFoundException
provider.
- Specified by:
providerin interfacecom.pi4j.internal.ProviderProvider- Type Parameters:
T- the provider type- Parameters:
providerId- aStringobject.providerClass- a T object.- Returns:
- a T object.
- Throws:
ProviderNotFoundException- if any.
-
hasProvider
default boolean hasProvider(String providerId)
hasProvider.
- Specified by:
hasProviderin interfacecom.pi4j.internal.ProviderProvider- Parameters:
providerId- aStringobject.- Returns:
- a boolean.
-
hasProvider
default <T extends Provider> boolean hasProvider(IOType ioType)
hasProvider.
- Specified by:
hasProviderin interfacecom.pi4j.internal.ProviderProvider- Type Parameters:
T- a T object.- Parameters:
ioType- aIOTypeobject.- Returns:
- a boolean.
-
hasProvider
default <T extends Provider> boolean hasProvider(Class<T> providerClass)
hasProvider.
- Specified by:
hasProviderin interfacecom.pi4j.internal.ProviderProvider- Type Parameters:
T- a T object.- Parameters:
providerClass- aClassobject.- Returns:
- a boolean.
-
provider
default <T extends Provider> T provider(Class<T> providerClass) throws ProviderNotFoundException, ProviderInterfaceException
provider.
- Specified by:
providerin interfacecom.pi4j.internal.ProviderProvider- Type Parameters:
T- a T object.- Parameters:
providerClass- aClassobject.- Returns:
- a T object.
- Throws:
ProviderNotFoundException- if any.ProviderInterfaceException- if any.
-
provider
default <T extends Provider> T provider(IOType ioType) throws ProviderNotFoundException
provider.
- Specified by:
providerin interfacecom.pi4j.internal.ProviderAliases- Specified by:
providerin interfacecom.pi4j.internal.ProviderProvider- Type Parameters:
T- a T object.- Parameters:
ioType- aIOTypeobject.- Returns:
- a T object.
- Throws:
ProviderNotFoundException- if the provider specified byioTypecan not be found.
-
create
default <I extends IO> I create(IOConfig config, IOType ioType)
- Specified by:
createin interfacecom.pi4j.internal.IOCreator
-
create
default <T extends IO> T create(String id)
- Specified by:
createin interfacecom.pi4j.internal.IOCreator
-
create
default <T extends IO> T create(String id, IOType ioType)
- Specified by:
createin interfacecom.pi4j.internal.IOCreator
-
hasIO
default boolean hasIO(String id) throws IOInvalidIDException, IONotFoundException
-
io
default <T extends IO> T io(String id) throws IOInvalidIDException, IONotFoundException
-
io
default <T extends IO> T io(String id, Class<T> ioClass) throws IOInvalidIDException, IONotFoundException
-
getIO
default <T extends IO> T getIO(String id) throws IOInvalidIDException, IONotFoundException
-
getIO
default <T extends IO> T getIO(String id, Class<T> ioClass) throws IOInvalidIDException, IONotFoundException
-
describe
default Descriptor describe()
describe.
- Specified by:
describein interfaceDescribable- Returns:
- a
Descriptorobject.
-
-