mini_program_gizwits_sdk 3.5.13-kuka → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -30
- package/dist/index.js +10 -3
- package/dist/src/GizLog.d.ts +1 -1
- package/dist/src/crc/calculators/crc16modbus.d.ts +2 -0
- package/dist/src/crc/calculators/crc32.d.ts +2 -0
- package/dist/src/crc/crc16modbus.d.ts +7 -0
- package/dist/src/crc/crc32.d.ts +7 -0
- package/dist/src/crc/create_buffer.d.ts +3 -0
- package/dist/src/crc/define_crc.d.ts +7 -0
- package/dist/src/crc/index.d.ts +19 -0
- package/dist/src/crc/types.d.ts +11 -0
- package/dist/src/handler/ble.d.ts +64 -17
- package/dist/src/handler/lan.d.ts +5 -5
- package/dist/src/handler/socket.d.ts +15 -4
- package/dist/src/productConfigFileManage.d.ts +2 -1
- package/dist/src/protocol/DataPoint.d.ts +6 -5
- package/dist/src/protocol/DeviceInfo.d.ts +11 -0
- package/dist/src/protocol/{DiscoverUdp.d.ts → DiscoverUDP.d.ts} +1 -1
- package/dist/src/protocol/OTA/AwaitNoti.d.ts +7 -0
- package/dist/src/protocol/OTA/CheckCanOTA.d.ts +10 -0
- package/dist/src/protocol/OTA/OTAPackPackage.d.ts +8 -0
- package/dist/src/protocol/OTA/OtaComplete.d.ts +8 -0
- package/dist/src/protocol/OTA/PreOTA.d.ts +11 -0
- package/dist/src/protocol/OTA/ResetPosition.d.ts +6 -0
- package/dist/src/protocol/Reset.d.ts +8 -0
- package/dist/src/protocol/SetReset.d.ts +7 -0
- package/dist/src/protocol/tool.d.ts +4 -1
- package/dist/src/sdk.d.ts +63 -52
- package/dist/src/services/monitor.d.ts +11 -0
- package/dist/src/services/ota.d.ts +11 -0
- package/dist/src/utils.d.ts +6 -2
- package/dist/src/wechatApi.d.ts +5 -1
- package/dist/src/wifiConfig/ConfigBase.d.ts +11 -3
- package/dist/src/wifiConfig/ble.d.ts +15 -12
- package/dist/src/wifiConfig/nfc/disposeData.d.ts +2 -0
- package/dist/src/wifiConfig/nfc/formatData.d.ts +3 -0
- package/dist/src/wifiConfig/nfc/formatSSID.d.ts +6 -0
- package/dist/src/wifiConfig/nfc/index.d.ts +22 -0
- package/dist/src/wifiConfig/nfc/isIncludedCH.d.ts +1 -0
- package/dist/src/wifiConfig/nfc/nfcAConnect.d.ts +6 -0
- package/dist/src/wifiConfig/nfc/nfcATransceive.d.ts +5 -0
- package/dist/src/wifiConfig/nfc/ssIDToASC.d.ts +1 -0
- package/dist/src/wifiConfig/nfc/stringToGbk.d.ts +1 -0
- package/dist/src/wifiConfig/nfc/transceive.wx.d.ts +2 -0
- package/dist/src/wifiConfig/nfc/types.d.ts +15 -0
- package/package.json +4 -4
- package/src/crc/calculators/crc16modbus.ts +36 -0
- package/src/crc/calculators/crc32.ts +47 -0
- package/src/crc/crc16modbus.ts +3 -0
- package/src/crc/crc32.ts +4 -0
- package/src/crc/create_buffer.ts +7 -0
- package/src/crc/define_crc.ts +9 -0
- package/src/crc/index.ts +10 -0
- package/src/crc/package.json +3 -0
- package/src/crc/types.ts +10 -0
- package/src/errorCode.ts +20 -1
- package/src/handler/ble.ts +872 -257
- package/src/handler/lan.ts +8 -8
- package/src/handler/socket.ts +81 -23
- package/src/openApiRequest.ts +4 -4
- package/src/productConfigFileManage.ts +33 -17
- package/src/protocol/DeviceInfo.ts +37 -0
- package/src/protocol/OTA/AwaitNoti.ts +16 -0
- package/src/protocol/OTA/CheckCanOTA.ts +24 -0
- package/src/protocol/OTA/OTAPackPackage.ts +37 -0
- package/src/protocol/OTA/OtaComplete.ts +17 -0
- package/src/protocol/OTA/PreOTA.ts +49 -0
- package/src/protocol/OTA/ResetPosition.ts +15 -0
- package/src/protocol/OffLineData.ts +4 -4
- package/src/protocol/Reset.ts +16 -0
- package/src/protocol/SetReset.ts +13 -0
- package/src/protocol/dataPoint.ts +1 -1
- package/src/protocol/tool.ts +30 -1
- package/src/randomCode.ts +1 -1
- package/src/sdk.ts +603 -313
- package/src/sentry.ts +1 -1
- package/src/services/devices.ts +93 -4
- package/src/services/monitor.ts +116 -0
- package/src/services/ota.ts +21 -0
- package/src/utils.ts +35 -15
- package/src/wechatApi.ts +35 -6
- package/src/wifiConfig/ConfigBase.ts +62 -4
- package/src/wifiConfig/ap.ts +5 -1
- package/src/wifiConfig/ble.ts +284 -232
- package/src/wifiConfig/nfc/disposeData.ts +63 -0
- package/src/wifiConfig/nfc/formatData.ts +46 -0
- package/src/wifiConfig/nfc/formatSSID.ts +59 -0
- package/src/wifiConfig/nfc/index.ts +136 -0
- package/src/wifiConfig/nfc/isIncludedCH.ts +8 -0
- package/src/wifiConfig/nfc/nfcAConnect.ts +30 -0
- package/src/wifiConfig/nfc/nfcATransceive.ts +29 -0
- package/src/wifiConfig/nfc/ssIDToASC.ts +12 -0
- package/src/wifiConfig/nfc/stringToGbk.ts +51 -0
- package/src/wifiConfig/nfc/transceive.wx.ts +124 -0
- package/src/wifiConfig/nfc/types.ts +18 -0
- package/src/wifiConfig/timeZoneName.json +1 -0
- package/dist/src/aepApi/aepApiRequest.d.ts +0 -7
- package/dist/src/protocol/thirdProtocol/YunZhiMianBleProtocolBase.d.ts +0 -10
- package/dist/src/wifiConfig/ble_ailCloud.d.ts +0 -69
- package/src/aepApi/aepApiRequest.ts +0 -62
- package/src/protocol/thirdProtocol/YunZhiMianBleProtocolBase.ts +0 -39
- package/src/wifiConfig/ble_ailCloud.ts +0 -531
- package/yarn-error.log +0 -3415
package/README.md
CHANGED
|
@@ -3,13 +3,6 @@
|
|
|
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
|
-
|
|
13
6
|
## ⚠️ 重要
|
|
14
7
|
|
|
15
8
|
使用小程序 sdk 前,请在微信开发者后台-开发管理-开发设置-服务器域名添加以下请求地址。
|
|
@@ -28,6 +21,17 @@ wss://wxstage.gizwits.com
|
|
|
28
21
|
wss://wxm2m.gizwits.com
|
|
29
22
|
```
|
|
30
23
|
|
|
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
|
+
|
|
31
35
|
## 🔧 安装
|
|
32
36
|
|
|
33
37
|
```bash
|
|
@@ -40,13 +44,13 @@ yarn add mini_program_gizwits_sdk
|
|
|
40
44
|
|
|
41
45
|
> 采用小程序代码片段,安装新版小程序开发工具,点击链接即可打开
|
|
42
46
|
|
|
43
|
-
###
|
|
47
|
+
### 蓝牙配网
|
|
44
48
|
|
|
45
|
-
[点击打开微信开发者工具](https://developers.weixin.qq.com/s/
|
|
49
|
+
[点击打开微信开发者工具](https://developers.weixin.qq.com/s/Wk0aZlmg7jOR)
|
|
46
50
|
|
|
47
51
|
### 设备控制
|
|
48
52
|
|
|
49
|
-
[点击打开微信开发者工具](https://developers.weixin.qq.com/s/
|
|
53
|
+
[点击打开微信开发者工具](https://developers.weixin.qq.com/s/Kh0CMlmq77OA)
|
|
50
54
|
|
|
51
55
|
## 🏍 初始化 Sdk
|
|
52
56
|
|
|
@@ -82,9 +86,9 @@ export default class Index extends Component {
|
|
|
82
86
|
## 📋 日志
|
|
83
87
|
sdk.setLogLevel("debug")
|
|
84
88
|
|
|
85
|
-
## 📖
|
|
89
|
+
## 📖 API
|
|
86
90
|
|
|
87
|
-
|
|
91
|
+
小程序相关 API。
|
|
88
92
|
|
|
89
93
|
### sdk.initBle()
|
|
90
94
|
|
|
@@ -108,7 +112,7 @@ sdk.setLogLevel("debug")
|
|
|
108
112
|
|
|
109
113
|
### sdk.deviceSafetyRegister(Object object)
|
|
110
114
|
|
|
111
|
-
|
|
115
|
+
安全注册目标设备,蓝牙设备绑定前,需要调用这个接口,否则无法发起设备绑定。返回值中可以拿到注册结果。
|
|
112
116
|
|
|
113
117
|
#### 参数
|
|
114
118
|
|
|
@@ -132,10 +136,14 @@ sdk.setLogLevel("debug")
|
|
|
132
136
|
| mac | string | 待绑定设备 mac |
|
|
133
137
|
| productKey | string | 待绑定设备所属产品 |
|
|
134
138
|
|
|
135
|
-
### sdk.subscribe(device:[IDevice](#IDevice)
|
|
139
|
+
### sdk.subscribe(device:[IDevice](#IDevice),connectType:[TConnectType](#TConnectType))
|
|
136
140
|
|
|
137
141
|
订阅目标设备,订阅成功后可控制设备。返回值中可以拿到订阅结果。
|
|
138
142
|
|
|
143
|
+
### sdk.getDeviceStatus(device:[IDevice](#IDevice), attrNames?: string[])
|
|
144
|
+
|
|
145
|
+
查询目标设备当前状态,attrNames 不传则查询所有数据
|
|
146
|
+
|
|
139
147
|
### sdk.write(device:[IDevice](#IDevice),cmd:{[key]:value})
|
|
140
148
|
|
|
141
149
|
向目标设备发送指令。 其中`key`为数据点名称,value 为数据点的值。
|
|
@@ -194,15 +202,30 @@ this.gizSdk.addEventListener(
|
|
|
194
202
|
|
|
195
203
|
```ts
|
|
196
204
|
interface IDevice {
|
|
197
|
-
mac: string;
|
|
198
|
-
productKey: string;
|
|
199
|
-
did
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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;
|
|
203
216
|
isOnline: boolean; // 代表大循环在线
|
|
204
217
|
isLanOnline: boolean; // 代表小循环在线
|
|
205
218
|
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';
|
|
206
229
|
}
|
|
207
230
|
```
|
|
208
231
|
|
|
@@ -228,22 +251,24 @@ interface IError {
|
|
|
228
251
|
|
|
229
252
|
销毁事件监听。
|
|
230
253
|
|
|
231
|
-
#
|
|
254
|
+
# 配网相关
|
|
232
255
|
|
|
233
256
|
## 使用方法
|
|
234
257
|
|
|
235
258
|
```javascript
|
|
236
259
|
import GizwitsSdk, { errorCode } from 'mini_program_gizwits_sdk';
|
|
237
260
|
|
|
238
|
-
const
|
|
239
|
-
appID:
|
|
240
|
-
appSecret:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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);
|
|
247
272
|
|
|
248
273
|
try {
|
|
249
274
|
const data = await sdk.setDeviceOnboardingDeploy({
|