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.
- package/README.md +30 -55
- package/dist/index.js +4 -4
- package/package.json +5 -5
- package/src/aepApi/aepApiRequest.ts +61 -0
- package/src/errorCode.ts +19 -18
- package/src/handler/ble.ts +464 -574
- package/src/handler/lan.ts +8 -8
- package/src/handler/socket.ts +23 -81
- package/src/openApiRequest.ts +4 -4
- package/src/productConfigFileManage.ts +17 -33
- package/src/protocol/DeviceInfo.ts +10 -11
- package/src/protocol/GetDeviceStatus.ts +22 -20
- package/src/protocol/OTA/AwaitNoti.ts +5 -7
- package/src/protocol/OTA/CheckCanOTA.ts +7 -8
- package/src/protocol/OTA/OTAPackPackage.ts +15 -16
- package/src/protocol/OTA/OtaComplete.ts +6 -6
- package/src/protocol/OTA/PreOTA.ts +19 -21
- package/src/protocol/OTA/ResetPosition.ts +6 -7
- package/src/protocol/OffLineData.ts +4 -4
- package/src/protocol/Reset.ts +4 -5
- package/src/protocol/SetReset.ts +4 -6
- package/src/protocol/dataPoint.ts +96 -55
- package/src/protocol/thirdProtocol/YunZhiMianBleProtocolBase.ts +39 -0
- package/src/protocol/tool.ts +41 -34
- package/src/randomCode.ts +1 -1
- package/src/sdk.ts +349 -516
- package/src/sentry.ts +1 -1
- package/src/services/devices.ts +47 -70
- package/src/services/ota.ts +26 -17
- package/src/types/index.ts +48 -0
- package/src/utils.ts +57 -92
- package/src/wechatApi.ts +51 -73
- package/src/wifiConfig/ConfigBase.ts +4 -62
- package/src/wifiConfig/ap.ts +1 -5
- package/src/wifiConfig/ble.ts +232 -284
- package/src/wifiConfig/ble_ailCloud.ts +548 -0
- package/yarn-error.log +6901 -0
- package/dist/index.d.ts +0 -6
- package/dist/src/GizLog.d.ts +0 -18
- package/dist/src/crc/calculators/crc16modbus.d.ts +0 -2
- package/dist/src/crc/calculators/crc32.d.ts +0 -2
- package/dist/src/crc/crc16modbus.d.ts +0 -7
- package/dist/src/crc/crc32.d.ts +0 -7
- package/dist/src/crc/create_buffer.d.ts +0 -3
- package/dist/src/crc/define_crc.d.ts +0 -7
- package/dist/src/crc/index.d.ts +0 -19
- package/dist/src/crc/types.d.ts +0 -11
- package/dist/src/errorCode.d.ts +0 -5
- package/dist/src/globalData.d.ts +0 -2
- package/dist/src/handler/EventListener.d.ts +0 -9
- package/dist/src/handler/ble.d.ts +0 -166
- package/dist/src/handler/lan.d.ts +0 -93
- package/dist/src/handler/socket.d.ts +0 -150
- package/dist/src/openApiRequest.d.ts +0 -7
- package/dist/src/productConfigFileManage.d.ts +0 -14
- package/dist/src/protocol/Bind.d.ts +0 -7
- package/dist/src/protocol/DataPoint.d.ts +0 -68
- package/dist/src/protocol/DeviceInfo.d.ts +0 -11
- package/dist/src/protocol/DiscoverUDP.d.ts +0 -17
- package/dist/src/protocol/GetDeviceStatus.d.ts +0 -5
- package/dist/src/protocol/Login.d.ts +0 -12
- package/dist/src/protocol/Ntp.d.ts +0 -5
- package/dist/src/protocol/OTA/AwaitNoti.d.ts +0 -7
- package/dist/src/protocol/OTA/CheckCanOTA.d.ts +0 -10
- package/dist/src/protocol/OTA/OTAPackPackage.d.ts +0 -8
- package/dist/src/protocol/OTA/OtaComplete.d.ts +0 -8
- package/dist/src/protocol/OTA/PreOTA.d.ts +0 -11
- package/dist/src/protocol/OTA/ResetPosition.d.ts +0 -6
- package/dist/src/protocol/OffLineData.d.ts +0 -23
- package/dist/src/protocol/ProtocolBase.d.ts +0 -11
- package/dist/src/protocol/Reset.d.ts +0 -8
- package/dist/src/protocol/SetReset.d.ts +0 -7
- package/dist/src/protocol/WifiConfig.d.ts +0 -6
- package/dist/src/protocol/tool.d.ts +0 -14
- package/dist/src/randomCode.d.ts +0 -7
- package/dist/src/request.d.ts +0 -1
- package/dist/src/sdk.d.ts +0 -231
- package/dist/src/sentry.d.ts +0 -2
- package/dist/src/services/devices.d.ts +0 -63
- package/dist/src/services/login.d.ts +0 -8
- package/dist/src/services/monitor.d.ts +0 -11
- package/dist/src/services/ota.d.ts +0 -11
- package/dist/src/services/tool.d.ts +0 -4
- package/dist/src/services/uploadP0.d.ts +0 -13
- package/dist/src/sleep.d.ts +0 -2
- package/dist/src/utils.d.ts +0 -51
- package/dist/src/wechatApi.d.ts +0 -40
- package/dist/src/wifiConfig/ConfigBase.d.ts +0 -34
- package/dist/src/wifiConfig/ap.d.ts +0 -21
- package/dist/src/wifiConfig/ble.d.ts +0 -47
- package/dist/src/wifiConfig/nfc/disposeData.d.ts +0 -2
- package/dist/src/wifiConfig/nfc/formatData.d.ts +0 -3
- package/dist/src/wifiConfig/nfc/formatSSID.d.ts +0 -6
- package/dist/src/wifiConfig/nfc/index.d.ts +0 -22
- package/dist/src/wifiConfig/nfc/isIncludedCH.d.ts +0 -1
- package/dist/src/wifiConfig/nfc/nfcAConnect.d.ts +0 -6
- package/dist/src/wifiConfig/nfc/nfcATransceive.d.ts +0 -5
- package/dist/src/wifiConfig/nfc/ssIDToASC.d.ts +0 -1
- package/dist/src/wifiConfig/nfc/stringToGbk.d.ts +0 -1
- package/dist/src/wifiConfig/nfc/transceive.wx.d.ts +0 -2
- package/dist/src/wifiConfig/nfc/types.d.ts +0 -15
- package/src/services/monitor.ts +0 -116
- package/src/wifiConfig/nfc/disposeData.ts +0 -63
- package/src/wifiConfig/nfc/formatData.ts +0 -46
- package/src/wifiConfig/nfc/formatSSID.ts +0 -59
- package/src/wifiConfig/nfc/index.ts +0 -136
- package/src/wifiConfig/nfc/isIncludedCH.ts +0 -8
- package/src/wifiConfig/nfc/nfcAConnect.ts +0 -30
- package/src/wifiConfig/nfc/nfcATransceive.ts +0 -29
- package/src/wifiConfig/nfc/ssIDToASC.ts +0 -12
- package/src/wifiConfig/nfc/stringToGbk.ts +0 -51
- package/src/wifiConfig/nfc/transceive.wx.ts +0 -124
- package/src/wifiConfig/nfc/types.ts +0 -18
- 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/
|
|
45
|
+
[点击打开微信开发者工具](https://developers.weixin.qq.com/s/UQI8fpm87jDI)
|
|
50
46
|
|
|
51
47
|
### 设备控制
|
|
52
48
|
|
|
53
|
-
[点击打开微信开发者工具](https://developers.weixin.qq.com/s/
|
|
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
|
-
|
|
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)
|
|
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
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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
|
|
262
|
-
appID:
|
|
263
|
-
appSecret:
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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({
|