蓝牙模块添加在web平台默认成功方便调试功能,4877功能完成
This commit is contained in:
@ -2,23 +2,24 @@
|
||||
<view class="content contentBg">
|
||||
<view class="eq">
|
||||
<view class="leftImg" @click.stop="previewImg(formData.img)">
|
||||
<image class="img" :src="formData.img?formData.img:'/static/images/4877/4877equip.png'" mode="aspectFit"></image>
|
||||
<image class="img" :src="formData.img?formData.img:'/static/images/4877/4877equip.png'"
|
||||
mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
<view class="row">
|
||||
<image class="img" src="/static/images/6155/DeviceDetail/battry.png" mode="aspectFit"></image>
|
||||
<view class="txt">
|
||||
<view class="bigTxt">{{formData.sta_PowerPercent}}%</view>
|
||||
<view class="bigTxt">{{formData.sta_battery}}%</view>
|
||||
<view class="smallTxt">电量</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="row">
|
||||
<view class="row">
|
||||
<image class="img" src="/static/images/6155/DeviceDetail/time.png" mode="aspectFit"></image>
|
||||
<view class="txt">
|
||||
<view class="bigTxt">{{formData.xuhang}}</view>
|
||||
<view class="smallTxt">续航时间</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="eqinfo">
|
||||
@ -36,12 +37,7 @@
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="warnnig" v-bind:class="formData.sta_SOSType=='sos'?'':'displayNone'" @click.stop="showUnWarn('sos_off')">
|
||||
<view>设备强制报警中!</view>
|
||||
<view class="netContent">
|
||||
{{formData.warnTime}}s
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="lamp">
|
||||
@ -245,12 +241,12 @@
|
||||
var ble = null;
|
||||
var these = null;
|
||||
var recei = null;
|
||||
var interval=null;
|
||||
var interval = null;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
Status: {
|
||||
|
||||
pageHide: false,
|
||||
Pop: {
|
||||
showPop: false, //是否显示弹窗
|
||||
popType: 'custom',
|
||||
@ -311,7 +307,7 @@
|
||||
},
|
||||
formData: {
|
||||
img: '/static/images/4877/4877equip.png',
|
||||
sta_PowerPercent: '',
|
||||
sta_battery: '',
|
||||
xuhang: '',
|
||||
blename: '',
|
||||
deviceId: '',
|
||||
@ -320,10 +316,14 @@
|
||||
statu: '',
|
||||
macAddress: '',
|
||||
bleStatu: false,
|
||||
sta_SOSType: '', //sos
|
||||
sta_GroupType: '', //配组
|
||||
sta_ArrowType: '', //箭头方向
|
||||
warnTime:0
|
||||
sta_address: '',
|
||||
sta_VoiceType: '',
|
||||
sta_VoiceVolume: '',
|
||||
sta_LightType: '',
|
||||
sta_LightFreq: '',
|
||||
sta_LightDimmer: '',
|
||||
sta_system: ''
|
||||
|
||||
},
|
||||
dic: {
|
||||
SOS: [{
|
||||
@ -438,7 +438,7 @@
|
||||
these.formData.blename = f.name ? f.name : "Unname";
|
||||
these.formData.deviceName = device.deviceName;
|
||||
these.formData.img = device.devicePic;
|
||||
these.formData.bleStatu=false;
|
||||
these.formData.bleStatu = false;
|
||||
these.formData.deviceId = f.deviceId;
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||
these.formData.bleStatu = true;
|
||||
@ -510,7 +510,7 @@
|
||||
buttonBgColor: "#E03434",
|
||||
okCallback: () => {
|
||||
clearInterval(interval);
|
||||
|
||||
|
||||
this.sosSetting({
|
||||
val: val
|
||||
});
|
||||
@ -528,30 +528,30 @@
|
||||
return;
|
||||
}
|
||||
let task = () => {
|
||||
|
||||
|
||||
|
||||
var json = {
|
||||
ins_SOSType: this.formData.sta_SOSType==item.val?'sos_off':item.val
|
||||
ins_SOSType: this.formData.sta_SOSType == item.val ? 'sos_off' : item.val
|
||||
}
|
||||
json = JSON.stringify(json);
|
||||
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res=>{
|
||||
|
||||
if (this.formData.sta_SOSType === item.val) {
|
||||
this.formData.sta_SOSType = 'sos_off';
|
||||
} else {
|
||||
this.formData.sta_SOSType = item.val;
|
||||
}
|
||||
|
||||
if(this.formData.sta_SOSType=='sos'){
|
||||
this.formData.warnTime=0;
|
||||
clearInterval(interval);
|
||||
interval=setInterval(()=>{
|
||||
this.formData.warnTime+=1;
|
||||
},1000)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
|
||||
|
||||
if (this.formData.sta_SOSType === item.val) {
|
||||
this.formData.sta_SOSType = 'sos_off';
|
||||
} else {
|
||||
this.formData.sta_SOSType = item.val;
|
||||
}
|
||||
|
||||
if (this.formData.sta_SOSType == 'sos') {
|
||||
this.formData.warnTime = 0;
|
||||
clearInterval(interval);
|
||||
interval = setInterval(() => {
|
||||
this.formData.warnTime += 1;
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
.catch(ex => {
|
||||
this.showMsg(ex.msg);
|
||||
});
|
||||
@ -569,12 +569,12 @@
|
||||
});
|
||||
|
||||
} else {
|
||||
if(index!==undefined && this.formData.sta_SOSType=='sos'){
|
||||
if (index !== undefined && this.formData.sta_SOSType == 'sos') {
|
||||
this.showUnWarn(item.val);
|
||||
}else{
|
||||
task();
|
||||
} else {
|
||||
task();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -688,36 +688,58 @@
|
||||
return className;
|
||||
},
|
||||
bleValueNotify: function(receive, device, path, recArr) { //订阅消息
|
||||
if (receive.deviceId !== this.formData.deviceId) {
|
||||
return;
|
||||
}
|
||||
console.log("收到设备的数据", receive)
|
||||
let data = recei.ReceiveData(receive, device, pagePath, recArr);
|
||||
console.log("处理后的数据:", data);
|
||||
if (data) {
|
||||
let keys = Object.keys(data);
|
||||
keys.forEach(key => {
|
||||
if (key in this.formData) {
|
||||
this.formData[key] = data[key];
|
||||
let json = recei.ReceiveData(receive, device, pagePath, recArr);
|
||||
|
||||
|
||||
let key = 'sta_VoiceDate';
|
||||
if (key in json) {
|
||||
|
||||
let val = json[key];
|
||||
console.log("22222", val)
|
||||
if (val === 'start') {
|
||||
//开始发包
|
||||
|
||||
this.sendHex();
|
||||
return;
|
||||
} else if (val === 'finish') {
|
||||
|
||||
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: "发送完成"
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
//重新发送某一包
|
||||
|
||||
|
||||
|
||||
if (val > this.audioData.packetCtn) {
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
let msg = [];
|
||||
if (data.sta_SOSType == 'sos') {
|
||||
msg.push("设备声光报警中");
|
||||
}
|
||||
if (data.sta_PowerPercent <= 20) {
|
||||
msg.push("设备电量低");
|
||||
|
||||
this.sendHex(val);
|
||||
return;
|
||||
}
|
||||
if (msg.length) {
|
||||
msg = msg.join(",");
|
||||
this.showMsg(msg);
|
||||
}
|
||||
|
||||
these.setBleFormData();
|
||||
}
|
||||
|
||||
let keys = Object.keys(json);
|
||||
|
||||
keys.forEach(key => {
|
||||
if (key in this.formData) {
|
||||
this.formData[key] = json[key];
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
// // 转换为字节数组
|
||||
// const bytes = receive.bytes;
|
||||
// parseData(bytes);
|
||||
|
||||
|
||||
|
||||
@ -754,7 +776,7 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
buttonTextColor: '#232323de',
|
||||
okCallback: function() {
|
||||
|
||||
uni.navigateTo({
|
||||
@ -826,7 +848,7 @@
|
||||
}
|
||||
},
|
||||
showPop: function(option) {
|
||||
|
||||
hideLoading(this);
|
||||
let def = {
|
||||
showPop: true, //是否显示弹窗
|
||||
popType: 'custom',
|
||||
|
||||
Reference in New Issue
Block a user