Package org.opentcs.drivers.peripherals
Interface PeripheralCommAdapter
- All Superinterfaces:
Lifecycle
- All Known Implementing Classes:
BasicPeripheralCommAdapter
public interface PeripheralCommAdapter extends Lifecycle
This interface declares the methods that a driver communicating with and controlling a
peripheral device must implement.
-
Method Summary
Modifier and Type Method Description default void
abortJob()
Aborts the current job, if any.ExplainedBoolean
canProcess(PeripheralJob job)
Checks if the peripheral device would be able to process the given job, taking into account its current state.void
disable()
Disables this comm adapter, i.e.void
enable()
Enables this comm adapter, i.e.void
execute(PeripheralAdapterCommand command)
Executes the givenPeripheralAdapterCommand
.PeripheralProcessModel
getProcessModel()
Returns a model of the peripheral device's and its communication adapter's attributes.boolean
isEnabled()
Checks whether this communication adapter is enabled.void
process(PeripheralJob job, PeripheralJobCallback callback)
Processes the given job by sending it or a representation that the peripheral device understands to the peripheral device itself.Methods inherited from interface org.opentcs.components.Lifecycle
initialize, isInitialized, terminate
-
Method Details
-
enable
void enable()Enables this comm adapter, i.e. turns it on. -
disable
void disable()Disables this comm adapter, i.e. turns it off. -
isEnabled
boolean isEnabled()Checks whether this communication adapter is enabled.- Returns:
true
if, and only if, this communication adapter is enabled.
-
getProcessModel
Returns a model of the peripheral device's and its communication adapter's attributes.- Returns:
- A model of the peripheral device's and its communication adapter's attributes.
-
canProcess
Checks if the peripheral device would be able to process the given job, taking into account its current state.- Parameters:
job
- A job that might have to be processed.- Returns:
- An
ExplainedBoolean
telling if the peripheral device would be able to process the job.
-
process
Processes the given job by sending it or a representation that the peripheral device understands to the peripheral device itself.- Parameters:
job
- The job to process.callback
- The callback to use to report back about the successful or failed completion of the job.
-
abortJob
@ScheduledApiChange(when="6.0", details="Default implementation will be removed") default void abortJob()Aborts the current job, if any.Whether a job can actually be aborted depends on the actual peripheral/job semantics. The callback for the current job may still be called to indicate the job has failed, but it is not strictly expected to. The kernel will ignore calls to the callback after calling this method.
-
execute
Executes the givenPeripheralAdapterCommand
.- Parameters:
command
- The command to execute.
-