6331前端功能初步完成,扩展msgPop支持自定义插槽

This commit is contained in:
liub
2025-10-17 17:29:08 +08:00
parent b114f6690d
commit 90cee62df1
16 changed files with 574 additions and 1031 deletions

View File

@ -135,7 +135,7 @@ class BleHelper {
let item = this.data.LinkedList[i];
if (deviceId && item.device) {
if (item.device.id == deviceId) {
console.log("找到要删除的设备", item);
console.log("找到要删除的设备", item);
this.data.LinkedList.splice(i, 1);
this.disconnectDevice(item.deviceId);
flag = true;
@ -144,7 +144,7 @@ class BleHelper {
} else {
if (bleId && item.deviceId == bleId) {
console.log("找到要删除的设备1,", item)
console.log("找到要删除的设备1,", item)
this.data.LinkedList.splice(i, 1);
this.disconnectDevice(item.deviceId);
flag = true;
@ -249,7 +249,7 @@ class BleHelper {
}
//设置蓝牙恢复连接的回调
@ -313,7 +313,7 @@ class BleHelper {
removeStateRecoveryCallback(currKey) {
this.removeCallback(currKey, 'stateRecoveryCallback');
}
//清除所有事件回调
removeAllCallback(currKey) {
this.removeDeviceFound(currKey)
@ -1570,7 +1570,46 @@ class BleHelper {
////console.log("无已连接设备");
}
}
//向蓝牙设备发送一个字符串的ASCII码
sendString(deviceid, str, writeServiceId, wirteCharactId, ms) {
if (str && str.length) {
let buffer = new ArrayBuffer(str.length);
let dataView = new DataView(buffer);
// 2. 将字符串转换为 ASCII 码并写入 DataView
for (let i = 0; i < str.length; i++) {
dataView.setUint8(i, str.charCodeAt(i));
}
return this.sendData(deviceid, buffer, writeServiceId, wirteCharactId, ms);
} else {
return Promise.resolve({
code: 200,
msg: "没有数据要发送"
})
}
}
//向蓝牙设备发送一个16进制的数组数据
sendHexs(deviceid, array, writeServiceId, wirteCharactId, ms) {
if (array && array.length) {
let bufferSize = array.length;
let buffer = new ArrayBuffer(bufferSize);
let dataView = new DataView(buffer);
for (let i = 0; i < array.length; i++) {
dataView.setUint8(i, array);
}
return this.sendData(deviceid, buffer, writeServiceId, wirteCharactId, ms);
} else {
return Promise.resolve({
code: 200,
msg: "没有数据要发送"
})
}
}
//向蓝牙设备发送数据,如果没连接将自动连接后再发
sendData(deviceid, buffer, writeServiceId, wirteCharactId, ms) {