Package: android.hardware.soundtrigger@2.0

ISoundTriggerHwCallback

interface ISoundTriggerHwCallback

Properties

CallbackCookie

typedef int32_t CallbackCookie

RecognitionStatus

enum RecognitionStatus: uint32_t
Details
Members
SUCCESS = 0
ABORT = 1
FAILURE = 2

SoundModelStatus

enum SoundModelStatus: uint32_t
Details
Members
UPDATED = 0

RecognitionEvent

struct RecognitionEvent {RecognitionStatus status; SoundModelType type; SoundModelHandle model; bool captureAvailable; int32_t captureSession; int32_t captureDelayMs; int32_t capturePreambleMs; bool triggerInData; AudioConfig audioConfig; vec data}

Generic recognition event sent via recognition callback

Details
Members
status
Recognition status e.g.SUCCESS
type
Sound model type for this event.e.g SoundModelType.TYPE_KEYPHRASE
model
Handle of loaded sound model which triggered the event
captureAvailable
It is possible to capture audio from this utterance buffered by the implementation
captureSession
Audio session ID.framework use
captureDelayMs
Delay in ms between end of model detection and start of audio available for capture.A negative value is possible(e.g.if key phrase is also available for capture
capturePreambleMs
Duration in ms of audio captured before the start of the trigger.0 if none.
triggerInData
The opaque data is the capture of the trigger sound
audioConfig
Audio format of either the trigger in event data or to use for capture of the rest of the utterance
data
Opaque event data

PhraseRecognitionEvent

struct PhraseRecognitionEvent {RecognitionEvent common; vec phraseExtras}

Specialized recognition event for key phrase recognitions

Details
Members
common
Common part of the recognition event
phraseExtras
List of descriptors for each recognized key phrase

ModelEvent

struct ModelEvent {SoundModelStatus status; SoundModelHandle model; vec data}

Event sent via load sound model callback

Details
Members
status
Sound model status e.g.SoundModelStatus.UPDATED
model
Loaded sound model that triggered the event
data
Opaque event data, passed transparently by the framework

Methods

recognitionCallback

recognitionCallback (RecognitionEvent event, CallbackCookie cookie)

Callback method called by the HAL when the sound recognition triggers

Details
Parameters
event
A RecognitionEvent structure containing detailed results of the recognition triggered
cookie
The cookie passed by the framework when recognition was started(see ISoundtriggerHw.startRecognition()

phraseRecognitionCallback

phraseRecognitionCallback (PhraseRecognitionEvent event, CallbackCookie cookie)

Callback method called by the HAL when the sound recognition triggers for a key phrase sound model.

Details
Parameters
event
A RecognitionEvent structure containing detailed results of the recognition triggered
cookie
The cookie passed by the framework when recognition was started(see ISoundtriggerHw.startRecognition()

soundModelCallback

soundModelCallback (ModelEvent event, CallbackCookie cookie)

Callback method called by the HAL when the sound model loading completes

Details
Parameters
event
A ModelEvent structure containing detailed results of the model loading operation
cookie
The cookie passed by the framework when loading was initiated(see ISoundtriggerHw.loadSoundModel()