|
@@ -254,10 +254,10 @@ class BtCmd {
|
|
|
}
|
|
|
|
|
|
// wifi ,md5都用这个
|
|
|
- static sendWiFiInfo(wifiName, pwd, changePwd) {
|
|
|
+ static sendWiFiInfo(wifiName, pwd) {
|
|
|
// [0x22, (wifiList.length + pwdList.length + 6), 0x33, (wifiList.length), (wifiList), 0x44, (pwdList)];
|
|
|
|
|
|
- if (!wifiName || !pwd) {
|
|
|
+ if (!wifiName) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -267,7 +267,10 @@ class BtCmd {
|
|
|
let wifiList = BtCmd.stringToUint8Array(wifiName);
|
|
|
|
|
|
// 数字*3 +
|
|
|
- let pwdList = BtCmd.stringToUint8Array(pwd);
|
|
|
+ var pwdList = [];
|
|
|
+ if (pwd) {
|
|
|
+ pwdList = BtCmd.stringToUint8Array(pwd);
|
|
|
+ }
|
|
|
console.log("wifiList", wifiList, "pwdList", pwdList)
|
|
|
|
|
|
// 16进制
|
|
@@ -285,13 +288,18 @@ class BtCmd {
|
|
|
result.splice(i, 0, wifiList[j++]);
|
|
|
}
|
|
|
|
|
|
- // 密码
|
|
|
result.splice(p, 0, 0x44);
|
|
|
- result.splice(++p, 0, BtCmd.intToHex(pwdList.length));
|
|
|
- p++;
|
|
|
- j = 0;
|
|
|
- for (let i = p; i < p + pwdList.length; i++) {
|
|
|
- result.splice(i, 0, pwdList[j++]);
|
|
|
+ // 有密码
|
|
|
+ if (pwdList.length > 0) {
|
|
|
+ result.splice(++p, 0, BtCmd.intToHex(pwdList.length));
|
|
|
+ p++;
|
|
|
+ j = 0;
|
|
|
+ for (let i = p; i < p + pwdList.length; i++) {
|
|
|
+ result.splice(i, 0, pwdList[j++]);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ p++
|
|
|
+ result.splice(++p, 0, BtCmd.intToHex(pwdList.length));
|
|
|
}
|
|
|
|
|
|
console.log("发送转换拼接数据:", result.toString());
|