mini_program_gizwits_sdk 3.7.7-kuka → 3.7.8-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 +81 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6 -4
- 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 +4 -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 +10 -0
- package/dist/src/handler/EventListener.d.ts +9 -0
- package/dist/src/handler/ble.d.ts +128 -0
- package/dist/src/handler/lan.d.ts +78 -0
- package/dist/src/handler/socket.d.ts +161 -0
- package/dist/src/protocol/Bind.d.ts +7 -0
- package/dist/src/protocol/DeviceInfo.d.ts +11 -0
- package/dist/src/protocol/DiscoverUDP.d.ts +17 -0
- package/dist/src/protocol/GetDeviceStatus.d.ts +5 -0
- package/dist/src/protocol/Login.d.ts +12 -0
- package/dist/src/protocol/Ntp.d.ts +5 -0
- 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/OffLineData.d.ts +23 -0
- package/dist/src/protocol/ProtocolBase.d.ts +12 -0
- package/dist/src/protocol/Reset.d.ts +8 -0
- package/dist/src/protocol/SetReset.d.ts +7 -0
- package/dist/src/protocol/WifiConfig.d.ts +11 -0
- package/dist/src/protocol/dataPoint.d.ts +34 -0
- package/dist/src/protocol/tool.d.ts +14 -0
- package/dist/src/sdk.d.ts +146 -0
- package/dist/src/services/devices.d.ts +52 -0
- package/dist/src/services/login.d.ts +4 -0
- package/dist/src/services/monitor.d.ts +12 -0
- package/dist/src/services/ota.d.ts +7 -0
- package/dist/src/services/tool.d.ts +4 -0
- package/dist/src/services/uploadP0.d.ts +14 -0
- package/dist/src/types/index.d.ts +398 -0
- package/dist/src/utils/GizLog.d.ts +18 -0
- package/dist/src/utils/bleConfigLog.d.ts +11 -0
- package/dist/src/utils/connectedBssid.d.ts +6 -0
- package/dist/src/utils/errorCode.d.ts +3 -0
- package/dist/src/utils/globalData.d.ts +2 -0
- package/dist/src/utils/openApiRequest.d.ts +27 -0
- package/dist/src/utils/productConfigFileManage.d.ts +15 -0
- package/dist/src/utils/randomCode.d.ts +3 -0
- package/dist/src/utils/request.d.ts +1 -0
- package/dist/src/utils/sentry.d.ts +2 -0
- package/dist/src/utils/sleep.d.ts +2 -0
- package/dist/src/utils/utils.d.ts +55 -0
- package/dist/src/utils/wechatApi.d.ts +23 -0
- package/dist/src/utils/wifiConfigLogReport.d.ts +28 -0
- package/dist/src/wifiConfig/ConfigBase.d.ts +30 -0
- package/dist/src/wifiConfig/ap.d.ts +11 -0
- package/dist/src/wifiConfig/ble.d.ts +43 -0
- 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 +1 -1
- package/src/handler/ble.ts +22 -11
- package/src/protocol/DeviceInfo.ts +14 -1
- package/src/protocol/thirdProtocol/TqBleProtocol.ts +141 -0
- package/src/protocol/thirdProtocol/TqDeviceInfo.ts +31 -0
- package/src/sdk.ts +136 -7
- package/src/utils.ts +16 -0
- package/src/wifiConfig/ConfigBase.ts +6 -1
- package/src/wifiConfig/ble.ts +31 -10
- package/src/wifiConfig/tq.ts +140 -0
- package/.vscode/launch.json +0 -19
- package/.vscode/settings.json +0 -3
- package/yarn-error.log +0 -6901
package/README.md
CHANGED
|
@@ -329,3 +329,84 @@ const errorCode: IErrorCode = {
|
|
|
329
329
|
},
|
|
330
330
|
};
|
|
331
331
|
```
|
|
332
|
+
|
|
333
|
+
### 探趣 BLE 配网
|
|
334
|
+
|
|
335
|
+
SDK 将 `name` / `localName` 以“探趣”开头的设备映射到
|
|
336
|
+
`188c3f02286f472b898f9fadc8058372`,仍需在 `productInfo` 中配置该产品。
|
|
337
|
+
广播不含 MAC,扫描阶段以 `bleDeviceID` 区分设备,不生成虚假 MAC。
|
|
338
|
+
|
|
339
|
+
```ts
|
|
340
|
+
// 先初始化蓝牙并扫描,从设备列表选择探趣设备。
|
|
341
|
+
const deviceId = device.bleDeviceID;
|
|
342
|
+
// 选择设备时不用连接,输入 Wi-Fi 后直接调用统一配网接口。
|
|
343
|
+
const result = await sdk.setDeviceOnboardingDeploy({
|
|
344
|
+
mode: 11,
|
|
345
|
+
bleDeviceID: deviceId,
|
|
346
|
+
ssid: '家庭WiFi',
|
|
347
|
+
password: 'your-password', // 开放网络可传空字符串
|
|
348
|
+
timeout: 60,
|
|
349
|
+
isBind: false,
|
|
350
|
+
softAPSSIDPrefix: '',
|
|
351
|
+
});
|
|
352
|
+
// result.success 表示设备报告网络配置成功,不代表云端注册或绑定完成。
|
|
353
|
+
// SDK 自动连接、进入配网、发送凭据、查询状态,并在结束后清理连接。
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
直接调用 mode 11 即可完成配网。SDK 缓存已发现设备的身份,实时扫描列表过期不会阻止已选设备连接。
|
|
357
|
+
`prepareTqOnboarding()` 仍可选用来读取设备 Wi-Fi 列表,但不再是 demo 的前置步骤。
|
|
358
|
+
取消使用 `stopDeviceOnboardingDeploy()`,会中断请求并断开当前配网连接。
|
|
359
|
+
SDK 销毁会清理探趣连接、通知监听和未完成请求。
|
|
360
|
+
|
|
361
|
+
探趣设备也可通过统一接口查询信息,无需先绑定或进入配网模式:
|
|
362
|
+
|
|
363
|
+
```ts
|
|
364
|
+
const result = await sdk.getDeviceInfo({ device });
|
|
365
|
+
if (result.success) {
|
|
366
|
+
console.log(result.data.deviceID, result.data.deviceHardVersion, result.data.deviceSoftVersion);
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
SDK 使用 L2 `ver=1, fun=0x01, cmd=0x01`,请求数据为空。发送失败、响应超时或
|
|
371
|
+
响应长度不为 29 字节时,改用 `ver=2` 重试;成功后使用回复中的 `ver` 作为当前
|
|
372
|
+
会话后续命令的协议版本。独立查询结束会断开连接;已有配网会话会保持连接。
|
|
373
|
+
|
|
374
|
+
|返回字段|协议来源|格式|
|
|
375
|
+
|---|---|---|
|
|
376
|
+
|`deviceTypeID`|Byte[0–3]|8 位十六进制字符串,保留字节顺序|
|
|
377
|
+
|`deviceID`|Byte[4–20]|UTF-8 文本,去掉末尾 NUL;无法解码时保留十六进制原值|
|
|
378
|
+
|`deviceHardVersion`|Byte[21–24]|8 位十六进制字符串,保留字节顺序|
|
|
379
|
+
|`deviceSoftVersion`|Byte[25–28]|8 位十六进制字符串,保留字节顺序|
|
|
380
|
+
|`protocolVersion`|L2 回复的 `ver`|数字|
|
|
381
|
+
|
|
382
|
+
协议未说明版本编码,暂保留原始十六进制值。没有分别提供模组、MCU 和业务版本,
|
|
383
|
+
因此 `moduleHardVersion`、`moduleSoftVersion`、`mcuHardVersion`、`mcuSoftVersion`
|
|
384
|
+
和 `businessVersion` 均为空字符串。
|
|
385
|
+
|
|
386
|
+
仅探趣设备支持设置设备 ID,接口参数中的 `deviceId` 是要写入设备的新 ID,
|
|
387
|
+
蓝牙连接仍使用 `device.bleDeviceID`:
|
|
388
|
+
|
|
389
|
+
```ts
|
|
390
|
+
const result = await sdk.setDeviceId({ device, deviceId: 'TQ123456789012345' });
|
|
391
|
+
// result.success 为 true 表示设备返回 status code 0。
|
|
392
|
+
// 有效的设备回复会在 result.data.statusCode 中保留原始单字节状态码。
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
ID 必须是字符串,UTF-8 编码后恰好 17 字节;长度不符不会连接或发送命令,
|
|
396
|
+
不会自动截断、补零或去除空格。中文等多字节字符按编码字节数计算。
|
|
397
|
+
SDK 先通过查询设备信息确定当前会话的协议版本,再发送 `fun=0x01, cmd=0x10`。
|
|
398
|
+
回复必须为 1 字节,状态码非 0 返回失败。独立调用结束清理连接,已有配网会话保持连接。
|
|
399
|
+
|
|
400
|
+
服务 `18FF`,写入 `2B02`,通知 `2B01`。L0 每包最多 20 字节,CRC8
|
|
401
|
+
多项式 `0x07`、初始值 `0`,校验 Data;L2 长度为大端。每包匹配序号
|
|
402
|
+
等待 ACK,超时 2 秒,最多发送 3 次。该实现依据 tq_ble_tools,未添加加密。
|
|
403
|
+
收到开始配网确认后等待 2 秒,每秒查询状态,最多 20 次,外层 timeout
|
|
404
|
+
限制整个配网过程。云端绑定及其他设备控制功能不在此接口支持范围内。
|
|
405
|
+
|
|
406
|
+
协议及模拟设备测试(需要安装 TypeScript):
|
|
407
|
+
|
|
408
|
+
```sh
|
|
409
|
+
node tests/tq-protocol.cjs
|
|
410
|
+
node tests/tq-session.cjs
|
|
411
|
+
node tests/tq-device-info.cjs
|
|
412
|
+
```
|
package/dist/index.d.ts
ADDED