• Home
Name Date Size #Lines LOC

..--

hdi_service/12-May-2024-1,327987

interfaces/12-May-2024-13795

passthrough/12-May-2024-609399

utils/12-May-2024-217125

BUILD.gnD12-May-2024967 2927

README_zh.mdD12-May-202412.9 KiB188163

bundle.jsonD12-May-20241 KiB4140

intelligent_voice.gniD12-May-2024674 1715

README_zh.md

1# intelligent_voice<a name="ZH-CN_TOPIC_0000001078525242"></a>
2
3-   [简介](#section11660541593)
4-   [目录](#section161941989596)
5    -   [接口说明](#section1551164914237)
6    -   [使用说明](#section129654513264)
7
8-   [相关仓](#section1371113476307)
9
10## 简介<a name="section11660541593"></a>
11
12intelligent_voice仓下主要包含HDI接口,HDI接口主要用于:
13
14-   智能音频引擎的注册、管理、回调
15-   Trigger模型的管理、加载、卸载,以及回调
16
17## 目录<a name="section161941989596"></a>
18
19该仓下源代码目录结构如下所示
20
21```
22drivers/peripheral/intelligent_voice/
23├── hdi_service        # hdi服务,虚拟接口实现
24│   └── engine         # engine虚拟接口实现
25│   └── trigger        # trigger虚拟接口实现
26├── interfaces         # intelligent_voice模块定义的虚拟接口
27│   └── include        # 接口定义
28```
29
30### 接口说明<a name="section1551164914237"></a>
31
32intelligent_voice模块提供给intelligent_voice_framework可直接调用的能力接口,主要功能有:智能音频引擎的注册、管理、回调,Trigger模型的加载卸载,回调,以及管理等。
33
34提供的部分接口说明如[表1 intelligent_voice HDI接口](#table1513255710559)所示:
35
36**表 1**  intelligent_voice HDI接口
37
38<a name="table1513255710559"></a>
39<table><thead align="left"><tr id="row171321857155517"><th class="cellrowborder" valign="top" width="10.721072107210723%" id="mcps1.2.4.1.1"><p id="p6132957115511"><a name="p6132957115511"></a><a name="p6132957115511"></a>头文件</p>
40</th>
41<th class="cellrowborder" valign="top" width="66.36663666366637%" id="mcps1.2.4.1.2"><p id="p14132125715552"><a name="p14132125715552"></a><a name="p14132125715552"></a>接口名称</p>
42</th>
43<th class="cellrowborder" valign="top" width="22.912291229122914%" id="mcps1.2.4.1.3"><p id="p18132205755516"><a name="p18132205755516"></a><a name="p18132205755516"></a>功能描述</p>
44</th>
45</tr>
46</thead>
47<tbody><tr id="row13132357165514"><td class="cellrowborder" rowspan="13" valign="top" width="10.721072107210723%" headers="mcps1.2.4.1.1 "><p id="p15132185775510"><a name="p15132185775510"></a><a name="p15132185775510"></a>i_engine.h</p>
48<p id="p18132157175510"><a name="p18132157175510"></a><a name="p18132157175510"></a></p>
49<p id="p2133757135510"><a name="p2133757135510"></a><a name="p2133757135510"></a></p>
50</td>
51<td class="cellrowborder" valign="top" width="66.36663666366637%" headers="mcps1.2.4.1.2 "><p id="p1213365714550"><a name="p1213365714550"></a><a name="p1213365714550"></a>virtual void OnIntellVoiceEvent(const IntellVoiceEngineCallBackEvent &event) = 0;</p>
52</td>
53<td class="cellrowborder" valign="top" width="22.912291229122914%" headers="mcps1.2.4.1.3 "><p id="p201331557185512"><a name="p201331557185512"></a><a name="p201331557185512"></a>开启智能语音事件</p>
54</td>
55</tr>
56<tr id="row171331657185514"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p913305715553"><a name="p913305715553"></a><a name="p913305715553"></a>virtual IntellVoiceStatus SetListener(std::shared_ptr<IEngineCallback> listener) = 0;</p>
57</td>
58<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p161332570553"><a name="p161332570553"></a><a name="p161332570553"></a>设置监听器</p>
59</td>
60</tr>
61<tr id="row41331557165518"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p6133145713559"><a name="p6133145713559"></a><a name="p6133145713559"></a>virtual IntellVoiceStatus Init(const IntellVoiceEngineAdapterInfo &adapterInfo) = 0;</p>
62</td>
63<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p131331557175510"><a name="p131331557175510"></a><a name="p131331557175510"></a>初始化</p>
64</td>
65</tr>
66<tr id="row77021769584"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p77031566584"><a name="p77031566584"></a><a name="p77031566584"></a>virtual IntellVoiceStatus Release() = 0;</p>
67</td>
68<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1470315695811"><a name="p1470315695811"></a><a name="p1470315695811"></a>释放</p>
69</td>
70</tr>
71<tr id="row71857914585"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1318619155811"><a name="p1318619155811"></a><a name="p1318619155811"></a>virtual IntellVoiceStatus SetParameter(const std::string &keyValueList) = 0;</p>
72</td>
73<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1186597589"><a name="p1186597589"></a><a name="p1186597589"></a>设置参数</p>
74</td>
75</tr>
76<tr id="row18831119115815"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p48323975814"><a name="p48323975814"></a><a name="p48323975814"></a>virtual IntellVoiceStatus GetParameter(const std::string &keyList, getParameterCb cb) = 0;</p>
77</td>
78<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p15832129135813"><a name="p15832129135813"></a><a name="p15832129135813"></a>获取参数</p>
79</td>
80</tr>
81<tr id="row71857914585"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1318619155811"><a name="p1318619155811"></a><a name="p1318619155811"></a>virtual IntellVoiceStatus Write(const uint8_t *buffer, uint32_t size) = 0;</p>
82</td>
83<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1186597589"><a name="p1186597589"></a><a name="p1186597589"></a>写入</p>
84</td>
85</tr>
86<tr id="row18831119115815"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p48323975814"><a name="p48323975814"></a><a name="p48323975814"></a>virtual IntellVoiceStatus Start(const StartInfo& info) = 0;</p>
87</td>
88<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p15832129135813"><a name="p15832129135813"></a><a name="p15832129135813"></a>启动</p>
89</td>
90</tr>
91<tr id="row71857914585"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1318619155811"><a name="p1318619155811"></a><a name="p1318619155811"></a>virtual IntellVoiceStatus Stop() = 0;</p>
92</td>
93<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1186597589"><a name="p1186597589"></a><a name="p1186597589"></a>停止</p>
94</td>
95</tr>
96<tr id="row18831119115815"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p48323975814"><a name="p48323975814"></a><a name="p48323975814"></a>virtual IntellVoiceStatus Cancel() = 0;</p>
97</td>
98<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p15832129135813"><a name="p15832129135813"></a><a name="p15832129135813"></a>取消</p>
99</td>
100</tr>
101<tr id="row18831119115815"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p48323975814"><a name="p48323975814"></a><a name="p48323975814"></a>virtual IntellVoiceStatus ReadFileData(const std::string &filePath, getFileDataCb cb) = 0;</p>
102</td>
103<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p15832129135813"><a name="p15832129135813"></a><a name="p15832129135813"></a>读取文件数据</p>
104</td>
105</tr>
106<tr id="row18831119115815"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p48323975814"><a name="p48323975814"></a><a name="p48323975814"></a>virtual int32_t CreateAdapter(const IntellVoiceEngineAdapterDescriptor &descriptor, std::unique_ptr<IEngine> &engine) = 0;</p>
107</td>
108<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p15832129135813"><a name="p15832129135813"></a><a name="p15832129135813"></a>创建适配器</p>
109</td>
110</tr>
111<tr id="row18831119115815"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p48323975814"><a name="p48323975814"></a><a name="p48323975814"></a>virtual int32_t ReleaseAdapter(const IntellVoiceEngineAdapterDescriptor &descriptor) = 0;</p>
112</td>
113<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p15832129135813"><a name="p15832129135813"></a><a name="p15832129135813"></a>释放适配器</p>
114</td>
115</tr>
116<tr id="row1267017500274"><td class="cellrowborder" rowspan="8" align="left" valign="top" width="12.821282128212822%" headers="mcps1.2.4.1.1 "><p id="p15674038913"><a name="p15674038913"></a><a name="p15674038913"></a></p>
117<p id="p825185015460"><a name="p825185015460"></a><a name="p825185015460"></a>i_trigger.h</p>
118<p id="p2133757135510"><a name="p2133757135510"></a><a name="p2133757135510"></a></p>
119<p id="p14171441118"><a name="p14171441118"></a><a name="p14171441118"></a></p>
120<p id="p57063567463"><a name="p57063567463"></a><a name="p57063567463"></a></p>
121<p id="p1285144710118"><a name="p1285144710118"></a><a name="p1285144710118"></a></p>
122</td>
123<td class="cellrowborder" valign="top" width="62.16621662166217%" headers="mcps1.2.4.1.2 "><p id="p6264341172811"><a name="p6264341172811"></a><a name="p6264341172811"></a>virtual void OnRecognitionHdiEvent(const IntellVoiceRecognitionEvent &event, int32_t cookie) = 0;</p>
124</td>
125<td class="cellrowborder" valign="top" width="25.012501250125013%" headers="mcps1.2.4.1.3 "><p id="p13264114182817"><a name="p13264114182817"></a><a name="p13264114182817"></a>开启识别接口事件</p>
126</td>
127</tr>
128<tr id="row2661171172814"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p126514172811"><a name="p126514172811"></a><a name="p126514172811"></a>virtual int32_t GetProperties(IntellVoiceTriggerProperties &properties) = 0;</p>
129</td>
130<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p15265164122819"><a name="p15265164122819"></a><a name="p15265164122819"></a>获取属性</p>
131</td>
132</tr>
133<tr id="row4385112822818"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p10265134111284"><a name="p10265134111284"></a><a name="p10265134111284"></a>virtual int32_t LoadIntellVoiceTriggerModel(const TriggerModel &model,
134        const std::shared_ptr<ITriggerCallback> &callback, int32_t cookie, int32_t &handle) = 0;</p>
135</td>
136<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p726554110289"><a name="p726554110289"></a><a name="p726554110289"></a>加载智能语音触发模型</p>
137</td>
138</tr>
139<tr id="row181371630162816"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p426517411284"><a name="p426517411284"></a><a name="p426517411284"></a>virtual int32_t UnloadIntellVoiceTriggerModel(int32_t handle) = 0;</p>
140</td>
141<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1926512413287"><a name="p1926512413287"></a><a name="p1926512413287"></a>卸载智能语音触发模型</p>
142</td>
143</tr>
144<tr id="row01531026142811"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p182651741162812"><a name="p182651741162812"></a><a name="p182651741162812"></a>virtual int32_t Start(int32_t handle) = 0;</p>
145</td>
146<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p142651241152813"><a name="p142651241152813"></a><a name="p142651241152813"></a>启动</p>
147</td>
148</tr>
149<tr id="row11460182372815"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1626534118284"><a name="p1626534118284"></a><a name="p1626534118284"></a>virtual int32_t Stop(int32_t handle) = 0;</p>
150</td>
151<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p72661241112817"><a name="p72661241112817"></a><a name="p72661241112817"></a>停止</p>
152</td>
153</tr>
154<tr id="row11460182372815"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1626534118284"><a name="p1626534118284"></a><a name="p1626534118284"></a>virtual int32_t LoadAdapter(const IntellVoiceTriggerAdapterDsecriptor &descriptor, std::unique_ptr<ITrigger> &adapter) = 0;</p>
155</td>
156<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p72661241112817"><a name="p72661241112817"></a><a name="p72661241112817"></a>加载适配器</p>
157</td>
158</tr>
159<tr id="row11460182372815"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1626534118284"><a name="p1626534118284"></a><a name="p1626534118284"></a>virtual int32_t UnloadAdapter(const IntellVoiceTriggerAdapterDsecriptor &descriptor) = 0;</p>
160</td>
161<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p72661241112817"><a name="p72661241112817"></a><a name="p72661241112817"></a>卸载适配器</p>
162</td>
163</tr>
164</tbody>
165</table>
166
167### 使用说明<a name="section129654513264"></a>
168
169该仓核心功能包括两个方面:
170
1711.  提供intelligent_voice HDI接口供framework层调用,实现智能音频服务的基本功能。
1722.  作为标准南向接口,保证南向OEM产商实现HDI-adapter的规范性,保证生态良性演进。
173
174具体接口调用及实现,以接口注释为准。
175
176## 相关仓<a name="section1371113476307"></a>
177
178[驱动子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E9%A9%B1%E5%8A%A8%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
179
180[drivers\_framework](https://gitee.com/openharmony/drivers_framework/blob/master/README_zh.md)
181
182[drivers\_adapter](https://gitee.com/openharmony/drivers_adapter/blob/master/README_zh.md)
183
184[drivers\_adapter\_khdf\_linux](https://gitee.com/openharmony/drivers_adapter_khdf_linux/blob/master/README_zh.md)
185
186[drivers\_peripheral](https://gitee.com/openharmony/drivers_peripheral)
187
188