Sequenceablepublic class SpeechEvent extends MultimodalEvent
The system offers the speech recognition capability to recognize user speeches and sends the recognition result to you as an event. This event carries such information as the recognized speech action, hot words.
MultimodalEventSystemCapability.MultimodalInput#MULTIMODAL_INPUTSequenceable.Producer<T>| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
ACTION_HIT_HOTWORD |
Indicates the action of hitting a hot word.
|
static int |
ACTION_SWITCH_OFF |
Indicates the action of setting the switch to the OFF state.
|
static int |
ACTION_SWITCH_ON |
Indicates the action of setting the switch to the ON state.
|
static int |
MATCH_MODE_EXACT |
Indicates the exact match mode.
|
static int |
MATCH_MODE_FUZZY |
Indicates the fuzzy match mode.
|
static int |
SCENES_AUDIO |
Indicates the scene where the action is performed for an audio.
|
static int |
SCENES_COMMON |
Indicates the common scene where voice action is performed.
|
static int |
SCENES_PAGE |
Indicates the scene where the action is performed for a page.
|
static int |
SCENES_SWITCH |
Indicates the scene where the action is performed for a switch.
|
static int |
SCENES_VIDEO |
Indicates the scene where the action is performed for a video.
|
BUILTIN_KEY, DEFAULT_TYPE, highLevelEvent, KEYBOARD, MOUSE, ROTATION, SPEECH, STYLUS, TOUCH_PANEL, UNSUPPORTED_DEVICE, uuid| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static Optional<SpeechEvent> |
createEvent(long occurTime,
int action,
String value) |
A constructor used to create a
SpeechEvent instance. |
int |
getAction() |
Obtains the action of this speech event.
|
String |
getActionProperty() |
Obtains the property value carried in
action. |
String |
getDeviceId() |
Obtains the ID of the bearing device for the input device that generates the current event.
|
int |
getInputDeviceId() |
Obtains the ID of the input device that generates the current event.
|
int |
getMatchMode() |
Obtains the match mode for the current recognition result.
|
long |
getOccurredTime() |
Obtains the time when the current event is generated.
|
int |
getScene() |
Obtains the scene where the action is performed.
|
int |
getSourceDevice() |
Obtains the type of the input device that generates the current event.
|
getUuid, isSameEvent, marshalling, unmarshallingclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasFileDescriptorpublic static final int ACTION_HIT_HOTWORD
public static final int ACTION_SWITCH_OFF
public static final int ACTION_SWITCH_ON
public static final int MATCH_MODE_EXACT
public static final int MATCH_MODE_FUZZY
public static final int SCENES_AUDIO
public static final int SCENES_COMMON
public static final int SCENES_PAGE
public static final int SCENES_SWITCH
public static final int SCENES_VIDEO
public static Optional<SpeechEvent> createEvent(long occurTime, int action, String value)
SpeechEvent instance.occurTime - Indicates the time when the event occurs.action - Indicates the action of the event. The value should be ACTION_SWITCH_ON,
ACTION_SWITCH_OFF or ACTION_HIT_HOTWORD.value - Indicates the property value carried in action.SpeechEvent object. In a valid SpeechEvent object,
the SCENE value is SCENES_PAGE and the matchmode value is MATCH_MODE_EXACT.public int getAction()
ACTION_SWITCH_ON,
ACTION_SWITCH_OFF or ACTION_HIT_HOTWORD.public int getScene()
SCENES_VIDEO, SCENES_AUDIO,
SCENES_PAGE, SCENES_SWITCH or SCENES_COMMON.public String getActionProperty()
action.action.public int getMatchMode()
MATCH_MODE_EXACT or MATCH_MODE_FUZZY.public int getSourceDevice()
MultimodalEventgetSourceDevice 在类中 MultimodalEventMultimodalEvent.UNSUPPORTED_DEVICE: no input device. Generally, this is the default value.
MultimodalEvent.TOUCH_PANEL: touch panel
MultimodalEvent.KEYBOARD: keyboard
MultimodalEvent.MOUSE: mouse
MultimodalEvent.STYLUS: stylus
MultimodalEvent.BUILTIN_KEY: built-in key
MultimodalEvent.ROTATION: rotation component
MultimodalEvent.SPEECH: speech componentpublic String getDeviceId()
MultimodalEventFor example, if two mouse devices are connected to the same device, this device is the bearing device of the two mouse devices.
getDeviceId 在类中 MultimodalEventnull if there is no input device.MultimodalEvent.getInputDeviceId()public int getInputDeviceId()
MultimodalEventAn input device is identified by a unique ID. For example, when two mouse devices generate an event respectively, the device ID in the generated events are different. This allows your application to use the device ID to identify the actual input device.
getInputDeviceId 在类中 MultimodalEvent-1 if there is no input device.MultimodalEvent.getDeviceId()public long getOccurredTime()
MultimodalEventgetOccurredTime 在类中 MultimodalEvent