更新100、670电量低的提示方式为监听式
This commit is contained in:
@ -63,6 +63,10 @@ export function mapReverseGeocoding(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deviceRealTimeStatus(){
|
export function deviceRealTimeStatus(params){
|
||||||
return Promise.resolve({code:500});
|
return request({
|
||||||
|
url: `/app/device/realTimeStatus`,
|
||||||
|
method: 'get',
|
||||||
|
data:params
|
||||||
|
})
|
||||||
}
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
"name" : "星汉物联",
|
"name" : "星汉物联",
|
||||||
"appid" : "__UNI__A21EF43",
|
"appid" : "__UNI__A21EF43",
|
||||||
"description" : "设备管控",
|
"description" : "设备管控",
|
||||||
"versionName" : "1.0.18",
|
"versionName" : "1.0.19",
|
||||||
"versionCode" : 101,
|
"versionCode" : 101,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
@ -114,7 +114,8 @@
|
|||||||
"xhdpi" : "unpackage/res/icons/48x48.png",
|
"xhdpi" : "unpackage/res/icons/48x48.png",
|
||||||
"xxhdpi" : "unpackage/res/icons/72x72.png"
|
"xxhdpi" : "unpackage/res/icons/72x72.png"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"meizu" : {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -223,11 +223,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="proinfo lamp">
|
<view class="proinfo lamp">
|
||||||
<text class="title">产品信息</text>
|
<text class="title">产品信息</text>
|
||||||
<view class="itemcontent">
|
<view class="itemcontent">
|
||||||
@ -245,18 +245,18 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 弹窗通知 -->
|
<!-- 弹窗通知 -->
|
||||||
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
|
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
|
||||||
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
|
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
|
||||||
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
|
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
|
||||||
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
|
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
|
||||||
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
|
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
|
||||||
v-model="Status.Pop.modelValue" @closePop="closePop" :buttonCancelText="Status.Pop.buttonCancelText"
|
v-model="Status.Pop.modelValue" @closePop="closePop" :buttonCancelText="Status.Pop.buttonCancelText"
|
||||||
:showCancel="Status.Pop.showCancel" @cancelPop="closePop" />
|
:showCancel="Status.Pop.showCancel" @cancelPop="closePop" />
|
||||||
|
|
||||||
<!-- 下方菜单 -->
|
<!-- 下方菜单 -->
|
||||||
<!-- <BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
|
<!-- <BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
|
||||||
@btnClick="btnClick">
|
@btnClick="btnClick">
|
||||||
<view>
|
<view>
|
||||||
<view class="addIco">
|
<view class="addIco">
|
||||||
@ -266,8 +266,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</BottomSlideMenuPlus> -->
|
</BottomSlideMenuPlus> -->
|
||||||
|
|
||||||
<global-loading ref="loading" />
|
<global-loading ref="loading" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -518,6 +518,11 @@
|
|||||||
recei = BleReceive.getBleReceive();
|
recei = BleReceive.getBleReceive();
|
||||||
ble = BleTool.getBleTool();
|
ble = BleTool.getBleTool();
|
||||||
|
|
||||||
|
this.$watch("formData.sta_battery", (newVal, oldVal) => {
|
||||||
|
if (newVal <= 20 && this.formData.sta_system==2) {
|
||||||
|
this.showMsg("设备电量低");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ble.addReceiveCallback(this.bleValueNotify, pagePath);
|
ble.addReceiveCallback(this.bleValueNotify, pagePath);
|
||||||
ble.addStateBreakCallback(this.bleStateBreak, pagePath);
|
ble.addStateBreakCallback(this.bleStateBreak, pagePath);
|
||||||
@ -572,10 +577,10 @@
|
|||||||
|
|
||||||
these.formData.bleStatu = false;
|
these.formData.bleStatu = false;
|
||||||
these.formData.deviceId = f.deviceId;
|
these.formData.deviceId = f.deviceId;
|
||||||
these.formData.bleStatu = 'connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex=>{
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
});
|
});
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
@ -592,17 +597,17 @@
|
|||||||
this.Status.pageHide = false;
|
this.Status.pageHide = false;
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
getbleStatu(){
|
getbleStatu() {
|
||||||
if(this.formData.bleStatu===true){
|
if (this.formData.bleStatu === true) {
|
||||||
return '已连接';
|
return '已连接';
|
||||||
}
|
}
|
||||||
if(this.formData.bleStatu==='connecting'){
|
if (this.formData.bleStatu === 'connecting') {
|
||||||
return '连接中';
|
return '连接中';
|
||||||
}
|
}
|
||||||
if(this.formData.bleStatu==='dicconnect'){
|
if (this.formData.bleStatu === 'dicconnect') {
|
||||||
return '正在断开';
|
return '正在断开';
|
||||||
}
|
}
|
||||||
if(this.formData.bleStatu==='err'){
|
if (this.formData.bleStatu === 'err') {
|
||||||
return '连接异常';
|
return '连接异常';
|
||||||
}
|
}
|
||||||
return '未连接';
|
return '未连接';
|
||||||
@ -1196,9 +1201,9 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
if(res.device){
|
if (res.device) {
|
||||||
these.formData.bleStatu = 'connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
}else{
|
} else {
|
||||||
this.formData.bleStatu = false;
|
this.formData.bleStatu = false;
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -1233,14 +1238,14 @@
|
|||||||
showLoading(this, {
|
showLoading(this, {
|
||||||
text: "蓝牙恢复可用,正在连接设备"
|
text: "蓝牙恢复可用,正在连接设备"
|
||||||
});
|
});
|
||||||
these.formData.bleStatu='connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(these.formData.deviceId).then(() => {
|
ble.LinkBlue(these.formData.deviceId).then(() => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: '连接成功'
|
text: '连接成功'
|
||||||
});
|
});
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu='err';
|
these.formData.bleStatu = 'err';
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: ex.msg
|
text: ex.msg
|
||||||
})
|
})
|
||||||
@ -1313,9 +1318,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.formData.sta_battery <= 20) {
|
|
||||||
this.showMsg("设备电量低");
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
|
|
||||||
@ -1327,32 +1333,32 @@
|
|||||||
|
|
||||||
return f;
|
return f;
|
||||||
},
|
},
|
||||||
|
|
||||||
bleStatuToggle(){
|
bleStatuToggle() {
|
||||||
let f=this.getDevice();
|
let f = this.getDevice();
|
||||||
if(!f){
|
if (!f) {
|
||||||
this.showBleUnConnect();
|
this.showBleUnConnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(this.formData.bleStatu===true){
|
if (this.formData.bleStatu === true) {
|
||||||
this.formData.bleStatu='dicconnect';
|
this.formData.bleStatu = 'dicconnect';
|
||||||
ble.disconnectDevice(f.deviceId).finally(r=>{
|
ble.disconnectDevice(f.deviceId).finally(r => {
|
||||||
this.formData.bleStatu=false;
|
this.formData.bleStatu = false;
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.formData.bleStatu===false || this.formData.bleStatu==='err'){
|
if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
|
||||||
this.formData.bleStatu='connecting';
|
this.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex=>{
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -411,7 +411,8 @@
|
|||||||
staPowerTime: null,
|
staPowerTime: null,
|
||||||
staPowerPercent: null,
|
staPowerPercent: null,
|
||||||
staDetectResult: null
|
staDetectResult: null
|
||||||
}
|
},
|
||||||
|
inteval:50
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -994,179 +995,146 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let f = this.getDevice();
|
let f = this.getDevice();
|
||||||
// 处理像素数据并发送
|
|
||||||
var processAndSendImageData = function(pixels) {
|
|
||||||
return new Promise((resolve, reject) => {
|
var sendImagePackets = function(ReSendNo) {
|
||||||
// 创建RGB565格式的像素数据
|
|
||||||
const arr = Common.convertToRGB565(pixels, 'bgr');
|
|
||||||
|
|
||||||
var list = [];
|
|
||||||
let index = 0; // 用于追踪arr的当前位置
|
|
||||||
let packetSize = 2048;
|
|
||||||
let cSize = 248;
|
|
||||||
// 外层循环:7个主要元素(i从1到7)
|
|
||||||
for (let i = 1; i < 8; i++) {
|
|
||||||
let secondLevel = [];
|
|
||||||
let secondCnt = 0;
|
|
||||||
// 中层循环:每个主要元素包含9个子数组(j从1到9)
|
|
||||||
for (let j = 1; j < 10; j++) {
|
|
||||||
// 确定当前子数组的长度:前8个是254,第9个是64
|
|
||||||
|
|
||||||
let thirdLevel = [];
|
|
||||||
|
|
||||||
// 从arr中提取相应数量的元素
|
|
||||||
for (let k = 0; k < cSize && index < arr.length; k++) {
|
|
||||||
|
|
||||||
if (secondCnt == packetSize) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
thirdLevel.push(arr[index]);
|
|
||||||
secondCnt++;
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
secondLevel.push(thirdLevel);
|
|
||||||
}
|
|
||||||
list.push(secondLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("list=", list);
|
|
||||||
|
|
||||||
let length = 0;
|
|
||||||
for (let i = 0; i < list.length; i++) {
|
|
||||||
const item = list[i];
|
|
||||||
let clength = 0;
|
|
||||||
for (let j = 0; j < item.length; j++) {
|
|
||||||
const element = item[j];
|
|
||||||
console.log("第" + i + "包,第" + j + "小包,长度:" + element.length)
|
|
||||||
length += element.length;
|
|
||||||
clength += element.length;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 分包发送
|
|
||||||
sendImagePackets(list).then(resolve).catch(reject);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 分包发送图片数据
|
|
||||||
var sendImagePackets = function(imageData) {
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
// 总数据包数
|
// 总数据包数
|
||||||
const totalPackets = 7;
|
let totalPackets = 52;
|
||||||
let currentPacket = 1;
|
let currentPacket = 1;
|
||||||
let childPacket = 1;
|
|
||||||
let totalChildPacket = 9;
|
if (ReSendNo) {
|
||||||
|
totalPackets = ReSendNo;
|
||||||
|
currentPacket = ReSendNo;
|
||||||
// 发送单个数据包
|
}
|
||||||
const sendNextPacket = () => {
|
|
||||||
if (currentPacket > totalPackets) {
|
if (f) {
|
||||||
setTimeout(() => {
|
// 发送单个数据包
|
||||||
|
const sendNextPacket = () => {
|
||||||
|
if (currentPacket > totalPackets) {
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
|
these.closeAction();
|
||||||
MsgSuccess("上传成功", "确定", these);
|
these.showPop({
|
||||||
|
showPop: true,
|
||||||
|
message: "上传成功",
|
||||||
|
iconUrl: "/static/images/common/success.png",
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(()=>{
|
||||||
|
ble.sendString(f.deviceId, "transmit complete", f.writeServiceId, f
|
||||||
|
.wirteCharactId);
|
||||||
|
},1000);
|
||||||
|
|
||||||
|
these.rgb565Data = null;
|
||||||
resolve();
|
resolve();
|
||||||
}, 3000)
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算当前包的数据
|
||||||
|
let packetSize = 250;
|
||||||
|
// if (currentPacket <= 51) {
|
||||||
|
// packetSize = 250; // 前51个包每个500字节
|
||||||
|
// } else {
|
||||||
|
// packetSize = 50; // 最后一个包100字节
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 创建数据包
|
||||||
|
const startIndex = (currentPacket - 1) * packetSize;
|
||||||
|
const endIndex = Math.min(startIndex + packetSize, these.rgb565Data
|
||||||
|
.length);
|
||||||
|
if (startIndex > endIndex) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const packetData = these.rgb565Data.slice(startIndex,
|
||||||
|
endIndex);
|
||||||
|
// 构建数据包
|
||||||
|
const bufferSize = 505; // 5 + packetData.length * 2; // 头部5字节 + 数据部分
|
||||||
|
const buffer = new ArrayBuffer(bufferSize);
|
||||||
|
const dataView = new DataView(buffer);
|
||||||
|
|
||||||
|
// 填充头部
|
||||||
|
dataView.setUint8(0, 0x55); // 帧头
|
||||||
|
dataView.setUint8(1, 0x02); // 帧类型:开机画面
|
||||||
|
dataView.setUint8(2, '0x' + currentPacket.toString(16).padStart(2,
|
||||||
|
'0')); // 包序号
|
||||||
|
|
||||||
|
|
||||||
|
if (packetData.length == 250) {
|
||||||
|
dataView.setUint8(3, 0x01);
|
||||||
|
dataView.setUint8(4, 0xF4);
|
||||||
|
} else {
|
||||||
|
dataView.setUint8(3, 0x00);
|
||||||
|
dataView.setUint8(4, 0x64);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 填充数据(每个RGB565值占2字节)
|
||||||
|
for (let i = 0; i < packetData.length; i++) {
|
||||||
|
dataView.setUint16(5 + i * 2, packetData[i], false); // 大端字节序
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentPacket > 51) { //第52包补FF
|
||||||
|
for (var i = 105; i < bufferSize; i++) {
|
||||||
|
dataView.setUint8(i, 0xFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//发送数据包
|
||||||
|
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId,
|
||||||
|
10)
|
||||||
|
.then(() => {
|
||||||
|
|
||||||
|
|
||||||
|
updateLoading(these, {
|
||||||
|
text: "正在发送:" + currentPacket + "/" +
|
||||||
|
totalPackets
|
||||||
|
})
|
||||||
|
currentPacket++;
|
||||||
|
|
||||||
|
setTimeout(sendNextPacket, these.inteval);
|
||||||
|
}).catch(err => {
|
||||||
|
console.log("发送数据包失败了" + JSON.stringify(err));
|
||||||
|
if (err.code == '10007') {
|
||||||
|
setTimeout(sendNextPacket, these.inteval);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
these.closeAction();
|
||||||
|
these.showPop({
|
||||||
|
message: err.msg,
|
||||||
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
|
borderColor: "#e034344d",
|
||||||
|
buttonBgColor: "#E03434",
|
||||||
|
});
|
||||||
|
hideLoading(these);
|
||||||
|
these.rgb565Data = null;
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ReSendNo) {
|
||||||
|
sendNextPacket(ReSendNo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 开始牵手
|
||||||
var packetData = imageData[currentPacket - 1][childPacket - 1];
|
ble.sendString(f.deviceId, "picture transmit start", f.writeServiceId,
|
||||||
|
f.wirteCharactId).then(() => {
|
||||||
let start = 0;
|
setTimeout(sendNextPacket, 120);
|
||||||
let bufferSize = packetData.length * 2;
|
|
||||||
|
}).catch((err) => {
|
||||||
if (currentPacket == 7) {
|
console.log("握手没有成功");
|
||||||
if (childPacket > 2 && childPacket < 9) {
|
these.showPop({
|
||||||
bufferSize = 496;
|
message: err.msg,
|
||||||
} else if (childPacket == 9) {
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
bufferSize = 128;
|
borderColor: "#e034344d",
|
||||||
}
|
buttonBgColor: "#E03434",
|
||||||
}
|
|
||||||
|
|
||||||
if (childPacket == 1) {
|
|
||||||
bufferSize = bufferSize + 8
|
|
||||||
start = 8;
|
|
||||||
}
|
|
||||||
if (childPacket == 9) { //|| (currentPacket==7 && childPacket==3
|
|
||||||
bufferSize = bufferSize + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//FA 09 10 04 FC 09 [00] [01] + 4096字节+FF 数据格式
|
|
||||||
var buffer = new ArrayBuffer(bufferSize);
|
|
||||||
var dataView = new DataView(buffer);
|
|
||||||
if (childPacket == 1) {
|
|
||||||
dataView.setUint8(0, 0xFA); // 帧头
|
|
||||||
dataView.setUint8(1, 0x09); // 帧头
|
|
||||||
dataView.setUint8(2, 0x10); // 帧头
|
|
||||||
dataView.setUint8(3, 0x04); // 帧头
|
|
||||||
dataView.setUint8(4, 0xFC); // 帧头
|
|
||||||
dataView.setUint8(5, 0x09); // 帧头
|
|
||||||
|
|
||||||
dataView.setUint8(6, 0x00); // 图序号,图片固定0,视频的话要写序号
|
|
||||||
dataView.setUint8(7, currentPacket); //子包序号
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < packetData.length; i++) {
|
|
||||||
dataView.setUint16(start + i * 2, packetData[i], false); //本包数据,大端字节序
|
|
||||||
}
|
|
||||||
console.log("packetData.length=", packetData.length);
|
|
||||||
console.log("bufferSize=", bufferSize)
|
|
||||||
if (childPacket == 9) { // || (currentPacket==7 && childPacket==3
|
|
||||||
dataView.setUint8(bufferSize - 1, 0xFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
//发送数据包
|
|
||||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId,
|
|
||||||
30)
|
|
||||||
.then(() => {
|
|
||||||
|
|
||||||
let curr = childPacket + (currentPacket - 1) *
|
|
||||||
totalChildPacket;
|
|
||||||
console.log("第" + currentPacket + "大包,第" + childPacket +
|
|
||||||
"小包发送完成,总计:" + curr);
|
|
||||||
updateLoading(these, {
|
|
||||||
text: "正在发送" + curr + "/63"
|
|
||||||
|
|
||||||
})
|
|
||||||
if (childPacket == 9) {
|
|
||||||
currentPacket++;
|
|
||||||
childPacket = 1;
|
|
||||||
} else {
|
|
||||||
childPacket++;
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(sendNextPacket, 100);
|
|
||||||
}).catch(err => {
|
|
||||||
if (err.code == 10007) {
|
|
||||||
setTimeout(sendNextPacket, 100);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("发送数据包失败了", err);
|
|
||||||
|
|
||||||
|
|
||||||
showPop({
|
|
||||||
message: "发送数据包失败了" + err.msg,
|
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
|
||||||
borderColor: "#e034344d",
|
|
||||||
buttonBgColor: "#E03434",
|
|
||||||
});
|
|
||||||
|
|
||||||
hideLoading(these);
|
|
||||||
reject(err);
|
|
||||||
});
|
});
|
||||||
|
hideLoading(these);
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
// 开始发送数据
|
|
||||||
sendNextPacket();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1186,10 +1154,11 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
these.rgb565Data = Common.convertToRGB565(data.piexls);
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
processAndSendImageData(data.piexls).catch((
|
sendImagePackets().catch(() => {
|
||||||
ex) => {
|
|
||||||
console.log("出现异常", ex);
|
|
||||||
});
|
});
|
||||||
}, 0)
|
}, 0)
|
||||||
|
|
||||||
|
|||||||
@ -486,10 +486,14 @@
|
|||||||
},
|
},
|
||||||
onLoad: function() {
|
onLoad: function() {
|
||||||
|
|
||||||
|
|
||||||
these = this;
|
these = this;
|
||||||
recei = BleReceive.getBleReceive();
|
recei = BleReceive.getBleReceive();
|
||||||
ble = BleTool.getBleTool();
|
ble = BleTool.getBleTool();
|
||||||
|
this.$watch("formData.battary", (newVal, oldVal) => {
|
||||||
|
if (newVal <= 20 && this.formData.sta_system==2) {
|
||||||
|
this.showMsg("设备电量低");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
ble.addReceiveCallback(these.bleValueNotify, pagePath);
|
ble.addReceiveCallback(these.bleValueNotify, pagePath);
|
||||||
@ -928,30 +932,16 @@
|
|||||||
// console.log("收到文本回复", payload);
|
// console.log("收到文本回复", payload);
|
||||||
// // this.SendTxtMQ(json);
|
// // this.SendTxtMQ(json);
|
||||||
// }
|
// }
|
||||||
if (keys.indexOf('sta_BreakNews') > -
|
if (keys.indexOf('sta_BreakNews') > -1) { //紧急通知
|
||||||
1) { //紧急通知
|
if(json.sta_BreakNews=='I get it'){
|
||||||
if (json.sta_BreakNews ===
|
these.showPop({
|
||||||
'I get it'
|
showPop: true,
|
||||||
) // && this.Status.msgOkTime && this.Status.msgOkIntval){
|
message: "用户已确认收到紧急通知",
|
||||||
{
|
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
|
||||||
these.showPop({
|
});
|
||||||
showPop: true,
|
}
|
||||||
message: "用户已确认收到紧急通知",
|
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
|
}
|
||||||
});
|
|
||||||
|
|
||||||
// this.Status.msgOkTime=null
|
|
||||||
// clearInterval(this.Status.msgOkIntval);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
// else {
|
|
||||||
// console.log("收到不能处理的数据", payload);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("无法解析此消息", payload);
|
console.error("无法解析此消息", payload);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,7 +72,6 @@
|
|||||||
callback: this.scan
|
callback: this.scan
|
||||||
}],
|
}],
|
||||||
title: '扫码'
|
title: '扫码'
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
formData: {
|
formData: {
|
||||||
@ -208,7 +207,7 @@
|
|||||||
this.qrCodeResult(cleanedResult, true, null);
|
this.qrCodeResult(cleanedResult, true, null);
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
this.showMsg("扫码失败:" + err.errMsg, MsgType.error);
|
MsgError("扫码失败:" + err.errMsg,"确定",these);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -187,7 +187,8 @@ import BleReceive from '@/utils/BleReceive';
|
|||||||
navTitle: "我的设备",
|
navTitle: "我的设备",
|
||||||
deleteShow: false,
|
deleteShow: false,
|
||||||
RenameModel: false,
|
RenameModel: false,
|
||||||
menuItems: [{
|
menuItems: [
|
||||||
|
{
|
||||||
text: '扫一扫添加',
|
text: '扫一扫添加',
|
||||||
icon: '/static/images/common/scane.png',
|
icon: '/static/images/common/scane.png',
|
||||||
action: 'scan'
|
action: 'scan'
|
||||||
|
|||||||
Reference in New Issue
Block a user