@tarojs/taro 3.4.1 → 3.4.2
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/package.json +5 -5
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/visionkit.d.ts +303 -0
- package/types/api/base/crypto.d.ts +90 -0
- package/types/api/base/debug.d.ts +152 -13
- package/types/api/base/env.d.ts +2 -1
- package/types/api/base/index.d.ts +10 -2
- package/types/api/base/performance.d.ts +195 -0
- package/types/api/base/system.d.ts +539 -101
- package/types/api/base/update.d.ts +59 -7
- package/types/api/base/weapp/app-event.d.ts +46 -23
- package/types/api/base/weapp/life-cycle.d.ts +141 -1
- package/types/api/canvas/index.d.ts +150 -136
- package/types/api/cloud/index.d.ts +2 -2
- package/types/api/device/accelerometer.d.ts +3 -3
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +2 -2
- package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +67 -2
- package/types/api/device/calendar.d.ts +88 -0
- package/types/api/device/contact.d.ts +74 -50
- package/types/api/device/gyroscope.d.ts +5 -5
- package/types/api/device/iBeacon.d.ts +33 -19
- package/types/api/{ui → device}/keyboard.d.ts +0 -0
- package/types/api/device/{performance.d.ts → memory.d.ts} +4 -4
- package/types/api/device/motion.d.ts +3 -3
- package/types/api/device/network.d.ts +53 -12
- package/types/api/device/nfc.d.ts +1089 -13
- package/types/api/device/scan.d.ts +1 -1
- package/types/api/device/screen.d.ts +40 -12
- package/types/api/device/wifi.d.ts +41 -6
- package/types/api/files/index.d.ts +371 -184
- package/types/api/location/index.d.ts +116 -55
- package/types/api/media/audio.d.ts +629 -38
- package/types/api/media/background-audio.d.ts +8 -8
- package/types/api/media/camera.d.ts +38 -19
- package/types/api/media/editor.d.ts +22 -2
- package/types/api/media/image.d.ts +61 -32
- package/types/api/media/live.d.ts +66 -6
- package/types/api/media/map.d.ts +469 -49
- package/types/api/media/media-recorder.d.ts +92 -0
- package/types/api/media/recorder.d.ts +20 -20
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +11 -7
- package/types/api/media/video.d.ts +45 -16
- package/types/api/media/voip.d.ts +290 -0
- package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +63 -25
- package/types/api/network/download.d.ts +39 -16
- package/types/api/network/request.d.ts +125 -37
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +154 -83
- package/types/api/network/upload.d.ts +41 -25
- package/types/api/network/websocket.d.ts +16 -15
- package/types/api/open-api/authorize.d.ts +41 -2
- package/types/api/open-api/channels.d.ts +178 -0
- package/types/api/open-api/facial.d.ts +3 -0
- package/types/api/open-api/favorites.d.ts +100 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +2 -2
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +21 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +76 -14
- package/types/api/open-api/soter.d.ts +2 -2
- package/types/api/open-api/subscribe-message.d.ts +88 -3
- package/types/api/open-api/user-info.d.ts +55 -18
- package/types/api/open-api/werun.d.ts +33 -6
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/route/index.d.ts +13 -9
- package/types/api/share/index.d.ts +192 -9
- package/types/api/storage/index.d.ts +29 -83
- package/types/api/swan/index.d.ts +1 -1
- package/types/api/ui/animation.d.ts +84 -70
- package/types/api/ui/background.d.ts +4 -2
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +27 -31
- package/types/api/ui/navigation-bar.d.ts +1 -0
- package/types/api/ui/scroll.d.ts +73 -7
- package/types/api/ui/sticky.d.ts +4 -4
- package/types/api/ui/tab-bar.d.ts +7 -7
- package/types/api/ui/window.d.ts +22 -2
- package/types/api/worker/index.d.ts +9 -1
- package/types/api/wxml/index.d.ts +111 -107
- package/types/compile.d.ts +5 -0
- package/types/global.d.ts +142 -111
- package/types/taro.api.d.ts +79 -62
- package/types/api/open-api/payment.d.ts +0 -61
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace onBLEPeripheralConnectionStateChanged {
|
|
5
|
+
/** 当前外围设备被连接或断开连接事件的回调函数 */
|
|
6
|
+
type Callback = (
|
|
7
|
+
result: CallbackResult,
|
|
8
|
+
) => void
|
|
9
|
+
|
|
10
|
+
interface CallbackResult {
|
|
11
|
+
/** 蓝牙设备 id */
|
|
12
|
+
deviceId: string
|
|
13
|
+
/** server 的 UUID */
|
|
14
|
+
serverId: string
|
|
15
|
+
/** 连接目前状态 */
|
|
16
|
+
connected: string
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
namespace createBLEPeripheralServer {
|
|
21
|
+
interface Option {
|
|
22
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
23
|
+
complete?: (res: TaroGeneral.BluetoothError) => void
|
|
24
|
+
/** 接口调用失败的回调函数 */
|
|
25
|
+
fail?: (res: TaroGeneral.BluetoothError) => void
|
|
26
|
+
/** 接口调用成功的回调函数 */
|
|
27
|
+
success?: (res: SuccessCallbackResult) => void
|
|
28
|
+
}
|
|
29
|
+
interface SuccessCallbackResult extends TaroGeneral.BluetoothError {
|
|
30
|
+
/** 外围设备的服务端 */
|
|
31
|
+
server: BLEPeripheralServer
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** 外围设备的服务端
|
|
36
|
+
* @supported weapp
|
|
37
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.html
|
|
38
|
+
*/
|
|
39
|
+
interface BLEPeripheralServer {
|
|
40
|
+
/** 添加服务
|
|
41
|
+
* @supported weapp
|
|
42
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.addService.html
|
|
43
|
+
*/
|
|
44
|
+
addService(option: BLEPeripheralServer.addService.Option): Promise<TaroGeneral.BluetoothError>
|
|
45
|
+
/** 关闭当前服务端
|
|
46
|
+
* @supported weapp
|
|
47
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.close.html
|
|
48
|
+
*/
|
|
49
|
+
close(option: BLEPeripheralServer.close.Option): Promise<TaroGeneral.BluetoothError>
|
|
50
|
+
/** 取消监听已连接的设备请求读当前外围设备的特征值事件
|
|
51
|
+
* @supported weapp
|
|
52
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicReadRequest.html
|
|
53
|
+
*/
|
|
54
|
+
offCharacteristicReadRequest(
|
|
55
|
+
/** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */
|
|
56
|
+
callback: BLEPeripheralServer.onCharacteristicReadRequest.Callback,
|
|
57
|
+
): void
|
|
58
|
+
/** 取消监听特征订阅事件
|
|
59
|
+
* @supported weapp
|
|
60
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicSubscribed.html
|
|
61
|
+
*/
|
|
62
|
+
offCharacteristicSubscribed(
|
|
63
|
+
/** 特征订阅事件的回调函数 */
|
|
64
|
+
callback: BLEPeripheralServer.onCharacteristicSubscribed.Callback,
|
|
65
|
+
): void
|
|
66
|
+
/** 取消监听取消特征订阅事件
|
|
67
|
+
* @supported weapp
|
|
68
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicUnsubscribed.html
|
|
69
|
+
*/
|
|
70
|
+
offCharacteristicUnsubscribed(
|
|
71
|
+
/** 取消特征订阅事件的回调函数 */
|
|
72
|
+
callback: BLEPeripheralServer.onCharacteristicUnsubscribed.Callback,
|
|
73
|
+
): void
|
|
74
|
+
/** 取消监听已连接的设备请求写当前外围设备的特征值事件
|
|
75
|
+
* @supported weapp
|
|
76
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicWriteRequest.html
|
|
77
|
+
*/
|
|
78
|
+
offCharacteristicWriteRequest(
|
|
79
|
+
/** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */
|
|
80
|
+
callback: BLEPeripheralServer.onCharacteristicWriteRequest.Callback,
|
|
81
|
+
): void
|
|
82
|
+
/** 监听已连接的设备请求读当前外围设备的特征值事件
|
|
83
|
+
*
|
|
84
|
+
* 收到该消息后需要立刻调用 [writeCharacteristicValue](/docs/apis/device/bluetooth-peripheral/BLEPeripheralServer#writecharacteristicvalue) 写回数据,否则主机不会收到响应。
|
|
85
|
+
* @supported weapp
|
|
86
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicReadRequest.html
|
|
87
|
+
*/
|
|
88
|
+
onCharacteristicReadRequest(
|
|
89
|
+
/** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */
|
|
90
|
+
callback: BLEPeripheralServer.onCharacteristicReadRequest.Callback,
|
|
91
|
+
): void
|
|
92
|
+
/** 监听特征订阅事件,仅 iOS 支持
|
|
93
|
+
* @supported weapp
|
|
94
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicSubscribed.html
|
|
95
|
+
*/
|
|
96
|
+
onCharacteristicSubscribed(
|
|
97
|
+
/** 特征订阅事件的回调函数 */
|
|
98
|
+
callback: BLEPeripheralServer.onCharacteristicSubscribed.Callback,
|
|
99
|
+
): void
|
|
100
|
+
/** 监听取消特征订阅事件,仅 iOS 支持
|
|
101
|
+
* @supported weapp
|
|
102
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicUnsubscribed.html
|
|
103
|
+
*/
|
|
104
|
+
onCharacteristicUnsubscribed(
|
|
105
|
+
/** 取消特征订阅事件的回调函数 */
|
|
106
|
+
callback: BLEPeripheralServer.onCharacteristicUnsubscribed.Callback,
|
|
107
|
+
): void
|
|
108
|
+
/** 监听已连接的设备请求写当前外围设备的特征值事件
|
|
109
|
+
* @supported weapp
|
|
110
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicWriteRequest.html
|
|
111
|
+
*/
|
|
112
|
+
onCharacteristicWriteRequest(
|
|
113
|
+
/** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */
|
|
114
|
+
callback: BLEPeripheralServer.onCharacteristicWriteRequest.Callback,
|
|
115
|
+
): void
|
|
116
|
+
/** 移除服务
|
|
117
|
+
* @supported weapp
|
|
118
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.removeService.html
|
|
119
|
+
*/
|
|
120
|
+
removeService(option: BLEPeripheralServer.removeService.Option): Promise<TaroGeneral.BluetoothError>
|
|
121
|
+
/** 开始广播本地创建的外围设备
|
|
122
|
+
* @supported weapp
|
|
123
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.startAdvertising.html
|
|
124
|
+
*/
|
|
125
|
+
startAdvertising(option: BLEPeripheralServer.startAdvertising.Option): Promise<TaroGeneral.BluetoothError>
|
|
126
|
+
/** 停止广播
|
|
127
|
+
* @supported weapp
|
|
128
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.stopAdvertising.html
|
|
129
|
+
*/
|
|
130
|
+
stopAdvertising(option: BLEPeripheralServer.stopAdvertising.Option): Promise<TaroGeneral.BluetoothError>
|
|
131
|
+
/** 往指定特征写入二进制数据值,并通知已连接的主机,从机的特征值已发生变化,该接口会处理是走回包还是走订阅
|
|
132
|
+
* @supported weapp
|
|
133
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html
|
|
134
|
+
*/
|
|
135
|
+
writeCharacteristicValue(option: BLEPeripheralServer.writeCharacteristicValue.Option): Promise<TaroGeneral.BluetoothError>
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
namespace BLEPeripheralServer {
|
|
139
|
+
namespace addService {
|
|
140
|
+
interface Option {
|
|
141
|
+
/** 描述 service 的 Object */
|
|
142
|
+
service: service
|
|
143
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
144
|
+
complete?: (res: TaroGeneral.BluetoothError) => void
|
|
145
|
+
/** 接口调用失败的回调函数 */
|
|
146
|
+
fail?: (res: TaroGeneral.BluetoothError) => void
|
|
147
|
+
/** 接口调用成功的回调函数 */
|
|
148
|
+
success?: (res: TaroGeneral.BluetoothError) => void
|
|
149
|
+
}
|
|
150
|
+
interface service {
|
|
151
|
+
/** 蓝牙服务的 UUID */
|
|
152
|
+
uuid: string
|
|
153
|
+
/** characteristics 列表 */
|
|
154
|
+
characteristics: characteristic[]
|
|
155
|
+
}
|
|
156
|
+
interface characteristic {
|
|
157
|
+
/** characteristic 的 UUID */
|
|
158
|
+
uuid: string
|
|
159
|
+
/** 特征支持的操作 */
|
|
160
|
+
properties: properties
|
|
161
|
+
/** 特征权限 */
|
|
162
|
+
permission: characteristicPermission
|
|
163
|
+
/** 特征对应的二进制值 */
|
|
164
|
+
value: ArrayBuffer
|
|
165
|
+
/** 描述符数据 */
|
|
166
|
+
descriptors: descriptor[]
|
|
167
|
+
}
|
|
168
|
+
/** 特征支持的操作 */
|
|
169
|
+
interface properties {
|
|
170
|
+
/** 写
|
|
171
|
+
* @default false
|
|
172
|
+
*/
|
|
173
|
+
write?: boolean
|
|
174
|
+
/** 无回复写
|
|
175
|
+
* @default false
|
|
176
|
+
*/
|
|
177
|
+
writeNoResponse?: boolean
|
|
178
|
+
/** 读
|
|
179
|
+
* @default false
|
|
180
|
+
*/
|
|
181
|
+
read?: boolean
|
|
182
|
+
/** 订阅
|
|
183
|
+
* @default false
|
|
184
|
+
*/
|
|
185
|
+
notify?: boolean
|
|
186
|
+
/** 回包
|
|
187
|
+
* @default false
|
|
188
|
+
*/
|
|
189
|
+
indicate?: boolean
|
|
190
|
+
}
|
|
191
|
+
/** 特征权限 */
|
|
192
|
+
interface characteristicPermission {
|
|
193
|
+
/** 可读
|
|
194
|
+
* @default false
|
|
195
|
+
*/
|
|
196
|
+
readable?: boolean
|
|
197
|
+
/** 可写
|
|
198
|
+
* @default false
|
|
199
|
+
*/
|
|
200
|
+
writeable?: boolean
|
|
201
|
+
/** 加密读请求
|
|
202
|
+
* @default false
|
|
203
|
+
*/
|
|
204
|
+
readEncryptionRequired?: boolean
|
|
205
|
+
/** 加密写请求
|
|
206
|
+
* @default false
|
|
207
|
+
*/
|
|
208
|
+
writeEncryptionRequired?: boolean
|
|
209
|
+
}
|
|
210
|
+
/** 描述符数据 */
|
|
211
|
+
interface descriptor {
|
|
212
|
+
/** Descriptor 的 UUID */
|
|
213
|
+
uuid: string
|
|
214
|
+
/** 描述符的权限 */
|
|
215
|
+
permission: descriptorPermission
|
|
216
|
+
/** 描述符数据 */
|
|
217
|
+
value: ArrayBuffer
|
|
218
|
+
}
|
|
219
|
+
/** 描述符的权限 */
|
|
220
|
+
interface descriptorPermission {
|
|
221
|
+
/** 写
|
|
222
|
+
* @default false
|
|
223
|
+
*/
|
|
224
|
+
write?: boolean
|
|
225
|
+
/** 读
|
|
226
|
+
* @default false
|
|
227
|
+
*/
|
|
228
|
+
read?: boolean
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
namespace close {
|
|
232
|
+
interface Option {
|
|
233
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
234
|
+
complete?: (res: TaroGeneral.BluetoothError) => void
|
|
235
|
+
/** 接口调用失败的回调函数 */
|
|
236
|
+
fail?: (res: TaroGeneral.BluetoothError) => void
|
|
237
|
+
/** 接口调用成功的回调函数 */
|
|
238
|
+
success?: (res: TaroGeneral.BluetoothError) => void
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
namespace onCharacteristicReadRequest {
|
|
242
|
+
/** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */
|
|
243
|
+
type Callback = (
|
|
244
|
+
result: CallbackResult,
|
|
245
|
+
) => void
|
|
246
|
+
|
|
247
|
+
interface CallbackResult {
|
|
248
|
+
/** 蓝牙特征对应服务的 UUID */
|
|
249
|
+
serviceId: string
|
|
250
|
+
/** 蓝牙特征的 UUID */
|
|
251
|
+
characteristicId: string
|
|
252
|
+
/** 唯一标识码,调用 [writeCharacteristicValue](/docs/apis/device/bluetooth-peripheral/BLEPeripheralServer#writecharacteristicvalue) 时使用 */
|
|
253
|
+
callbackId: number
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
namespace onCharacteristicSubscribed {
|
|
257
|
+
/** 特征订阅事件的回调函数 */
|
|
258
|
+
type Callback = (
|
|
259
|
+
result: CallbackResult,
|
|
260
|
+
) => void
|
|
261
|
+
|
|
262
|
+
interface CallbackResult {
|
|
263
|
+
/** 蓝牙特征对应服务的 UUID */
|
|
264
|
+
serviceId: string
|
|
265
|
+
/** 蓝牙特征的 UUID */
|
|
266
|
+
characteristicId: string
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
namespace onCharacteristicUnsubscribed {
|
|
270
|
+
/** 取消特征订阅事件的回调函数 */
|
|
271
|
+
type Callback = (
|
|
272
|
+
result: CallbackResult,
|
|
273
|
+
) => void
|
|
274
|
+
|
|
275
|
+
interface CallbackResult {
|
|
276
|
+
/** 蓝牙特征对应服务的 UUID */
|
|
277
|
+
serviceId: string
|
|
278
|
+
/** 蓝牙特征的 UUID */
|
|
279
|
+
characteristicId: string
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
namespace onCharacteristicWriteRequest {
|
|
283
|
+
/** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */
|
|
284
|
+
type Callback = (
|
|
285
|
+
result: CallbackResult,
|
|
286
|
+
) => void
|
|
287
|
+
|
|
288
|
+
interface CallbackResult {
|
|
289
|
+
/** 蓝牙特征对应服务的 UUID */
|
|
290
|
+
serviceId: string
|
|
291
|
+
/** 蓝牙特征的 UUID */
|
|
292
|
+
characteristicId: string
|
|
293
|
+
/** 唯一标识码,调用 [writeCharacteristicValue](/docs/apis/device/bluetooth-peripheral/BLEPeripheralServer#writecharacteristicvalue) 时使用 */
|
|
294
|
+
callbackId: number
|
|
295
|
+
/** 请求写入特征的二进制数据值 */
|
|
296
|
+
value: ArrayBuffer
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
namespace removeService {
|
|
300
|
+
interface Option {
|
|
301
|
+
/** service 的 UUID */
|
|
302
|
+
serviceId: string
|
|
303
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
304
|
+
complete?: (res: TaroGeneral.BluetoothError) => void
|
|
305
|
+
/** 接口调用失败的回调函数 */
|
|
306
|
+
fail?: (res: TaroGeneral.BluetoothError) => void
|
|
307
|
+
/** 接口调用成功的回调函数 */
|
|
308
|
+
success?: (res: TaroGeneral.BluetoothError) => void
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
namespace startAdvertising {
|
|
312
|
+
interface Option {
|
|
313
|
+
/** 广播自定义参数 */
|
|
314
|
+
advertiseRequest: advertiseRequest
|
|
315
|
+
/** 广播功率
|
|
316
|
+
* @default "medium"
|
|
317
|
+
*/
|
|
318
|
+
powerLevel?: keyof PowerLevel
|
|
319
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
320
|
+
complete?: (res: TaroGeneral.BluetoothError) => void
|
|
321
|
+
/** 接口调用失败的回调函数 */
|
|
322
|
+
fail?: (res: TaroGeneral.BluetoothError) => void
|
|
323
|
+
/** 接口调用成功的回调函数 */
|
|
324
|
+
success?: (res: TaroGeneral.BluetoothError) => void
|
|
325
|
+
}
|
|
326
|
+
/** 广播自定义参数 */
|
|
327
|
+
interface advertiseRequest {
|
|
328
|
+
/** 当前设备是否可连接
|
|
329
|
+
* @default true
|
|
330
|
+
*/
|
|
331
|
+
connectable?: boolean
|
|
332
|
+
/** 广播中 deviceName 字段,默认为空
|
|
333
|
+
* @default ""
|
|
334
|
+
*/
|
|
335
|
+
deviceName?: string
|
|
336
|
+
/** 要广播的服务 UUID 列表。使用 16/32 位 UUID 时请参考注意事项。 */
|
|
337
|
+
serviceUuids?: string[]
|
|
338
|
+
/** 广播的制造商信息。仅安卓支持,iOS 因系统限制无法定制。 */
|
|
339
|
+
manufacturerData?: manufacturerData[]
|
|
340
|
+
/** 以 beacon 设备形式广播的参数。 */
|
|
341
|
+
beacon?: beacon
|
|
342
|
+
}
|
|
343
|
+
/** 广播的制造商信息。仅安卓支持,iOS 因系统限制无法定制。 */
|
|
344
|
+
interface manufacturerData {
|
|
345
|
+
/** 制造商ID,0x 开头的十六进制 */
|
|
346
|
+
manufacturerId: string
|
|
347
|
+
/** 制造商信息 */
|
|
348
|
+
manufacturerSpecificData?: ArrayBuffer
|
|
349
|
+
}
|
|
350
|
+
/** 以 beacon 设备形式广播的参数。 */
|
|
351
|
+
interface beacon {
|
|
352
|
+
/** Beacon 设备广播的 UUID */
|
|
353
|
+
uuid: string
|
|
354
|
+
/** Beacon 设备的主 ID */
|
|
355
|
+
major: number
|
|
356
|
+
/** Beacon 设备的次 ID */
|
|
357
|
+
minor: number
|
|
358
|
+
/** 用于判断距离设备 1 米时 RSSI 大小的参考值 */
|
|
359
|
+
measuredPower?: number
|
|
360
|
+
}
|
|
361
|
+
/** 广播功率合法值 */
|
|
362
|
+
interface PowerLevel {
|
|
363
|
+
/** 功率低 */
|
|
364
|
+
low
|
|
365
|
+
/** 功率适中 */
|
|
366
|
+
medium
|
|
367
|
+
/** 功率高 */
|
|
368
|
+
high
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
namespace stopAdvertising {
|
|
372
|
+
interface Option {
|
|
373
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
374
|
+
complete?: (res: TaroGeneral.BluetoothError) => void
|
|
375
|
+
/** 接口调用失败的回调函数 */
|
|
376
|
+
fail?: (res: TaroGeneral.BluetoothError) => void
|
|
377
|
+
/** 接口调用成功的回调函数 */
|
|
378
|
+
success?: (res: TaroGeneral.BluetoothError) => void
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
namespace writeCharacteristicValue {
|
|
382
|
+
interface Option {
|
|
383
|
+
/** 蓝牙特征对应服务的 UUID */
|
|
384
|
+
serviceId: string
|
|
385
|
+
/** 蓝牙特征的 UUID */
|
|
386
|
+
characteristicId: string
|
|
387
|
+
/** characteristic 对应的二进制值 */
|
|
388
|
+
value: ArrayBuffer
|
|
389
|
+
/** 是否需要通知主机 value 已更新 */
|
|
390
|
+
needNotify: boolean
|
|
391
|
+
/** 可选,处理回包时使用 */
|
|
392
|
+
callbackId?: number
|
|
393
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
394
|
+
complete?: (res: TaroGeneral.BluetoothError) => void
|
|
395
|
+
/** 接口调用失败的回调函数 */
|
|
396
|
+
fail?: (res: TaroGeneral.BluetoothError) => void
|
|
397
|
+
/** 接口调用成功的回调函数 */
|
|
398
|
+
success?: (res: TaroGeneral.BluetoothError) => void
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
interface TaroStatic {
|
|
404
|
+
/** 监听当前外围设备被连接或断开连接事件
|
|
405
|
+
* @supported weapp
|
|
406
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.onBLEPeripheralConnectionStateChanged.html
|
|
407
|
+
*/
|
|
408
|
+
onBLEPeripheralConnectionStateChanged(
|
|
409
|
+
/** 监听当前外围设备被连接或断开连接事件 */
|
|
410
|
+
callback: onBLEPeripheralConnectionStateChanged.Callback,
|
|
411
|
+
): void
|
|
412
|
+
|
|
413
|
+
/** 取消监听当前外围设备被连接或断开连接事件
|
|
414
|
+
* @supported weapp
|
|
415
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.offBLEPeripheralConnectionStateChanged.html
|
|
416
|
+
*/
|
|
417
|
+
offBLEPeripheralConnectionStateChanged(
|
|
418
|
+
/** 当前外围设备被连接或断开连接事件的回调函数 */
|
|
419
|
+
callback: onBLEPeripheralConnectionStateChanged.Callback,
|
|
420
|
+
): void
|
|
421
|
+
|
|
422
|
+
/** 建立本地作为蓝牙低功耗外围设备的服务端,可创建多个
|
|
423
|
+
* @supported weapp
|
|
424
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.createBLEPeripheralServer.html
|
|
425
|
+
*/
|
|
426
|
+
createBLEPeripheralServer(
|
|
427
|
+
option: createBLEPeripheralServer.Option,
|
|
428
|
+
): Promise<createBLEPeripheralServer.SuccessCallbackResult>
|
|
429
|
+
}
|
|
430
|
+
}
|
|
@@ -103,6 +103,39 @@ declare module '../../index' {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
namespace makeBluetoothPair {
|
|
107
|
+
interface Option {
|
|
108
|
+
/** 蓝牙设备 id */
|
|
109
|
+
deviceId: string
|
|
110
|
+
/** pin 码,Base64 格式 */
|
|
111
|
+
pin: string
|
|
112
|
+
/** 超时时间,单位 ms
|
|
113
|
+
* @default 20000
|
|
114
|
+
*/
|
|
115
|
+
timeout?: string
|
|
116
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
117
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
118
|
+
/** 接口调用失败的回调函数 */
|
|
119
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
120
|
+
/** 接口调用成功的回调函数 */
|
|
121
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
namespace isBluetoothDevicePaired {
|
|
126
|
+
interface Option {
|
|
127
|
+
/** 蓝牙设备 id */
|
|
128
|
+
deviceId: string
|
|
129
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
130
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
131
|
+
/** 接口调用失败的回调函数 */
|
|
132
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
133
|
+
/** 接口调用成功的回调函数 */
|
|
134
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
135
|
+
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
106
139
|
namespace getConnectedBluetoothDevices {
|
|
107
140
|
interface Option {
|
|
108
141
|
/** 蓝牙设备主 service 的 uuid 列表 */
|
|
@@ -225,7 +258,7 @@ declare module '../../index' {
|
|
|
225
258
|
* ```
|
|
226
259
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.startBluetoothDevicesDiscovery.html
|
|
227
260
|
*/
|
|
228
|
-
|
|
261
|
+
startBluetoothDevicesDiscovery(
|
|
229
262
|
option: startBluetoothDevicesDiscovery.Option,
|
|
230
263
|
): Promise<startBluetoothDevicesDiscovery.Promised>
|
|
231
264
|
|
|
@@ -294,6 +327,38 @@ declare module '../../index' {
|
|
|
294
327
|
callback: onBluetoothAdapterStateChange.Callback,
|
|
295
328
|
): void
|
|
296
329
|
|
|
330
|
+
/** 取消监听寻找到新设备的事件
|
|
331
|
+
* @supported weapp
|
|
332
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothDeviceFound.html
|
|
333
|
+
*/
|
|
334
|
+
offBluetoothDeviceFound(
|
|
335
|
+
/** 寻找到新设备的事件的回调函数 */
|
|
336
|
+
callback: onBluetoothDeviceFound.Callback,
|
|
337
|
+
): void
|
|
338
|
+
|
|
339
|
+
/** 取消监听蓝牙适配器状态变化事件
|
|
340
|
+
* @supported weapp
|
|
341
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothAdapterStateChange.html
|
|
342
|
+
*/
|
|
343
|
+
offBluetoothAdapterStateChange(
|
|
344
|
+
/** 蓝牙适配器状态变化事件的回调函数 */
|
|
345
|
+
callback: onBluetoothAdapterStateChange.Callback,
|
|
346
|
+
): void
|
|
347
|
+
|
|
348
|
+
/** 蓝牙配对接口,仅安卓支持
|
|
349
|
+
*
|
|
350
|
+
* 通常情况下(需要指定 pin 码或者密码时)系统会接管配对流程,直接调用 [Taro.createBLEConnection](/docs/apis/device/bluetooth-ble/createBLEConnection) 即可。该接口只应当在开发者不想让用户手动输入 pin 码且真机验证确认可以正常生效情况下用。
|
|
351
|
+
* @supported weapp
|
|
352
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.makeBluetoothPair.html
|
|
353
|
+
*/
|
|
354
|
+
makeBluetoothPair(option: makeBluetoothPair.Option): Promise<TaroGeneral.CallbackResult>
|
|
355
|
+
|
|
356
|
+
/** 查询蓝牙设备是否配对,仅安卓支持
|
|
357
|
+
* @supported weapp
|
|
358
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.isBluetoothDevicePaired.html
|
|
359
|
+
*/
|
|
360
|
+
isBluetoothDevicePaired(option: isBluetoothDevicePaired.Option): boolean
|
|
361
|
+
|
|
297
362
|
/** 根据 uuid 获取处于已连接状态的设备。
|
|
298
363
|
* @supported weapp
|
|
299
364
|
* @example
|
|
@@ -308,7 +373,7 @@ declare module '../../index' {
|
|
|
308
373
|
*/
|
|
309
374
|
getConnectedBluetoothDevices(
|
|
310
375
|
option: getConnectedBluetoothDevices.Option,
|
|
311
|
-
):
|
|
376
|
+
): Promise<getConnectedBluetoothDevices.SuccessCallbackResult>
|
|
312
377
|
|
|
313
378
|
/** 获取在蓝牙模块生效期间所有已发现的蓝牙设备。包括已经和本机处于连接状态的设备。
|
|
314
379
|
*
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace addPhoneRepeatCalendar {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 日历事件标题 */
|
|
7
|
+
title: string
|
|
8
|
+
/** 开始时间的 unix 时间戳 (1970年1月1日开始所经过的秒数) */
|
|
9
|
+
startTime: number
|
|
10
|
+
/** 是否全天事件
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
allDay?: boolean
|
|
14
|
+
/** 事件说明 */
|
|
15
|
+
description?: string
|
|
16
|
+
/** 事件位置 */
|
|
17
|
+
location?: string
|
|
18
|
+
/** 结束时间的 unix 时间戳,默认与开始时间相同 */
|
|
19
|
+
endTime?: string
|
|
20
|
+
/** 是否提醒
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
alarm?: boolean
|
|
24
|
+
/** 提醒提前量,单位秒,默认 0 表示开始时提醒
|
|
25
|
+
* @default 0
|
|
26
|
+
*/
|
|
27
|
+
alarmOffset?: number
|
|
28
|
+
/** 重复周期,默认 month 每月重复
|
|
29
|
+
* @default "month"
|
|
30
|
+
*/
|
|
31
|
+
repeatInterval?: string
|
|
32
|
+
/** 重复周期结束时间的 unix 时间戳,不填表示一直重复 */
|
|
33
|
+
repeatEndTime?: number
|
|
34
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
35
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
36
|
+
/** 接口调用失败的回调函数 */
|
|
37
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
38
|
+
/** 接口调用成功的回调函数 */
|
|
39
|
+
success?: (result: TaroGeneral.CallbackResult) => void
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
namespace addPhoneCalendar {
|
|
44
|
+
interface Option {
|
|
45
|
+
/** 日历事件标题 */
|
|
46
|
+
title: string
|
|
47
|
+
/** 开始时间的 unix 时间戳 (1970年1月1日开始所经过的秒数) */
|
|
48
|
+
startTime: number
|
|
49
|
+
/** 是否全天事件
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
allDay?: boolean
|
|
53
|
+
/** 事件说明 */
|
|
54
|
+
description?: string
|
|
55
|
+
/** 事件位置 */
|
|
56
|
+
location?: string
|
|
57
|
+
/** 结束时间的 unix 时间戳,默认与开始时间相同 */
|
|
58
|
+
endTime?: string
|
|
59
|
+
/** 是否提醒
|
|
60
|
+
* @default true
|
|
61
|
+
*/
|
|
62
|
+
alarm?: boolean
|
|
63
|
+
/** 提醒提前量,单位秒,默认 0 表示开始时提醒
|
|
64
|
+
* @default 0
|
|
65
|
+
*/
|
|
66
|
+
alarmOffset?: number
|
|
67
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
68
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
69
|
+
/** 接口调用失败的回调函数 */
|
|
70
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
71
|
+
/** 接口调用成功的回调函数 */
|
|
72
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface TaroStatic {
|
|
77
|
+
/** 向系统日历添加重复事件
|
|
78
|
+
* @supported weapp
|
|
79
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneRepeatCalendar.html
|
|
80
|
+
*/
|
|
81
|
+
addPhoneRepeatCalendar(option: addPhoneRepeatCalendar.Option): Promise<TaroGeneral.CallbackResult>
|
|
82
|
+
/** 向系统日历添加事件
|
|
83
|
+
* @supported weapp
|
|
84
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneCalendar.html
|
|
85
|
+
*/
|
|
86
|
+
addPhoneCalendar(option: addPhoneCalendar.Option): Promise<TaroGeneral.CallbackResult>
|
|
87
|
+
}
|
|
88
|
+
}
|