@quec/rn-device-module 1.9.13

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/src/module.ts ADDED
@@ -0,0 +1,939 @@
1
+ /**
2
+ 该文件自动生成,每次都会覆盖
3
+ */
4
+ import React from 'react';
5
+ import { NativeModules, EmitterSubscription, NativeEventEmitter, Platform } from 'react-native';
6
+
7
+ const NativeNotificationModule = new NativeEventEmitter(NativeModules.QuecRNDeviceModule);
8
+
9
+ /**
10
+ 设备桥组件
11
+ @version: 1.9.13
12
+ @owner: vic.huang@quectel.com
13
+ @platform: all
14
+ */
15
+
16
+ /** 获取当前设备WS订阅通道状态,订阅状态为true,不代表设备在线,只代表app和云端对当前设备进行了订阅
17
+ @platform: all
18
+ @return Promise
19
+ */
20
+ function isWebSocketSubscribe(): Promise<any> {
21
+ return NativeModules.QuecRNDeviceModule.isWebSocketSubscribe();
22
+ }
23
+
24
+ /** 获取设备通道连接中状态
25
+ @platform: all
26
+ @return Promise
27
+ */
28
+ function getDeviceConnectingState(): Promise<any> {
29
+ return NativeModules.QuecRNDeviceModule.getDeviceConnectingState();
30
+ }
31
+
32
+ /** writeDpsByHttp
33
+ @platform: all
34
+ @param dps {Array<object>} – dps 确保code和value不为空 [ {id:0, code:"electric" type:BOOL, value:false} ,{id:1, code:"electric2", type:INT, value:2}]
35
+ @param deviceList {Array<object>} – deviceList 设备列表 [{"deviceKey":"", "productKey":""}]
36
+ @param type {integer} - 类型 1:透传 2:属性 3:服务
37
+ @param extraData {object} – {
38
+ dataFormat 数据类型 1:Hex 2:Text(当type为透传时,需要指定 dataFormat)
39
+ cacheTime 缓存时间,单位为秒,缓存时间范围 1-7776000 秒,启用缓存时必须设置缓存时间
40
+ isCache 是否启用缓存 1:启用 2:不启用,默认不启用
41
+ isCover 是否覆盖之前发送的相同的命令 1:覆盖 2:不覆盖,默认不覆盖,启用缓存时此参数有效
42
+
43
+ 查看接口定义
44
+ }
45
+ @return Promise
46
+ */
47
+ function writeDpsByHttp(
48
+ dps: Array<object>,
49
+ deviceList: Array<object>,
50
+ type: number,
51
+ extraData: Object
52
+ ): Promise<any> {
53
+ return NativeModules.QuecRNDeviceModule.writeDpsByHttp(dps, deviceList, type, extraData);
54
+ }
55
+
56
+ /** read data points
57
+ @platform: all
58
+ @param dps {Array<object>} – dps [ {id:0, type:BOOL, value:false} ,{id:1, type:INT, value:2}]
59
+ @param extraData {object} – map
60
+ cacheTime number 指令缓存时间,ws通道有效,单位是s
61
+ msgId number 消息Id,ws通道有效
62
+ @return Promise
63
+ */
64
+ function readDpsWithExtraData(dps: Array<object>, extraData: Object): Promise<any> {
65
+ return NativeModules.QuecRNDeviceModule.readDpsWithExtraData(dps, extraData);
66
+ }
67
+
68
+ /** read data points
69
+ @platform: all
70
+ @param dps {Array<object>} – dps [ {id:0, type:BOOL, value:false} ,{id:1, type:INT, value:2}]
71
+ @param extraData {object} – map
72
+ cacheTime number 指令缓存时间,ws通道有效,单位是s
73
+ msgId number 消息Id,ws通道有效
74
+ @param mode {integer} – mode 下发模式: 0 auto,1: websocket 2:wifi 3:ble
75
+ @return Promise
76
+ */
77
+ function readDpsWithExtraDataAndMode(
78
+ dps: Array<object>,
79
+ extraData: Object,
80
+ mode: number
81
+ ): Promise<any> {
82
+ return NativeModules.QuecRNDeviceModule.readDpsWithExtraDataAndMode(dps, extraData, mode);
83
+ }
84
+
85
+ /** write data points
86
+ @platform: all
87
+ @param dps {Array<object>} – dps [ {id:0, type:BOOL, value:false} ,{id:1, type:INT, value:2}]
88
+ @param extraData {object} – map
89
+ cacheTime number 指令缓存时间,ws通道有效,单位是s
90
+ msgId number 消息Id,ws通道有效
91
+ @return Promise
92
+ */
93
+ function writeDpsWithExtraData(dps: Array<object>, extraData: Object): Promise<any> {
94
+ return NativeModules.QuecRNDeviceModule.writeDpsWithExtraData(dps, extraData);
95
+ }
96
+
97
+ /** write data points
98
+ @platform: all
99
+ @param dps {Array<object>} – dps [ {id:0, type:BOOL, value:false} ,{id:1, type:INT, value:2}]
100
+ @param extraData {object} – map
101
+ cacheTime number 指令缓存时间,ws通道有效,单位是s
102
+ msgId number 消息Id,ws通道有效
103
+ @param mode {integer} – mode 下发模式: 0 auto,1: websocket 2:wifi 3:ble
104
+ @return Promise
105
+ */
106
+ function writeDpsWithExtraDataAndMode(
107
+ dps: Array<object>,
108
+ extraData: Object,
109
+ mode: number
110
+ ): Promise<any> {
111
+ return NativeModules.QuecRNDeviceModule.writeDpsWithExtraDataAndMode(dps, extraData, mode);
112
+ }
113
+
114
+ /** 获取设备通道状态
115
+ @platform: all
116
+ @return Promise
117
+ */
118
+ function getBleState(): Promise<any> {
119
+ return NativeModules.QuecRNDeviceModule.getBleState();
120
+ }
121
+
122
+ /** 获取物模型以及属性值
123
+ @platform: all
124
+ @param params {object} map
125
+ productKey string 产品key
126
+ deviceKey string 设备key
127
+ codeList string 非必填 查询的属性标识符
128
+ gatewayDk string 网关设备的 Device Key
129
+ gatewayPk string 网关设备的 Product Key
130
+ 和查询类型配合使用,如果查询多个属性,使用英文逗号分隔
131
+ type string 非必填 查询类型
132
+ 1 查询设备基础属性
133
+ 2 查询物模型属性
134
+ 3 查询定位信息
135
+ 查询类型可以单选和多选,如果需要查询多个类型的属性值,使用英文逗号分隔
136
+ @return Promise
137
+ */
138
+ function getTslAndAttrs(params: Object): Promise<any> {
139
+ return NativeModules.QuecRNDeviceModule.getTslAndAttrs(params);
140
+ }
141
+
142
+ /** read data points
143
+ @platform: all
144
+ @param dps {Array<object>} – dps [ {id:0, type:BOOL, value:false} ,{id:1, type:INT, value:2}]
145
+ @return Promise
146
+ */
147
+ function readDps(dps: Array<object>): Promise<any> {
148
+ return NativeModules.QuecRNDeviceModule.readDps(dps);
149
+ }
150
+
151
+ /** write data points
152
+ @platform: all
153
+ @param dps {Array<object>} – dps [ {id:0, type:BOOL, value:false} ,{id:1, type:INT, value:2}]
154
+ @return Promise
155
+ */
156
+ function writeDps(dps: Array<object>): Promise<any> {
157
+ return NativeModules.QuecRNDeviceModule.writeDps(dps);
158
+ }
159
+
160
+ /** read data points
161
+ @platform: all
162
+ @param dps {Array<object>} – dps [ {id:0, type:BOOL, value:false} ,{id:1, type:INT, value:2}]
163
+ @param mode {integer} – mode 下发模式: 0 auto,1: websocket 2:wifi 3:ble
164
+ @return Promise
165
+ */
166
+ function readDpsWithMode(dps: Array<object>, mode: number): Promise<any> {
167
+ return NativeModules.QuecRNDeviceModule.readDpsWithMode(dps, mode);
168
+ }
169
+
170
+ /** write data points
171
+ @platform: all
172
+ @param dps {Array<object>} – dps [ {id:0, type:BOOL, value:false} ,{id:1, type:INT, value:2}]
173
+ @param mode {integer} – mode 下发模式: 0 auto,1: websocket 2:wifi 3:ble
174
+ @return Promise
175
+ */
176
+ function writeDpsWithMode(dps: Array<object>, mode: number): Promise<any> {
177
+ return NativeModules.QuecRNDeviceModule.writeDpsWithMode(dps, mode);
178
+ }
179
+
180
+ /** 获取设备通道状态
181
+ @platform: all
182
+ @return Promise
183
+ */
184
+ function getOnlineState(): Promise<any> {
185
+ return NativeModules.QuecRNDeviceModule.getOnlineState();
186
+ }
187
+
188
+ /** 建立通道,(设备会自动根据设备通道能力capabilitiesBitmask建立通道,此API用于手动切换指定通道)
189
+ @platform: all
190
+ @param mode {integer} – mode 建立通道模式: 0 auto,1: websocket 2:wifi 3:ble
191
+ 注意:1,建立的通通与已连接通道不同时,已连接通道会断开。
192
+ 2,当设备不具备相应通道,建立其不具备的通道会失败。不会再自动建立其他通道
193
+ */
194
+ function connectChannel(mode: number) {
195
+ return NativeModules.QuecRNDeviceModule.connectChannel(mode);
196
+ }
197
+
198
+ /** 断开通道,(
199
+ @platform: all
200
+ @param type {integer} – type 通道类型,0: 关闭所有通道(关闭wifi和ble), 2:wifi 3:ble
201
+ */
202
+ function disconnectChannel(type: number) {
203
+ return NativeModules.QuecRNDeviceModule.disconnectChannel(type);
204
+ }
205
+
206
+ /**该方法已废弃 获取websocket是否登录成功
207
+ @platform: all
208
+ @param isLoginCallback {successcb} Func 接受是否登录websocket回调 已登录成功 true 登录失败 false
209
+ */
210
+ function isWebSocketLoginCallback(isLoginCallback: Function) {
211
+ return NativeModules.QuecRNDeviceModule.isWebSocketLoginCallback(isLoginCallback);
212
+ }
213
+
214
+ /**该方法已废弃 订阅设备
215
+ @platform: all
216
+ @param list {Array<object>} 订阅设备列表,订阅结果QuecDeviceServiceWebSocketDelegate返回
217
+ [
218
+ {
219
+ "deviceKey": "1234567890",
220
+ "messageType": [
221
+ "ONLINE"
222
+ ],
223
+ "productKey": "p12345"
224
+ },
225
+ {
226
+ "deviceKey": "1234567890",
227
+ "messageType": [
228
+ "ONLINE",
229
+ "STATUS"
230
+ ],
231
+ "productKey": "p12345"
232
+ }
233
+ ]
234
+ */
235
+ function subscribeDevicesWithList(list: Array<object>) {
236
+ return NativeModules.QuecRNDeviceModule.subscribeDevicesWithList(list);
237
+ }
238
+
239
+ /**该方法已废弃 取消订阅设备
240
+ @platform: all
241
+ @param list {Array<object>} 取消订阅设备列表,取消订阅结果QuecDeviceServiceWebSocketDelegate返回
242
+ [
243
+ {
244
+ "deviceKey": "1234567890",
245
+ "productKey": "p12345"
246
+ },
247
+ {
248
+ "deviceKey": "1234567890",
249
+ "productKey": "p12345"
250
+ }
251
+ ]
252
+ */
253
+ function unSubscribeDevicesWithList(list: Array<object>) {
254
+ return NativeModules.QuecRNDeviceModule.unSubscribeDevicesWithList(list);
255
+ }
256
+
257
+ /**该方法已废弃 获取设备业务属性值
258
+ @platform: all
259
+ @param params {object} 发送数据,需要在delegate的websocketDidOpen回调之后才能调用
260
+ 透传
261
+ {
262
+ "cmd": "send",
263
+ "data": {
264
+ "cacheTime": 3600,
265
+ "dataFormat": "Text",
266
+ "deviceKey": "866123456789015",
267
+ "isCache": true,
268
+ "productKey": "p12345",
269
+ "raw": "123456",
270
+ "type": "RAW"
271
+ }
272
+ }
273
+ 物模型
274
+ {
275
+ "cmd": "send",
276
+ "data": {
277
+ "deviceKey": "1234567890",
278
+ "kv": "[{\"id\":5,\"name\":\"openapi\",\"type\":\"BOOL\",\"value\":\"true\"}]",
279
+ "productKey": "p12345",
280
+ "type": "WRITE-ATTR"
281
+ }
282
+ }
283
+ */
284
+ function sendDataToDeviceByWebSocketWithDataDict(params: Object) {
285
+ return NativeModules.QuecRNDeviceModule.sendDataToDeviceByWebSocketWithDataDict(params);
286
+ }
287
+
288
+ /**该方法已废弃 获取设备列表
289
+ @platform: all
290
+ @param pageNumber {integer} number 页码
291
+ @param pageSize {integer} number 页大小
292
+ @return Promise
293
+ */
294
+ function getDeviceListWithPageNumber(pageNumber: number, pageSize: number): Promise<any> {
295
+ return NativeModules.QuecRNDeviceModule.getDeviceListWithPageNumber(pageNumber, pageSize);
296
+ }
297
+
298
+ /**该方法已废弃 获取设备业务物模型属性值
299
+ @platform: all
300
+ @param params {object} map
301
+ productKey string 产品key
302
+ deviceKey string 设备key
303
+ codeList string 非必填 查询的属性标识符
304
+ gatewayDk string 网关设备的 Device Key
305
+ gatewayPk string 网关设备的 Product Key
306
+ 和查询类型配合使用,如果查询多个属性,使用英文逗号分隔
307
+ type string 非必填 查询类型
308
+ 1 查询设备基础属性
309
+ 2 查询物模型属性
310
+ 3 查询定位信息
311
+ 查询类型可以单选和多选,如果需要查询多个类型的属性值,使用英文逗号分隔
312
+ @return Promise
313
+ */
314
+ function getProductTSLWithProductKey(params: Object): Promise<any> {
315
+ return NativeModules.QuecRNDeviceModule.getProductTSLWithProductKey(params);
316
+ }
317
+
318
+ /**该方法已废弃 获取设备业务属性值
319
+ @platform: all
320
+ @param params {object} map
321
+ productKey string 产品key
322
+ deviceKey string 设备key
323
+ codeList string 非必填 查询的属性标识符
324
+ 和查询类型配合使用,如果查询多个属性,使用英文逗号分隔
325
+ type string 非必填 查询类型
326
+ 1 查询设备基础属性
327
+ 2 查询物模型属性
328
+ 3 查询定位信息
329
+ 查询类型可以单选和多选,如果需要查询多个类型的属性值,使用英文逗号分隔
330
+ @return Promise
331
+ */
332
+ function getDeviceBusinessAttributesWithProductKey(params: Object): Promise<any> {
333
+ return NativeModules.QuecRNDeviceModule.getDeviceBusinessAttributesWithProductKey(params);
334
+ }
335
+
336
+ /**该方法已废弃 更改分享设备名称
337
+ @platform: all
338
+ @param deviceName {string} string 设备名称
339
+ @param shareCode {string} string 分享码
340
+ @return Promise
341
+ */
342
+ function updateDeviceNameByShareUserWithDeviceName(
343
+ deviceName: string,
344
+ shareCode: string
345
+ ): Promise<any> {
346
+ return NativeModules.QuecRNDeviceModule.updateDeviceNameByShareUserWithDeviceName(
347
+ deviceName,
348
+ shareCode
349
+ );
350
+ }
351
+
352
+ /**该方法已废弃 更改分享设备名称
353
+ @platform: all
354
+ @param deviceName {string} string deviceName
355
+ @param productKey {string} string product key
356
+ @param deviceKey {string} string deviceKey
357
+ @return Promise
358
+ */
359
+ function updateDeviceName(deviceName: string, productKey: string, deviceKey: string): Promise<any> {
360
+ return NativeModules.QuecRNDeviceModule.updateDeviceName(deviceName, productKey, deviceKey);
361
+ }
362
+
363
+ /**该方法已废弃 查询网关设备下子设备列表
364
+ @platform: all
365
+ @param params {object} deviceKey string 必传 网关设备deviceKey
366
+ productKey string 必传 网关设备productKey
367
+ pageNumber number 必传 页码
368
+ pageSize number 必传 页大小
369
+ @return Promise
370
+ */
371
+ function getGatewayDeviceChildListWithParams(params: Object): Promise<any> {
372
+ return NativeModules.QuecRNDeviceModule.getGatewayDeviceChildListWithParams(params);
373
+ }
374
+
375
+ /**该方法已废弃 设备解绑
376
+ @platform: all
377
+ @param deviceKey {string} string device key
378
+ @param productKey {string} string product key
379
+ @return Promise
380
+ */
381
+ function unbindDeviceWithDeviceKey(deviceKey: string, productKey: string): Promise<any> {
382
+ return NativeModules.QuecRNDeviceModule.unbindDeviceWithDeviceKey(deviceKey, productKey);
383
+ }
384
+
385
+ /**该方法已废弃 设备解绑
386
+ @platform: all
387
+ @param shareCode {string} string 分享码
388
+ @return Promise
389
+ */
390
+ function unShareDeviceByShareUserWithShareCode(shareCode: string): Promise<any> {
391
+ return NativeModules.QuecRNDeviceModule.unShareDeviceByShareUserWithShareCode(shareCode);
392
+ }
393
+
394
+ /** 获取设备属性图表列表
395
+ @platform: all
396
+ @param params {object} productKey 产品key
397
+ deviceKey 设备key
398
+ startTimestamp 开始时间(毫秒时间戳)
399
+ endTimestamp 结束时间(毫秒时间戳)
400
+ attributeCode 物模型属性标识符,查询多个属性时使用英文逗号分隔
401
+ gatewayDk 网关设备的 Device Key
402
+ gatewayPk 网关设备的 Product Key
403
+ countType 聚合类型(默认3):1-最大值 2-最小值 3-平均值 4-差值 5-总值
404
+ timeGranularity 统计时间粒度(默认2):1-月 2-日 3-小时 4-分钟 5-秒
405
+ callback {"data": []}
406
+ @return Promise
407
+ */
408
+ function getPropertyChartListWithParams(params: Object): Promise<any> {
409
+ return NativeModules.QuecRNDeviceModule.getPropertyChartListWithParams(params);
410
+ }
411
+
412
+ /** 获取设备分享人列表
413
+ @platform: all
414
+ @param deviceKey {string} string 设备名称
415
+ @param productKey {string} string 产品key
416
+ @return Promise
417
+ */
418
+ function getDeviceShareUserListWithDeviceKey(deviceKey: string, productKey: string): Promise<any> {
419
+ return NativeModules.QuecRNDeviceModule.getDeviceShareUserListWithDeviceKey(
420
+ deviceKey,
421
+ productKey
422
+ );
423
+ }
424
+
425
+ /** 分享人设置分享信息
426
+ @platform: all
427
+ @param params {object} deviceKey string 设备key
428
+ productKey string 产品key
429
+ acceptingExpireTime number 分享二维码种子失效时间 时间戳(毫秒),表示该分享在此时间戳时间内没有使用,会失效
430
+ coverMark number 覆盖标志:1 直接覆盖上条有效分享(默认)(覆盖原有的分享码);2 直接添加,允许多条并存;3 只有分享时间延长了,才允许覆盖上条分享
431
+ isSharingAlwaysValid bool 设备是否永久有效
432
+ sharingExpireTime number 设备使用到期时间 时间戳(毫秒),表示该分享的设备,被分享人可以使用的时间,isSharingAlwaysValid为YES时该参数无效
433
+ @return Promise
434
+ */
435
+ function setShareInfoByOwnerWithDeviceKey(params: Object): Promise<any> {
436
+ return NativeModules.QuecRNDeviceModule.setShareInfoByOwnerWithDeviceKey(params);
437
+ }
438
+
439
+ /** 分享人取消分享
440
+ @platform: all
441
+ @param shareCode {string} string 分享码
442
+ @return Promise
443
+ */
444
+ function unShareDeviceByOwnerWithShareCode(shareCode: string): Promise<any> {
445
+ return NativeModules.QuecRNDeviceModule.unShareDeviceByOwnerWithShareCode(shareCode);
446
+ }
447
+
448
+ /** 获取设备历史轨迹
449
+ @platform: all
450
+ @param params {object} productKey 产品key
451
+ deviceKey 设备key
452
+ startTimestamp 开始时间(毫秒时间戳)
453
+ endTimestamp 结束时间(毫秒时间戳)
454
+ gatewayDk 网关设备的 Device Key
455
+ gatewayPk 网关设备的 Product Key
456
+ locateTypes 定位类型(默认查询所有类型的定位),查询多种定位时使用英文逗号分隔
457
+ GNSS-全球导航卫星系统
458
+ GPS-美国导航定位系统
459
+ GL-俄罗斯格洛纳导航定位系统
460
+ GA-欧盟伽利略卫星导航系统
461
+ BD/PQ-中国导航定位系统
462
+ LBS-基于通信运营商的基站定位系统
463
+ @return Promise
464
+ */
465
+ function getLocationHistoryWithParams(params: Object): Promise<any> {
466
+ return NativeModules.QuecRNDeviceModule.getLocationHistoryWithParams(params);
467
+ }
468
+
469
+ /** 获取设备信息
470
+ @platform: all
471
+ @param deviceKey {string} string 设备key
472
+ @param productKey {string} string 产品key
473
+ @return Promise
474
+ */
475
+ function getDeviceInfoByDeviceKey(deviceKey: string, productKey: string): Promise<any> {
476
+ return NativeModules.QuecRNDeviceModule.getDeviceInfoByDeviceKey(deviceKey, productKey);
477
+ }
478
+
479
+ /** 获取设备属性信息
480
+ @platform: all
481
+ @param params {object} map
482
+ productKey 产品key
483
+ deviceKey 设备key
484
+ startTimestamp 开始时间(毫秒时间戳)
485
+ endTimestamp 结束时间(毫秒时间戳)
486
+ attributeCode 物模型属性标识符,查询多个属性时使用英文逗号分隔
487
+ gatewayDk 网关设备的 Device Key
488
+ gatewayPk 网关设备的 Product Key
489
+ pageNumber 当前页,默认为第 1 页
490
+ pageSize 页大小,默认为 10 条
491
+ @return Promise
492
+ */
493
+ function getPropertyDataListWithParams(params: Object): Promise<any> {
494
+ return NativeModules.QuecRNDeviceModule.getPropertyDataListWithParams(params);
495
+ }
496
+
497
+ /** 获取设备属性环比统计数据
498
+ @platform: all
499
+ @param params {object} map
500
+ productKey 产品key
501
+ deviceKey 设备key
502
+ currentTimestamp 当前时间(毫秒时间戳
503
+ attributeCode 物模型属性标识符,查询多个属性时使用英文逗号分隔
504
+ gatewayDk 网关设备的 Device Key
505
+ gatewayPk 网关设备的 Product Key
506
+ countType 聚合类型(默认3):1-最大值 2-最小值 3-平均值 4-差值 5-总值
507
+ timeGranularities 统计时间粒度,查询多个粒度时使用英文逗号分隔(默认1):1-日 2-周 3-月 4-年
508
+ callback {"data": []}
509
+ @return Promise
510
+ */
511
+ function getPropertyStatisticsWithParams(params: Object): Promise<any> {
512
+ return NativeModules.QuecRNDeviceModule.getPropertyStatisticsWithParams(params);
513
+ }
514
+
515
+ /** 通过分享码查询设备信息
516
+ @platform: all
517
+ @param shareCode {string} 分享码
518
+ @return Promise
519
+ */
520
+ function getDeviceInfoByShareCode(shareCode: string): Promise<any> {
521
+ return NativeModules.QuecRNDeviceModule.getDeviceInfoByShareCode(shareCode);
522
+ }
523
+
524
+ /** 获取设备列表-根据设备名称搜索
525
+ @platform: all
526
+ @param deviceName {string} 设备名称
527
+ @param pageNumber {integer} number 页码
528
+ @param pageSize {integer} number 页大小
529
+ @return Promise
530
+ */
531
+ function getDeviceListByDeviceName(
532
+ deviceName: string,
533
+ pageNumber: number,
534
+ pageSize: number
535
+ ): Promise<any> {
536
+ return NativeModules.QuecRNDeviceModule.getDeviceListByDeviceName(
537
+ deviceName,
538
+ pageNumber,
539
+ pageSize
540
+ );
541
+ }
542
+
543
+ /** 通过SN绑定设备
544
+ @platform: all
545
+ @param serialNumber {string} string 设备SN码
546
+ @param productKey {string} string 产品key
547
+ @param deviceName {string} string 设备名称
548
+ @return Promise
549
+ */
550
+ function bindDeviceBySerialNumber(
551
+ serialNumber: string,
552
+ productKey: string,
553
+ deviceName: string
554
+ ): Promise<any> {
555
+ return NativeModules.QuecRNDeviceModule.bindDeviceBySerialNumber(
556
+ serialNumber,
557
+ productKey,
558
+ deviceName
559
+ );
560
+ }
561
+
562
+ /** 通过authCode绑定设备
563
+ 可用于wifi/wifi+蓝牙设备绑定
564
+ @platform: all
565
+ @param params {object} Map 包含以下属性
566
+ authCode string 设备authCode
567
+ productKey string 产品key
568
+ deviceKey string 设备key
569
+ deviceName string 设备名称
570
+ @return Promise
571
+ */
572
+ function bindDeviceByAuthCode(params: Object): Promise<any> {
573
+ return NativeModules.QuecRNDeviceModule.bindDeviceByAuthCode(params);
574
+ }
575
+
576
+ /** 通过authCode + password绑定设备
577
+ 可用于蓝牙设备绑定
578
+ @platform: all
579
+ @param params {object} Map 包含以下属性
580
+ authCode string 设备authCode
581
+ productKey string 产品key
582
+ deviceKey string 设备key
583
+ password string 设备password
584
+ deviceName string 设备名称
585
+ @return Promise
586
+ */
587
+ function bindDeviceByPSWAuthCode(params: Object): Promise<any> {
588
+ return NativeModules.QuecRNDeviceModule.bindDeviceByPSWAuthCode(params);
589
+ }
590
+
591
+ /** 查询设备升级信息
592
+ @platform: all
593
+ @param productKey {string} string 产品key
594
+ @param deviceKey {string} string 设备key
595
+ @param params {object} map 其他信息 非必传
596
+ batteryLevelLimit number 设备剩余电量百分比
597
+ mcuVersions array 固件信息 componentNo string 升级组件标识 version string 升级组件版本
598
+ minSignalIntensity number 设备最小信号量 dbM
599
+ moduleVersion string 模组版本
600
+ upgradeTime number 升级时间时间戳,默认为当前时间戳
601
+ useSpace number 所需磁盘空间,KB
602
+ {'batteryLevelLimit':1, 'mcuVersions':[{'componentNo': '', 'version': ''}], 'minSignalIntensity':1, 'moduleVersion':'', 'upgradeTime':1, 'useSpace':1}
603
+ @return Promise
604
+ */
605
+ function getFetchPlanWithProductKey(
606
+ productKey: string,
607
+ deviceKey: string,
608
+ params: Object
609
+ ): Promise<any> {
610
+ return NativeModules.QuecRNDeviceModule.getFetchPlanWithProductKey(productKey, deviceKey, params);
611
+ }
612
+
613
+ /** 上报设备升级信息
614
+ @platform: all
615
+ @param params {object} map
616
+ productKey string 产品key
617
+ deviceKey string 设备key
618
+ componentNo string 升级固件标识
619
+ reportStatus number 升级状态 0 - 1 2
620
+ @return Promise
621
+ */
622
+ function reportDeviceUpgradeStatusWithProductKey(params: Object): Promise<any> {
623
+ return NativeModules.QuecRNDeviceModule.reportDeviceUpgradeStatusWithProductKey(params);
624
+ }
625
+
626
+ /** 设备批量控制
627
+ @platform: all
628
+ @param params {object} Map
629
+ data 遵循tsl格式的json string [{"id":62,"value":99,"type":"INT","name":"温度(temp)"},{"id":63,"value":"true","type":"BOOL","name":"开关机状态(powerstate)"}]
630
+ deviceList 设备列表 [{"deviceKey":"", "productKey":""}]
631
+ type number 类型 1:透传 2:属性 3:服务
632
+ dataFormat number 数据类型 1:Hex 2:Text(当type为透传时,需要指定 dataFormat)
633
+ cacheTime number 非必传 缓存时间,单位为秒,缓存时间范围 1-7776000 秒,启用缓存时必须设置缓存时间
634
+ isCache number 非必传 是否启用缓存 1:启用 2:不启用,默认不启用
635
+ isCover number 非必传 是否覆盖之前发送的相同的命令 1:覆盖 2:不覆盖,默认不覆盖,启用缓存时此参数有效
636
+ @return Promise
637
+ */
638
+ function sendDataToDevicesByHttpWithData(params: Object): Promise<any> {
639
+ return NativeModules.QuecRNDeviceModule.sendDataToDevicesByHttpWithData(params);
640
+ }
641
+
642
+ /** 创建定时任务
643
+ @platform: all
644
+ @param params {object} productKey – string 必传 产品key
645
+ deviceKey – string 必传 设备key
646
+ type – string 必传 定时任务类型,once: 执行一次,day-repeat: 每天重复,custom-repeat: 自定义重复,multi-section: 多段执行,random: 随机执行,delay: 延迟执行(倒计时)
647
+ timers:[{
648
+ action – string 必传 定时任务执行的命令,格式:物模型的 json 字符串,
649
+ time – string 非必传 执行时间,格式为 HH:mm:ss, 当 type = once || day-repeat || custom-repeat ||
650
+ multi-section 时必填,
651
+ startTime – string 非必传 当 type 为 random 时必填,格式为 "HH:mm:ss",如 "12:00:00"
652
+ endTime – string 非必传 当 type 为 random 时必填,格式为 "HH:mm:ss",如 "12:00:00"
653
+ delay – number 非必传 延迟执行时间,单位为秒, 当 type = delay 时必填,单位为 s
654
+ }]
655
+ enabled – 定时任务状态:false-停止(默认) true-启动
656
+ dayOfWeek – string 非必传 周几执行:1-周一 2-周二 3-周三 4-周四 5-周五 6-周六 7-周日, 可以多选,传多个值时使用英文逗号分隔, 当 type = custom-repeat || multi-section || random 时必填
657
+ @return Promise
658
+ */
659
+ function addCornJob(params: Object): Promise<any> {
660
+ return NativeModules.QuecRNDeviceModule.addCornJob(params);
661
+ }
662
+
663
+ /** 修改定时任务
664
+ @platform: all
665
+ @param params {object} productKey – string 必传 产品key
666
+ deviceKey – string 必传 设备key
667
+ ruleId – string 必传 规则唯一标识,修改规则实例信息时必填
668
+ type – string 必传 定时任务类型,once: 执行一次,day-repeat: 每天重复,custom-repeat: 自定义重复,multi-section: 多段执行,random: 随机执行,delay: 延迟执行(倒计时)
669
+ timers:[{
670
+ action – string 必传 定时任务执行的命令,格式:物模型的 json 字符串,
671
+ time – string 非必传 执行时间,格式为 HH:mm:ss, 当 type = once || day-repeat || custom-repeat ||
672
+ multi-section 时必填,
673
+ startTime – string 非必传 当 type 为 random 时必填,格式为 "HH:mm:ss",如 "12:00:00"
674
+ endTime – string 非必传 当 type 为 random 时必填,格式为 "HH:mm:ss",如 "12:00:00"
675
+ delay – number 非必传 延迟执行时间,单位为秒, 当 type = delay 时必填,单位为 s
676
+ }]
677
+ enabled – 定时任务状态:false-停止(默认) true-启动
678
+ dayOfWeek – string 非必传 周几执行:1-周一 2-周二 3-周三 4-周四 5-周五 6-周六 7-周日, 可以多选,传多个值时使用英文逗号分隔, 当 type = custom-repeat || multi-section || random 时必填
679
+ @return Promise
680
+ */
681
+ function setCronJob(params: Object): Promise<any> {
682
+ return NativeModules.QuecRNDeviceModule.setCronJob(params);
683
+ }
684
+
685
+ /** 查询设备下定时任务列表
686
+ @platform: all
687
+ @param params {object} productKey – string 必传 产品key
688
+ deviceKey – string 必传 设备key
689
+ type – string 必传 定时任务类型,once: 执行一次,day-repeat: 每天重复,custom-repeat: 自定义重复,multi-section: 多段执行,random: 随机执行,delay: 延迟执行(倒计时)
690
+ page – number 分页页码,默认: 1
691
+ pageSize – number 分页大小,默认: 10
692
+ @return Promise
693
+ */
694
+ function getCronJobList(params: Object): Promise<any> {
695
+ return NativeModules.QuecRNDeviceModule.getCronJobList(params);
696
+ }
697
+
698
+ /** 查询定时任务详情
699
+ @platform: all
700
+ @param ruleId {string} – string 必传 定时任务ID
701
+ @return Promise
702
+ */
703
+ function getCronJobInfo(ruleId: string): Promise<any> {
704
+ return NativeModules.QuecRNDeviceModule.getCronJobInfo(ruleId);
705
+ }
706
+
707
+ /** 批量删除定时任务
708
+ @platform: all
709
+ @param params {object} – {ruleIdList:[] String[] 必传 定时任务ID}
710
+ @return Promise
711
+ */
712
+ function batchDeleteCronJob(params: Object): Promise<any> {
713
+ return NativeModules.QuecRNDeviceModule.batchDeleteCronJob(params);
714
+ }
715
+
716
+ /** 查询产品下定时任务限制数
717
+ @platform: all
718
+ @param productKey {string} – string 必传 产品key
719
+ @return Promise
720
+ */
721
+ function getProductCornJobLimit(productKey: string): Promise<any> {
722
+ return NativeModules.QuecRNDeviceModule.getProductCornJobLimit(productKey);
723
+ }
724
+
725
+ /** 打开websocket
726
+ @platform: all
727
+ */
728
+ function openWebSocket() {
729
+ return NativeModules.QuecRNDeviceModule.openWebSocket();
730
+ }
731
+
732
+ /** 关闭websocket
733
+ @platform: all
734
+ */
735
+ function closeWebSocket() {
736
+ return NativeModules.QuecRNDeviceModule.closeWebSocket();
737
+ }
738
+
739
+ /** 查询产品的tls模型
740
+ @platform: all
741
+ @param param {object} -{productKey:String } --必传
742
+ @return Promise
743
+ */
744
+ function getProductTSLWithCacheByProductKey(param: Object): Promise<any> {
745
+ return NativeModules.QuecRNDeviceModule.getProductTSLWithCacheByProductKey(param);
746
+ }
747
+
748
+ /** 门锁事件日志
749
+ @platform: all
750
+ @param params {object} {codeList:["",""],productKey:"",deviceKey:"",startTime:long,endTime:long,pageNumber:1,pageSize:10}
751
+ @return Promise
752
+ */
753
+ function listDeviceEvent(params: Object): Promise<any> {
754
+ return NativeModules.QuecRNDeviceModule.listDeviceEvent(params);
755
+ }
756
+
757
+ /**该方法已废弃 设备解绑
758
+ @platform: all
759
+ @param pk {string} string 产品id
760
+ @param dk {string} string 设备id
761
+ @param shareCode {string} string 分享码
762
+ @return Promise
763
+ */
764
+ function unShareDeviceByShareUserWithShareCodeIpc(
765
+ pk: string,
766
+ dk: string,
767
+ shareCode: string
768
+ ): Promise<any> {
769
+ return NativeModules.QuecRNDeviceModule.unShareDeviceByShareUserWithShareCodeIpc(
770
+ pk,
771
+ dk,
772
+ shareCode
773
+ );
774
+ }
775
+
776
+ /** 设备链路连接状态状态通知
777
+ @call (object:object)=>{} @param object 事件数据 {"connectingState": 0/1/2/3/4/5/6/7}
778
+ connectingStateMaskWS = 1 << 0,
779
+ connectingStateMaskWifi = 1 << 1,
780
+ connectingStateMaskBle = 1 << 2,
781
+ (0: all offline, 1: websocket online, 2 : wifi online, 3: wifi + websocket online, 4: ble online, 5: websocket + ble online, 6: ble + wifi online , 7: wifi + ble + ws online)
782
+ */
783
+ function NativeEvent_onDeviceConnectingState(call: (object: object) => void): EmitterSubscription {
784
+ return NativeNotificationModule.addListener('onDeviceConnectingState', call);
785
+ }
786
+
787
+ /** 设备在离线状态通知
788
+ @call (object:object)=>{} @param object 事件数据 {"onlineState": 0/1/2/3/4/5/6/7}
789
+ onlineStateMaskWS = 1 << 0,
790
+ onlineStateMaskWifi = 1 << 1,
791
+ onlineStateMaskBle = 1 << 2,
792
+ (0: all offline, 1: websocket online, 2 : wifi online, 3: wifi + websocket online, 4: ble online, 5: websocket + ble online, 6: ble + wifi online , 7: wifi + ble + ws online)
793
+ */
794
+ function NativeEvent_onDeviceOnlineState(call: (object: object) => void): EmitterSubscription {
795
+ return NativeNotificationModule.addListener('onDeviceOnlineState', call);
796
+ }
797
+
798
+ /** 设备dps更新
799
+ @call (object:object)=>{} @param object 事件数据 {
800
+ type: (1:ws 2: wifi 3: ble,)
801
+ pk: "xxxx",
802
+ dk: "xxxx",
803
+ "dps": [{id: 0, type:BOOL, value, true/false},{id: 1, type:INT, value, 1}, ...]
804
+ }
805
+ */
806
+ function NativeEvent_onDeviceDpsUpdate(call: (object: object) => void): EmitterSubscription {
807
+ return NativeNotificationModule.addListener('onDeviceDpsUpdate', call);
808
+ }
809
+
810
+ /** 设备信息更新
811
+ @call (object:object)=>{} @param object 事件数据
812
+ */
813
+ function NativeEvent_onDeviceInfoUpdate(call: (object: object) => void): EmitterSubscription {
814
+ return NativeNotificationModule.addListener('onDeviceInfoUpdate', call);
815
+ }
816
+
817
+ /** WebSocket 已打开事件
818
+ @call (object:object)=>{} @param object 事件数据 data = {"code":"this is code", @"message":" this is reason"}
819
+ reminder.data = {}
820
+ */
821
+ function NativeEvent_onWebSocketDidOpen(call: (object: object) => void): EmitterSubscription {
822
+ return NativeNotificationModule.addListener('onWebSocketDidOpen', call);
823
+ }
824
+
825
+ /** WebSocket 错误事件
826
+ @call (object:object)=>{} @param object 事件数据 data = {"code":"this is code", @"message":" this is reason"}
827
+ */
828
+ function NativeEvent_onWebSocketDidError(call: (object: object) => void): EmitterSubscription {
829
+ return NativeNotificationModule.addListener('onWebSocketDidError', call);
830
+ }
831
+
832
+ /** WebSocket 消息事件
833
+ @call (object:object)=>{} @param object 事件数据
834
+ object.data = {
835
+ "cmd": "message",
836
+ "data": {
837
+ "createdAt": 1609316592000,
838
+ "data": {
839
+ "value": 1
840
+ },
841
+ "deviceKey": "866123456789015",
842
+ "productKey": "123456",
843
+ "ticket": "5f9924d171977c33bc5ad1b1",
844
+ "type": "ONLINE"
845
+ }
846
+ }
847
+ error
848
+ {
849
+ cmd = error;
850
+ data = {
851
+ code = 4010;
852
+ msg = "user not logged in";
853
+ reqMsg = "";
854
+ };
855
+ */
856
+ function NativeEvent_onWebSocketDidReceiveMessage(
857
+ call: (object: object) => void
858
+ ): EmitterSubscription {
859
+ return NativeNotificationModule.addListener('onWebSocketDidReceiveMessage', call);
860
+ }
861
+
862
+ const QuecRNDeviceModuleMethods = {
863
+ isWebSocketSubscribe,
864
+ getDeviceConnectingState,
865
+ writeDpsByHttp,
866
+ readDpsWithExtraData,
867
+ readDpsWithExtraDataAndMode,
868
+ writeDpsWithExtraData,
869
+ writeDpsWithExtraDataAndMode,
870
+ getBleState,
871
+ getTslAndAttrs,
872
+ readDps,
873
+ writeDps,
874
+ readDpsWithMode,
875
+ writeDpsWithMode,
876
+ getOnlineState,
877
+ connectChannel,
878
+ disconnectChannel,
879
+ isWebSocketLoginCallback,
880
+ subscribeDevicesWithList,
881
+ unSubscribeDevicesWithList,
882
+ sendDataToDeviceByWebSocketWithDataDict,
883
+ getDeviceListWithPageNumber,
884
+ getProductTSLWithProductKey,
885
+ getDeviceBusinessAttributesWithProductKey,
886
+ updateDeviceNameByShareUserWithDeviceName,
887
+ updateDeviceName,
888
+ getGatewayDeviceChildListWithParams,
889
+ unbindDeviceWithDeviceKey,
890
+ unShareDeviceByShareUserWithShareCode,
891
+ getPropertyChartListWithParams,
892
+ getDeviceShareUserListWithDeviceKey,
893
+ setShareInfoByOwnerWithDeviceKey,
894
+ unShareDeviceByOwnerWithShareCode,
895
+ getLocationHistoryWithParams,
896
+ getDeviceInfoByDeviceKey,
897
+ getPropertyDataListWithParams,
898
+ getPropertyStatisticsWithParams,
899
+ getDeviceInfoByShareCode,
900
+ getDeviceListByDeviceName,
901
+ bindDeviceBySerialNumber,
902
+ bindDeviceByAuthCode,
903
+ bindDeviceByPSWAuthCode,
904
+ getFetchPlanWithProductKey,
905
+ reportDeviceUpgradeStatusWithProductKey,
906
+ sendDataToDevicesByHttpWithData,
907
+ addCornJob,
908
+ setCronJob,
909
+ getCronJobList,
910
+ getCronJobInfo,
911
+ batchDeleteCronJob,
912
+ getProductCornJobLimit,
913
+ openWebSocket,
914
+ closeWebSocket,
915
+ getProductTSLWithCacheByProductKey,
916
+ listDeviceEvent,
917
+ unShareDeviceByShareUserWithShareCodeIpc,
918
+ };
919
+ const QuecRNDeviceModuleEvents = {
920
+ NativeEvent_onDeviceConnectingState,
921
+
922
+ NativeEvent_onDeviceOnlineState,
923
+
924
+ NativeEvent_onDeviceDpsUpdate,
925
+
926
+ NativeEvent_onDeviceInfoUpdate,
927
+
928
+ NativeEvent_onWebSocketDidOpen,
929
+
930
+ NativeEvent_onWebSocketDidError,
931
+
932
+ NativeEvent_onWebSocketDidReceiveMessage,
933
+ };
934
+ const QuecRNDeviceModule = {
935
+ ...NativeModules.QuecRNDeviceModule,
936
+ ...QuecRNDeviceModuleMethods,
937
+ ...QuecRNDeviceModuleEvents,
938
+ };
939
+ export default QuecRNDeviceModule;