mini_program_gizwits_sdk 3.6.0 → 3.6.1-kuka

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 (114) hide show
  1. package/README.md +30 -55
  2. package/dist/index.js +4 -4
  3. package/package.json +5 -5
  4. package/src/aepApi/aepApiRequest.ts +61 -0
  5. package/src/errorCode.ts +19 -18
  6. package/src/handler/ble.ts +464 -574
  7. package/src/handler/lan.ts +8 -8
  8. package/src/handler/socket.ts +23 -81
  9. package/src/openApiRequest.ts +4 -4
  10. package/src/productConfigFileManage.ts +17 -33
  11. package/src/protocol/DeviceInfo.ts +10 -11
  12. package/src/protocol/GetDeviceStatus.ts +22 -20
  13. package/src/protocol/OTA/AwaitNoti.ts +5 -7
  14. package/src/protocol/OTA/CheckCanOTA.ts +7 -8
  15. package/src/protocol/OTA/OTAPackPackage.ts +15 -16
  16. package/src/protocol/OTA/OtaComplete.ts +6 -6
  17. package/src/protocol/OTA/PreOTA.ts +19 -21
  18. package/src/protocol/OTA/ResetPosition.ts +6 -7
  19. package/src/protocol/OffLineData.ts +4 -4
  20. package/src/protocol/Reset.ts +4 -5
  21. package/src/protocol/SetReset.ts +4 -6
  22. package/src/protocol/dataPoint.ts +96 -55
  23. package/src/protocol/thirdProtocol/YunZhiMianBleProtocolBase.ts +39 -0
  24. package/src/protocol/tool.ts +41 -34
  25. package/src/randomCode.ts +1 -1
  26. package/src/sdk.ts +349 -516
  27. package/src/sentry.ts +1 -1
  28. package/src/services/devices.ts +47 -70
  29. package/src/services/ota.ts +26 -17
  30. package/src/types/index.ts +48 -0
  31. package/src/utils.ts +57 -92
  32. package/src/wechatApi.ts +51 -73
  33. package/src/wifiConfig/ConfigBase.ts +4 -62
  34. package/src/wifiConfig/ap.ts +1 -5
  35. package/src/wifiConfig/ble.ts +232 -284
  36. package/src/wifiConfig/ble_ailCloud.ts +548 -0
  37. package/yarn-error.log +6901 -0
  38. package/dist/index.d.ts +0 -6
  39. package/dist/src/GizLog.d.ts +0 -18
  40. package/dist/src/crc/calculators/crc16modbus.d.ts +0 -2
  41. package/dist/src/crc/calculators/crc32.d.ts +0 -2
  42. package/dist/src/crc/crc16modbus.d.ts +0 -7
  43. package/dist/src/crc/crc32.d.ts +0 -7
  44. package/dist/src/crc/create_buffer.d.ts +0 -3
  45. package/dist/src/crc/define_crc.d.ts +0 -7
  46. package/dist/src/crc/index.d.ts +0 -19
  47. package/dist/src/crc/types.d.ts +0 -11
  48. package/dist/src/errorCode.d.ts +0 -5
  49. package/dist/src/globalData.d.ts +0 -2
  50. package/dist/src/handler/EventListener.d.ts +0 -9
  51. package/dist/src/handler/ble.d.ts +0 -166
  52. package/dist/src/handler/lan.d.ts +0 -93
  53. package/dist/src/handler/socket.d.ts +0 -150
  54. package/dist/src/openApiRequest.d.ts +0 -7
  55. package/dist/src/productConfigFileManage.d.ts +0 -14
  56. package/dist/src/protocol/Bind.d.ts +0 -7
  57. package/dist/src/protocol/DataPoint.d.ts +0 -68
  58. package/dist/src/protocol/DeviceInfo.d.ts +0 -11
  59. package/dist/src/protocol/DiscoverUDP.d.ts +0 -17
  60. package/dist/src/protocol/GetDeviceStatus.d.ts +0 -5
  61. package/dist/src/protocol/Login.d.ts +0 -12
  62. package/dist/src/protocol/Ntp.d.ts +0 -5
  63. package/dist/src/protocol/OTA/AwaitNoti.d.ts +0 -7
  64. package/dist/src/protocol/OTA/CheckCanOTA.d.ts +0 -10
  65. package/dist/src/protocol/OTA/OTAPackPackage.d.ts +0 -8
  66. package/dist/src/protocol/OTA/OtaComplete.d.ts +0 -8
  67. package/dist/src/protocol/OTA/PreOTA.d.ts +0 -11
  68. package/dist/src/protocol/OTA/ResetPosition.d.ts +0 -6
  69. package/dist/src/protocol/OffLineData.d.ts +0 -23
  70. package/dist/src/protocol/ProtocolBase.d.ts +0 -11
  71. package/dist/src/protocol/Reset.d.ts +0 -8
  72. package/dist/src/protocol/SetReset.d.ts +0 -7
  73. package/dist/src/protocol/WifiConfig.d.ts +0 -6
  74. package/dist/src/protocol/tool.d.ts +0 -14
  75. package/dist/src/randomCode.d.ts +0 -7
  76. package/dist/src/request.d.ts +0 -1
  77. package/dist/src/sdk.d.ts +0 -231
  78. package/dist/src/sentry.d.ts +0 -2
  79. package/dist/src/services/devices.d.ts +0 -63
  80. package/dist/src/services/login.d.ts +0 -8
  81. package/dist/src/services/monitor.d.ts +0 -11
  82. package/dist/src/services/ota.d.ts +0 -11
  83. package/dist/src/services/tool.d.ts +0 -4
  84. package/dist/src/services/uploadP0.d.ts +0 -13
  85. package/dist/src/sleep.d.ts +0 -2
  86. package/dist/src/utils.d.ts +0 -51
  87. package/dist/src/wechatApi.d.ts +0 -40
  88. package/dist/src/wifiConfig/ConfigBase.d.ts +0 -34
  89. package/dist/src/wifiConfig/ap.d.ts +0 -21
  90. package/dist/src/wifiConfig/ble.d.ts +0 -47
  91. package/dist/src/wifiConfig/nfc/disposeData.d.ts +0 -2
  92. package/dist/src/wifiConfig/nfc/formatData.d.ts +0 -3
  93. package/dist/src/wifiConfig/nfc/formatSSID.d.ts +0 -6
  94. package/dist/src/wifiConfig/nfc/index.d.ts +0 -22
  95. package/dist/src/wifiConfig/nfc/isIncludedCH.d.ts +0 -1
  96. package/dist/src/wifiConfig/nfc/nfcAConnect.d.ts +0 -6
  97. package/dist/src/wifiConfig/nfc/nfcATransceive.d.ts +0 -5
  98. package/dist/src/wifiConfig/nfc/ssIDToASC.d.ts +0 -1
  99. package/dist/src/wifiConfig/nfc/stringToGbk.d.ts +0 -1
  100. package/dist/src/wifiConfig/nfc/transceive.wx.d.ts +0 -2
  101. package/dist/src/wifiConfig/nfc/types.d.ts +0 -15
  102. package/src/services/monitor.ts +0 -116
  103. package/src/wifiConfig/nfc/disposeData.ts +0 -63
  104. package/src/wifiConfig/nfc/formatData.ts +0 -46
  105. package/src/wifiConfig/nfc/formatSSID.ts +0 -59
  106. package/src/wifiConfig/nfc/index.ts +0 -136
  107. package/src/wifiConfig/nfc/isIncludedCH.ts +0 -8
  108. package/src/wifiConfig/nfc/nfcAConnect.ts +0 -30
  109. package/src/wifiConfig/nfc/nfcATransceive.ts +0 -29
  110. package/src/wifiConfig/nfc/ssIDToASC.ts +0 -12
  111. package/src/wifiConfig/nfc/stringToGbk.ts +0 -51
  112. package/src/wifiConfig/nfc/transceive.wx.ts +0 -124
  113. package/src/wifiConfig/nfc/types.ts +0 -18
  114. package/src/wifiConfig/timeZoneName.json +0 -1
package/README.md CHANGED
@@ -3,6 +3,13 @@
3
3
  # 机智云小程序 SDK
4
4
 
5
5
 
6
+ ## 🔴 破坏性更新
7
+
8
+ - 3.2.4(含)开始蓝牙广播包过滤增加了 `['ABF8', 'ABF0', 'F0AB', 'F8AB']` 四个过滤字段,为了兼容部分低端手机不过滤,长时间挂机会假死的问题。
9
+ - 乐鑫_0ESP32C3_0403000G 和 博流_00BL602L_0403000B 之后的版本都支持这个特性。
10
+ - 如果您使用的是更早期的固件,请联系我们。
11
+
12
+
6
13
  ## ⚠️ 重要
7
14
 
8
15
  使用小程序 sdk 前,请在微信开发者后台-开发管理-开发设置-服务器域名添加以下请求地址。
@@ -21,17 +28,6 @@ wss://wxstage.gizwits.com
21
28
  wss://wxm2m.gizwits.com
22
29
  ```
23
30
 
24
- - 关于services
25
-
26
- 为了搜索效率,sdk会根据`services `过滤蓝牙设备。默认 ['ABF8', 'ABF0', 'F0AB', 'F8AB']。
27
- 如果有特殊情况,不想用`services `过滤设备,可以
28
-
29
- ```js
30
- sdk.scanBleDevice(3000, [])
31
- sdk.startAutoScan([])
32
- ```
33
-
34
-
35
31
  ## 🔧 安装
36
32
 
37
33
  ```bash
@@ -44,13 +40,13 @@ yarn add mini_program_gizwits_sdk
44
40
 
45
41
  > 采用小程序代码片段,安装新版小程序开发工具,点击链接即可打开
46
42
 
47
- ### 蓝牙配网
43
+ ### 蓝牙和 softAp 配网
48
44
 
49
- [点击打开微信开发者工具](https://developers.weixin.qq.com/s/Wk0aZlmg7jOR)
45
+ [点击打开微信开发者工具](https://developers.weixin.qq.com/s/UQI8fpm87jDI)
50
46
 
51
47
  ### 设备控制
52
48
 
53
- [点击打开微信开发者工具](https://developers.weixin.qq.com/s/Kh0CMlmq77OA)
49
+ [点击打开微信开发者工具](https://developers.weixin.qq.com/s/NZI5gpmX7qD1)
54
50
 
55
51
  ## 🏍 初始化 Sdk
56
52
 
@@ -86,9 +82,9 @@ export default class Index extends Component {
86
82
  ## 📋 日志
87
83
  sdk.setLogLevel("debug")
88
84
 
89
- ## 📖 API
85
+ ## 📖 BLE API
90
86
 
91
- 小程序相关 API。
87
+ 小程序 BLE 相关 API。
92
88
 
93
89
  ### sdk.initBle()
94
90
 
@@ -112,7 +108,7 @@ sdk.setLogLevel("debug")
112
108
 
113
109
  ### sdk.deviceSafetyRegister(Object object)
114
110
 
115
- 安全注册目标设备,蓝牙设备绑定前,需要调用这个接口,否则无法发起设备绑定。返回值中可以拿到注册结果。
111
+ 安全注册目标设备,否则无法发起设备绑定。返回值中可以拿到注册结果。
116
112
 
117
113
  #### 参数
118
114
 
@@ -136,14 +132,10 @@ sdk.setLogLevel("debug")
136
132
  | mac | string | 待绑定设备 mac |
137
133
  | productKey | string | 待绑定设备所属产品 |
138
134
 
139
- ### sdk.subscribe(device:[IDevice](#IDevice),connectType:[TConnectType](#TConnectType))
135
+ ### sdk.subscribe(device:[IDevice](#IDevice) )
140
136
 
141
137
  订阅目标设备,订阅成功后可控制设备。返回值中可以拿到订阅结果。
142
138
 
143
- ### sdk.getDeviceStatus(device:[IDevice](#IDevice), attrNames?: string[])
144
-
145
- 查询目标设备当前状态,attrNames 不传则查询所有数据
146
-
147
139
  ### sdk.write(device:[IDevice](#IDevice),cmd:{[key]:value})
148
140
 
149
141
  向目标设备发送指令。 其中`key`为数据点名称,value 为数据点的值。
@@ -202,30 +194,15 @@ this.gizSdk.addEventListener(
202
194
 
203
195
  ```ts
204
196
  interface IDevice {
205
- mac: string;
206
- productKey: string;
207
- did: string;
208
- bleWorkStatus?: number; // 0 默认状态 1 配网状态
209
- name: string;
210
- isBind: boolean;
211
- rootDeviceId?: string;
212
- bleDeviceID?: string;
213
- remark?: string;
214
- passcode?: string;
215
- connectType: TConnectType;
197
+ mac: string; // 设备mac
198
+ productKey: string; // 机智云pk
199
+ did?: string; // 云平台did
200
+ name: string; // 设备名称
201
+ isBind: boolean; // 是否绑定
202
+ bleDeviceID?: string; // 本地蓝牙设备id
216
203
  isOnline: boolean; // 代表大循环在线
217
204
  isLanOnline: boolean; // 代表小循环在线
218
205
  isBleOnline: boolean; // 代表蓝牙在线
219
- host?: string;
220
- wss_port?: number;
221
- ctime?: number;
222
- }
223
- ```
224
-
225
- - <a id="TConnectType">TConnectType</a>
226
-
227
- ```ts
228
- type TConnectType = 'BLE' | 'BLE_BROADCAST' | 'LAN' | 'WAN' | 'NONE';
229
206
  }
230
207
  ```
231
208
 
@@ -251,24 +228,22 @@ interface IError {
251
228
 
252
229
  销毁事件监听。
253
230
 
254
- # 配网相关
231
+ # 机智云小程序 wifi SDK
255
232
 
256
233
  ## 使用方法
257
234
 
258
235
  ```javascript
259
236
  import GizwitsSdk, { errorCode } from 'mini_program_gizwits_sdk';
260
237
 
261
- const configData = {
262
- appID: "xxx",
263
- appSecret: "xxx",
264
- productInfo: [
265
- {
266
- productKey: "xxx",
267
- productSecret: "xxx",
268
- },
269
- ],
270
- };
271
- const sdk = new GizwitsSdk(configData);
238
+ const sdk = new GizwitsSdk({
239
+ appID: '8f187b1deb9e44b6aa1374b8f13bccb1',
240
+ appSecret: 'd73fa6d6d7c04d37b6b2cc13a18a9f37',
241
+ specialProductKeys: ['00e7e327afa74a3d8ff1cc190bad78c0'],
242
+ specialProductKeySecrets: ['aa3d301fa291466fbed20e4204609abc'],
243
+ token: token,
244
+ uid: uid,
245
+ cloudServiceInfo: null,
246
+ });
272
247
 
273
248
  try {
274
249
  const data = await sdk.setDeviceOnboardingDeploy({