@quec/rn-device-module 1.9.19 → 2.16.1

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.
Files changed (80) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/QuecRNDeviceModule.podspec +54 -0
  3. package/README.md +1535 -1043
  4. package/android/build.gradle +119 -0
  5. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  6. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  7. package/android/gradle.properties +23 -0
  8. package/android/gradlew +185 -0
  9. package/android/gradlew.bat +89 -0
  10. package/android/old-info.properties +2 -0
  11. package/android/proguard-rules.pro +21 -0
  12. package/android/publishInfo.properties +4 -0
  13. package/android/settings.gradle +3 -0
  14. package/android/src/main/AndroidManifest.xml +6 -0
  15. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/IQuecRNDeviceModuleSpec.java +1352 -0
  16. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/QuecRNDeviceModule.java +2423 -0
  17. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/QuecRNDeviceModulePackage.java +23 -0
  18. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/bean/DataInfo.java +25 -0
  19. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/bean/DataRes.java +31 -0
  20. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/bean/DeviceDpsUpdateModel.java +18 -0
  21. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/bean/ModelBridgeBasic.java +86 -0
  22. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/bean/OtaUpgradePlanModel.java +292 -0
  23. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/bean/ShareInfo.java +166 -0
  24. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/bean/UserInfo.java +137 -0
  25. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/bean/WriteCmdWithId.java +10 -0
  26. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/utils/AnalysisChannelDataUtils.java +82 -0
  27. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/utils/DataConvertUtils.kt +130 -0
  28. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/utils/ErrorCode.java +26 -0
  29. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/utils/ErrorUtils.java +11 -0
  30. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/utils/IpcUtil.java +75 -0
  31. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/utils/NetUtils.java +85 -0
  32. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/utils/OnConnectListener.java +22 -0
  33. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/utils/ParamsValueUtils.java +79 -0
  34. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/utils/QuecIotChannelMode.java +8 -0
  35. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/utils/ReactNativeJson.java +199 -0
  36. package/android/src/main/java/com/quectel/smart/rnplugin/quecrndevicemodule/utils/ResponseUtils.java +156 -0
  37. package/android/src/main/res/values/strings.xml +4 -0
  38. package/android/src/main/res/values-en/strings.xml +4 -0
  39. package/android/src/main/res/values-zh/strings.xml +4 -0
  40. package/android/src/test/java/com/quectel/smart/template/ExampleUnitTest.java +17 -0
  41. package/build.gradle +1 -0
  42. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  43. package/gradle/wrapper/gradle-wrapper.properties +6 -0
  44. package/ios/Example/Podfile +17 -0
  45. package/ios/Example/QuecRNDeviceModule/AppDelegate.h +13 -0
  46. package/ios/Example/QuecRNDeviceModule/AppDelegate.m +46 -0
  47. package/ios/Example/QuecRNDeviceModule/Base.lproj/LaunchScreen.storyboard +31 -0
  48. package/ios/Example/QuecRNDeviceModule/Base.lproj/Main.storyboard +31 -0
  49. package/ios/Example/QuecRNDeviceModule/Images.xcassets/AppIcon.appiconset/Contents.json +98 -0
  50. package/ios/Example/QuecRNDeviceModule/QuecRNDeviceModule-Info.plist +40 -0
  51. package/ios/Example/QuecRNDeviceModule/QuecRNDeviceModule-Prefix.pch +16 -0
  52. package/ios/Example/QuecRNDeviceModule/ViewController.h +12 -0
  53. package/ios/Example/QuecRNDeviceModule/ViewController.m +29 -0
  54. package/ios/Example/QuecRNDeviceModule/en.lproj/InfoPlist.strings +2 -0
  55. package/ios/Example/QuecRNDeviceModule/main.m +15 -0
  56. package/ios/Example/QuecRNDeviceModule.xcodeproj/project.pbxproj +583 -0
  57. package/ios/Example/QuecRNDeviceModule.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  58. package/ios/Example/QuecRNDeviceModule.xcodeproj/xcshareddata/xcschemes/QuecRNDeviceModule-Example.xcscheme +101 -0
  59. package/ios/Example/QuecRNDeviceModule.xcworkspace/contents.xcworkspacedata +10 -0
  60. package/ios/Example/QuecRNDeviceModule.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  61. package/ios/LICENSE +4 -0
  62. package/ios/QuecRNDeviceModule/Assets/.gitkeep +0 -0
  63. package/ios/QuecRNDeviceModule/Classes/QuecRNDeviceModule+Ext.h +27 -0
  64. package/ios/QuecRNDeviceModule/Classes/QuecRNDeviceModule+Impl.h +1137 -0
  65. package/ios/QuecRNDeviceModule/Classes/QuecRNDeviceModule+Impl.m +1524 -0
  66. package/ios/QuecRNDeviceModule/Classes/QuecRNDeviceModule.h +157 -0
  67. package/ios/QuecRNDeviceModule/Classes/QuecRNDeviceModule.m +721 -0
  68. package/ios/README.md +20 -0
  69. package/{.prettierrc.js → js/.prettierrc.js} +11 -11
  70. package/js/README.md +1535 -0
  71. package/js/package.json +25 -0
  72. package/{src → js/src}/index.ts +12 -12
  73. package/{src → js/src}/module.ts +1332 -939
  74. package/{src → js/src}/viewCommon.ts +3 -3
  75. package/js/tsconfig.json +26 -0
  76. package/js/yarn.lock +4 -0
  77. package/package.json +10 -25
  78. package/plugin.ts +1180 -0
  79. package/settings.gradle +2 -0
  80. package/tsconfig.json +9 -0
@@ -1,939 +1,1332 @@
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.19
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
- actionstring 必传 定时任务执行的命令,格式:物模型的 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
- pagenumber 分页页码,默认: 1
691
- pageSizenumber 分页大小,默认: 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;
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: 3.2.0
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
+
132
+ type string 非必填 查询类型
133
+ 1 查询设备基础属性
134
+ 2 查询物模型属性
135
+ 3 查询定位信息
136
+ 查询类型可以单选和多选,如果需要查询多个类型的属性值,使用英文逗号分隔
137
+
138
+ filterType 过滤类型
139
+ 0: 仅获取属性定义(默认行为)
140
+ 1: 获取属性和事件定义
141
+ 2: 获取属性,事件和服务定义 (为后续预留)
142
+ @return Promise
143
+ */
144
+ function getTslAndAttrs(params: Object): Promise<any> {
145
+ return NativeModules.QuecRNDeviceModule.getTslAndAttrs(params);
146
+ }
147
+
148
+ /** read data points
149
+ @platform: all
150
+ @param dps {Array<object>} – dps [ {id:0, type:BOOL, value:false} ,{id:1, type:INT, value:2}]
151
+ @return Promise
152
+ */
153
+ function readDps(dps: Array<object>): Promise<any> {
154
+ return NativeModules.QuecRNDeviceModule.readDps(dps);
155
+ }
156
+
157
+ /** write data points
158
+ @platform: all
159
+ @param dps {Array<object>} – dps [ {id:0, type:BOOL, value:false} ,{id:1, type:INT, value:2}]
160
+ @return Promise
161
+ */
162
+ function writeDps(dps: Array<object>): Promise<any> {
163
+ return NativeModules.QuecRNDeviceModule.writeDps(dps);
164
+ }
165
+
166
+ /** write transparent data
167
+ @platform: all
168
+ @param data {string} 透传数据, 二进制base64转换的字符串
169
+ @param mode {integer} 发送模式
170
+ @param extraData {object} 额外参数(预留)
171
+ @return Promise
172
+ */
173
+ function writeTransparent(data: string, mode: number, extraData: Object): Promise<any> {
174
+ return NativeModules.QuecRNDeviceModule.writeTransparent(data, mode, extraData);
175
+ }
176
+
177
+ /** read data points
178
+ @platform: all
179
+ @param dps {Array<object>} – dps [ {id:0, type:BOOL, value:false} ,{id:1, type:INT, value:2}]
180
+ @param mode {integer} – mode 下发模式: 0 auto,1: websocket 2:wifi 3:ble
181
+ @return Promise
182
+ */
183
+ function readDpsWithMode(dps: Array<object>, mode: number): Promise<any> {
184
+ return NativeModules.QuecRNDeviceModule.readDpsWithMode(dps, mode);
185
+ }
186
+
187
+ /** write data points
188
+ @platform: all
189
+ @param dps {Array<object>} – dps [ {id:0, type:BOOL, value:false} ,{id:1, type:INT, value:2}]
190
+ @param mode {integer} – mode 下发模式: 0 auto,1: websocket 2:wifi 3:ble
191
+ @return Promise
192
+ */
193
+ function writeDpsWithMode(dps: Array<object>, mode: number): Promise<any> {
194
+ return NativeModules.QuecRNDeviceModule.writeDpsWithMode(dps, mode);
195
+ }
196
+
197
+ /** 获取设备通道状态
198
+ @platform: all
199
+ @return Promise
200
+ */
201
+ function getOnlineState(): Promise<any> {
202
+ return NativeModules.QuecRNDeviceModule.getOnlineState();
203
+ }
204
+
205
+ /** 建立通道,(设备会自动根据设备通道能力capabilitiesBitmask建立通道,此API用于手动切换指定通道)
206
+ @platform: all
207
+ @param mode {integer} – mode 建立通道模式: 0 auto,1: websocket 2:wifi 3:ble
208
+ 注意:1,建立的通通与已连接通道不同时,已连接通道会断开。
209
+ 2,当设备不具备相应通道,建立其不具备的通道会失败。不会再自动建立其他通道
210
+ */
211
+ function connectChannel(mode: number) {
212
+ return NativeModules.QuecRNDeviceModule.connectChannel(mode);
213
+ }
214
+
215
+ /** 断开通道,(
216
+ @platform: all
217
+ @param type {integer} – type 通道类型,0: 关闭所有通道(关闭wifi和ble), 2:wifi 3:ble
218
+ */
219
+ function disconnectChannel(type: number) {
220
+ return NativeModules.QuecRNDeviceModule.disconnectChannel(type);
221
+ }
222
+
223
+ /**该方法已废弃 获取websocket是否登录成功
224
+ @platform: all
225
+ @param isLoginCallback {successcb} Func 接受是否登录websocket回调 已登录成功 true 登录失败 false
226
+ */
227
+ function isWebSocketLoginCallback(isLoginCallback: Function) {
228
+ return NativeModules.QuecRNDeviceModule.isWebSocketLoginCallback(isLoginCallback);
229
+ }
230
+
231
+ /**该方法已废弃 订阅设备
232
+ @platform: all
233
+ @param list {Array<object>} 订阅设备列表,订阅结果QuecDeviceServiceWebSocketDelegate返回
234
+ [
235
+ {
236
+ "deviceKey": "1234567890",
237
+ "messageType": [
238
+ "ONLINE"
239
+ ],
240
+ "productKey": "p12345"
241
+ },
242
+ {
243
+ "deviceKey": "1234567890",
244
+ "messageType": [
245
+ "ONLINE",
246
+ "STATUS"
247
+ ],
248
+ "productKey": "p12345"
249
+ }
250
+ ]
251
+ */
252
+ function subscribeDevicesWithList(list: Array<object>) {
253
+ return NativeModules.QuecRNDeviceModule.subscribeDevicesWithList(list);
254
+ }
255
+
256
+ /**该方法已废弃 取消订阅设备
257
+ @platform: all
258
+ @param list {Array<object>} 取消订阅设备列表,取消订阅结果QuecDeviceServiceWebSocketDelegate返回
259
+ [
260
+ {
261
+ "deviceKey": "1234567890",
262
+ "productKey": "p12345"
263
+ },
264
+ {
265
+ "deviceKey": "1234567890",
266
+ "productKey": "p12345"
267
+ }
268
+ ]
269
+ */
270
+ function unSubscribeDevicesWithList(list: Array<object>) {
271
+ return NativeModules.QuecRNDeviceModule.unSubscribeDevicesWithList(list);
272
+ }
273
+
274
+ /**该方法已废弃 获取设备业务属性值
275
+ @platform: all
276
+ @param params {object} 发送数据,需要在delegate的websocketDidOpen回调之后才能调用
277
+ 透传
278
+ {
279
+ "cmd": "send",
280
+ "data": {
281
+ "cacheTime": 3600,
282
+ "dataFormat": "Text",
283
+ "deviceKey": "866123456789015",
284
+ "isCache": true,
285
+ "productKey": "p12345",
286
+ "raw": "123456",
287
+ "type": "RAW"
288
+ }
289
+ }
290
+ 物模型
291
+ {
292
+ "cmd": "send",
293
+ "data": {
294
+ "deviceKey": "1234567890",
295
+ "kv": "[{\"id\":5,\"name\":\"openapi\",\"type\":\"BOOL\",\"value\":\"true\"}]",
296
+ "productKey": "p12345",
297
+ "type": "WRITE-ATTR"
298
+ }
299
+ }
300
+ */
301
+ function sendDataToDeviceByWebSocketWithDataDict(params: Object) {
302
+ return NativeModules.QuecRNDeviceModule.sendDataToDeviceByWebSocketWithDataDict(params);
303
+ }
304
+
305
+ /**该方法已废弃 获取设备列表
306
+ @platform: all
307
+ @param pageNumber {integer} number 页码
308
+ @param pageSize {integer} number 页大小
309
+ @return Promise
310
+ */
311
+ function getDeviceListWithPageNumber(pageNumber: number, pageSize: number): Promise<any> {
312
+ return NativeModules.QuecRNDeviceModule.getDeviceListWithPageNumber(pageNumber, pageSize);
313
+ }
314
+
315
+ /**该方法已废弃 获取设备业务物模型属性值
316
+ @platform: all
317
+ @param params {object} map
318
+ productKey string 产品key
319
+ deviceKey string 设备key
320
+ codeList string 非必填 查询的属性标识符
321
+ gatewayDk string 网关设备的 Device Key
322
+ gatewayPk string 网关设备的 Product Key
323
+ 和查询类型配合使用,如果查询多个属性,使用英文逗号分隔
324
+ type string 非必填 查询类型
325
+ 1 查询设备基础属性
326
+ 2 查询物模型属性
327
+ 3 查询定位信息
328
+ 查询类型可以单选和多选,如果需要查询多个类型的属性值,使用英文逗号分隔
329
+ @return Promise
330
+ */
331
+ function getProductTSLWithProductKey(params: Object): Promise<any> {
332
+ return NativeModules.QuecRNDeviceModule.getProductTSLWithProductKey(params);
333
+ }
334
+
335
+ /**该方法已废弃 获取设备业务属性值
336
+ @platform: all
337
+ @param params {object} map
338
+ productKey string 产品key
339
+ deviceKey string 设备key
340
+ codeList string 非必填 查询的属性标识符
341
+ 和查询类型配合使用,如果查询多个属性,使用英文逗号分隔
342
+ type string 非必填 查询类型
343
+ 1 查询设备基础属性
344
+ 2 查询物模型属性
345
+ 3 查询定位信息
346
+ 查询类型可以单选和多选,如果需要查询多个类型的属性值,使用英文逗号分隔
347
+ @return Promise
348
+ */
349
+ function getDeviceBusinessAttributesWithProductKey(params: Object): Promise<any> {
350
+ return NativeModules.QuecRNDeviceModule.getDeviceBusinessAttributesWithProductKey(params);
351
+ }
352
+
353
+ /**该方法已废弃 更改分享设备名称
354
+ @platform: all
355
+ @param deviceName {string} string 设备名称
356
+ @param shareCode {string} string 分享码
357
+ @return Promise
358
+ */
359
+ function updateDeviceNameByShareUserWithDeviceName(
360
+ deviceName: string,
361
+ shareCode: string
362
+ ): Promise<any> {
363
+ return NativeModules.QuecRNDeviceModule.updateDeviceNameByShareUserWithDeviceName(
364
+ deviceName,
365
+ shareCode
366
+ );
367
+ }
368
+
369
+ /**该方法已废弃 更改分享设备名称
370
+ @platform: all
371
+ @param deviceName {string} string deviceName
372
+ @param productKey {string} string product key
373
+ @param deviceKey {string} string deviceKey
374
+ @return Promise
375
+ */
376
+ function updateDeviceName(deviceName: string, productKey: string, deviceKey: string): Promise<any> {
377
+ return NativeModules.QuecRNDeviceModule.updateDeviceName(deviceName, productKey, deviceKey);
378
+ }
379
+
380
+ /**该方法已废弃 查询网关设备下子设备列表
381
+ @platform: all
382
+ @param params {object} deviceKey string 必传 网关设备deviceKey
383
+ productKey string 必传 网关设备productKey
384
+ pageNumber number 必传 页码
385
+ pageSize number 必传 页大小
386
+ @return Promise
387
+ */
388
+ function getGatewayDeviceChildListWithParams(params: Object): Promise<any> {
389
+ return NativeModules.QuecRNDeviceModule.getGatewayDeviceChildListWithParams(params);
390
+ }
391
+
392
+ /**该方法已废弃 设备解绑
393
+ @platform: all
394
+ @param deviceKey {string} string device key
395
+ @param productKey {string} string product key
396
+ @return Promise
397
+ */
398
+ function unbindDeviceWithDeviceKey(deviceKey: string, productKey: string): Promise<any> {
399
+ return NativeModules.QuecRNDeviceModule.unbindDeviceWithDeviceKey(deviceKey, productKey);
400
+ }
401
+
402
+ /**该方法已废弃 设备解绑
403
+ @platform: all
404
+ @param shareCode {string} string 分享码
405
+ @return Promise
406
+ */
407
+ function unShareDeviceByShareUserWithShareCode(shareCode: string): Promise<any> {
408
+ return NativeModules.QuecRNDeviceModule.unShareDeviceByShareUserWithShareCode(shareCode);
409
+ }
410
+
411
+ /** 获取设备属性图表列表
412
+ @platform: all
413
+ @param params {object} productKey 产品key
414
+ deviceKey 设备key
415
+ startTimestamp 开始时间(毫秒时间戳)
416
+ endTimestamp 结束时间(毫秒时间戳)
417
+ attributeCode 物模型属性标识符,查询多个属性时使用英文逗号分隔
418
+ gatewayDk 网关设备的 Device Key
419
+ gatewayPk 网关设备的 Product Key
420
+ countType 聚合类型(默认3):1-最大值 2-最小值 3-平均值 4-差值 5-总值
421
+ timeGranularity 统计时间粒度(默认2):1-月 2-日 3-小时 4-分钟 5-秒
422
+ callback {"data": []}
423
+ @return Promise
424
+ */
425
+ function getPropertyChartListWithParams(params: Object): Promise<any> {
426
+ return NativeModules.QuecRNDeviceModule.getPropertyChartListWithParams(params);
427
+ }
428
+
429
+ /** 获取设备分享人列表
430
+ @platform: all
431
+ @param deviceKey {string} string 设备名称
432
+ @param productKey {string} string 产品key
433
+ @return Promise
434
+ */
435
+ function getDeviceShareUserListWithDeviceKey(deviceKey: string, productKey: string): Promise<any> {
436
+ return NativeModules.QuecRNDeviceModule.getDeviceShareUserListWithDeviceKey(
437
+ deviceKey,
438
+ productKey
439
+ );
440
+ }
441
+
442
+ /** 分享人设置分享信息
443
+ @platform: all
444
+ @param params {object} deviceKey string 设备key
445
+ productKey string 产品key
446
+ acceptingExpireTime number 分享二维码种子失效时间 时间戳(毫秒),表示该分享在此时间戳时间内没有使用,会失效
447
+ coverMark number 覆盖标志:1 直接覆盖上条有效分享(默认)(覆盖原有的分享码);2 直接添加,允许多条并存;3 只有分享时间延长了,才允许覆盖上条分享
448
+ isSharingAlwaysValid bool 设备是否永久有效
449
+ sharingExpireTime number 设备使用到期时间 时间戳(毫秒),表示该分享的设备,被分享人可以使用的时间,isSharingAlwaysValid为YES时该参数无效
450
+ @return Promise
451
+ */
452
+ function setShareInfoByOwnerWithDeviceKey(params: Object): Promise<any> {
453
+ return NativeModules.QuecRNDeviceModule.setShareInfoByOwnerWithDeviceKey(params);
454
+ }
455
+
456
+ /** 分享人取消分享
457
+ @platform: all
458
+ @param shareCode {string} string 分享码
459
+ @return Promise
460
+ */
461
+ function unShareDeviceByOwnerWithShareCode(shareCode: string): Promise<any> {
462
+ return NativeModules.QuecRNDeviceModule.unShareDeviceByOwnerWithShareCode(shareCode);
463
+ }
464
+
465
+ /** 获取设备历史轨迹
466
+ @platform: all
467
+ @param params {object} productKey 产品key
468
+ deviceKey 设备key
469
+ startTimestamp 开始时间(毫秒时间戳)
470
+ endTimestamp 结束时间(毫秒时间戳)
471
+ gatewayDk 网关设备的 Device Key
472
+ gatewayPk 网关设备的 Product Key
473
+ locateTypes 定位类型(默认查询所有类型的定位),查询多种定位时使用英文逗号分隔
474
+ GNSS-全球导航卫星系统
475
+ GPS-美国导航定位系统
476
+ GL-俄罗斯格洛纳导航定位系统
477
+ GA-欧盟伽利略卫星导航系统
478
+ BD/PQ-中国导航定位系统
479
+ LBS-基于通信运营商的基站定位系统
480
+ @return Promise
481
+ */
482
+ function getLocationHistoryWithParams(params: Object): Promise<any> {
483
+ return NativeModules.QuecRNDeviceModule.getLocationHistoryWithParams(params);
484
+ }
485
+
486
+ /** 获取设备信息
487
+ @platform: all
488
+ @param deviceKey {string} string 设备key
489
+ @param productKey {string} string 产品key
490
+ @return Promise
491
+ */
492
+ function getDeviceInfoByDeviceKey(deviceKey: string, productKey: string): Promise<any> {
493
+ return NativeModules.QuecRNDeviceModule.getDeviceInfoByDeviceKey(deviceKey, productKey);
494
+ }
495
+
496
+ /** 获取设备属性信息
497
+ @platform: all
498
+ @param params {object} map
499
+ productKey 产品key
500
+ deviceKey 设备key
501
+ startTimestamp 开始时间(毫秒时间戳)
502
+ endTimestamp 结束时间(毫秒时间戳)
503
+ attributeCode 物模型属性标识符,查询多个属性时使用英文逗号分隔
504
+ gatewayDk 网关设备的 Device Key
505
+ gatewayPk 网关设备的 Product Key
506
+ pageNumber 当前页,默认为第 1
507
+ pageSize 页大小,默认为 10
508
+ @return Promise
509
+ */
510
+ function getPropertyDataListWithParams(params: Object): Promise<any> {
511
+ return NativeModules.QuecRNDeviceModule.getPropertyDataListWithParams(params);
512
+ }
513
+
514
+ /** 获取设备属性环比统计数据
515
+ @platform: all
516
+ @param params {object} map
517
+ productKey 产品key
518
+ deviceKey 设备key
519
+ currentTimestamp 当前时间(毫秒时间戳
520
+ attributeCode 物模型属性标识符,查询多个属性时使用英文逗号分隔
521
+ gatewayDk 网关设备的 Device Key
522
+ gatewayPk 网关设备的 Product Key
523
+ countType 聚合类型(默认3):1-最大值 2-最小值 3-平均值 4-差值 5-总值
524
+ timeGranularities 统计时间粒度,查询多个粒度时使用英文逗号分隔(默认1):1-日 2-周 3-月 4-年
525
+ callback {"data": []}
526
+ @return Promise
527
+ */
528
+ function getPropertyStatisticsWithParams(params: Object): Promise<any> {
529
+ return NativeModules.QuecRNDeviceModule.getPropertyStatisticsWithParams(params);
530
+ }
531
+
532
+ /** 通过分享码查询设备信息
533
+ @platform: all
534
+ @param shareCode {string} 分享码
535
+ @return Promise
536
+ */
537
+ function getDeviceInfoByShareCode(shareCode: string): Promise<any> {
538
+ return NativeModules.QuecRNDeviceModule.getDeviceInfoByShareCode(shareCode);
539
+ }
540
+
541
+ /** 获取设备列表-根据设备名称搜索
542
+ @platform: all
543
+ @param deviceName {string} 设备名称
544
+ @param pageNumber {integer} number 页码
545
+ @param pageSize {integer} number 页大小
546
+ @return Promise
547
+ */
548
+ function getDeviceListByDeviceName(
549
+ deviceName: string,
550
+ pageNumber: number,
551
+ pageSize: number
552
+ ): Promise<any> {
553
+ return NativeModules.QuecRNDeviceModule.getDeviceListByDeviceName(
554
+ deviceName,
555
+ pageNumber,
556
+ pageSize
557
+ );
558
+ }
559
+
560
+ /** 通过SN绑定设备
561
+ @platform: all
562
+ @param serialNumber {string} string 设备SN码
563
+ @param productKey {string} string 产品key
564
+ @param deviceName {string} string 设备名称
565
+ @return Promise
566
+ */
567
+ function bindDeviceBySerialNumber(
568
+ serialNumber: string,
569
+ productKey: string,
570
+ deviceName: string
571
+ ): Promise<any> {
572
+ return NativeModules.QuecRNDeviceModule.bindDeviceBySerialNumber(
573
+ serialNumber,
574
+ productKey,
575
+ deviceName
576
+ );
577
+ }
578
+
579
+ /** 通过authCode绑定设备
580
+ 可用于wifi/wifi+蓝牙设备绑定
581
+ @platform: all
582
+ @param params {object} Map 包含以下属性
583
+ authCode string 设备authCode
584
+ productKey string 产品key
585
+ deviceKey string 设备key
586
+ deviceName string 设备名称
587
+ @return Promise
588
+ */
589
+ function bindDeviceByAuthCode(params: Object): Promise<any> {
590
+ return NativeModules.QuecRNDeviceModule.bindDeviceByAuthCode(params);
591
+ }
592
+
593
+ /** 通过authCode + password绑定设备
594
+ 可用于蓝牙设备绑定
595
+ @platform: all
596
+ @param params {object} Map 包含以下属性
597
+ authCode string 设备authCode
598
+ productKey string 产品key
599
+ deviceKey string 设备key
600
+ password string 设备password
601
+ deviceName string 设备名称
602
+ @return Promise
603
+ */
604
+ function bindDeviceByPSWAuthCode(params: Object): Promise<any> {
605
+ return NativeModules.QuecRNDeviceModule.bindDeviceByPSWAuthCode(params);
606
+ }
607
+
608
+ /** 查询设备升级信息
609
+ @platform: all
610
+ @param productKey {string} string 产品key
611
+ @param deviceKey {string} string 设备key
612
+ @param params {object} map 其他信息 非必传
613
+ batteryLevelLimit number 设备剩余电量百分比
614
+ mcuVersions array 固件信息 componentNo string 升级组件标识 version string 升级组件版本
615
+ minSignalIntensity number 设备最小信号量 dbM
616
+ moduleVersion string 模组版本
617
+ upgradeTime number 升级时间时间戳,默认为当前时间戳
618
+ useSpace number 所需磁盘空间,KB
619
+ {'batteryLevelLimit':1, 'mcuVersions':[{'componentNo': '', 'version': ''}], 'minSignalIntensity':1, 'moduleVersion':'', 'upgradeTime':1, 'useSpace':1}
620
+ @return Promise
621
+ */
622
+ function getFetchPlanWithProductKey(
623
+ productKey: string,
624
+ deviceKey: string,
625
+ params: Object
626
+ ): Promise<any> {
627
+ return NativeModules.QuecRNDeviceModule.getFetchPlanWithProductKey(productKey, deviceKey, params);
628
+ }
629
+
630
+ /** 上报设备升级信息
631
+ @platform: all
632
+ @param params {object} map
633
+ productKey string 产品key
634
+ deviceKey string 设备key
635
+ componentNo string 升级固件标识
636
+ reportStatus number 升级状态 0 - 1 2
637
+ @return Promise
638
+ */
639
+ function reportDeviceUpgradeStatusWithProductKey(params: Object): Promise<any> {
640
+ return NativeModules.QuecRNDeviceModule.reportDeviceUpgradeStatusWithProductKey(params);
641
+ }
642
+
643
+ /** 设备批量控制
644
+ @platform: all
645
+ @param params {object} Map
646
+ data 遵循tsl格式的json string [{"id":62,"value":99,"type":"INT","name":"温度(temp)"},{"id":63,"value":"true","type":"BOOL","name":"开关机状态(powerstate)"}]
647
+ deviceList 设备列表 [{"deviceKey":"", "productKey":""}]
648
+ type number 类型 1:透传 2:属性 3:服务
649
+ dataFormat number 数据类型 1:Hex 2:Text(当type为透传时,需要指定 dataFormat)
650
+ cacheTime number 非必传 缓存时间,单位为秒,缓存时间范围 1-7776000 秒,启用缓存时必须设置缓存时间
651
+ isCache number 非必传 是否启用缓存 1:启用 2:不启用,默认不启用
652
+ isCover number 非必传 是否覆盖之前发送的相同的命令 1:覆盖 2:不覆盖,默认不覆盖,启用缓存时此参数有效
653
+ @return Promise
654
+ */
655
+ function sendDataToDevicesByHttpWithData(params: Object): Promise<any> {
656
+ return NativeModules.QuecRNDeviceModule.sendDataToDevicesByHttpWithData(params);
657
+ }
658
+
659
+ /** 创建定时任务
660
+ @platform: all
661
+ @param params {object} productKey – string 必传 产品key
662
+ deviceKey – string 必传 设备key
663
+ type – string 必传 定时任务类型,once: 执行一次,day-repeat: 每天重复,custom-repeat: 自定义重复,multi-section: 多段执行,random: 随机执行,delay: 延迟执行(倒计时)
664
+ timers:[{
665
+ action string 必传 定时任务执行的命令,格式:物模型的 json 字符串,
666
+ time – string 非必传 执行时间,格式为 HH:mm:ss, 当 type = once || day-repeat || custom-repeat ||
667
+ multi-section 时必填,
668
+ startTime – string 非必传 type random 时必填,格式为 "HH:mm:ss",如 "12:00:00"
669
+ endTime – string 非必传 当 type 为 random 时必填,格式为 "HH:mm:ss",如 "12:00:00"
670
+ delaynumber 非必传 延迟执行时间,单位为秒, type = delay 时必填,单位为 s
671
+ }]
672
+ enabled – 定时任务状态:false-停止(默认) true-启动
673
+ dayOfWeek – string 非必传 周几执行:1-周一 2-周二 3-周三 4-周四 5-周五 6-周六 7-周日, 可以多选,传多个值时使用英文逗号分隔, 当 type = custom-repeat || multi-section || random 时必填
674
+ @return Promise
675
+ */
676
+ function addCornJob(params: Object): Promise<any> {
677
+ return NativeModules.QuecRNDeviceModule.addCornJob(params);
678
+ }
679
+
680
+ /** 修改定时任务
681
+ @platform: all
682
+ @param params {object} productKey – string 必传 产品key
683
+ deviceKey – string 必传 设备key
684
+ ruleId – string 必传 规则唯一标识,修改规则实例信息时必填
685
+ type – string 必传 定时任务类型,once: 执行一次,day-repeat: 每天重复,custom-repeat: 自定义重复,multi-section: 多段执行,random: 随机执行,delay: 延迟执行(倒计时)
686
+ timers:[{
687
+ action string 必传 定时任务执行的命令,格式:物模型的 json 字符串,
688
+ time – string 非必传 执行时间,格式为 HH:mm:ss, 当 type = once || day-repeat || custom-repeat ||
689
+ multi-section 时必填,
690
+ startTimestring 非必传 当 type 为 random 时必填,格式为 "HH:mm:ss",如 "12:00:00"
691
+ endTimestring 非必传 当 type 为 random 时必填,格式为 "HH:mm:ss",如 "12:00:00"
692
+ delay – number 非必传 延迟执行时间,单位为秒, 当 type = delay 时必填,单位为 s
693
+ }]
694
+ enabled 定时任务状态:false-停止(默认) true-启动
695
+ dayOfWeek – string 非必传 周几执行:1-周一 2-周二 3-周三 4-周四 5-周五 6-周六 7-周日, 可以多选,传多个值时使用英文逗号分隔, 当 type = custom-repeat || multi-section || random 时必填
696
+ @return Promise
697
+ */
698
+ function setCronJob(params: Object): Promise<any> {
699
+ return NativeModules.QuecRNDeviceModule.setCronJob(params);
700
+ }
701
+
702
+ /** 查询设备下定时任务列表
703
+ @platform: all
704
+ @param params {object} productKey – string 必传 产品key
705
+ deviceKey – string 必传 设备key
706
+ type – string 必传 定时任务类型,once: 执行一次,day-repeat: 每天重复,custom-repeat: 自定义重复,multi-section: 多段执行,random: 随机执行,delay: 延迟执行(倒计时)
707
+ page – number 分页页码,默认: 1
708
+ pageSize – number 分页大小,默认: 10
709
+ @return Promise
710
+ */
711
+ function getCronJobList(params: Object): Promise<any> {
712
+ return NativeModules.QuecRNDeviceModule.getCronJobList(params);
713
+ }
714
+
715
+ /** 查询定时任务详情
716
+ @platform: all
717
+ @param ruleId {string} – string 必传 定时任务ID
718
+ @return Promise
719
+ */
720
+ function getCronJobInfo(ruleId: string): Promise<any> {
721
+ return NativeModules.QuecRNDeviceModule.getCronJobInfo(ruleId);
722
+ }
723
+
724
+ /** 批量删除定时任务
725
+ @platform: all
726
+ @param params {object} – {ruleIdList:[] String[] 必传 定时任务ID}
727
+ @return Promise
728
+ */
729
+ function batchDeleteCronJob(params: Object): Promise<any> {
730
+ return NativeModules.QuecRNDeviceModule.batchDeleteCronJob(params);
731
+ }
732
+
733
+ /** 查询产品下定时任务限制数
734
+ @platform: all
735
+ @param productKey {string} – string 必传 产品key
736
+ @return Promise
737
+ */
738
+ function getProductCornJobLimit(productKey: string): Promise<any> {
739
+ return NativeModules.QuecRNDeviceModule.getProductCornJobLimit(productKey);
740
+ }
741
+
742
+ /** 打开websocket
743
+ @platform: all
744
+ */
745
+ function openWebSocket() {
746
+ return NativeModules.QuecRNDeviceModule.openWebSocket();
747
+ }
748
+
749
+ /** 关闭websocket
750
+ @platform: all
751
+ */
752
+ function closeWebSocket() {
753
+ return NativeModules.QuecRNDeviceModule.closeWebSocket();
754
+ }
755
+
756
+ /** 查询产品的tls模型
757
+ @platform: all
758
+ @param param {object} -{productKey:String } --必传
759
+ @return Promise
760
+ */
761
+ function getProductTSLWithCacheByProductKey(param: Object): Promise<any> {
762
+ return NativeModules.QuecRNDeviceModule.getProductTSLWithCacheByProductKey(param);
763
+ }
764
+
765
+ /** 门锁事件日志
766
+ @platform: all
767
+ @param params {object} {codeList:["",""],productKey:"",deviceKey:"",startTime:long,endTime:long,pageNumber:1,pageSize:10}
768
+ @return Promise
769
+ */
770
+ function listDeviceEvent(params: Object): Promise<any> {
771
+ return NativeModules.QuecRNDeviceModule.listDeviceEvent(params);
772
+ }
773
+
774
+ /**该方法已废弃 设备解绑
775
+ @platform: all
776
+ @param pk {string} string 产品id
777
+ @param dk {string} string 设备id
778
+ @param shareCode {string} string 分享码
779
+ @return Promise
780
+ */
781
+ function unShareDeviceByShareUserWithShareCodeIpc(
782
+ pk: string,
783
+ dk: string,
784
+ shareCode: string
785
+ ): Promise<any> {
786
+ return NativeModules.QuecRNDeviceModule.unShareDeviceByShareUserWithShareCodeIpc(
787
+ pk,
788
+ dk,
789
+ shareCode
790
+ );
791
+ }
792
+
793
+ /** 订阅设备(非当前面板设备)
794
+ @platform: all
795
+ @param pk {string} string 产品id
796
+ @param dk {string} string 设备id
797
+ */
798
+ function subscribeDevice(pk: string, dk: string) {
799
+ return NativeModules.QuecRNDeviceModule.subscribeDevice(pk, dk);
800
+ }
801
+
802
+ /** 取消订阅 (非当前面板设备)
803
+ @platform: all
804
+ @param pk {string} string 产品id
805
+ @param dk {string} string 设备id
806
+ */
807
+ function unSubscribeDevice(pk: string, dk: string) {
808
+ return NativeModules.QuecRNDeviceModule.unSubscribeDevice(pk, dk);
809
+ }
810
+
811
+ /** 设置主从设备关联关系
812
+ @platform: all
813
+ @param list {Array<object>} - array<DeviceModel> 关联设备列表
814
+ [
815
+ {
816
+ "deviceKey": "1234567890",
817
+ "productKey": "p12345",
818
+ ...设备其他信息
819
+ },
820
+ {
821
+ "deviceKey": "1234567890",
822
+ "productKey": "p12345"
823
+ ...设备其他信息
824
+ }
825
+ ]
826
+ @param master {object} - DeviceModel Object 主设备信息
827
+ @param fid {string} - string 家庭 id, 没有传空
828
+ @return Promise
829
+ */
830
+ function deviceAssociationWithList(list: Array<object>, master: Object, fid: string): Promise<any> {
831
+ return NativeModules.QuecRNDeviceModule.deviceAssociationWithList(list, master, fid);
832
+ }
833
+
834
+ /** 设备关联关系查询
835
+ @platform: all
836
+ @param master {object} - DeviceModel Object 主设备信息
837
+ @param fid {string} - string 家庭 id, 没有传空
838
+ @param codelist {string} - string 物模型code, 用逗号分隔
839
+ @return Promise
840
+ */
841
+ function deviceAssociation(master: Object, fid: string, codelist: string): Promise<any> {
842
+ return NativeModules.QuecRNDeviceModule.deviceAssociation(master, fid, codelist);
843
+ }
844
+
845
+ /** 设备关联关系解除
846
+ @platform: all
847
+ @param device {object} - DeviceModel Object 从设备信息
848
+ @param fid {string} - string 家庭 id, 没有传空
849
+ @return Promise
850
+ */
851
+ function deviceDisassociation(device: Object, fid: string): Promise<any> {
852
+ return NativeModules.QuecRNDeviceModule.deviceDisassociation(device, fid);
853
+ }
854
+
855
+ /** 设备关联关系配置查询
856
+ @platform: all
857
+ @param pk {string} string 主设备pk
858
+ @return Promise
859
+ */
860
+ function deviceAssociationConfig(pk: string): Promise<any> {
861
+ return NativeModules.QuecRNDeviceModule.deviceAssociationConfig(pk);
862
+ }
863
+
864
+ /** 通过设备dk,pk获取指定设备设备通道状态
865
+ @platform: all
866
+ @param pk {string} - string 设备 productkey
867
+ @param dk {string} - string 设备 devicekey
868
+ @return Promise
869
+ */
870
+ function getDeviceOnlineState(pk: string, dk: string): Promise<any> {
871
+ return NativeModules.QuecRNDeviceModule.getDeviceOnlineState(pk, dk);
872
+ }
873
+
874
+ /** 设置离线提醒开关
875
+ @platform: all
876
+ @param enableOfflineReminder {integer} number 开关 0关闭1开启
877
+ @param productKey {string} - string productKey
878
+ @param deviceKey {string} - string deviceKey
879
+ @return Promise
880
+ */
881
+ function setOfflineReminder(
882
+ enableOfflineReminder: number,
883
+ productKey: string,
884
+ deviceKey: string
885
+ ): Promise<any> {
886
+ return NativeModules.QuecRNDeviceModule.setOfflineReminder(
887
+ enableOfflineReminder,
888
+ productKey,
889
+ deviceKey
890
+ );
891
+ }
892
+
893
+ /** 离线提醒开关查询
894
+ @platform: all
895
+ @param productKey {string} - string productKey
896
+ @param deviceKey {string} - string deviceKey
897
+ @return Promise
898
+ */
899
+ function getOfflineReminderInfo(productKey: string, deviceKey: string): Promise<any> {
900
+ return NativeModules.QuecRNDeviceModule.getOfflineReminderInfo(productKey, deviceKey);
901
+ }
902
+
903
+ /** 获取设备是否有OTA计划
904
+ @platform: all
905
+ @param device {object} - DeviceModel Object 设备信息
906
+ @return Promise
907
+ */
908
+ function checkDeviceUpdatePlan(device: Object): Promise<any> {
909
+ return NativeModules.QuecRNDeviceModule.checkDeviceUpdatePlan(device);
910
+ }
911
+
912
+ /** 打开设备OTA详情
913
+ @platform: all
914
+ @param productKey {string} - string productKey
915
+ @param deviceKey {string} - string deviceKey
916
+ @return Promise
917
+ */
918
+ function openDeviceOTAPage(productKey: string, deviceKey: string): Promise<any> {
919
+ return NativeModules.QuecRNDeviceModule.openDeviceOTAPage(productKey, deviceKey);
920
+ }
921
+
922
+ /** 获取当前手机设置时区
923
+ @platform: all
924
+ @return Promise
925
+ */
926
+ function getTimeDifferenceWithGMT(): Promise<any> {
927
+ return NativeModules.QuecRNDeviceModule.getTimeDifferenceWithGMT();
928
+ }
929
+
930
+ /** 获取当前设备设置时区
931
+ @platform: all
932
+ @param productKey {string} - string productKey
933
+ @param deviceKey {string} - string deviceKey
934
+ @return Promise
935
+ */
936
+ function getDeviceTimeZone(productKey: string, deviceKey: string): Promise<any> {
937
+ return NativeModules.QuecRNDeviceModule.getDeviceTimeZone(productKey, deviceKey);
938
+ }
939
+
940
+ /** 设置设备时区
941
+ @platform: all
942
+ @param productKey {string} - string productKey
943
+ @param deviceKey {string} - string deviceKey
944
+ @param timezone {string} - string 时区
945
+ @return Promise
946
+ */
947
+ function setDeviceTimeZone(productKey: string, deviceKey: string, timezone: string): Promise<any> {
948
+ return NativeModules.QuecRNDeviceModule.setDeviceTimeZone(productKey, deviceKey, timezone);
949
+ }
950
+
951
+ /** 获取设备当前连接WiFi信息
952
+ @platform: all
953
+ @param productKey {string} - string productKey
954
+ @param deviceKey {string} - string deviceKey
955
+ @return Promise
956
+ */
957
+ function getDeviceStateInfo(productKey: string, deviceKey: string): Promise<any> {
958
+ return NativeModules.QuecRNDeviceModule.getDeviceStateInfo(productKey, deviceKey);
959
+ }
960
+
961
+ /** 跳转WiFi列表页
962
+ @platform: all
963
+ @param productKey {string} - string productKey
964
+ @param deviceKey {string} - string deviceKey
965
+ @param oldSsid {string} - string 已连接ssid
966
+ @param signal_strength {string} - string 信号强度
967
+ @param supportOnlineWiFiScan {boolean} - boolean 设备是否支持在线WiFi扫描
968
+ @return Promise
969
+ */
970
+ function jumpDeviceWiFiListPage(
971
+ productKey: string,
972
+ deviceKey: string,
973
+ oldSsid: string,
974
+ signal_strength: string,
975
+ supportOnlineWiFiScan: boolean
976
+ ): Promise<any> {
977
+ return NativeModules.QuecRNDeviceModule.jumpDeviceWiFiListPage(
978
+ productKey,
979
+ deviceKey,
980
+ oldSsid,
981
+ signal_strength,
982
+ supportOnlineWiFiScan
983
+ );
984
+ }
985
+
986
+ /** 获取产品说明书地址
987
+ @platform: all
988
+ @param productKey {string} - string productKey
989
+ @return Promise
990
+ */
991
+ function getProductDescription(productKey: string): Promise<any> {
992
+ return NativeModules.QuecRNDeviceModule.getProductDescription(productKey);
993
+ }
994
+
995
+ /** 获取设备列表
996
+ @platform: all
997
+ @param pageNumber {integer} number 页码
998
+ @param pageSize {integer} number 页大小
999
+ @return Promise
1000
+ */
1001
+ function getFamilyDeviceList(pageNumber: number, pageSize: number): Promise<any> {
1002
+ return NativeModules.QuecRNDeviceModule.getFamilyDeviceList(pageNumber, pageSize);
1003
+ }
1004
+
1005
+ /** 设备校时 only pure bt
1006
+ @platform: all
1007
+ @param productKey {string} - string productKey
1008
+ @param deviceKey {string} - string deviceKey
1009
+ @return Promise
1010
+ */
1011
+ function timeZoneSync(productKey: string, deviceKey: string): Promise<any> {
1012
+ return NativeModules.QuecRNDeviceModule.timeZoneSync(productKey, deviceKey);
1013
+ }
1014
+
1015
+ /** 纯蓝牙设备解绑
1016
+ @platform: all
1017
+ @param productKey {string} - string productKey
1018
+ @param deviceKey {string} - string deviceKey
1019
+ @param isInit {boolean} - boolean 是否重置设备
1020
+ @param random {string} - string 非必传 random
1021
+ @param pureBtResetCredentials {string} - string 非必传 重置凭证
1022
+ @return Promise
1023
+ */
1024
+ function unbindlingPureBtDevice(
1025
+ productKey: string,
1026
+ deviceKey: string,
1027
+ isInit: boolean,
1028
+ random: string,
1029
+ pureBtResetCredentials: string
1030
+ ): Promise<any> {
1031
+ return NativeModules.QuecRNDeviceModule.unbindlingPureBtDevice(
1032
+ productKey,
1033
+ deviceKey,
1034
+ isInit,
1035
+ random,
1036
+ pureBtResetCredentials
1037
+ );
1038
+ }
1039
+
1040
+ /** 获取产品物模型(无网络获取缓存)
1041
+ @platform: all
1042
+ @param productKey {string} - string productKey
1043
+ @return Promise
1044
+ */
1045
+ function getTsl(productKey: string): Promise<any> {
1046
+ return NativeModules.QuecRNDeviceModule.getTsl(productKey);
1047
+ }
1048
+
1049
+ /** 激活设备(设备配网)
1050
+ @platform: all
1051
+ @param productKey {string} productKey
1052
+ @param deviceKey {string} deviceKey
1053
+ @return Promise
1054
+ */
1055
+ function startVerifyDevice(productKey: string, deviceKey: string): Promise<any> {
1056
+ return NativeModules.QuecRNDeviceModule.startVerifyDevice(productKey, deviceKey);
1057
+ }
1058
+
1059
+ /** 已绑定设备配网
1060
+ @platform: all
1061
+ @param productKey {string} productKey
1062
+ @param deviceKey {string} deviceKey
1063
+ @return Promise
1064
+ */
1065
+ function startNetConfigDevice(productKey: string, deviceKey: string): Promise<any> {
1066
+ return NativeModules.QuecRNDeviceModule.startNetConfigDevice(productKey, deviceKey);
1067
+ }
1068
+
1069
+ /** 被分享人查询分享权限
1070
+ @platform: all
1071
+ @param shareCodeList {Array<string>} 分享码列表
1072
+ @return Promise
1073
+ */
1074
+ function getSharePermList(shareCodeList: Array<string>): Promise<any> {
1075
+ return NativeModules.QuecRNDeviceModule.getSharePermList(shareCodeList);
1076
+ }
1077
+
1078
+ /** 立刻上传设备历史数据
1079
+ @platform: all
1080
+ @param productKey {string} productKey
1081
+ @param deviceKey {string} deviceKey
1082
+ @return Promise
1083
+ */
1084
+ function uploadDeviceHistoricalData(productKey: string, deviceKey: string): Promise<any> {
1085
+ return NativeModules.QuecRNDeviceModule.uploadDeviceHistoricalData(productKey, deviceKey);
1086
+ }
1087
+
1088
+ /** 获取产品语音技能支持
1089
+ @platform: all
1090
+ @param productKey {string} productKey
1091
+ @param uid {string} 终端用户id
1092
+ @param account {string} 当前用户的账号(优先邮箱 没有就手机号, 都没有就不传)
1093
+ @return Promise
1094
+ */
1095
+ function getVoiceSupport(productKey: string, uid: string, account: string): Promise<any> {
1096
+ return NativeModules.QuecRNDeviceModule.getVoiceSupport(productKey, uid, account);
1097
+ }
1098
+
1099
+ /** 设备链路连接状态状态通知
1100
+ @call (object:object)=>{} @param object 事件数据 {"connectingState": 0/1/2/3/4/5/6/7}
1101
+ connectingStateMaskWS = 1 << 0,
1102
+ connectingStateMaskWifi = 1 << 1,
1103
+ connectingStateMaskBle = 1 << 2,
1104
+ (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)
1105
+ */
1106
+ function NativeEvent_onDeviceConnectingState(call: (object: object) => void): EmitterSubscription {
1107
+ return NativeNotificationModule.addListener('onDeviceConnectingState', call);
1108
+ }
1109
+
1110
+ /** 设备在离线状态通知
1111
+ @call (object:object)=>{} @param object 事件数据 {"onlineState": 0/1/2/3/4/5/6/7}
1112
+ onlineStateMaskWS = 1 << 0,
1113
+ onlineStateMaskWifi = 1 << 1,
1114
+ onlineStateMaskBle = 1 << 2,
1115
+ (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)
1116
+ */
1117
+ function NativeEvent_onDeviceOnlineState(call: (object: object) => void): EmitterSubscription {
1118
+ return NativeNotificationModule.addListener('onDeviceOnlineState', call);
1119
+ }
1120
+
1121
+ /** 设备dps更新 (尽量)
1122
+ @call (object:object)=>{} @param object 事件数据 {
1123
+ type: (1:ws 2: wifi 3: ble,)
1124
+ action: {
1125
+ 1.读取消息(面板不需要处理)
1126
+ 2.设备上报-读响应
1127
+ 3.发生消息(面板不需要处理)
1128
+ 4.设备上报-写响应
1129
+ 5.调用 EXE-SERV2服务 (面板暂时不需要处理)
1130
+ 6.设备上报-服务调用
1131
+ 7.设备告警-info
1132
+ 8.设备告警-warn
1133
+ 9.设备告警-error
1134
+ 10.位置信息LOCATION
1135
+ 11.发生RAW (面板暂时不需要处理)
1136
+ 12.接受RAW (面板暂时不需要处理)
1137
+ 13.设备上报-自动上报
1138
+ 14.设备在线状态 (面板不需要处理)
1139
+ 15.设备上报-信号量
1140
+ 16.设备上报-设备
1141
+ 17.设备上报-设备被移除(value: 1 解绑, 2.重置, 3.分享过期, 4.取消分享, 5.覆盖分享, 6. 用户注销, 7. 从设备组中移除)
1142
+ 18.设备状态信息回复
1143
+ 19.透传数据方向 app → iot
1144
+ 20.透传数据 方向 iot→ app
1145
+ }
1146
+ pk: "xxxx",
1147
+ dk: "xxxx",
1148
+ "dps": [{id: 0, type:BOOL, value, true/false},{id: 1, type:INT, value, 1}, ...]
1149
+ "transparent": "xxx"(二进制数据base64后转字符串),
1150
+ }
1151
+ */
1152
+ function NativeEvent_onDeviceDpsUpdate(call: (object: object) => void): EmitterSubscription {
1153
+ return NativeNotificationModule.addListener('onDeviceDpsUpdate', call);
1154
+ }
1155
+
1156
+ /** 设备信息更新
1157
+ @call (object:object)=>{} @param object 事件数据
1158
+ */
1159
+ function NativeEvent_onDeviceInfoUpdate(call: (object: object) => void): EmitterSubscription {
1160
+ return NativeNotificationModule.addListener('onDeviceInfoUpdate', call);
1161
+ }
1162
+
1163
+ /** WebSocket 已打开事件
1164
+ @call (object:object)=>{} @param object 事件数据 data = {"code":"this is code", @"message":" this is reason"}
1165
+ reminder.data = {}
1166
+ */
1167
+ function NativeEvent_onWebSocketDidOpen(call: (object: object) => void): EmitterSubscription {
1168
+ return NativeNotificationModule.addListener('onWebSocketDidOpen', call);
1169
+ }
1170
+
1171
+ /** WebSocket 错误事件
1172
+ @call (object:object)=>{} @param object 事件数据 data = {"code":"this is code", @"message":" this is reason"}
1173
+ */
1174
+ function NativeEvent_onWebSocketDidError(call: (object: object) => void): EmitterSubscription {
1175
+ return NativeNotificationModule.addListener('onWebSocketDidError', call);
1176
+ }
1177
+
1178
+ /** WebSocket 消息事件
1179
+ @call (object:object)=>{} @param object 事件数据
1180
+ object.data = {
1181
+ "cmd": "message",
1182
+ "data": {
1183
+ "createdAt": 1609316592000,
1184
+ "data": {
1185
+ "value": 1
1186
+ },
1187
+ "deviceKey": "866123456789015",
1188
+ "productKey": "123456",
1189
+ "ticket": "5f9924d171977c33bc5ad1b1",
1190
+ "type": "ONLINE"
1191
+ }
1192
+ }
1193
+ error
1194
+ {
1195
+ cmd = error;
1196
+ data = {
1197
+ code = 4010;
1198
+ msg = "user not logged in";
1199
+ reqMsg = "";
1200
+ };
1201
+ */
1202
+ function NativeEvent_onWebSocketDidReceiveMessage(
1203
+ call: (object: object) => void
1204
+ ): EmitterSubscription {
1205
+ return NativeNotificationModule.addListener('onWebSocketDidReceiveMessage', call);
1206
+ }
1207
+
1208
+ /** 设备关联选中的设备
1209
+ @call (list:Array<object>)=>{} @param list 设备列表数组,Object是devcie model
1210
+ */
1211
+ function NativeEvent_deviceAssociationSelected(
1212
+ call: (list: Array<object>) => void
1213
+ ): EmitterSubscription {
1214
+ return NativeNotificationModule.addListener('deviceAssociationSelected', call);
1215
+ }
1216
+
1217
+ /** 设备信息更新
1218
+ @call (object:object)=>{} @param object 设备状态数据
1219
+ */
1220
+ function NativeEvent_onDeviceStatusUpdate(call: (object: object) => void): EmitterSubscription {
1221
+ return NativeNotificationModule.addListener('onDeviceStatusUpdate', call);
1222
+ }
1223
+
1224
+ const QuecRNDeviceModuleMethods = {
1225
+ isWebSocketSubscribe,
1226
+ getDeviceConnectingState,
1227
+ writeDpsByHttp,
1228
+ readDpsWithExtraData,
1229
+ readDpsWithExtraDataAndMode,
1230
+ writeDpsWithExtraData,
1231
+ writeDpsWithExtraDataAndMode,
1232
+ getBleState,
1233
+ getTslAndAttrs,
1234
+ readDps,
1235
+ writeDps,
1236
+ writeTransparent,
1237
+ readDpsWithMode,
1238
+ writeDpsWithMode,
1239
+ getOnlineState,
1240
+ connectChannel,
1241
+ disconnectChannel,
1242
+ isWebSocketLoginCallback,
1243
+ subscribeDevicesWithList,
1244
+ unSubscribeDevicesWithList,
1245
+ sendDataToDeviceByWebSocketWithDataDict,
1246
+ getDeviceListWithPageNumber,
1247
+ getProductTSLWithProductKey,
1248
+ getDeviceBusinessAttributesWithProductKey,
1249
+ updateDeviceNameByShareUserWithDeviceName,
1250
+ updateDeviceName,
1251
+ getGatewayDeviceChildListWithParams,
1252
+ unbindDeviceWithDeviceKey,
1253
+ unShareDeviceByShareUserWithShareCode,
1254
+ getPropertyChartListWithParams,
1255
+ getDeviceShareUserListWithDeviceKey,
1256
+ setShareInfoByOwnerWithDeviceKey,
1257
+ unShareDeviceByOwnerWithShareCode,
1258
+ getLocationHistoryWithParams,
1259
+ getDeviceInfoByDeviceKey,
1260
+ getPropertyDataListWithParams,
1261
+ getPropertyStatisticsWithParams,
1262
+ getDeviceInfoByShareCode,
1263
+ getDeviceListByDeviceName,
1264
+ bindDeviceBySerialNumber,
1265
+ bindDeviceByAuthCode,
1266
+ bindDeviceByPSWAuthCode,
1267
+ getFetchPlanWithProductKey,
1268
+ reportDeviceUpgradeStatusWithProductKey,
1269
+ sendDataToDevicesByHttpWithData,
1270
+ addCornJob,
1271
+ setCronJob,
1272
+ getCronJobList,
1273
+ getCronJobInfo,
1274
+ batchDeleteCronJob,
1275
+ getProductCornJobLimit,
1276
+ openWebSocket,
1277
+ closeWebSocket,
1278
+ getProductTSLWithCacheByProductKey,
1279
+ listDeviceEvent,
1280
+ unShareDeviceByShareUserWithShareCodeIpc,
1281
+ subscribeDevice,
1282
+ unSubscribeDevice,
1283
+ deviceAssociationWithList,
1284
+ deviceAssociation,
1285
+ deviceDisassociation,
1286
+ deviceAssociationConfig,
1287
+ getDeviceOnlineState,
1288
+ setOfflineReminder,
1289
+ getOfflineReminderInfo,
1290
+ checkDeviceUpdatePlan,
1291
+ openDeviceOTAPage,
1292
+ getTimeDifferenceWithGMT,
1293
+ getDeviceTimeZone,
1294
+ setDeviceTimeZone,
1295
+ getDeviceStateInfo,
1296
+ jumpDeviceWiFiListPage,
1297
+ getProductDescription,
1298
+ getFamilyDeviceList,
1299
+ timeZoneSync,
1300
+ unbindlingPureBtDevice,
1301
+ getTsl,
1302
+ startVerifyDevice,
1303
+ startNetConfigDevice,
1304
+ getSharePermList,
1305
+ uploadDeviceHistoricalData,
1306
+ getVoiceSupport,
1307
+ };
1308
+ const QuecRNDeviceModuleEvents = {
1309
+ NativeEvent_onDeviceConnectingState,
1310
+
1311
+ NativeEvent_onDeviceOnlineState,
1312
+
1313
+ NativeEvent_onDeviceDpsUpdate,
1314
+
1315
+ NativeEvent_onDeviceInfoUpdate,
1316
+
1317
+ NativeEvent_onWebSocketDidOpen,
1318
+
1319
+ NativeEvent_onWebSocketDidError,
1320
+
1321
+ NativeEvent_onWebSocketDidReceiveMessage,
1322
+
1323
+ NativeEvent_deviceAssociationSelected,
1324
+
1325
+ NativeEvent_onDeviceStatusUpdate,
1326
+ };
1327
+ const QuecRNDeviceModule = {
1328
+ ...NativeModules.QuecRNDeviceModule,
1329
+ ...QuecRNDeviceModuleMethods,
1330
+ ...QuecRNDeviceModuleEvents,
1331
+ };
1332
+ export default QuecRNDeviceModule;