@doubao-apps/create 0.0.25 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/template-empty/.ai/reference/open-api/01-/345/237/272/347/241/200-/350/264/246/345/217/267-/347/263/273/347/273/237.md +699 -0
- package/dist/template-empty/.ai/reference/open-api/02-storage.md +417 -0
- package/dist/template-empty/.ai/reference/open-api/03-router.md +165 -0
- package/dist/template-empty/.ai/reference/open-api/04-ui-/344/272/244/344/272/222.md +432 -0
- package/dist/template-empty/.ai/reference/open-api/05-ui-/350/276/223/345/205/245.md +95 -0
- package/dist/template-empty/.ai/reference/open-api/06-network.md +298 -0
- package/dist/template-empty/.ai/reference/open-api/07-media.md +346 -0
- package/dist/template-empty/.ai/reference/open-api/08-open-/344/270/232/345/212/241/350/203/275/345/212/233.md +477 -0
- package/dist/template-empty/.ai/reference/open-api/09-device-bluetooth.md +985 -0
- package/dist/template-empty/.ai/reference/open-api/10-device-wi-fi.md +277 -0
- package/dist/template-empty/.ai/reference/open-api/11-device-/344/274/240/346/204/237/345/231/250.md +372 -0
- package/dist/template-empty/.ai/reference/open-api/12-device-/346/234/254/345/234/260/350/203/275/345/212/233.md +1005 -0
- package/dist/template-empty/.ai/reference/open-api/README.md +20 -0
- package/dist/template-empty/.ai/reference/open-api.md +1532 -307
- package/dist/template-empty/AGENTS.md +2 -2
- package/dist/template-empty/package.json +2 -2
- package/dist/template-starter/.ai/reference/open-api/01-/345/237/272/347/241/200-/350/264/246/345/217/267-/347/263/273/347/273/237.md +699 -0
- package/dist/template-starter/.ai/reference/open-api/02-storage.md +417 -0
- package/dist/template-starter/.ai/reference/open-api/03-router.md +165 -0
- package/dist/template-starter/.ai/reference/open-api/04-ui-/344/272/244/344/272/222.md +432 -0
- package/dist/template-starter/.ai/reference/open-api/05-ui-/350/276/223/345/205/245.md +95 -0
- package/dist/template-starter/.ai/reference/open-api/06-network.md +298 -0
- package/dist/template-starter/.ai/reference/open-api/07-media.md +346 -0
- package/dist/template-starter/.ai/reference/open-api/08-open-/344/270/232/345/212/241/350/203/275/345/212/233.md +477 -0
- package/dist/template-starter/.ai/reference/open-api/09-device-bluetooth.md +985 -0
- package/dist/template-starter/.ai/reference/open-api/10-device-wi-fi.md +277 -0
- package/dist/template-starter/.ai/reference/open-api/11-device-/344/274/240/346/204/237/345/231/250.md +372 -0
- package/dist/template-starter/.ai/reference/open-api/12-device-/346/234/254/345/234/260/350/203/275/345/212/233.md +1005 -0
- package/dist/template-starter/.ai/reference/open-api/README.md +20 -0
- package/dist/template-starter/.ai/reference/open-api.md +1532 -307
- package/dist/template-starter/AGENTS.md +2 -2
- package/dist/template-starter/package.json +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# Open API: Device / Wi-Fi
|
|
2
|
+
|
|
3
|
+
Wi-Fi 模块能力;通常先 startWifi,再获取列表或连接。
|
|
4
|
+
|
|
5
|
+
[返回目录](./README.md) | [返回速查](../open-api.md)
|
|
6
|
+
|
|
7
|
+
## 速查
|
|
8
|
+
|
|
9
|
+
| API | 签名 | 用途 | 参数类型 | 结果类型 | 注意点 |
|
|
10
|
+
| --- | --- | --- | --- | --- | --- |
|
|
11
|
+
| [`startWifi`](#startwifi) | `startWifi(params?): Promise<object>` | 初始化 Wi-Fi 模块 | `params?` | `Promise<object>` | Wi-Fi 流程入口 |
|
|
12
|
+
| [`stopWifi`](#stopwifi) | `stopWifi(params?): Promise<object>` | 关闭 Wi-Fi 模块 | `params?` | `Promise<object>` | - |
|
|
13
|
+
| [`setWifiList`](#setwifilist) | `setWifiList(params): Promise<object>` | 设置 Wi-Fi 预设列表 | `params: SetWifiListParams` | `Promise<object>` | 用于预设 Wi-Fi 列表 |
|
|
14
|
+
| [`connectWifi`](#connectwifi) | `connectWifi(params): Promise<object>` | 连接指定 Wi-Fi | `params: ConnectWifiParams` | `Promise<object>` | 通常先调用 startWifi |
|
|
15
|
+
| [`getConnectedWifi`](#getconnectedwifi) | `getConnectedWifi(params?): Promise<GetConnectedWifiResult>` | 获取当前已连接 Wi-Fi 信息 | `params?: GetConnectedWifiParams` | `Promise<GetConnectedWifiResult>` | - |
|
|
16
|
+
| [`getWifiList`](#getwifilist) | `getWifiList(params?): Promise<GetWifiListResult>` | 获取 Wi-Fi 列表 | `params?` | `Promise<GetWifiListResult>` | 通常先调用 startWifi |
|
|
17
|
+
|
|
18
|
+
## API 详情
|
|
19
|
+
|
|
20
|
+
<a id="startwifi"></a>
|
|
21
|
+
### startWifi()
|
|
22
|
+
|
|
23
|
+
> **startWifi**(`params`?): `Promise`\<`object`\>
|
|
24
|
+
|
|
25
|
+
初始化 Wi-Fi 模块。
|
|
26
|
+
|
|
27
|
+
#### Parameters
|
|
28
|
+
|
|
29
|
+
• **params?**
|
|
30
|
+
|
|
31
|
+
#### Returns
|
|
32
|
+
|
|
33
|
+
`Promise`\<`object`\>
|
|
34
|
+
|
|
35
|
+
#### Remarks
|
|
36
|
+
|
|
37
|
+
Wi-Fi 流程入口。
|
|
38
|
+
|
|
39
|
+
<a id="stopwifi"></a>
|
|
40
|
+
### stopWifi()
|
|
41
|
+
|
|
42
|
+
> **stopWifi**(`params`?): `Promise`\<`object`\>
|
|
43
|
+
|
|
44
|
+
关闭 Wi-Fi 模块。
|
|
45
|
+
|
|
46
|
+
#### Parameters
|
|
47
|
+
|
|
48
|
+
• **params?**
|
|
49
|
+
|
|
50
|
+
#### Returns
|
|
51
|
+
|
|
52
|
+
`Promise`\<`object`\>
|
|
53
|
+
|
|
54
|
+
<a id="setwifilist"></a>
|
|
55
|
+
### setWifiList()
|
|
56
|
+
|
|
57
|
+
> **setWifiList**(`params`): `Promise`\<`object`\>
|
|
58
|
+
|
|
59
|
+
设置 Wi-Fi 预设列表。
|
|
60
|
+
|
|
61
|
+
#### Parameters
|
|
62
|
+
|
|
63
|
+
• **params**: [`SetWifiListParams`](#setwifilistparams)
|
|
64
|
+
|
|
65
|
+
#### Returns
|
|
66
|
+
|
|
67
|
+
`Promise`\<`object`\>
|
|
68
|
+
|
|
69
|
+
#### Remarks
|
|
70
|
+
|
|
71
|
+
用于预设 Wi-Fi 列表。
|
|
72
|
+
|
|
73
|
+
<a id="connectwifi"></a>
|
|
74
|
+
### connectWifi()
|
|
75
|
+
|
|
76
|
+
> **connectWifi**(`params`): `Promise`\<`object`\>
|
|
77
|
+
|
|
78
|
+
连接指定 Wi-Fi。
|
|
79
|
+
|
|
80
|
+
#### Parameters
|
|
81
|
+
|
|
82
|
+
• **params**: [`ConnectWifiParams`](#connectwifiparams)
|
|
83
|
+
|
|
84
|
+
#### Returns
|
|
85
|
+
|
|
86
|
+
`Promise`\<`object`\>
|
|
87
|
+
|
|
88
|
+
#### Remarks
|
|
89
|
+
|
|
90
|
+
通常先调用 startWifi。
|
|
91
|
+
|
|
92
|
+
<a id="getconnectedwifi"></a>
|
|
93
|
+
### getConnectedWifi()
|
|
94
|
+
|
|
95
|
+
> **getConnectedWifi**(`params`?): `Promise`\<[`GetConnectedWifiResult`](#getconnectedwifiresult)\>
|
|
96
|
+
|
|
97
|
+
获取当前已连接 Wi-Fi 信息。
|
|
98
|
+
|
|
99
|
+
#### Parameters
|
|
100
|
+
|
|
101
|
+
• **params?**: [`GetConnectedWifiParams`](#getconnectedwifiparams)
|
|
102
|
+
|
|
103
|
+
#### Returns
|
|
104
|
+
|
|
105
|
+
`Promise`\<[`GetConnectedWifiResult`](#getconnectedwifiresult)\>
|
|
106
|
+
|
|
107
|
+
<a id="getwifilist"></a>
|
|
108
|
+
### getWifiList()
|
|
109
|
+
|
|
110
|
+
> **getWifiList**(`params`?): `Promise`\<[`GetWifiListResult`](#getwifilistresult)\>
|
|
111
|
+
|
|
112
|
+
获取 Wi-Fi 列表。
|
|
113
|
+
|
|
114
|
+
#### Parameters
|
|
115
|
+
|
|
116
|
+
• **params?**
|
|
117
|
+
|
|
118
|
+
#### Returns
|
|
119
|
+
|
|
120
|
+
`Promise`\<[`GetWifiListResult`](#getwifilistresult)\>
|
|
121
|
+
|
|
122
|
+
#### Remarks
|
|
123
|
+
|
|
124
|
+
通常先调用 startWifi。
|
|
125
|
+
|
|
126
|
+
## 相关类型
|
|
127
|
+
|
|
128
|
+
<a id="setwifilistparams"></a>
|
|
129
|
+
### SetWifiListParams
|
|
130
|
+
|
|
131
|
+
设置 Wi-Fi 预设列表的请求参数。
|
|
132
|
+
|
|
133
|
+
#### Properties
|
|
134
|
+
|
|
135
|
+
##### wifiList
|
|
136
|
+
|
|
137
|
+
> **wifiList**: [`WifiListItem`](#wifilistitem)[]
|
|
138
|
+
|
|
139
|
+
预设的 Wi-Fi 列表。
|
|
140
|
+
|
|
141
|
+
<a id="wifilistitem"></a>
|
|
142
|
+
### WifiListItem
|
|
143
|
+
|
|
144
|
+
预设 Wi-Fi 条目。
|
|
145
|
+
|
|
146
|
+
#### Properties
|
|
147
|
+
|
|
148
|
+
##### bssid?
|
|
149
|
+
|
|
150
|
+
> `optional` **bssid**: `string`
|
|
151
|
+
|
|
152
|
+
Wi-Fi BSSID。
|
|
153
|
+
|
|
154
|
+
##### password?
|
|
155
|
+
|
|
156
|
+
> `optional` **password**: `string`
|
|
157
|
+
|
|
158
|
+
Wi-Fi 密码。
|
|
159
|
+
|
|
160
|
+
##### ssid?
|
|
161
|
+
|
|
162
|
+
> `optional` **ssid**: `string`
|
|
163
|
+
|
|
164
|
+
Wi-Fi SSID。
|
|
165
|
+
|
|
166
|
+
<a id="connectwifiparams"></a>
|
|
167
|
+
### ConnectWifiParams
|
|
168
|
+
|
|
169
|
+
连接 Wi-Fi 的请求参数。
|
|
170
|
+
|
|
171
|
+
#### Properties
|
|
172
|
+
|
|
173
|
+
##### bssid?
|
|
174
|
+
|
|
175
|
+
> `optional` **bssid**: `string`
|
|
176
|
+
|
|
177
|
+
Wi-Fi BSSID。
|
|
178
|
+
|
|
179
|
+
##### manual?
|
|
180
|
+
|
|
181
|
+
> `optional` **manual**: `boolean`
|
|
182
|
+
|
|
183
|
+
是否跳转到系统设置页连接。
|
|
184
|
+
|
|
185
|
+
##### partialInfo?
|
|
186
|
+
|
|
187
|
+
> `optional` **partialInfo**: `boolean`
|
|
188
|
+
|
|
189
|
+
是否仅返回部分 Wi-Fi 信息。
|
|
190
|
+
|
|
191
|
+
##### password
|
|
192
|
+
|
|
193
|
+
> **password**: `string`
|
|
194
|
+
|
|
195
|
+
Wi-Fi 密码。
|
|
196
|
+
|
|
197
|
+
##### ssid
|
|
198
|
+
|
|
199
|
+
> **ssid**: `string`
|
|
200
|
+
|
|
201
|
+
Wi-Fi SSID。
|
|
202
|
+
|
|
203
|
+
<a id="getconnectedwifiparams"></a>
|
|
204
|
+
### GetConnectedWifiParams
|
|
205
|
+
|
|
206
|
+
获取当前已连接 Wi-Fi 的请求参数。
|
|
207
|
+
|
|
208
|
+
#### Properties
|
|
209
|
+
|
|
210
|
+
##### partialInfo?
|
|
211
|
+
|
|
212
|
+
> `optional` **partialInfo**: `boolean`
|
|
213
|
+
|
|
214
|
+
是否只返回部分 Wi-Fi 信息。
|
|
215
|
+
|
|
216
|
+
<a id="getconnectedwifiresult"></a>
|
|
217
|
+
### GetConnectedWifiResult
|
|
218
|
+
|
|
219
|
+
获取当前已连接 Wi-Fi 的返回结果。
|
|
220
|
+
|
|
221
|
+
#### Properties
|
|
222
|
+
|
|
223
|
+
##### wifi
|
|
224
|
+
|
|
225
|
+
> **wifi**: [`WifiInfo`](#wifiinfo)
|
|
226
|
+
|
|
227
|
+
当前连接的 Wi-Fi 信息。
|
|
228
|
+
|
|
229
|
+
<a id="wifiinfo"></a>
|
|
230
|
+
### WifiInfo
|
|
231
|
+
|
|
232
|
+
Wi-Fi 信息。
|
|
233
|
+
|
|
234
|
+
#### Properties
|
|
235
|
+
|
|
236
|
+
##### bssid?
|
|
237
|
+
|
|
238
|
+
> `optional` **bssid**: `string`
|
|
239
|
+
|
|
240
|
+
Wi-Fi BSSID。
|
|
241
|
+
|
|
242
|
+
##### frequency?
|
|
243
|
+
|
|
244
|
+
> `optional` **frequency**: `number`
|
|
245
|
+
|
|
246
|
+
频段,单位 MHz。
|
|
247
|
+
|
|
248
|
+
##### secure?
|
|
249
|
+
|
|
250
|
+
> `optional` **secure**: `boolean`
|
|
251
|
+
|
|
252
|
+
Wi-Fi 是否安全。
|
|
253
|
+
|
|
254
|
+
##### signalStrength?
|
|
255
|
+
|
|
256
|
+
> `optional` **signalStrength**: `number`
|
|
257
|
+
|
|
258
|
+
信号强度。
|
|
259
|
+
|
|
260
|
+
##### ssid
|
|
261
|
+
|
|
262
|
+
> **ssid**: `string`
|
|
263
|
+
|
|
264
|
+
Wi-Fi SSID。
|
|
265
|
+
|
|
266
|
+
<a id="getwifilistresult"></a>
|
|
267
|
+
### GetWifiListResult
|
|
268
|
+
|
|
269
|
+
获取 Wi-Fi 列表的返回结果。
|
|
270
|
+
|
|
271
|
+
#### Properties
|
|
272
|
+
|
|
273
|
+
##### wifiList
|
|
274
|
+
|
|
275
|
+
> **wifiList**: [`WifiInfo`](#wifiinfo)[]
|
|
276
|
+
|
|
277
|
+
当前获取到的 Wi-Fi 列表。
|
package/dist/template-empty/.ai/reference/open-api/11-device-/344/274/240/346/204/237/345/231/250.md
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
# Open API: Device / 传感器
|
|
2
|
+
|
|
3
|
+
加速度、罗盘、陀螺仪、设备方向和 iBeacon。
|
|
4
|
+
|
|
5
|
+
[返回目录](./README.md) | [返回速查](../open-api.md)
|
|
6
|
+
|
|
7
|
+
## 速查
|
|
8
|
+
|
|
9
|
+
| API | 签名 | 用途 | 参数类型 | 结果类型 | 注意点 |
|
|
10
|
+
| --- | --- | --- | --- | --- | --- |
|
|
11
|
+
| [`startAccelerometer`](#startaccelerometer) | `startAccelerometer(params?): Promise<object>` | 开始监听加速度 | `params?: StartAccelerometerParams` | `Promise<object>` | 需配对调用 stopAccelerometer |
|
|
12
|
+
| [`stopAccelerometer`](#stopaccelerometer) | `stopAccelerometer(params?): Promise<object>` | 停止监听加速度 | `params?` | `Promise<object>` | - |
|
|
13
|
+
| [`startBeaconDiscovery`](#startbeacondiscovery) | `startBeaconDiscovery(params): Promise<object>` | 开始搜索附近的 iBeacon | `params: StartBeaconDiscoveryParams` | `Promise<object>` | 需配对调用 stopBeaconDiscovery |
|
|
14
|
+
| [`stopBeaconDiscovery`](#stopbeacondiscovery) | `stopBeaconDiscovery(params?): Promise<object>` | 停止搜索附近的 iBeacon | `params?` | `Promise<object>` | - |
|
|
15
|
+
| [`getBeacons`](#getbeacons) | `getBeacons(params?): Promise<GetBeaconsResult>` | 获取已搜索到的 iBeacon 列表 | `params?` | `Promise<GetBeaconsResult>` | - |
|
|
16
|
+
| [`startCompass`](#startcompass) | `startCompass(params?): Promise<object>` | 开始监听罗盘 | `params?` | `Promise<object>` | 需配对调用 stopCompass |
|
|
17
|
+
| [`stopCompass`](#stopcompass) | `stopCompass(params?): Promise<object>` | 停止监听罗盘 | `params?` | `Promise<object>` | - |
|
|
18
|
+
| [`onCompassChange`](#oncompasschange) | `onCompassChange(handler): () => void` | 监听罗盘数据变化事件 | `handler` | `() => void` | 返回取消监听函数 |
|
|
19
|
+
| [`startDeviceMotionListening`](#startdevicemotionlistening) | `startDeviceMotionListening(params?): Promise<object>` | 开始监听设备方向变化 | `params?: StartDeviceMotionListeningParams` | `Promise<object>` | 需配对调用 stopDeviceMotionListening |
|
|
20
|
+
| [`stopDeviceMotionListening`](#stopdevicemotionlistening) | `stopDeviceMotionListening(params?): Promise<object>` | 停止监听设备方向变化 | `params?` | `Promise<object>` | - |
|
|
21
|
+
| [`startGyroscope`](#startgyroscope) | `startGyroscope(params?): Promise<object>` | 开始监听陀螺仪 | `params?: StartGyroscopeParams` | `Promise<object>` | 需配对调用 stopGyroscope |
|
|
22
|
+
| [`stopGyroscope`](#stopgyroscope) | `stopGyroscope(params?): Promise<object>` | 停止监听陀螺仪 | `params?` | `Promise<object>` | - |
|
|
23
|
+
|
|
24
|
+
## API 详情
|
|
25
|
+
|
|
26
|
+
<a id="startaccelerometer"></a>
|
|
27
|
+
### startAccelerometer()
|
|
28
|
+
|
|
29
|
+
> **startAccelerometer**(`params`?): `Promise`\<`object`\>
|
|
30
|
+
|
|
31
|
+
开始监听加速度。
|
|
32
|
+
|
|
33
|
+
#### Parameters
|
|
34
|
+
|
|
35
|
+
• **params?**: [`StartAccelerometerParams`](#startaccelerometerparams)
|
|
36
|
+
|
|
37
|
+
#### Returns
|
|
38
|
+
|
|
39
|
+
`Promise`\<`object`\>
|
|
40
|
+
|
|
41
|
+
#### Remarks
|
|
42
|
+
|
|
43
|
+
需配对调用 stopAccelerometer。
|
|
44
|
+
|
|
45
|
+
<a id="stopaccelerometer"></a>
|
|
46
|
+
### stopAccelerometer()
|
|
47
|
+
|
|
48
|
+
> **stopAccelerometer**(`params`?): `Promise`\<`object`\>
|
|
49
|
+
|
|
50
|
+
停止监听加速度。
|
|
51
|
+
|
|
52
|
+
#### Parameters
|
|
53
|
+
|
|
54
|
+
• **params?**
|
|
55
|
+
|
|
56
|
+
#### Returns
|
|
57
|
+
|
|
58
|
+
`Promise`\<`object`\>
|
|
59
|
+
|
|
60
|
+
<a id="startbeacondiscovery"></a>
|
|
61
|
+
### startBeaconDiscovery()
|
|
62
|
+
|
|
63
|
+
> **startBeaconDiscovery**(`params`): `Promise`\<`object`\>
|
|
64
|
+
|
|
65
|
+
开始搜索附近的 iBeacon。
|
|
66
|
+
|
|
67
|
+
#### Parameters
|
|
68
|
+
|
|
69
|
+
• **params**: [`StartBeaconDiscoveryParams`](#startbeacondiscoveryparams)
|
|
70
|
+
|
|
71
|
+
#### Returns
|
|
72
|
+
|
|
73
|
+
`Promise`\<`object`\>
|
|
74
|
+
|
|
75
|
+
#### Remarks
|
|
76
|
+
|
|
77
|
+
需配对调用 stopBeaconDiscovery。
|
|
78
|
+
|
|
79
|
+
<a id="stopbeacondiscovery"></a>
|
|
80
|
+
### stopBeaconDiscovery()
|
|
81
|
+
|
|
82
|
+
> **stopBeaconDiscovery**(`params`?): `Promise`\<`object`\>
|
|
83
|
+
|
|
84
|
+
停止搜索附近的 iBeacon。
|
|
85
|
+
|
|
86
|
+
#### Parameters
|
|
87
|
+
|
|
88
|
+
• **params?**
|
|
89
|
+
|
|
90
|
+
#### Returns
|
|
91
|
+
|
|
92
|
+
`Promise`\<`object`\>
|
|
93
|
+
|
|
94
|
+
<a id="getbeacons"></a>
|
|
95
|
+
### getBeacons()
|
|
96
|
+
|
|
97
|
+
> **getBeacons**(`params`?): `Promise`\<[`GetBeaconsResult`](#getbeaconsresult)\>
|
|
98
|
+
|
|
99
|
+
获取已搜索到的 iBeacon 列表。
|
|
100
|
+
|
|
101
|
+
#### Parameters
|
|
102
|
+
|
|
103
|
+
• **params?**
|
|
104
|
+
|
|
105
|
+
#### Returns
|
|
106
|
+
|
|
107
|
+
`Promise`\<[`GetBeaconsResult`](#getbeaconsresult)\>
|
|
108
|
+
|
|
109
|
+
<a id="startcompass"></a>
|
|
110
|
+
### startCompass()
|
|
111
|
+
|
|
112
|
+
> **startCompass**(`params`?): `Promise`\<`object`\>
|
|
113
|
+
|
|
114
|
+
开始监听罗盘。
|
|
115
|
+
|
|
116
|
+
#### Parameters
|
|
117
|
+
|
|
118
|
+
• **params?**
|
|
119
|
+
|
|
120
|
+
#### Returns
|
|
121
|
+
|
|
122
|
+
`Promise`\<`object`\>
|
|
123
|
+
|
|
124
|
+
#### Remarks
|
|
125
|
+
|
|
126
|
+
需配对调用 stopCompass。
|
|
127
|
+
|
|
128
|
+
<a id="stopcompass"></a>
|
|
129
|
+
### stopCompass()
|
|
130
|
+
|
|
131
|
+
> **stopCompass**(`params`?): `Promise`\<`object`\>
|
|
132
|
+
|
|
133
|
+
停止监听罗盘。
|
|
134
|
+
|
|
135
|
+
#### Parameters
|
|
136
|
+
|
|
137
|
+
• **params?**
|
|
138
|
+
|
|
139
|
+
#### Returns
|
|
140
|
+
|
|
141
|
+
`Promise`\<`object`\>
|
|
142
|
+
|
|
143
|
+
<a id="oncompasschange"></a>
|
|
144
|
+
### onCompassChange()
|
|
145
|
+
|
|
146
|
+
> **onCompassChange**(`handler`): () => `void`
|
|
147
|
+
|
|
148
|
+
监听罗盘数据变化事件。
|
|
149
|
+
|
|
150
|
+
#### Parameters
|
|
151
|
+
|
|
152
|
+
• **handler**
|
|
153
|
+
|
|
154
|
+
#### Returns
|
|
155
|
+
|
|
156
|
+
`Function`
|
|
157
|
+
|
|
158
|
+
返回取消当前监听函数的函数。
|
|
159
|
+
|
|
160
|
+
##### Returns
|
|
161
|
+
|
|
162
|
+
`void`
|
|
163
|
+
|
|
164
|
+
#### Example
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
import { onCompassChange } from '@doubao-apps/framework/api';
|
|
168
|
+
|
|
169
|
+
const off = onCompassChange(({ direction }) => {
|
|
170
|
+
console.log(direction);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
off();
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
<a id="startdevicemotionlistening"></a>
|
|
177
|
+
### startDeviceMotionListening()
|
|
178
|
+
|
|
179
|
+
> **startDeviceMotionListening**(`params`?): `Promise`\<`object`\>
|
|
180
|
+
|
|
181
|
+
开始监听设备方向变化。
|
|
182
|
+
|
|
183
|
+
#### Parameters
|
|
184
|
+
|
|
185
|
+
• **params?**: [`StartDeviceMotionListeningParams`](#startdevicemotionlisteningparams)
|
|
186
|
+
|
|
187
|
+
#### Returns
|
|
188
|
+
|
|
189
|
+
`Promise`\<`object`\>
|
|
190
|
+
|
|
191
|
+
#### Remarks
|
|
192
|
+
|
|
193
|
+
需配对调用 stopDeviceMotionListening。
|
|
194
|
+
|
|
195
|
+
<a id="stopdevicemotionlistening"></a>
|
|
196
|
+
### stopDeviceMotionListening()
|
|
197
|
+
|
|
198
|
+
> **stopDeviceMotionListening**(`params`?): `Promise`\<`object`\>
|
|
199
|
+
|
|
200
|
+
停止监听设备方向变化。
|
|
201
|
+
|
|
202
|
+
#### Parameters
|
|
203
|
+
|
|
204
|
+
• **params?**
|
|
205
|
+
|
|
206
|
+
#### Returns
|
|
207
|
+
|
|
208
|
+
`Promise`\<`object`\>
|
|
209
|
+
|
|
210
|
+
<a id="startgyroscope"></a>
|
|
211
|
+
### startGyroscope()
|
|
212
|
+
|
|
213
|
+
> **startGyroscope**(`params`?): `Promise`\<`object`\>
|
|
214
|
+
|
|
215
|
+
开始监听陀螺仪。
|
|
216
|
+
|
|
217
|
+
#### Parameters
|
|
218
|
+
|
|
219
|
+
• **params?**: [`StartGyroscopeParams`](#startgyroscopeparams)
|
|
220
|
+
|
|
221
|
+
#### Returns
|
|
222
|
+
|
|
223
|
+
`Promise`\<`object`\>
|
|
224
|
+
|
|
225
|
+
#### Remarks
|
|
226
|
+
|
|
227
|
+
需配对调用 stopGyroscope。
|
|
228
|
+
|
|
229
|
+
<a id="stopgyroscope"></a>
|
|
230
|
+
### stopGyroscope()
|
|
231
|
+
|
|
232
|
+
> **stopGyroscope**(`params`?): `Promise`\<`object`\>
|
|
233
|
+
|
|
234
|
+
停止监听陀螺仪。
|
|
235
|
+
|
|
236
|
+
#### Parameters
|
|
237
|
+
|
|
238
|
+
• **params?**
|
|
239
|
+
|
|
240
|
+
#### Returns
|
|
241
|
+
|
|
242
|
+
`Promise`\<`object`\>
|
|
243
|
+
|
|
244
|
+
## 相关类型
|
|
245
|
+
|
|
246
|
+
<a id="startaccelerometerparams"></a>
|
|
247
|
+
### StartAccelerometerParams
|
|
248
|
+
|
|
249
|
+
开始监听加速度的请求参数。
|
|
250
|
+
|
|
251
|
+
#### Properties
|
|
252
|
+
|
|
253
|
+
##### interval?
|
|
254
|
+
|
|
255
|
+
> `optional` **interval**: [`SensorInterval`](#sensorinterval)
|
|
256
|
+
|
|
257
|
+
监听频率。
|
|
258
|
+
|
|
259
|
+
<a id="sensorinterval"></a>
|
|
260
|
+
### SensorInterval
|
|
261
|
+
|
|
262
|
+
> **SensorInterval**: `"game"` \| `"ui"` \| `"normal"`
|
|
263
|
+
|
|
264
|
+
传感器监听频率。
|
|
265
|
+
|
|
266
|
+
<a id="startbeacondiscoveryparams"></a>
|
|
267
|
+
### StartBeaconDiscoveryParams
|
|
268
|
+
|
|
269
|
+
开始搜索 iBeacon 的请求参数。
|
|
270
|
+
|
|
271
|
+
#### Properties
|
|
272
|
+
|
|
273
|
+
##### ignoreBluetoothAvailable?
|
|
274
|
+
|
|
275
|
+
> `optional` **ignoreBluetoothAvailable**: `boolean`
|
|
276
|
+
|
|
277
|
+
iOS 下是否忽略蓝牙可用性校验。
|
|
278
|
+
|
|
279
|
+
##### uuids
|
|
280
|
+
|
|
281
|
+
> **uuids**: `string`[]
|
|
282
|
+
|
|
283
|
+
要搜索的 iBeacon UUID 列表。
|
|
284
|
+
|
|
285
|
+
<a id="getbeaconsresult"></a>
|
|
286
|
+
### GetBeaconsResult
|
|
287
|
+
|
|
288
|
+
获取 iBeacon 列表的返回结果。
|
|
289
|
+
|
|
290
|
+
#### Properties
|
|
291
|
+
|
|
292
|
+
##### beacons
|
|
293
|
+
|
|
294
|
+
> **beacons**: [`BeaconInfo`](#beaconinfo)[]
|
|
295
|
+
|
|
296
|
+
当前搜到的 iBeacon 列表。
|
|
297
|
+
|
|
298
|
+
<a id="beaconinfo"></a>
|
|
299
|
+
### BeaconInfo
|
|
300
|
+
|
|
301
|
+
iBeacon 设备信息。
|
|
302
|
+
|
|
303
|
+
#### Properties
|
|
304
|
+
|
|
305
|
+
##### accuracy
|
|
306
|
+
|
|
307
|
+
> **accuracy**: `number`
|
|
308
|
+
|
|
309
|
+
距离,单位米。
|
|
310
|
+
|
|
311
|
+
##### major
|
|
312
|
+
|
|
313
|
+
> **major**: `string`
|
|
314
|
+
|
|
315
|
+
主 ID。
|
|
316
|
+
|
|
317
|
+
##### minor
|
|
318
|
+
|
|
319
|
+
> **minor**: `string`
|
|
320
|
+
|
|
321
|
+
次 ID。
|
|
322
|
+
|
|
323
|
+
##### proximity
|
|
324
|
+
|
|
325
|
+
> **proximity**: [`BeaconProximity`](#beaconproximity)
|
|
326
|
+
|
|
327
|
+
距离等级。
|
|
328
|
+
|
|
329
|
+
##### rssi
|
|
330
|
+
|
|
331
|
+
> **rssi**: `number`
|
|
332
|
+
|
|
333
|
+
RSSI 信号强度,单位 dBm。
|
|
334
|
+
|
|
335
|
+
##### uuid
|
|
336
|
+
|
|
337
|
+
> **uuid**: `string`
|
|
338
|
+
|
|
339
|
+
Beacon UUID。
|
|
340
|
+
|
|
341
|
+
<a id="beaconproximity"></a>
|
|
342
|
+
### BeaconProximity
|
|
343
|
+
|
|
344
|
+
> **BeaconProximity**: `0` \| `1` \| `2` \| `3`
|
|
345
|
+
|
|
346
|
+
iBeacon 距离等级。
|
|
347
|
+
|
|
348
|
+
<a id="startdevicemotionlisteningparams"></a>
|
|
349
|
+
### StartDeviceMotionListeningParams
|
|
350
|
+
|
|
351
|
+
开始监听设备方向变化的请求参数。
|
|
352
|
+
|
|
353
|
+
#### Properties
|
|
354
|
+
|
|
355
|
+
##### interval?
|
|
356
|
+
|
|
357
|
+
> `optional` **interval**: [`SensorInterval`](#sensorinterval)
|
|
358
|
+
|
|
359
|
+
监听频率。
|
|
360
|
+
|
|
361
|
+
<a id="startgyroscopeparams"></a>
|
|
362
|
+
### StartGyroscopeParams
|
|
363
|
+
|
|
364
|
+
开始监听陀螺仪的请求参数。
|
|
365
|
+
|
|
366
|
+
#### Properties
|
|
367
|
+
|
|
368
|
+
##### interval?
|
|
369
|
+
|
|
370
|
+
> `optional` **interval**: [`SensorInterval`](#sensorinterval)
|
|
371
|
+
|
|
372
|
+
监听频率。
|