@spcsn/taro 0.1.0
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/README.md +12 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/index.js +9 -0
- package/package.json +86 -0
- package/types/api/ad/index.d.ts +197 -0
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/inference.d.ts +129 -0
- package/types/api/ai/visionkit.d.ts +874 -0
- package/types/api/alipay/index.d.ts +69 -0
- package/types/api/base/crypto.d.ts +104 -0
- package/types/api/base/debug.d.ts +329 -0
- package/types/api/base/env.d.ts +19 -0
- package/types/api/base/index.d.ts +102 -0
- package/types/api/base/performance.d.ts +258 -0
- package/types/api/base/system.d.ts +742 -0
- package/types/api/base/update.d.ts +130 -0
- package/types/api/base/weapp/app-event.d.ts +265 -0
- package/types/api/base/weapp/life-cycle.d.ts +155 -0
- package/types/api/canvas/index.d.ts +2162 -0
- package/types/api/cloud/index.d.ts +2622 -0
- package/types/api/data-analysis/index.d.ts +122 -0
- package/types/api/device/accelerometer.d.ts +102 -0
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +46 -0
- package/types/api/device/bluetooth-ble.d.ts +601 -0
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +463 -0
- package/types/api/device/calendar.d.ts +98 -0
- package/types/api/device/clipboard.d.ts +81 -0
- package/types/api/device/compass.d.ts +105 -0
- package/types/api/device/contact.d.ts +110 -0
- package/types/api/device/gyroscope.d.ts +85 -0
- package/types/api/device/iBeacon.d.ts +168 -0
- package/types/api/device/keyboard.d.ts +97 -0
- package/types/api/device/memory.d.ts +52 -0
- package/types/api/device/motion.d.ts +88 -0
- package/types/api/device/network.d.ts +172 -0
- package/types/api/device/nfc.d.ts +1238 -0
- package/types/api/device/phone.d.ts +30 -0
- package/types/api/device/scan.d.ts +111 -0
- package/types/api/device/screen.d.ts +217 -0
- package/types/api/device/sms.d.ts +26 -0
- package/types/api/device/vibrate.d.ts +51 -0
- package/types/api/device/wifi.d.ts +301 -0
- package/types/api/ext/index.d.ts +64 -0
- package/types/api/files/index.d.ts +1472 -0
- package/types/api/framework/index.d.ts +51 -0
- package/types/api/location/index.d.ts +517 -0
- package/types/api/media/audio.d.ts +1013 -0
- package/types/api/media/background-audio.d.ts +291 -0
- package/types/api/media/camera.d.ts +207 -0
- package/types/api/media/editor.d.ts +239 -0
- package/types/api/media/image.d.ts +469 -0
- package/types/api/media/live.d.ts +461 -0
- package/types/api/media/map.d.ts +638 -0
- package/types/api/media/media-recorder.d.ts +117 -0
- package/types/api/media/recorder.d.ts +317 -0
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +84 -0
- package/types/api/media/video.d.ts +527 -0
- package/types/api/media/voip.d.ts +393 -0
- package/types/api/navigate/index.d.ts +327 -0
- package/types/api/network/download.d.ts +173 -0
- package/types/api/network/mdns.d.ts +191 -0
- package/types/api/network/request.d.ts +480 -0
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +218 -0
- package/types/api/network/upload.d.ts +201 -0
- package/types/api/network/websocket.d.ts +383 -0
- package/types/api/open-api/account.d.ts +51 -0
- package/types/api/open-api/address.d.ts +68 -0
- package/types/api/open-api/authorize.d.ts +80 -0
- package/types/api/open-api/card.d.ts +110 -0
- package/types/api/open-api/channels.d.ts +225 -0
- package/types/api/open-api/customer-service.d.ts +45 -0
- package/types/api/open-api/device-voip.d.ts +103 -0
- package/types/api/open-api/facial.d.ts +98 -0
- package/types/api/open-api/favorites.d.ts +101 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +87 -0
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +115 -0
- package/types/api/open-api/my-miniprogram.d.ts +28 -0
- package/types/api/open-api/privacy.d.ts +107 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +174 -0
- package/types/api/open-api/soter.d.ts +184 -0
- package/types/api/open-api/sticker.d.ts +83 -0
- package/types/api/open-api/subscribe-message.d.ts +305 -0
- package/types/api/open-api/user-info.d.ts +182 -0
- package/types/api/open-api/werun.d.ts +101 -0
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/qq/index.d.ts +354 -0
- package/types/api/route/index.d.ts +324 -0
- package/types/api/share/index.d.ts +354 -0
- package/types/api/skyline/index.d.ts +345 -0
- package/types/api/storage/background-fetch.d.ts +131 -0
- package/types/api/storage/cache-manager.d.ts +249 -0
- package/types/api/storage/index.d.ts +405 -0
- package/types/api/swan/bookshelf.d.ts +307 -0
- package/types/api/swan/download-package.d.ts +80 -0
- package/types/api/swan/index.d.ts +251 -0
- package/types/api/swan/pay.d.ts +139 -0
- package/types/api/taro.extend.d.ts +233 -0
- package/types/api/taro.hooks.d.ts +148 -0
- package/types/api/ui/animation.d.ts +427 -0
- package/types/api/ui/background.d.ts +69 -0
- package/types/api/ui/custom-component.d.ts +23 -0
- package/types/api/ui/fonts.d.ts +77 -0
- package/types/api/ui/interaction.d.ts +281 -0
- package/types/api/ui/menu.d.ts +29 -0
- package/types/api/ui/navigation-bar.d.ts +130 -0
- package/types/api/ui/pull-down-refresh.d.ts +50 -0
- package/types/api/ui/scroll.d.ts +114 -0
- package/types/api/ui/sticky.d.ts +32 -0
- package/types/api/ui/tab-bar.d.ts +196 -0
- package/types/api/ui/window.d.ts +71 -0
- package/types/api/worker/index.d.ts +83 -0
- package/types/api/wxml/index.d.ts +540 -0
- package/types/compile/compiler.d.ts +32 -0
- package/types/compile/config/h5.d.ts +134 -0
- package/types/compile/config/harmony.d.ts +118 -0
- package/types/compile/config/index.d.ts +8 -0
- package/types/compile/config/manifest.d.ts +155 -0
- package/types/compile/config/mini.d.ts +118 -0
- package/types/compile/config/plugin.d.ts +34 -0
- package/types/compile/config/project.d.ts +338 -0
- package/types/compile/config/rn.d.ts +85 -0
- package/types/compile/config/util.d.ts +179 -0
- package/types/compile/hooks.d.ts +13 -0
- package/types/compile/index.d.ts +11 -0
- package/types/compile/viteCompilerContext.d.ts +167 -0
- package/types/global.d.ts +428 -0
- package/types/index.d.ts +190 -0
- package/types/taro.api.d.ts +130 -0
- package/types/taro.component.d.ts +168 -0
- package/types/taro.config.d.ts +712 -0
- package/types/taro.lifecycle.d.ts +220 -0
- package/types/taro.runtime.d.ts +9 -0
|
@@ -0,0 +1,1238 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace stopHCE {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
10
|
+
/** 接口调用成功的回调函数 */
|
|
11
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
namespace startHCE {
|
|
16
|
+
interface Option {
|
|
17
|
+
/** 需要注册到系统的 AID 列表 */
|
|
18
|
+
aid_list: string[]
|
|
19
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
20
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
21
|
+
/** 接口调用失败的回调函数 */
|
|
22
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
23
|
+
/** 接口调用成功的回调函数 */
|
|
24
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
namespace sendHCEMessage {
|
|
29
|
+
interface Option {
|
|
30
|
+
/** 二进制数据 */
|
|
31
|
+
data: ArrayBuffer
|
|
32
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
33
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
34
|
+
/** 接口调用失败的回调函数 */
|
|
35
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
36
|
+
/** 接口调用成功的回调函数 */
|
|
37
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
namespace onHCEMessage {
|
|
42
|
+
/** 接收 NFC 设备消息事件的回调函数 */
|
|
43
|
+
type Callback = (result: CallbackResult) => void
|
|
44
|
+
|
|
45
|
+
interface CallbackResult {
|
|
46
|
+
/** `messageType=1` 时 ,客户端接收到 NFC 设备的指令 */
|
|
47
|
+
data: ArrayBuffer
|
|
48
|
+
/** 消息类型 */
|
|
49
|
+
messageType: keyof MessageType
|
|
50
|
+
/** `messageType=2` 时,原因 */
|
|
51
|
+
reason: number
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** 消息类型 */
|
|
55
|
+
interface MessageType {
|
|
56
|
+
/** HCE APDU Command类型,小程序需对此指令进行处理,并调用 sendHCEMessage 接口返回处理指令 */
|
|
57
|
+
1
|
|
58
|
+
/** 设备离场事件类型 */
|
|
59
|
+
2
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
namespace getHCEState {
|
|
64
|
+
interface Option {
|
|
65
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
66
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
67
|
+
/** 接口调用失败的回调函数 */
|
|
68
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
69
|
+
/** 接口调用成功的回调函数 */
|
|
70
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** IsoDep 标签
|
|
75
|
+
* @supported weapp
|
|
76
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.html
|
|
77
|
+
*/
|
|
78
|
+
interface IsoDep {
|
|
79
|
+
/** 断开连接
|
|
80
|
+
* @supported weapp
|
|
81
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.close.html
|
|
82
|
+
*/
|
|
83
|
+
close(option?: IsoDep.close.Option): Promise<TaroGeneral.NFCError>
|
|
84
|
+
/** 连接 NFC 标签
|
|
85
|
+
* @supported weapp
|
|
86
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.connect.html
|
|
87
|
+
*/
|
|
88
|
+
connect(option?: IsoDep.connect.Option): Promise<TaroGeneral.NFCError>
|
|
89
|
+
/** 获取复位信息
|
|
90
|
+
* @supported weapp
|
|
91
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getHistoricalBytes.html
|
|
92
|
+
*/
|
|
93
|
+
getHistoricalBytes(option?: IsoDep.getHistoricalBytes.Option): Promise<TaroGeneral.NFCError>
|
|
94
|
+
/** 获取最大传输长度
|
|
95
|
+
* @supported weapp
|
|
96
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getMaxTransceiveLength.html
|
|
97
|
+
*/
|
|
98
|
+
getMaxTransceiveLength(option?: IsoDep.getMaxTransceiveLength.Option): Promise<TaroGeneral.NFCError>
|
|
99
|
+
/** 检查是否已连接
|
|
100
|
+
* @supported weapp
|
|
101
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.isConnected.html
|
|
102
|
+
*/
|
|
103
|
+
isConnected(option?: IsoDep.isConnected.Option): Promise<TaroGeneral.NFCError>
|
|
104
|
+
/** 设置超时时间
|
|
105
|
+
* @supported weapp
|
|
106
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.setTimeout.html
|
|
107
|
+
*/
|
|
108
|
+
setTimeout(option?: IsoDep.setTimeout.Option): Promise<TaroGeneral.NFCError>
|
|
109
|
+
/** 发送数据
|
|
110
|
+
* @supported weapp
|
|
111
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.transceive.html
|
|
112
|
+
*/
|
|
113
|
+
transceive(option?: IsoDep.transceive.Option): Promise<TaroGeneral.NFCError>
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
namespace IsoDep {
|
|
117
|
+
namespace close {
|
|
118
|
+
interface Option {
|
|
119
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
120
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
121
|
+
/** 接口调用失败的回调函数 */
|
|
122
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
123
|
+
/** 接口调用成功的回调函数 */
|
|
124
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
namespace connect {
|
|
128
|
+
interface Option {
|
|
129
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
130
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
131
|
+
/** 接口调用失败的回调函数 */
|
|
132
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
133
|
+
/** 接口调用成功的回调函数 */
|
|
134
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
namespace getHistoricalBytes {
|
|
138
|
+
interface Option {
|
|
139
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
140
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
141
|
+
/** 接口调用失败的回调函数 */
|
|
142
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
143
|
+
/** 接口调用成功的回调函数 */
|
|
144
|
+
success?: (result: SuccessCallbackResult) => void
|
|
145
|
+
}
|
|
146
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
147
|
+
/** 返回历史二进制数据 */
|
|
148
|
+
histBytes: ArrayBuffer
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
namespace getMaxTransceiveLength {
|
|
152
|
+
interface Option {
|
|
153
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
154
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
155
|
+
/** 接口调用失败的回调函数 */
|
|
156
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
157
|
+
/** 接口调用成功的回调函数 */
|
|
158
|
+
success?: (result: SuccessCallbackResult) => void
|
|
159
|
+
}
|
|
160
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
161
|
+
/** 最大传输长度 */
|
|
162
|
+
length: number
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
namespace isConnected {
|
|
166
|
+
interface Option {
|
|
167
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
168
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
169
|
+
/** 接口调用失败的回调函数 */
|
|
170
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
171
|
+
/** 接口调用成功的回调函数 */
|
|
172
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
namespace setTimeout {
|
|
176
|
+
interface Option {
|
|
177
|
+
/** 设置超时时间 (ms) */
|
|
178
|
+
timeout: number
|
|
179
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
180
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
181
|
+
/** 接口调用失败的回调函数 */
|
|
182
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
183
|
+
/** 接口调用成功的回调函数 */
|
|
184
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
namespace transceive {
|
|
188
|
+
interface Option {
|
|
189
|
+
/** 需要传递的二进制数据 */
|
|
190
|
+
data: ArrayBuffer
|
|
191
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
192
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
193
|
+
/** 接口调用失败的回调函数 */
|
|
194
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
195
|
+
/** 接口调用成功的回调函数 */
|
|
196
|
+
success?: (result: SuccessCallbackResult) => void
|
|
197
|
+
}
|
|
198
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
199
|
+
data: ArrayBuffer
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** MifareClassic 标签
|
|
205
|
+
* @supported weapp
|
|
206
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.html
|
|
207
|
+
*/
|
|
208
|
+
interface MifareClassic {
|
|
209
|
+
/** 断开连接
|
|
210
|
+
* @supported weapp
|
|
211
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.close.html
|
|
212
|
+
*/
|
|
213
|
+
close(option?: MifareClassic.close.Option): Promise<TaroGeneral.NFCError>
|
|
214
|
+
/** 连接 NFC 标签
|
|
215
|
+
* @supported weapp
|
|
216
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.connect.html
|
|
217
|
+
*/
|
|
218
|
+
connect(option?: MifareClassic.connect.Option): Promise<TaroGeneral.NFCError>
|
|
219
|
+
/** 获取最大传输长度
|
|
220
|
+
* @supported weapp
|
|
221
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.getMaxTransceiveLength.html
|
|
222
|
+
*/
|
|
223
|
+
getMaxTransceiveLength(option?: MifareClassic.getMaxTransceiveLength.Option): Promise<TaroGeneral.NFCError>
|
|
224
|
+
/** 检查是否已连接
|
|
225
|
+
* @supported weapp
|
|
226
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.isConnected.html
|
|
227
|
+
*/
|
|
228
|
+
isConnected(option?: MifareClassic.isConnected.Option): Promise<TaroGeneral.NFCError>
|
|
229
|
+
/** 设置超时时间
|
|
230
|
+
* @supported weapp
|
|
231
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.setTimeout.html
|
|
232
|
+
*/
|
|
233
|
+
setTimeout(option?: MifareClassic.setTimeout.Option): Promise<TaroGeneral.NFCError>
|
|
234
|
+
/** 发送数据
|
|
235
|
+
* @supported weapp
|
|
236
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.transceive.html
|
|
237
|
+
*/
|
|
238
|
+
transceive(option?: MifareClassic.transceive.Option): Promise<TaroGeneral.NFCError>
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
namespace MifareClassic {
|
|
242
|
+
namespace close {
|
|
243
|
+
interface Option {
|
|
244
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
245
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
246
|
+
/** 接口调用失败的回调函数 */
|
|
247
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
248
|
+
/** 接口调用成功的回调函数 */
|
|
249
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
namespace connect {
|
|
253
|
+
interface Option {
|
|
254
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
255
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
256
|
+
/** 接口调用失败的回调函数 */
|
|
257
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
258
|
+
/** 接口调用成功的回调函数 */
|
|
259
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
namespace getMaxTransceiveLength {
|
|
263
|
+
interface Option {
|
|
264
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
265
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
266
|
+
/** 接口调用失败的回调函数 */
|
|
267
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
268
|
+
/** 接口调用成功的回调函数 */
|
|
269
|
+
success?: (result: SuccessCallbackResult) => void
|
|
270
|
+
}
|
|
271
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
272
|
+
/** 最大传输长度 */
|
|
273
|
+
length: number
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
namespace isConnected {
|
|
277
|
+
interface Option {
|
|
278
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
279
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
280
|
+
/** 接口调用失败的回调函数 */
|
|
281
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
282
|
+
/** 接口调用成功的回调函数 */
|
|
283
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
namespace setTimeout {
|
|
287
|
+
interface Option {
|
|
288
|
+
/** 设置超时时间 (ms) */
|
|
289
|
+
timeout: number
|
|
290
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
291
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
292
|
+
/** 接口调用失败的回调函数 */
|
|
293
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
294
|
+
/** 接口调用成功的回调函数 */
|
|
295
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
namespace transceive {
|
|
299
|
+
interface Option {
|
|
300
|
+
/** 需要传递的二进制数据 */
|
|
301
|
+
data: ArrayBuffer
|
|
302
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
303
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
304
|
+
/** 接口调用失败的回调函数 */
|
|
305
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
306
|
+
/** 接口调用成功的回调函数 */
|
|
307
|
+
success?: (result: SuccessCallbackResult) => void
|
|
308
|
+
}
|
|
309
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
310
|
+
data: ArrayBuffer
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** MifareUltralight 标签
|
|
316
|
+
* @supported weapp
|
|
317
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.html
|
|
318
|
+
*/
|
|
319
|
+
interface MifareUltralight {
|
|
320
|
+
/** 断开连接
|
|
321
|
+
* @supported weapp
|
|
322
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.close.html
|
|
323
|
+
*/
|
|
324
|
+
close(option?: MifareUltralight.close.Option): Promise<TaroGeneral.NFCError>
|
|
325
|
+
/** 连接 NFC 标签
|
|
326
|
+
* @supported weapp
|
|
327
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.connect.html
|
|
328
|
+
*/
|
|
329
|
+
connect(option?: MifareUltralight.connect.Option): Promise<TaroGeneral.NFCError>
|
|
330
|
+
/** 获取最大传输长度
|
|
331
|
+
* @supported weapp
|
|
332
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.getMaxTransceiveLength.html
|
|
333
|
+
*/
|
|
334
|
+
getMaxTransceiveLength(option?: MifareUltralight.getMaxTransceiveLength.Option): Promise<TaroGeneral.NFCError>
|
|
335
|
+
/** 检查是否已连接
|
|
336
|
+
* @supported weapp
|
|
337
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.isConnected.html
|
|
338
|
+
*/
|
|
339
|
+
isConnected(option?: MifareUltralight.isConnected.Option): Promise<TaroGeneral.NFCError>
|
|
340
|
+
/** 设置超时时间
|
|
341
|
+
* @supported weapp
|
|
342
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.setTimeout.html
|
|
343
|
+
*/
|
|
344
|
+
setTimeout(option?: MifareUltralight.setTimeout.Option): Promise<TaroGeneral.NFCError>
|
|
345
|
+
/** 发送数据
|
|
346
|
+
* @supported weapp
|
|
347
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.transceive.html
|
|
348
|
+
*/
|
|
349
|
+
transceive(option?: MifareUltralight.transceive.Option): Promise<TaroGeneral.NFCError>
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
namespace MifareUltralight {
|
|
353
|
+
namespace close {
|
|
354
|
+
interface Option {
|
|
355
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
356
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
357
|
+
/** 接口调用失败的回调函数 */
|
|
358
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
359
|
+
/** 接口调用成功的回调函数 */
|
|
360
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
namespace connect {
|
|
364
|
+
interface Option {
|
|
365
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
366
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
367
|
+
/** 接口调用失败的回调函数 */
|
|
368
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
369
|
+
/** 接口调用成功的回调函数 */
|
|
370
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
namespace getMaxTransceiveLength {
|
|
374
|
+
interface Option {
|
|
375
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
376
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
377
|
+
/** 接口调用失败的回调函数 */
|
|
378
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
379
|
+
/** 接口调用成功的回调函数 */
|
|
380
|
+
success?: (result: SuccessCallbackResult) => void
|
|
381
|
+
}
|
|
382
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
383
|
+
/** 最大传输长度 */
|
|
384
|
+
length: number
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
namespace isConnected {
|
|
388
|
+
interface Option {
|
|
389
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
390
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
391
|
+
/** 接口调用失败的回调函数 */
|
|
392
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
393
|
+
/** 接口调用成功的回调函数 */
|
|
394
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
namespace setTimeout {
|
|
398
|
+
interface Option {
|
|
399
|
+
/** 设置超时时间 (ms) */
|
|
400
|
+
timeout: number
|
|
401
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
402
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
403
|
+
/** 接口调用失败的回调函数 */
|
|
404
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
405
|
+
/** 接口调用成功的回调函数 */
|
|
406
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
namespace transceive {
|
|
410
|
+
interface Option {
|
|
411
|
+
/** 需要传递的二进制数据 */
|
|
412
|
+
data: ArrayBuffer
|
|
413
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
414
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
415
|
+
/** 接口调用失败的回调函数 */
|
|
416
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
417
|
+
/** 接口调用成功的回调函数 */
|
|
418
|
+
success?: (result: SuccessCallbackResult) => void
|
|
419
|
+
}
|
|
420
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
421
|
+
data: ArrayBuffer
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/** Ndef 标签
|
|
427
|
+
* @supported weapp
|
|
428
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.html
|
|
429
|
+
*/
|
|
430
|
+
interface Ndef {
|
|
431
|
+
/** 断开连接
|
|
432
|
+
* @supported weapp
|
|
433
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.close.html
|
|
434
|
+
*/
|
|
435
|
+
close(option?: Ndef.close.Option): Promise<TaroGeneral.NFCError>
|
|
436
|
+
/** 连接 NFC 标签
|
|
437
|
+
* @supported weapp
|
|
438
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.connect.html
|
|
439
|
+
*/
|
|
440
|
+
connect(option?: Ndef.connect.Option): Promise<TaroGeneral.NFCError>
|
|
441
|
+
/** 检查是否已连接
|
|
442
|
+
* @supported weapp
|
|
443
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.isConnected.html
|
|
444
|
+
*/
|
|
445
|
+
isConnected(option?: Ndef.isConnected.Option): Promise<TaroGeneral.NFCError>
|
|
446
|
+
/** 取消监听 Ndef 消息
|
|
447
|
+
* @supported weapp
|
|
448
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.offNdefMessage.html
|
|
449
|
+
*/
|
|
450
|
+
offNdefMessage(
|
|
451
|
+
/** 监听 Ndef 消息回调函数 */
|
|
452
|
+
callback: Ndef.onNdefMessage.Callback,
|
|
453
|
+
): void
|
|
454
|
+
/** 监听 Ndef 消息
|
|
455
|
+
* @supported weapp
|
|
456
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.onNdefMessage.html
|
|
457
|
+
*/
|
|
458
|
+
onNdefMessage(
|
|
459
|
+
/** 监听 Ndef 消息回调函数 */
|
|
460
|
+
callback: Ndef.onNdefMessage.Callback,
|
|
461
|
+
): void
|
|
462
|
+
/** 设置超时时间
|
|
463
|
+
* @supported weapp
|
|
464
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.setTimeout.html
|
|
465
|
+
*/
|
|
466
|
+
setTimeout(option?: Ndef.setTimeout.Option): Promise<TaroGeneral.NFCError>
|
|
467
|
+
/** 重写 Ndef 标签内容
|
|
468
|
+
* @supported weapp
|
|
469
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.writeNdefMessage.html
|
|
470
|
+
*/
|
|
471
|
+
writeNdefMessage(option?: Ndef.writeNdefMessage.Option): Promise<TaroGeneral.NFCError>
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
namespace Ndef {
|
|
475
|
+
namespace close {
|
|
476
|
+
interface Option {
|
|
477
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
478
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
479
|
+
/** 接口调用失败的回调函数 */
|
|
480
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
481
|
+
/** 接口调用成功的回调函数 */
|
|
482
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
namespace connect {
|
|
486
|
+
interface Option {
|
|
487
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
488
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
489
|
+
/** 接口调用失败的回调函数 */
|
|
490
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
491
|
+
/** 接口调用成功的回调函数 */
|
|
492
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
namespace isConnected {
|
|
496
|
+
interface Option {
|
|
497
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
498
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
499
|
+
/** 接口调用失败的回调函数 */
|
|
500
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
501
|
+
/** 接口调用成功的回调函数 */
|
|
502
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
namespace onNdefMessage {
|
|
506
|
+
/** 监听 Ndef 消息回调函数 */
|
|
507
|
+
type Callback = (...args: unknown[]) => void
|
|
508
|
+
}
|
|
509
|
+
namespace setTimeout {
|
|
510
|
+
interface Option {
|
|
511
|
+
/** 设置超时时间 (ms) */
|
|
512
|
+
timeout: number
|
|
513
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
514
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
515
|
+
/** 接口调用失败的回调函数 */
|
|
516
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
517
|
+
/** 接口调用成功的回调函数 */
|
|
518
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
namespace writeNdefMessage {
|
|
522
|
+
interface Option {
|
|
523
|
+
/** uri 数组 */
|
|
524
|
+
uris?: string[]
|
|
525
|
+
/** text 数组 */
|
|
526
|
+
texts?: string[]
|
|
527
|
+
/** 二进制对象数组, 需要指明 id, type 以及 payload (均为 ArrayBuffer 类型) */
|
|
528
|
+
records?: record[]
|
|
529
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
530
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
531
|
+
/** 接口调用失败的回调函数 */
|
|
532
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
533
|
+
/** 接口调用成功的回调函数 */
|
|
534
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
535
|
+
}
|
|
536
|
+
interface record {
|
|
537
|
+
id: ArrayBuffer
|
|
538
|
+
type: ArrayBuffer
|
|
539
|
+
payload: ArrayBuffer
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/** NfcA 标签
|
|
545
|
+
* @supported weapp, tt
|
|
546
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.html
|
|
547
|
+
*/
|
|
548
|
+
interface NfcA {
|
|
549
|
+
/** 断开连接
|
|
550
|
+
* @supported weapp, tt
|
|
551
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.close.html
|
|
552
|
+
*/
|
|
553
|
+
close(option?: NfcA.close.Option): Promise<TaroGeneral.NFCError>
|
|
554
|
+
/** 连接 NFC 标签
|
|
555
|
+
* @supported weapp, tt
|
|
556
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.connect.html
|
|
557
|
+
*/
|
|
558
|
+
connect(option?: NfcA.connect.Option): Promise<TaroGeneral.NFCError>
|
|
559
|
+
/** 获取 ATQA 信息
|
|
560
|
+
* @supported weapp, tt
|
|
561
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getAtqa.html
|
|
562
|
+
*/
|
|
563
|
+
getAtqa(option?: NfcA.getAtqa.Option): Promise<TaroGeneral.NFCError>
|
|
564
|
+
/** 获取最大传输长度
|
|
565
|
+
* @supported weapp, tt
|
|
566
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getMaxTransceiveLength.html
|
|
567
|
+
*/
|
|
568
|
+
getMaxTransceiveLength(option?: NfcA.getMaxTransceiveLength.Option): Promise<TaroGeneral.NFCError>
|
|
569
|
+
/** 获取 SAK 信息
|
|
570
|
+
* @supported weapp, tt
|
|
571
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getSak.html
|
|
572
|
+
*/
|
|
573
|
+
getSak(option?: NfcA.getSak.Option): Promise<TaroGeneral.NFCError>
|
|
574
|
+
/** 检查是否已连接
|
|
575
|
+
* @supported weapp, tt
|
|
576
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.isConnected.html
|
|
577
|
+
*/
|
|
578
|
+
isConnected(option?: NfcA.isConnected.Option): Promise<TaroGeneral.NFCError>
|
|
579
|
+
/** 设置超时时间
|
|
580
|
+
* @supported weapp, tt
|
|
581
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.setTimeout.html
|
|
582
|
+
*/
|
|
583
|
+
setTimeout(option?: NfcA.setTimeout.Option): Promise<TaroGeneral.NFCError>
|
|
584
|
+
/** 发送数据
|
|
585
|
+
* @supported weapp, tt
|
|
586
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.transceive.html
|
|
587
|
+
*/
|
|
588
|
+
transceive(option?: NfcA.transceive.Option): Promise<TaroGeneral.NFCError>
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
namespace NfcA {
|
|
592
|
+
namespace close {
|
|
593
|
+
interface Option {
|
|
594
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
595
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
596
|
+
/** 接口调用失败的回调函数 */
|
|
597
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
598
|
+
/** 接口调用成功的回调函数 */
|
|
599
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
namespace connect {
|
|
603
|
+
interface Option {
|
|
604
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
605
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
606
|
+
/** 接口调用失败的回调函数 */
|
|
607
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
608
|
+
/** 接口调用成功的回调函数 */
|
|
609
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
namespace getAtqa {
|
|
613
|
+
interface Option {
|
|
614
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
615
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
616
|
+
/** 接口调用失败的回调函数 */
|
|
617
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
618
|
+
/** 接口调用成功的回调函数 */
|
|
619
|
+
success?: (result: SuccessCallbackResult) => void
|
|
620
|
+
}
|
|
621
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
622
|
+
/** 返回 ATQA/SENS_RES 数据 */
|
|
623
|
+
atqa: ArrayBuffer
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
namespace getMaxTransceiveLength {
|
|
627
|
+
interface Option {
|
|
628
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
629
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
630
|
+
/** 接口调用失败的回调函数 */
|
|
631
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
632
|
+
/** 接口调用成功的回调函数 */
|
|
633
|
+
success?: (result: SuccessCallbackResult) => void
|
|
634
|
+
}
|
|
635
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
636
|
+
/** 最大传输长度 */
|
|
637
|
+
length: number
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
namespace getSak {
|
|
641
|
+
interface Option {
|
|
642
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
643
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
644
|
+
/** 接口调用失败的回调函数 */
|
|
645
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
646
|
+
/** 接口调用成功的回调函数 */
|
|
647
|
+
success?: (result: SuccessCallbackResult) => void
|
|
648
|
+
}
|
|
649
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
650
|
+
/** 返回 SAK/SEL_RES 数据 */
|
|
651
|
+
sak: number
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
namespace isConnected {
|
|
655
|
+
interface Option {
|
|
656
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
657
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
658
|
+
/** 接口调用失败的回调函数 */
|
|
659
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
660
|
+
/** 接口调用成功的回调函数 */
|
|
661
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
namespace setTimeout {
|
|
665
|
+
interface Option {
|
|
666
|
+
/** 设置超时时间 (ms) */
|
|
667
|
+
timeout: number
|
|
668
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
669
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
670
|
+
/** 接口调用失败的回调函数 */
|
|
671
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
672
|
+
/** 接口调用成功的回调函数 */
|
|
673
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
namespace transceive {
|
|
677
|
+
interface Option {
|
|
678
|
+
/** 需要传递的二进制数据 */
|
|
679
|
+
data: ArrayBuffer
|
|
680
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
681
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
682
|
+
/** 接口调用失败的回调函数 */
|
|
683
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
684
|
+
/** 接口调用成功的回调函数 */
|
|
685
|
+
success?: (result: SuccessCallbackResult) => void
|
|
686
|
+
}
|
|
687
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
688
|
+
data: ArrayBuffer
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
/** NFC 实例
|
|
694
|
+
* @supported weapp
|
|
695
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.html
|
|
696
|
+
*/
|
|
697
|
+
interface NFCAdapter {
|
|
698
|
+
/** 获取IsoDep实例,实例支持ISO-DEP (ISO 14443-4)标准的读写
|
|
699
|
+
* @supported weapp
|
|
700
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getIsoDep.html
|
|
701
|
+
*/
|
|
702
|
+
getIsoDep(): IsoDep
|
|
703
|
+
/** 获取MifareClassic实例,实例支持MIFARE Classic标签的读写
|
|
704
|
+
* @supported weapp, tt
|
|
705
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareClassic.html
|
|
706
|
+
*/
|
|
707
|
+
getMifareClassic(): MifareClassic
|
|
708
|
+
/** 获取MifareUltralight实例,实例支持MIFARE Ultralight标签的读写
|
|
709
|
+
* @supported weapp
|
|
710
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareUltralight.html
|
|
711
|
+
*/
|
|
712
|
+
getMifareUltralight(): MifareUltralight
|
|
713
|
+
/** 获取Ndef实例,实例支持对NDEF格式的NFC标签上的NDEF数据的读写
|
|
714
|
+
* @supported weapp
|
|
715
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNdef.html
|
|
716
|
+
*/
|
|
717
|
+
getNdef(): Ndef
|
|
718
|
+
/** 获取NfcA实例,实例支持NFC-A (ISO 14443-3A)标准的读写
|
|
719
|
+
* @supported weapp, tt
|
|
720
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcA.html
|
|
721
|
+
*/
|
|
722
|
+
getNfcA(): NfcA
|
|
723
|
+
/** 获取NfcB实例,实例支持NFC-B (ISO 14443-3B)标准的读写
|
|
724
|
+
* @supported weapp
|
|
725
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcB.html
|
|
726
|
+
*/
|
|
727
|
+
getNfcB(): NfcB
|
|
728
|
+
/** 获取NfcF实例,实例支持NFC-F (JIS 6319-4)标准的读写
|
|
729
|
+
* @supported weapp
|
|
730
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcF.html
|
|
731
|
+
*/
|
|
732
|
+
getNfcF(): NfcB
|
|
733
|
+
/** 获取NfcV实例,实例支持NFC-V (ISO 15693)标准的读写
|
|
734
|
+
* @supported weapp
|
|
735
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcV.html
|
|
736
|
+
*/
|
|
737
|
+
getNfcV(): NfcV
|
|
738
|
+
/** 取消监听 NFC Tag
|
|
739
|
+
* @supported weapp, tt
|
|
740
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.offDiscovered.html
|
|
741
|
+
*/
|
|
742
|
+
offDiscovered(
|
|
743
|
+
/** 监听 NFC Tag的回调函数 */
|
|
744
|
+
callback?: NFCAdapter.onDiscovered.Callback,
|
|
745
|
+
): void
|
|
746
|
+
/** 监听 NFC Tag
|
|
747
|
+
* @supported weapp, tt
|
|
748
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.onDiscovered.html
|
|
749
|
+
*/
|
|
750
|
+
onDiscovered(
|
|
751
|
+
/** 监听 NFC Tag的回调函数 */
|
|
752
|
+
callback: NFCAdapter.onDiscovered.Callback,
|
|
753
|
+
): void
|
|
754
|
+
/** 开始扫描NFC标签
|
|
755
|
+
* @supported weapp, tt
|
|
756
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.startDiscovery.html
|
|
757
|
+
*/
|
|
758
|
+
startDiscovery(option?: NFCAdapter.startDiscovery.Option): Promise<TaroGeneral.NFCError>
|
|
759
|
+
/** 关闭NFC标签扫描
|
|
760
|
+
* @supported weapp, tt
|
|
761
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.stopDiscovery.html
|
|
762
|
+
*/
|
|
763
|
+
stopDiscovery(option?: NFCAdapter.stopDiscovery.Option): Promise<TaroGeneral.NFCError>
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
namespace NFCAdapter {
|
|
767
|
+
namespace onDiscovered {
|
|
768
|
+
/** 监听 NFC Tag的回调函数 */
|
|
769
|
+
type Callback = (
|
|
770
|
+
result: CallbackResult,
|
|
771
|
+
) => void
|
|
772
|
+
|
|
773
|
+
interface CallbackResult {
|
|
774
|
+
/** tech 数组,用于匹配NFC卡片具体可以使用什么标准(NfcA等实例)处理 */
|
|
775
|
+
techs: string[]
|
|
776
|
+
/** NdefMessage 数组,消息格式为 {id: ArrayBuffer, type: ArrayBuffer, payload: ArrayBuffer} */
|
|
777
|
+
messages: NdefMessage[]
|
|
778
|
+
/** NFC标签的UID
|
|
779
|
+
* @supported tt
|
|
780
|
+
*/
|
|
781
|
+
id?: ArrayBuffer
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
interface NdefMessage {
|
|
785
|
+
id: ArrayBuffer
|
|
786
|
+
type: ArrayBuffer
|
|
787
|
+
payload: ArrayBuffer
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
namespace startDiscovery {
|
|
791
|
+
interface Option {
|
|
792
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
793
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
794
|
+
/** 接口调用失败的回调函数 */
|
|
795
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
796
|
+
/** 接口调用成功的回调函数 */
|
|
797
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
namespace stopDiscovery {
|
|
801
|
+
interface Option {
|
|
802
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
803
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
804
|
+
/** 接口调用失败的回调函数 */
|
|
805
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
806
|
+
/** 接口调用成功的回调函数 */
|
|
807
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/** NfcB 标签
|
|
813
|
+
* @supported weapp
|
|
814
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.html
|
|
815
|
+
*/
|
|
816
|
+
interface NfcB {
|
|
817
|
+
/** 断开连接
|
|
818
|
+
* @supported weapp
|
|
819
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.close.html
|
|
820
|
+
*/
|
|
821
|
+
close(option?: NfcB.close.Option): Promise<TaroGeneral.NFCError>
|
|
822
|
+
/** 连接 NFC 标签
|
|
823
|
+
* @supported weapp
|
|
824
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.connect.html
|
|
825
|
+
*/
|
|
826
|
+
connect(option?: NfcB.connect.Option): Promise<TaroGeneral.NFCError>
|
|
827
|
+
/** 获取最大传输长度
|
|
828
|
+
* @supported weapp
|
|
829
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.getMaxTransceiveLength.html
|
|
830
|
+
*/
|
|
831
|
+
getMaxTransceiveLength(option?: NfcB.getMaxTransceiveLength.Option): Promise<TaroGeneral.NFCError>
|
|
832
|
+
/** 检查是否已连接
|
|
833
|
+
* @supported weapp
|
|
834
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.isConnected.html
|
|
835
|
+
*/
|
|
836
|
+
isConnected(option?: NfcB.isConnected.Option): Promise<TaroGeneral.NFCError>
|
|
837
|
+
/** 设置超时时间
|
|
838
|
+
* @supported weapp
|
|
839
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.setTimeout.html
|
|
840
|
+
*/
|
|
841
|
+
setTimeout(option?: NfcB.setTimeout.Option): Promise<TaroGeneral.NFCError>
|
|
842
|
+
/** 发送数据
|
|
843
|
+
* @supported weapp
|
|
844
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.transceive.html
|
|
845
|
+
*/
|
|
846
|
+
transceive(option?: NfcB.transceive.Option): Promise<TaroGeneral.NFCError>
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
namespace NfcB {
|
|
850
|
+
namespace close {
|
|
851
|
+
interface Option {
|
|
852
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
853
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
854
|
+
/** 接口调用失败的回调函数 */
|
|
855
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
856
|
+
/** 接口调用成功的回调函数 */
|
|
857
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
namespace connect {
|
|
861
|
+
interface Option {
|
|
862
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
863
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
864
|
+
/** 接口调用失败的回调函数 */
|
|
865
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
866
|
+
/** 接口调用成功的回调函数 */
|
|
867
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
namespace getMaxTransceiveLength {
|
|
871
|
+
interface Option {
|
|
872
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
873
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
874
|
+
/** 接口调用失败的回调函数 */
|
|
875
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
876
|
+
/** 接口调用成功的回调函数 */
|
|
877
|
+
success?: (result: SuccessCallbackResult) => void
|
|
878
|
+
}
|
|
879
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
880
|
+
/** 最大传输长度 */
|
|
881
|
+
length: number
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
namespace isConnected {
|
|
885
|
+
interface Option {
|
|
886
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
887
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
888
|
+
/** 接口调用失败的回调函数 */
|
|
889
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
890
|
+
/** 接口调用成功的回调函数 */
|
|
891
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
namespace setTimeout {
|
|
895
|
+
interface Option {
|
|
896
|
+
/** 设置超时时间 (ms) */
|
|
897
|
+
timeout: number
|
|
898
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
899
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
900
|
+
/** 接口调用失败的回调函数 */
|
|
901
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
902
|
+
/** 接口调用成功的回调函数 */
|
|
903
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
namespace transceive {
|
|
907
|
+
interface Option {
|
|
908
|
+
/** 需要传递的二进制数据 */
|
|
909
|
+
data: ArrayBuffer
|
|
910
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
911
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
912
|
+
/** 接口调用失败的回调函数 */
|
|
913
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
914
|
+
/** 接口调用成功的回调函数 */
|
|
915
|
+
success?: (result: SuccessCallbackResult) => void
|
|
916
|
+
}
|
|
917
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
918
|
+
data: ArrayBuffer
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/** NfcF 标签
|
|
924
|
+
* @supported weapp
|
|
925
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.html
|
|
926
|
+
*/
|
|
927
|
+
interface NfcF {
|
|
928
|
+
/** 断开连接
|
|
929
|
+
* @supported weapp
|
|
930
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.close.html
|
|
931
|
+
*/
|
|
932
|
+
close(option?: NfcF.close.Option): Promise<TaroGeneral.NFCError>
|
|
933
|
+
/** 连接 NFC 标签
|
|
934
|
+
* @supported weapp
|
|
935
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.connect.html
|
|
936
|
+
*/
|
|
937
|
+
connect(option?: NfcF.connect.Option): Promise<TaroGeneral.NFCError>
|
|
938
|
+
/** 获取最大传输长度
|
|
939
|
+
* @supported weapp
|
|
940
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.getMaxTransceiveLength.html
|
|
941
|
+
*/
|
|
942
|
+
getMaxTransceiveLength(option?: NfcF.getMaxTransceiveLength.Option): Promise<TaroGeneral.NFCError>
|
|
943
|
+
/** 检查是否已连接
|
|
944
|
+
* @supported weapp
|
|
945
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.isConnected.html
|
|
946
|
+
*/
|
|
947
|
+
isConnected(option?: NfcF.isConnected.Option): Promise<TaroGeneral.NFCError>
|
|
948
|
+
/** 设置超时时间
|
|
949
|
+
* @supported weapp
|
|
950
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.setTimeout.html
|
|
951
|
+
*/
|
|
952
|
+
setTimeout(option?: NfcF.setTimeout.Option): Promise<TaroGeneral.NFCError>
|
|
953
|
+
/** 发送数据
|
|
954
|
+
* @supported weapp
|
|
955
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.transceive.html
|
|
956
|
+
*/
|
|
957
|
+
transceive(option?: NfcF.transceive.Option): Promise<TaroGeneral.NFCError>
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
namespace NfcF {
|
|
961
|
+
namespace close {
|
|
962
|
+
interface Option {
|
|
963
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
964
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
965
|
+
/** 接口调用失败的回调函数 */
|
|
966
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
967
|
+
/** 接口调用成功的回调函数 */
|
|
968
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
namespace connect {
|
|
972
|
+
interface Option {
|
|
973
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
974
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
975
|
+
/** 接口调用失败的回调函数 */
|
|
976
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
977
|
+
/** 接口调用成功的回调函数 */
|
|
978
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
namespace getMaxTransceiveLength {
|
|
982
|
+
interface Option {
|
|
983
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
984
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
985
|
+
/** 接口调用失败的回调函数 */
|
|
986
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
987
|
+
/** 接口调用成功的回调函数 */
|
|
988
|
+
success?: (result: SuccessCallbackResult) => void
|
|
989
|
+
}
|
|
990
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
991
|
+
/** 最大传输长度 */
|
|
992
|
+
length: number
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
namespace isConnected {
|
|
996
|
+
interface Option {
|
|
997
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
998
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
999
|
+
/** 接口调用失败的回调函数 */
|
|
1000
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
1001
|
+
/** 接口调用成功的回调函数 */
|
|
1002
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
namespace setTimeout {
|
|
1006
|
+
interface Option {
|
|
1007
|
+
/** 设置超时时间 (ms) */
|
|
1008
|
+
timeout: number
|
|
1009
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1010
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
1011
|
+
/** 接口调用失败的回调函数 */
|
|
1012
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
1013
|
+
/** 接口调用成功的回调函数 */
|
|
1014
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
namespace transceive {
|
|
1018
|
+
interface Option {
|
|
1019
|
+
/** 需要传递的二进制数据 */
|
|
1020
|
+
data: ArrayBuffer
|
|
1021
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1022
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
1023
|
+
/** 接口调用失败的回调函数 */
|
|
1024
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
1025
|
+
/** 接口调用成功的回调函数 */
|
|
1026
|
+
success?: (result: SuccessCallbackResult) => void
|
|
1027
|
+
}
|
|
1028
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
1029
|
+
data: ArrayBuffer
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
/** NfcV 标签
|
|
1035
|
+
* @supported weapp
|
|
1036
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.html
|
|
1037
|
+
*/
|
|
1038
|
+
interface NfcV {
|
|
1039
|
+
/** 断开连接
|
|
1040
|
+
* @supported weapp
|
|
1041
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.close.html
|
|
1042
|
+
*/
|
|
1043
|
+
close(option?: NfcV.close.Option): Promise<TaroGeneral.NFCError>
|
|
1044
|
+
/** 连接 NFC 标签
|
|
1045
|
+
* @supported weapp
|
|
1046
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.connect.html
|
|
1047
|
+
*/
|
|
1048
|
+
connect(option?: NfcV.connect.Option): Promise<TaroGeneral.NFCError>
|
|
1049
|
+
/** 获取最大传输长度
|
|
1050
|
+
* @supported weapp
|
|
1051
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.getMaxTransceiveLength.html
|
|
1052
|
+
*/
|
|
1053
|
+
getMaxTransceiveLength(option?: NfcV.getMaxTransceiveLength.Option): Promise<TaroGeneral.NFCError>
|
|
1054
|
+
/** 检查是否已连接
|
|
1055
|
+
* @supported weapp
|
|
1056
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.isConnected.html
|
|
1057
|
+
*/
|
|
1058
|
+
isConnected(option?: NfcV.isConnected.Option): Promise<TaroGeneral.NFCError>
|
|
1059
|
+
/** 设置超时时间
|
|
1060
|
+
* @supported weapp
|
|
1061
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.setTimeout.html
|
|
1062
|
+
*/
|
|
1063
|
+
setTimeout(option?: NfcV.setTimeout.Option): Promise<TaroGeneral.NFCError>
|
|
1064
|
+
/** 发送数据
|
|
1065
|
+
* @supported weapp
|
|
1066
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.transceive.html
|
|
1067
|
+
*/
|
|
1068
|
+
transceive(option?: NfcV.transceive.Option): Promise<TaroGeneral.NFCError>
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
namespace NfcV {
|
|
1072
|
+
namespace close {
|
|
1073
|
+
interface Option {
|
|
1074
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1075
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
1076
|
+
/** 接口调用失败的回调函数 */
|
|
1077
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
1078
|
+
/** 接口调用成功的回调函数 */
|
|
1079
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
namespace connect {
|
|
1083
|
+
interface Option {
|
|
1084
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1085
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
1086
|
+
/** 接口调用失败的回调函数 */
|
|
1087
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
1088
|
+
/** 接口调用成功的回调函数 */
|
|
1089
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
namespace getMaxTransceiveLength {
|
|
1093
|
+
interface Option {
|
|
1094
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1095
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
1096
|
+
/** 接口调用失败的回调函数 */
|
|
1097
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
1098
|
+
/** 接口调用成功的回调函数 */
|
|
1099
|
+
success?: (result: SuccessCallbackResult) => void
|
|
1100
|
+
}
|
|
1101
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
1102
|
+
/** 最大传输长度 */
|
|
1103
|
+
length: number
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
namespace isConnected {
|
|
1107
|
+
interface Option {
|
|
1108
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1109
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
1110
|
+
/** 接口调用失败的回调函数 */
|
|
1111
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
1112
|
+
/** 接口调用成功的回调函数 */
|
|
1113
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
namespace setTimeout {
|
|
1117
|
+
interface Option {
|
|
1118
|
+
/** 设置超时时间 (ms) */
|
|
1119
|
+
timeout: number
|
|
1120
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1121
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
1122
|
+
/** 接口调用失败的回调函数 */
|
|
1123
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
1124
|
+
/** 接口调用成功的回调函数 */
|
|
1125
|
+
success?: (res: TaroGeneral.NFCError) => void
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
namespace transceive {
|
|
1129
|
+
interface Option {
|
|
1130
|
+
/** 需要传递的二进制数据 */
|
|
1131
|
+
data: ArrayBuffer
|
|
1132
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1133
|
+
complete?: (res: TaroGeneral.NFCError) => void
|
|
1134
|
+
/** 接口调用失败的回调函数 */
|
|
1135
|
+
fail?: (res: TaroGeneral.NFCError) => void
|
|
1136
|
+
/** 接口调用成功的回调函数 */
|
|
1137
|
+
success?: (result: SuccessCallbackResult) => void
|
|
1138
|
+
}
|
|
1139
|
+
interface SuccessCallbackResult extends TaroGeneral.NFCError {
|
|
1140
|
+
data: ArrayBuffer
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
interface TaroStatic {
|
|
1146
|
+
/**
|
|
1147
|
+
* 关闭 NFC 模块。仅在安卓系统下有效。
|
|
1148
|
+
* @supported weapp
|
|
1149
|
+
* @example
|
|
1150
|
+
* ```tsx
|
|
1151
|
+
* Taro.stopHCE({
|
|
1152
|
+
* success: function (res) {
|
|
1153
|
+
* console.log(res.errMsg)
|
|
1154
|
+
* }
|
|
1155
|
+
* })
|
|
1156
|
+
* ```
|
|
1157
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.stopHCE.html
|
|
1158
|
+
*/
|
|
1159
|
+
stopHCE(option?: stopHCE.Option): Promise<TaroGeneral.NFCError>
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* 初始化 NFC 模块。
|
|
1163
|
+
* @supported weapp
|
|
1164
|
+
* @example
|
|
1165
|
+
* ```tsx
|
|
1166
|
+
* Taro.startHCE({
|
|
1167
|
+
* aid_list: ['F222222222']
|
|
1168
|
+
* success: function (res) {
|
|
1169
|
+
* console.log(res.errMsg)
|
|
1170
|
+
* }
|
|
1171
|
+
* })
|
|
1172
|
+
* ```
|
|
1173
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.startHCE.html
|
|
1174
|
+
*/
|
|
1175
|
+
startHCE(option: startHCE.Option): Promise<TaroGeneral.NFCError>
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* 发送 NFC 消息。仅在安卓系统下有效。
|
|
1179
|
+
* @supported weapp
|
|
1180
|
+
* @example
|
|
1181
|
+
* ```tsx
|
|
1182
|
+
* const buffer = new ArrayBuffer(1)
|
|
1183
|
+
* const dataView = new DataView(buffer)
|
|
1184
|
+
* dataView.setUint8(0, 0)
|
|
1185
|
+
* Taro.startHCE({
|
|
1186
|
+
* success: function (res) {
|
|
1187
|
+
* Taro.onHCEMessage(function (res) {
|
|
1188
|
+
* if (res.messageType === 1) {
|
|
1189
|
+
* Taro.sendHCEMessage({data: buffer})
|
|
1190
|
+
* }
|
|
1191
|
+
* })
|
|
1192
|
+
* }
|
|
1193
|
+
* })
|
|
1194
|
+
* ```
|
|
1195
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.sendHCEMessage.html
|
|
1196
|
+
*/
|
|
1197
|
+
sendHCEMessage(option: sendHCEMessage.Option): Promise<TaroGeneral.NFCError>
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* 监听接收 NFC 设备消息事件,仅能注册一个监听
|
|
1201
|
+
* @supported weapp
|
|
1202
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.onHCEMessage.html
|
|
1203
|
+
*/
|
|
1204
|
+
onHCEMessage(
|
|
1205
|
+
/** 接收 NFC 设备消息事件的回调函数 */
|
|
1206
|
+
callback: onHCEMessage.Callback,
|
|
1207
|
+
): void
|
|
1208
|
+
|
|
1209
|
+
/** 接收 NFC 设备消息事件,取消事件监听。
|
|
1210
|
+
* @supported weapp
|
|
1211
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.offHCEMessage.html
|
|
1212
|
+
*/
|
|
1213
|
+
offHCEMessage(
|
|
1214
|
+
/** 接收 NFC 设备消息事件的回调函数 */
|
|
1215
|
+
callback: onHCEMessage.Callback,
|
|
1216
|
+
): void
|
|
1217
|
+
|
|
1218
|
+
/** 获取 NFC 实例
|
|
1219
|
+
* @supported weapp, tt
|
|
1220
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.getNFCAdapter.html
|
|
1221
|
+
*/
|
|
1222
|
+
getNFCAdapter(): NFCAdapter
|
|
1223
|
+
|
|
1224
|
+
/** 判断当前设备是否支持 HCE 能力。
|
|
1225
|
+
* @supported weapp
|
|
1226
|
+
* @example
|
|
1227
|
+
* ```tsx
|
|
1228
|
+
* Taro.getHCEState({
|
|
1229
|
+
* success: function (res) {
|
|
1230
|
+
* console.log(res.errCode)
|
|
1231
|
+
* }
|
|
1232
|
+
* })
|
|
1233
|
+
* ```
|
|
1234
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.getHCEState.html
|
|
1235
|
+
*/
|
|
1236
|
+
getHCEState(option?: getHCEState.Option): Promise<TaroGeneral.NFCError>
|
|
1237
|
+
}
|
|
1238
|
+
}
|