- 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
Modifier and TypeMethodDescriptionconfig()config.default <I extends IO>
Idefault <T extends IO>
Tdefault <T extends IO>
Tdefault <P extends Platform>
Pplatform.default Descriptordescribe()describe.default <P extends Platform>
Pplatform.default <T extends IO>
Tdefault <T extends IO>
Tdefault <P extends Platform>
Pplatform.default <P extends Platform>
PgetPlatform(Class<P> platformClass) platform.default <P extends Platform>
PgetPlatform(String id) platform.default booleandefault 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>
Tdefault <T extends IO>
Tbooleandefault <P extends Platform>
Pplatform()platform.default <P extends Platform>
Pplatform.default <P extends Platform>
Pplatform.platforms.properties.default <T extends Provider>
Tprovider.default <T extends Provider>
Tprovider.default <T extends Provider>
Tprovider.default <T extends Provider>
Tprovider.providers.registry()registry.shutdown()shutdown.<T extends IO>
Tshutdown and unregister a created IO.Methods inherited from interface com.pi4j.event.InitializedEventProducer
addListener, removeAllInitializedListeners, removeListenerMethods 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, createMethods 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, spiMethods inherited from interface com.pi4j.internal.ProviderProvider
getProvider, getProvider, getProvider, getProviderMethods inherited from interface com.pi4j.event.ShutdownEventProducer
addListener, removeAllShutdownListeners, removeListener
-
Method Details
-
config
ContextConfig config()config.
- Returns:
- a
ContextConfigobject.
-
properties
ContextProperties properties()properties.
- Returns:
- a
ContextPropertiesobject.
-
providers
Providers providers()providers.
- Returns:
- a
Providersobject.
-
registry
Registry registry()registry.
- Returns:
- a
Registryobject.
-
platforms
Platforms platforms()platforms.
- Returns:
- a
Platformsobject.
-
shutdown
shutdown.
- Returns:
- a
Contextobject. - Throws:
ShutdownException- if an error occurs during shutdown.
-
asyncShutdown
-
isShutdown
boolean isShutdown()- Returns:
- Flag indicating if the context has been shutdown
-
platform
platform.
- Type Parameters:
P- a P object.- Returns:
- a P object.
-
getPlatform
platform.
- Type Parameters:
P- a P object.- Returns:
- a P object.
-
getDefaultPlatform
platform.
- Type Parameters:
P- a P object.- Returns:
- a P object.
-
defaultPlatform
platform.
- Type Parameters:
P- a P object.- Returns:
- a P object.
-
platform
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
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
platform.
- Parameters:
id- Id of the platform.- Returns:
- a P object.
- Throws:
PlatformNotFoundException- if platform specified byidis not found.
-
platform
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
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
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
hasProvider.
- Specified by:
hasProviderin interfacecom.pi4j.internal.ProviderProvider- Parameters:
providerId- aStringobject.- Returns:
- a boolean.
-
hasProvider
hasProvider.
- Specified by:
hasProviderin interfacecom.pi4j.internal.ProviderProvider- Type Parameters:
T- a T object.- Parameters:
ioType- aIOTypeobject.- Returns:
- a boolean.
-
hasProvider
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
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
- Specified by:
createin interfacecom.pi4j.internal.IOCreator
-
create
- Specified by:
createin interfacecom.pi4j.internal.IOCreator
-
create
- Specified by:
createin interfacecom.pi4j.internal.IOCreator
-
shutdown
<T extends IO> T shutdown(String id) throws IOInvalidIDException, IONotFoundException, IOShutdownException shutdown and unregister a created IO.- Type Parameters:
T- the IO Type- Parameters:
id- the IO id- Returns:
- the IO which was shutdown or null if it wasn't created/registered
- Throws:
IONotFoundException- if the IO was not registeredIOInvalidIDException- if the ID is invalidIOShutdownException- if an error occured while shuting down the IO
-
hasIO
-
io
-
io
default <T extends IO> T io(String id, Class<T> ioClass) throws IOInvalidIDException, IONotFoundException -
getIO
-
getIO
default <T extends IO> T getIO(String id, Class<T> ioClass) throws IOInvalidIDException, IONotFoundException -
describe
describe.
- Specified by:
describein interfaceDescribable- Returns:
- a
Descriptorobject.
-