mini_program_gizwits_sdk 3.4.9 → 3.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -21
- package/dist/index.js +3 -3
- package/dist/src/handler/ble.d.ts +1 -1
- package/dist/src/sdk.d.ts +3 -1
- package/dist/src/wifiConfig/ConfigBase.d.ts +8 -2
- package/dist/src/wifiConfig/ble.d.ts +14 -11
- package/package.json +2 -2
- package/src/handler/ble.ts +6 -8
- package/src/sdk.ts +10 -10
- package/src/wifiConfig/ConfigBase.ts +13 -3
- package/src/wifiConfig/ble.ts +272 -215
package/README.md
CHANGED
|
@@ -44,13 +44,13 @@ yarn add mini_program_gizwits_sdk
|
|
|
44
44
|
|
|
45
45
|
> 采用小程序代码片段,安装新版小程序开发工具,点击链接即可打开
|
|
46
46
|
|
|
47
|
-
###
|
|
47
|
+
### 蓝牙配网
|
|
48
48
|
|
|
49
|
-
[点击打开微信开发者工具](https://developers.weixin.qq.com/s/
|
|
49
|
+
[点击打开微信开发者工具](https://developers.weixin.qq.com/s/Wk0aZlmg7jOR)
|
|
50
50
|
|
|
51
51
|
### 设备控制
|
|
52
52
|
|
|
53
|
-
[点击打开微信开发者工具](https://developers.weixin.qq.com/s/
|
|
53
|
+
[点击打开微信开发者工具](https://developers.weixin.qq.com/s/Kh0CMlmq77OA)
|
|
54
54
|
|
|
55
55
|
## 🏍 初始化 Sdk
|
|
56
56
|
|
|
@@ -112,7 +112,7 @@ sdk.setLogLevel("debug")
|
|
|
112
112
|
|
|
113
113
|
### sdk.deviceSafetyRegister(Object object)
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
安全注册目标设备,蓝牙设备绑定前,需要调用这个接口,否则无法发起设备绑定。返回值中可以拿到注册结果。
|
|
116
116
|
|
|
117
117
|
#### 参数
|
|
118
118
|
|
|
@@ -202,17 +202,23 @@ this.gizSdk.addEventListener(
|
|
|
202
202
|
|
|
203
203
|
```ts
|
|
204
204
|
interface IDevice {
|
|
205
|
-
mac: string;
|
|
206
|
-
productKey: string;
|
|
207
|
-
did
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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;
|
|
211
216
|
isOnline: boolean; // 代表大循环在线
|
|
212
217
|
isLanOnline: boolean; // 代表小循环在线
|
|
213
218
|
isBleOnline: boolean; // 代表蓝牙在线
|
|
214
|
-
|
|
215
|
-
|
|
219
|
+
host?: string;
|
|
220
|
+
wss_port?: number;
|
|
221
|
+
ctime?: number;
|
|
216
222
|
}
|
|
217
223
|
```
|
|
218
224
|
|
|
@@ -252,15 +258,17 @@ interface IError {
|
|
|
252
258
|
```javascript
|
|
253
259
|
import GizwitsSdk, { errorCode } from 'mini_program_gizwits_sdk';
|
|
254
260
|
|
|
255
|
-
const
|
|
256
|
-
appID:
|
|
257
|
-
appSecret:
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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);
|
|
264
272
|
|
|
265
273
|
try {
|
|
266
274
|
const data = await sdk.setDeviceOnboardingDeploy({
|