41 std::vector<std::pair<std::string, std::string>>
data;
46 std::vector<std::uint8_t>
data;
112 const std::string& text = {},
113 const std::string& preannounce_media_id = {},
114 bool start_conversation =
false)
const;
Byte buffer / view aliases and protobuf base-128 varint codec.
Non-owning view over a contiguous run of bytes (a C++17 stand-in for std::span<const std::uint8_t>).
Definition bytes.hpp:17
Async client for a single device.
Definition client.hpp:38
Shared base for the subsystems exposed by Client (log streaming, the various proxies,...
Definition subsystem.hpp:18
Drives the device's voice-assistant pipeline: subscribing to start/stop requests, relaying events and...
Definition voice_assistant.hpp:79
void set_configuration(const std::vector< std::string > &active_wake_words) const
Set the device's active wake words by id.
void subscribe(VoiceAssistantSubscribeFlag flags, RequestHandler handler, bool subscribe=true)
Subscribe to (or unsubscribe from) the device's voice-assistant requests.
std::function< void(const VoiceEvent &)> EventHandler
Definition voice_assistant.hpp:82
void send_audio(ByteView data, bool end=false) const
Stream an audio chunk to the device. Set end on the final chunk.
void on_announce_finished(AnnounceFinishedHandler handler)
Register a callback fired when an announcement finishes.
std::function< void(bool)> AnnounceFinishedHandler
Definition voice_assistant.hpp:84
void request_configuration(ConfigurationHandler handler)
Request the device's voice-assistant configuration.
std::function< void(const VoiceConfiguration &)> ConfigurationHandler
Definition voice_assistant.hpp:85
void on_event(EventHandler handler)
Register a callback for each pipeline event (VoiceAssistantEventResponse).
void send_response(std::uint32_t port, bool error=false) const
Reply to a start request, telling the device which UDP port to stream audio to (0 when streaming over...
std::function< void(const VoiceRequest &)> RequestHandler
Definition voice_assistant.hpp:81
std::function< void(const VoiceAudio &)> AudioHandler
Definition voice_assistant.hpp:83
void on_timer_event(TimerEventHandler handler)
Register a callback for timer events (VoiceAssistantTimerEventResponse).
void announce(const std::string &media_id, const std::string &text={}, const std::string &preannounce_media_id={}, bool start_conversation=false) const
Ask the device to announce media and/or text.
VoiceAssistant(Client &client)
Definition voice_assistant.hpp:88
std::function< void(const VoiceTimerEvent &)> TimerEventHandler
Definition voice_assistant.hpp:86
void on_audio(AudioHandler handler)
Register a callback for inbound audio chunks (VoiceAssistantAudio).
Typed mirrors of the ESPHome protobuf enums.
VoiceAssistantEvent
Mirror of proto enum VoiceAssistantEvent.
Definition enums.hpp:311
VoiceAssistantTimerEvent
Mirror of proto enum VoiceAssistantTimerEvent.
Definition enums.hpp:331
VoiceAssistantRequestFlag
Mirror of proto enum VoiceAssistantRequestFlag.
Definition enums.hpp:304
VoiceAssistantSubscribeFlag
Mirror of proto enum VoiceAssistantSubscribeFlag.
Definition enums.hpp:298
Audio capture/processing settings the device requests for a pipeline run (api: VoiceAssistantRequest....
Definition voice_assistant.hpp:20
std::uint32_t auto_gain
Definition voice_assistant.hpp:22
float volume_multiplier
Definition voice_assistant.hpp:23
std::uint32_t noise_suppression_level
Definition voice_assistant.hpp:21
A chunk of audio streamed over the API (api: VoiceAssistantAudio).
Definition voice_assistant.hpp:45
std::vector< std::uint8_t > data
Definition voice_assistant.hpp:46
bool end
Definition voice_assistant.hpp:47
The device's voice-assistant configuration (api: VoiceAssistantConfigurationResponse).
Definition voice_assistant.hpp:70
std::vector< VoiceWakeWord > available_wake_words
Definition voice_assistant.hpp:71
std::vector< std::string > active_wake_words
Definition voice_assistant.hpp:72
std::uint32_t max_active_wake_words
Definition voice_assistant.hpp:73
A pipeline event emitted by the device (api: VoiceAssistantEventResponse).
Definition voice_assistant.hpp:39
std::vector< std::pair< std::string, std::string > > data
Definition voice_assistant.hpp:41
VoiceAssistantEvent event_type
Definition voice_assistant.hpp:40
The device asking the client to start or stop a voice pipeline (api: VoiceAssistantRequest).
Definition voice_assistant.hpp:28
std::string conversation_id
Definition voice_assistant.hpp:30
std::string wake_word_phrase
Definition voice_assistant.hpp:33
VoiceAudioSettings audio_settings
Definition voice_assistant.hpp:32
VoiceAssistantRequestFlag flags
Definition voice_assistant.hpp:31
bool start
Definition voice_assistant.hpp:29
A timer event surfaced by the device (api: VoiceAssistantTimerEventResponse).
Definition voice_assistant.hpp:51
std::uint32_t seconds_left
Definition voice_assistant.hpp:56
std::uint32_t total_seconds
Definition voice_assistant.hpp:55
VoiceAssistantTimerEvent event_type
Definition voice_assistant.hpp:52
bool is_active
Definition voice_assistant.hpp:57
std::string timer_id
Definition voice_assistant.hpp:53
std::string name
Definition voice_assistant.hpp:54
A wake word the device can be configured to listen for (api: VoiceAssistantWakeWord).
Definition voice_assistant.hpp:62
std::vector< std::string > trained_languages
Definition voice_assistant.hpp:65
std::string wake_word
Definition voice_assistant.hpp:64
std::string id
Definition voice_assistant.hpp:63
Common base for the Client-owned subsystems.