This service handles voice control endpoint messages, parses the data and exposes it for external tools. It also allows voice control messages to be sent to a Pebble. It does not implement the state machine for ordering voice control messages correctly: this must be handled by the user of the service.
The service exposes the following events, which can be subscribed to with VoiceServer.register_handler:
session_setup
- Session setup request receivedaudio_frame
- Audio data frame receivedaudio_stop
- Audio data stopped
The correct sequencing for communicating with the Pebble smartwatch is as follows:
This is the normal sequence of communication. The Server should wait until it receives a stop message from the Pebble before sending the dictation result.
Message | Sender | Event/Function |
---|---|---|
Session setup request | Pebble |
|
Session setup result | Server | VoiceService.send_session_setup_result |
Audio data (n frames) | Pebble |
|
Audio stop | Pebble |
|
Dictation result | Server | VoiceService.send_dictation_result |
If an error occurs a server can terminate the session by sending an audio stop message followed by the dictation result. The dictation result should always be sent.
Message | Sender | Event/Function |
---|---|---|
Session setup request | Pebble |
|
Session setup result | Server | VoiceService.send_session_setup_result |
Audio data (n frames) | Pebble |
|
Audio stop | Server | VoiceService.send_stop_audio |
Dictation result | Server | VoiceService.send_dictation_result |
libpebble2.services.voice