1
0
forked from dyf/APP

蓝牙模块添加在web平台默认成功方便调试功能,4877功能完成

This commit is contained in:
liub
2025-10-27 10:52:17 +08:00
parent d37ccfeabc
commit 61ed91695f
13 changed files with 575 additions and 318 deletions

View File

@ -523,7 +523,7 @@
these.formData['imei'] = these.device.deviceImei;
}
these.getDetail();
these.formData.bleStatu=false;
these.formData.bleStatu = false;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true;
});
@ -531,10 +531,10 @@
},
onShow() {
this.Status.pageHide=false;
this.Status.pageHide = false;
},
onHide: function() {
this.Status.pageHide=true;
this.Status.pageHide = true;
},
onBackPress(e) {
ble.removeReceiveCallback(pagePath);
@ -628,11 +628,12 @@
return;
}
this.showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备,取消"+(4-this.Status.bleLinkCnt)+"次后不再提醒",
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备,取消" + (4 - this.Status.bleLinkCnt) + "次后不再提醒",
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
showCancel: true,
cancelCallback: () => {
// this.closePop();
@ -644,7 +645,7 @@
events: {
BindOver: function(data) {
console.log(data)
these.formData.bleStatu=true;
these.formData.bleStatu = true;
}
},
success: function(res) {
@ -983,9 +984,11 @@
this.refreshFormData(receiveData, 'auto');
return receiveData;
},
bleValueNotify: function(receive, device, path,recArr) { //订阅消息
let data = recei.ReceiveData(receive, device, pagePath,recArr);
bleValueNotify: function(receive, device, path, recArr) { //订阅消息
if (receive.deviceId !== this.formData.deviceId) {
return;
}
let data = recei.ReceiveData(receive, device, pagePath, recArr);
console.log("收到设备的数据", data)
if (data) {
if ("staBlue_picture" in data) {
@ -1395,12 +1398,12 @@
clearInterval(these.Status.staticWarn.inteval);
these.Status.staticWarn.inteval = null;
these.formData.qzwarn = false;
if(this.Status.Pop.okCallback){
these.CloseWarn(false);
these.formData.SOS = 'close';
if (this.Status.Pop.okCallback) {
these.CloseWarn(false);
these.formData.SOS = 'close';
}
return;
}
these.Status.staticWarn.time = these.Status.staticWarn
@ -1433,9 +1436,10 @@
this.Status.staticWarn.time = 0;
return;
}
if (these.formData.qzwarn && these.Status.staticWarn.inteval && these.Status.staticWarn.time) {
if (these.formData.qzwarn && these.Status.staticWarn.inteval && these.Status.staticWarn
.time) {
console.log("222222");
this.Status.Pop.okCallback=null;
this.Status.Pop.okCallback = null;
these.showQzWarn(sendRb);
} else {
sendRb();
@ -2170,39 +2174,51 @@
},
showPop: function(option) {
hideLoading(this);
let defaultCfg = {
showHeader: false,
headerTxt: "",
showHeader: false,
showCancel: false,
borderColor: '#BBE600',
buttonBgColor: '#BBE600',
okCallback: null,
cancelCallback: null,
let def = {
showPop: true, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
iconUrl: '',
message: '',
buttonText: '确定',
clickEvt: '',
visiblePrompt: false,
promptTitle: '',
modelValue: '',
visibleClose: false,
okCallback: null,
showSlot: false,
buttonCancelText: '',
showCancel: false,
buttonCancelText: '取消',
clickEvt: ''
};
if (!option) {
}
}
let keys = Object.keys(option);
for (var i = 0; i < keys.length; i++) {
let key = keys[i];
this.Status.Pop[key] = option[key];
}
keys = Object.keys(defaultCfg);
for (var i = 0; i < keys.length; i++) {
let keys = Object.keys(def);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
if (key in option) {
continue;
}
this.Status.Pop[key] = defaultCfg[key];
this.Status.Pop[key] = def[key];
}
if (option) {
keys = Object.keys(option);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
this.Status.Pop[key] = option[key];
}
}
this.Status.Pop.showPop = true;
if (!option.borderColor) {
option.borderColor = '#BBE600';
option.buttonBgColor = '#BBE600';
}
these.Status.Pop.showPop = true;
},
sendUsr: function(ReSendNo) {
@ -2338,9 +2354,9 @@
// 获取当前行文字
const text = textLines[currentPacket - 1] || '';
let arr = gbk.encode(text)
console.log("arr=",arr);
console.log("arr=", arr);
let gbkData = gbk.arr2hex(arr);
console.log("gbkData=",gbkData);
console.log("gbkData=", gbkData);
// 构建数据包
const bufferSize = 5 + gbkData.length / 2; // 头部4字节 + 数据部分