Package org.openhab.core.audio
Interface AudioDialogProvider
@NonNullByDefault
public interface AudioDialogProvider
This interface is designed so the voice bundle can inject the start dialog functionality for audio bundle to consume,
which a programmatic way of trigger the dialog execution.
- Author:
- Miguel Álvarez Díez - Initial contribution
-
Method Summary
Modifier and TypeMethodDescription@Nullable RunnablestartDialog(AudioSink audioSink, AudioSource audioSource, @Nullable String locationItem, @Nullable String listeningItem, @Nullable Runnable onAbort) Starts a dialog and returns a runnable that triggers it or null if the dialog initialization failsdefault booleanstartKeywordSpottingDialog(AudioSink audioSink, AudioSource audioSource, @Nullable String locationItem, @Nullable String listeningItem, @Nullable Runnable onAbort) Starts a dialog that is triggered when the default keyword spotter spots the default magic word.
-
Method Details
-
startDialog
@Nullable Runnable startDialog(AudioSink audioSink, AudioSource audioSource, @Nullable String locationItem, @Nullable String listeningItem, @Nullable Runnable onAbort) Starts a dialog and returns a runnable that triggers it or null if the dialog initialization fails- Parameters:
audioSink- the audio sink to play soundaudioSource- the audio source to capture soundlocationItem- an optional Item name to scope dialog commandslisteningItem- an optional Item name to toggle while dialog is listening, overwrites defaultonAbort- an optionalRunnableinstance to call on abort.- Returns:
- a
Runnableinstance to trigger dialog processing or null if the dialog initialization fails
-
startKeywordSpottingDialog
default boolean startKeywordSpottingDialog(AudioSink audioSink, AudioSource audioSource, @Nullable String locationItem, @Nullable String listeningItem, @Nullable Runnable onAbort) Starts a dialog that is triggered when the default keyword spotter spots the default magic word.- Parameters:
audioSink- the audio sink to play soundaudioSource- the audio source to capture soundlocationItem- an optional Item name to scope dialog commandslisteningItem- an optional Item name to toggle while dialog is listening, overwrites defaultonAbort- an optionalRunnableinstance to call when the started dialog is stopped- Returns:
- true if the dialog was started, false if it failed to start or is not supported by this provider
- Throws:
IllegalStateException- if the voice settings don't allow starting the dialog
-