修改App图标、名称、蓝牙加入断线重连
This commit is contained in:
40
App.vue
40
App.vue
@ -6,26 +6,26 @@
|
|||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
//以下代码仅在开发时使用,否则会出现不可预知的问题。
|
//以下代码仅在开发时使用,否则会出现不可预知的问题。
|
||||||
//清除登陆之外的所有信息;
|
//清除登陆之外的所有信息;
|
||||||
let store=uni.getStorageInfoSync();
|
// let store=uni.getStorageInfoSync();
|
||||||
store.keys.forEach((val,index,array)=>{
|
// store.keys.forEach((val,index,array)=>{
|
||||||
if(val=="tokenTime"){
|
// if(val=="tokenTime"){
|
||||||
let time=uni.getStorageSync(val);
|
// let time=uni.getStorageSync(val);
|
||||||
if(!time){
|
// if(!time){
|
||||||
time=0;
|
// time=0;
|
||||||
}
|
// }
|
||||||
let currTime=new Date().getTime();
|
// let currTime=new Date().getTime();
|
||||||
if(currTime>=time){
|
// if(currTime>=time){
|
||||||
uni.removeStorageSync(val);
|
// uni.removeStorageSync(val);
|
||||||
uni.removeStorageSync("token");
|
// uni.removeStorageSync("token");
|
||||||
uni.removeStorageSync("clientID");
|
// uni.removeStorageSync("clientID");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if(val=="token" || val=="clientID"){
|
// else if(val=="token" || val=="clientID"){
|
||||||
console.log("忽略登陆信息");
|
// console.log("忽略登陆信息");
|
||||||
}else{
|
// }else{
|
||||||
uni.removeStorageSync(val);
|
// uni.removeStorageSync(val);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
//以上代码仅在开发时使用,否则会出现不可预知的问题。
|
//以上代码仅在开发时使用,否则会出现不可预知的问题。
|
||||||
|
|
||||||
uni.getSystemInfo({success:function(res){
|
uni.getSystemInfo({success:function(res){
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
const config = {
|
const config = {
|
||||||
// 开发环境
|
// 开发环境
|
||||||
development: {
|
development: {
|
||||||
BASE_URL: 'http://192.168.110.54:8000',
|
BASE_URL: 'http://192.168.110.56:8000',
|
||||||
API_PREFIX: '',
|
API_PREFIX: '',
|
||||||
// MQTT 配置
|
// MQTT 配置
|
||||||
MQTT_HOST: '47.120.79.150',
|
MQTT_HOST: '47.120.79.150',
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name" : "JingQuan",
|
"name" : "星汉物联",
|
||||||
"appid" : "__UNI__A21EF43",
|
"appid" : "__UNI__A21EF43",
|
||||||
"description" : "设备管控",
|
"description" : "设备管控",
|
||||||
"versionName" : "1.0.24",
|
"versionName" : "1.0.24",
|
||||||
@ -21,7 +21,6 @@
|
|||||||
"Bluetooth" : {},
|
"Bluetooth" : {},
|
||||||
"Barcode" : {},
|
"Barcode" : {},
|
||||||
"Camera" : {},
|
"Camera" : {},
|
||||||
"Maps" : {},
|
|
||||||
"OAuth" : {},
|
"OAuth" : {},
|
||||||
"Geolocation" : {}
|
"Geolocation" : {}
|
||||||
},
|
},
|
||||||
|
|||||||
12
pages.json
12
pages.json
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"pages": [
|
"pages": [
|
||||||
|
// {
|
||||||
|
// "path": "pages/BlueTooth/ModeSetting/index",
|
||||||
|
// "style": {
|
||||||
|
// "navigationBarTitleText": "设备类型"
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
|
||||||
{
|
|
||||||
"path": "pages/BlueTooth/ModeSetting/index",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "设备类型"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "pages/common/login/index",
|
"path": "pages/common/login/index",
|
||||||
"style": {
|
"style": {
|
||||||
|
|||||||
@ -151,6 +151,11 @@
|
|||||||
hideLoading,
|
hideLoading,
|
||||||
updateLoading
|
updateLoading
|
||||||
} from '@/utils/loading.js'
|
} from '@/utils/loading.js'
|
||||||
|
import {
|
||||||
|
registerPersonInfo
|
||||||
|
} from '@/api/6170/deviceControl.js';
|
||||||
|
|
||||||
|
|
||||||
var ble = null;
|
var ble = null;
|
||||||
var these = null;
|
var these = null;
|
||||||
var BrighInteval = null;
|
var BrighInteval = null;
|
||||||
@ -228,7 +233,26 @@
|
|||||||
textLines: ['', '', ''],
|
textLines: ['', '', ''],
|
||||||
mode: ''
|
mode: ''
|
||||||
},
|
},
|
||||||
inteval: 200
|
inteval: 200,
|
||||||
|
device: {
|
||||||
|
id: "",
|
||||||
|
deviceName: "",
|
||||||
|
deviceImei: "",
|
||||||
|
deviceMac: "",
|
||||||
|
communicationMode: 0,
|
||||||
|
devicePic: "",
|
||||||
|
typeName: "",
|
||||||
|
bluetoothName: null,
|
||||||
|
deviceStatus: null,
|
||||||
|
bindingTime: "",
|
||||||
|
onlineStatus: 0,
|
||||||
|
battery: "0",
|
||||||
|
latitude: null,
|
||||||
|
longitude: null,
|
||||||
|
alarmStatus: null,
|
||||||
|
detailPageUrl: "/pages/6155/deviceDetail",
|
||||||
|
showConfirm: false
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -290,9 +314,10 @@
|
|||||||
|
|
||||||
|
|
||||||
let device = data.data;
|
let device = data.data;
|
||||||
|
these.device = device;
|
||||||
console.log("收到父页面的参数:" + JSON.stringify(device));
|
console.log("收到父页面的参数:" + JSON.stringify(device));
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = ble.data.LinkedList.find((v) => {
|
||||||
if (v.deviceId == device.deviceId) {
|
if (v.macAddress == device.deviceMac) {
|
||||||
console.log("找到设备了", v);
|
console.log("找到设备了", v);
|
||||||
these.formData.deviceId = v.deviceId;
|
these.formData.deviceId = v.deviceId;
|
||||||
return true;
|
return true;
|
||||||
@ -362,7 +387,7 @@
|
|||||||
// console.log("LinkedList=", ble.data.LinkedList);
|
// console.log("LinkedList=", ble.data.LinkedList);
|
||||||
// console.log("formData=", these.formData);
|
// console.log("formData=", these.formData);
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = ble.data.LinkedList.find((v) => {
|
||||||
return v.deviceId == these.formData.deviceId;
|
return v.macAddress == these.device.deviceMac;
|
||||||
});
|
});
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
@ -564,7 +589,9 @@
|
|||||||
|
|
||||||
these.showPop({
|
these.showPop({
|
||||||
message: "上传成功",
|
message: "上传成功",
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
|
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
|
||||||
|
borderColor : '#BBE600',
|
||||||
|
buttonBgColor : '#BBE600'
|
||||||
});
|
});
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
@ -592,8 +619,7 @@
|
|||||||
if (currentPacket == 7) {
|
if (currentPacket == 7) {
|
||||||
if (childPacket > 2 && childPacket < 9) {
|
if (childPacket > 2 && childPacket < 9) {
|
||||||
bufferSize = 496;
|
bufferSize = 496;
|
||||||
}
|
} else if (childPacket == 9) {
|
||||||
else if(childPacket==9){
|
|
||||||
bufferSize = 128;
|
bufferSize = 128;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -638,7 +664,8 @@
|
|||||||
|
|
||||||
let curr = childPacket + (currentPacket - 1) *
|
let curr = childPacket + (currentPacket - 1) *
|
||||||
totalChildPacket;
|
totalChildPacket;
|
||||||
console.log("第"+currentPacket+"大包,第"+childPacket+"小包发送完成,总计:"+curr);
|
console.log("第" + currentPacket + "大包,第" + childPacket +
|
||||||
|
"小包发送完成,总计:" + curr);
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: "正在发送" + curr + "/63"
|
text: "正在发送" + curr + "/63"
|
||||||
|
|
||||||
@ -1086,8 +1113,26 @@ if(!result){
|
|||||||
if (flag) {
|
if (flag) {
|
||||||
console.log("发送成功");
|
console.log("发送成功");
|
||||||
this.showPop({
|
this.showPop({
|
||||||
message: "发送成功"
|
message: "发送成功",
|
||||||
|
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
|
||||||
|
borderColor : '#BBE600',
|
||||||
|
buttonBgColor : '#BBE600'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// let formdata = {
|
||||||
|
// code:"",
|
||||||
|
// name: these.formData.textLines[2],
|
||||||
|
// position: these.formData.textLines[1],
|
||||||
|
// unitName: these.formData.textLines[0],
|
||||||
|
// deviceId: these.device.id,
|
||||||
|
// deviceImei: these.device.deviceImei
|
||||||
|
// };
|
||||||
|
// registerPersonInfo(formdata).then(res=>{
|
||||||
|
// console.log("res=",res);
|
||||||
|
// }).catch(ex=>{
|
||||||
|
// console.log("ex=",ex);
|
||||||
|
// });
|
||||||
} else {
|
} else {
|
||||||
this.showPop({
|
this.showPop({
|
||||||
message: "出现异常发送失败",
|
message: "出现异常发送失败",
|
||||||
|
|||||||
@ -173,6 +173,11 @@
|
|||||||
hideLoading,
|
hideLoading,
|
||||||
updateLoading
|
updateLoading
|
||||||
} from '@/utils/loading.js'
|
} from '@/utils/loading.js'
|
||||||
|
import {request,baseURL} from '../../utils/request';
|
||||||
|
import {
|
||||||
|
registerPersonInfo
|
||||||
|
} from '@/api/6170/deviceControl.js';
|
||||||
|
|
||||||
const pagePath = "pages/650/HBY650";
|
const pagePath = "pages/650/HBY650";
|
||||||
var ble = null;
|
var ble = null;
|
||||||
var these = null;
|
var these = null;
|
||||||
@ -259,7 +264,26 @@
|
|||||||
iswarn: false
|
iswarn: false
|
||||||
},
|
},
|
||||||
rgb565Data: [],
|
rgb565Data: [],
|
||||||
videoHexArray: []
|
videoHexArray: [],
|
||||||
|
device: {
|
||||||
|
id: "",
|
||||||
|
deviceName: "",
|
||||||
|
deviceImei: "",
|
||||||
|
deviceMac: "",
|
||||||
|
communicationMode: 0,
|
||||||
|
devicePic: "",
|
||||||
|
typeName: "",
|
||||||
|
bluetoothName: null,
|
||||||
|
deviceStatus: null,
|
||||||
|
bindingTime: "",
|
||||||
|
onlineStatus: 0,
|
||||||
|
battery: "0",
|
||||||
|
latitude: null,
|
||||||
|
longitude: null,
|
||||||
|
alarmStatus: null,
|
||||||
|
detailPageUrl: "/pages/650/HBY650",
|
||||||
|
showConfirm: false
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -278,7 +302,7 @@
|
|||||||
|
|
||||||
console.log("收到父页面的参数:" + JSON.stringify(data));
|
console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||||
var device = data.data;
|
var device = data.data;
|
||||||
|
these.device=device;
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = ble.data.LinkedList.find((v) => {
|
||||||
if (v.macAddress == device.deviceMac) {
|
if (v.macAddress == device.deviceMac) {
|
||||||
console.log("找到设备了", v);
|
console.log("找到设备了", v);
|
||||||
@ -374,9 +398,9 @@
|
|||||||
return className;
|
return className;
|
||||||
},
|
},
|
||||||
bleValueNotify: function(receive, device, path) { //订阅消息
|
bleValueNotify: function(receive, device, path) { //订阅消息
|
||||||
|
|
||||||
let data = recei.ReceiveData(receive, device, pagePath);
|
|
||||||
console.log("收到设备的数据", data)
|
console.log("收到设备的数据", data)
|
||||||
|
let data = recei.ReceiveData(receive, device, pagePath);
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
if ("staBlue_picture" in data) {
|
if ("staBlue_picture" in data) {
|
||||||
//重发图片
|
//重发图片
|
||||||
@ -434,7 +458,7 @@ console.log("收到设备的数据",data)
|
|||||||
// console.log("LinkedList=", ble.data.LinkedList);
|
// console.log("LinkedList=", ble.data.LinkedList);
|
||||||
// console.log("formData=", these.formData);
|
// console.log("formData=", these.formData);
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = ble.data.LinkedList.find((v) => {
|
||||||
return v.deviceId == these.formData.deviceId;
|
return v.macAddress == these.device.deviceMac;
|
||||||
});
|
});
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
@ -607,7 +631,8 @@ console.log("收到设备的数据",data)
|
|||||||
});
|
});
|
||||||
if (!ReSendNo) {
|
if (!ReSendNo) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
these.HoldYouHand("transmit complete", 0, f.deviceId, f
|
these.HoldYouHand("transmit complete", 0, f
|
||||||
|
.deviceId, f
|
||||||
.writeServiceId, f.wirteCharactId);
|
.writeServiceId, f.wirteCharactId);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
@ -775,8 +800,10 @@ console.log("收到设备的数据",data)
|
|||||||
if (currentPacket > totalPackets) {
|
if (currentPacket > totalPackets) {
|
||||||
if (!ReSendNo) {
|
if (!ReSendNo) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
these.HoldYouHand("transmit complete", 0, f.deviceId, f
|
these.HoldYouHand("transmit complete", 0, f
|
||||||
.writeServiceId, f.wirteCharactId).then(()=>{
|
.deviceId, f
|
||||||
|
.writeServiceId, f.wirteCharactId).then(
|
||||||
|
() => {
|
||||||
console.log("全部发送完毕")
|
console.log("全部发送完毕")
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
console.log("出现异常", ex);
|
console.log("出现异常", ex);
|
||||||
@ -902,13 +929,28 @@ console.log("收到设备的数据",data)
|
|||||||
let p1 = these.HoldYouHand("video transmit start", 2200, f.deviceId, f.writeServiceId,
|
let p1 = these.HoldYouHand("video transmit start", 2200, f.deviceId, f.writeServiceId,
|
||||||
f.wirteCharactId);
|
f.wirteCharactId);
|
||||||
let p2 = new Promise((succ, err) => {
|
let p2 = new Promise((succ, err) => {
|
||||||
|
|
||||||
|
const token = uni.getStorageSync('token');
|
||||||
|
const clientid = uni.getStorageSync('clientID');
|
||||||
|
if (!token) {
|
||||||
|
err({
|
||||||
|
code: 401,
|
||||||
|
msg: "请先登陆后再试"
|
||||||
|
});
|
||||||
|
hideLoading(these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: 'http://114.55.111.217/video/upload',
|
// url: 'http://114.55.111.217/video/upload',
|
||||||
|
url: baseURL+"app/video/upload",
|
||||||
filePath: videoPath,
|
filePath: videoPath,
|
||||||
name: 'file',
|
name: 'file',
|
||||||
header: {
|
header: {
|
||||||
"Method": "POST",
|
"Method": "POST",
|
||||||
"Content-Type": "multipart/form-data"
|
"Content-Type": "multipart/form-data",
|
||||||
|
"Authorization": 'Bearer ' + token,
|
||||||
|
"clientid": clientid
|
||||||
},
|
},
|
||||||
timeout: 600000,
|
timeout: 600000,
|
||||||
fail: (ex) => {
|
fail: (ex) => {
|
||||||
@ -1131,7 +1173,8 @@ console.log("收到设备的数据",data)
|
|||||||
if (currentPacket > totalPackets) {
|
if (currentPacket > totalPackets) {
|
||||||
if (!ReSendNo) {
|
if (!ReSendNo) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
these.HoldYouHand("transmit complete", 0, f.deviceId, f.writeServiceId, f
|
these.HoldYouHand("transmit complete", 0, f.deviceId, f
|
||||||
|
.writeServiceId, f
|
||||||
.wirteCharactId);
|
.wirteCharactId);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
@ -1155,6 +1198,16 @@ console.log("收到设备的数据",data)
|
|||||||
visibleClose: true
|
visibleClose: true
|
||||||
});
|
});
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
|
|
||||||
|
// let formdata = {
|
||||||
|
// code: these.formData.id,
|
||||||
|
// name: these.formData.name,
|
||||||
|
// position: these.formData.job,
|
||||||
|
// unitName: these.formData.company,
|
||||||
|
// deviceId: these.device.id,
|
||||||
|
// deviceImei: these.device.deviceImei
|
||||||
|
// };
|
||||||
|
// registerPersonInfo(formdata);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1261,6 +1314,7 @@ console.log("收到设备的数据",data)
|
|||||||
}
|
}
|
||||||
console.log("开始握手");
|
console.log("开始握手");
|
||||||
|
|
||||||
|
let send = () => {
|
||||||
ble.sendData(deviceid, buffer, serviceid, characid, 10).then(
|
ble.sendData(deviceid, buffer, serviceid, characid, 10).then(
|
||||||
() => {
|
() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -1268,9 +1322,18 @@ console.log("收到设备的数据",data)
|
|||||||
resolve(true);
|
resolve(true);
|
||||||
}, pauseTime);
|
}, pauseTime);
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log("握手没有成功", )
|
if (err.code == 10007) {
|
||||||
|
send();
|
||||||
|
} else {
|
||||||
|
console.log("握手没有成功", err)
|
||||||
reject(err);
|
reject(err);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
send();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -249,6 +249,14 @@
|
|||||||
hideLoading,
|
hideLoading,
|
||||||
updateLoading
|
updateLoading
|
||||||
} from '@/utils/loading.js'
|
} from '@/utils/loading.js'
|
||||||
|
import {
|
||||||
|
request,
|
||||||
|
baseURL
|
||||||
|
} from '../../utils/request';
|
||||||
|
import {
|
||||||
|
registerPersonInfo
|
||||||
|
} from '@/api/6170/deviceControl.js';
|
||||||
|
|
||||||
const pagePath = "pages/650/HBY650";
|
const pagePath = "pages/650/HBY650";
|
||||||
var ble = null;
|
var ble = null;
|
||||||
var these = null;
|
var these = null;
|
||||||
@ -699,10 +707,10 @@
|
|||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
|
|
||||||
// console.log("LinkedList=", ble.data.LinkedList);
|
console.log("LinkedList=", ble.data.LinkedList);
|
||||||
// console.log("formData=", these.formData);
|
console.log("this.device=", this.device);
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = ble.data.LinkedList.find((v) => {
|
||||||
return v.deviceId == these.formData.deviceId;
|
return v.macAddress == these.device.deviceMac;
|
||||||
});
|
});
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
@ -876,17 +884,18 @@
|
|||||||
dataView.setUint8(3, 0x00); // 数据长度
|
dataView.setUint8(3, 0x00); // 数据长度
|
||||||
dataView.setUint8(4, 0x01); // 数据长度
|
dataView.setUint8(4, 0x01); // 数据长度
|
||||||
dataView.setUint8(5, 0x68);
|
dataView.setUint8(5, 0x68);
|
||||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10).then(()=>{
|
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10)
|
||||||
|
.then(() => {
|
||||||
console.log("成功");
|
console.log("成功");
|
||||||
});
|
});
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
closeSOS();
|
closeSOS();
|
||||||
closeWarn();
|
// closeWarn();
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
closeSOS();
|
closeSOS();
|
||||||
closeWarn();
|
// closeWarn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -972,21 +981,21 @@
|
|||||||
() => {
|
() => {
|
||||||
console.log("蓝牙发送成功了");
|
console.log("蓝牙发送成功了");
|
||||||
|
|
||||||
dic = {
|
// dic = {
|
||||||
close: 0x71
|
// close: 0x71
|
||||||
}
|
// }
|
||||||
if (type in dic) {
|
// if (type in dic) {
|
||||||
dataView.setUint8(1, 0x06); // 帧类型
|
// dataView.setUint8(1, 0x06); // 帧类型
|
||||||
dataView.setUint8(5, 0x71); // 数据
|
// dataView.setUint8(5, 0x71); // 数据
|
||||||
|
|
||||||
} else {
|
// } else {
|
||||||
dataView.setUint8(1, 0x06); // 帧类型
|
// dataView.setUint8(1, 0x06); // 帧类型
|
||||||
dataView.setUint8(5, 0x70); // 数据
|
// dataView.setUint8(5, 0x70); // 数据
|
||||||
}
|
// }
|
||||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId,
|
// ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId,
|
||||||
10).then(() => {
|
// 10).then(() => {
|
||||||
console.log("蓝牙发送报警成功", type);
|
// console.log("蓝牙发送报警成功", type);
|
||||||
})
|
// })
|
||||||
|
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
@ -1012,16 +1021,28 @@
|
|||||||
okCallback: function() {
|
okCallback: function() {
|
||||||
these.formData.qzwarn = true;
|
these.formData.qzwarn = true;
|
||||||
|
|
||||||
these.Status.staticWarn.time = 5;
|
these.Status.staticWarn.time = 180;
|
||||||
these.Status.staticWarn.inteval = setInterval(() => {
|
|
||||||
|
|
||||||
|
let loopFunc = () => {
|
||||||
|
if (these.Status.staticWarn.inteval === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (these.Status.staticWarn.time === 0) {
|
if (these.Status.staticWarn.time === 0) {
|
||||||
|
console.log("111111");
|
||||||
|
|
||||||
clearInterval(these.Status.staticWarn.inteval);
|
clearInterval(these.Status.staticWarn.inteval);
|
||||||
|
these.Status.staticWarn.inteval = null;
|
||||||
these.formData.qzwarn = false;
|
these.formData.qzwarn = false;
|
||||||
|
these.formData.SOS = 'close';
|
||||||
these.CloseWarn(false);
|
these.CloseWarn(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
these.Status.staticWarn.time = these.Status.staticWarn
|
these.Status.staticWarn.time = these.Status.staticWarn
|
||||||
.time - 1;
|
.time - 1;
|
||||||
|
}
|
||||||
|
these.Status.staticWarn.inteval = setInterval(() => {
|
||||||
|
loopFunc();
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
||||||
SendCmd();
|
SendCmd();
|
||||||
@ -1101,8 +1122,14 @@
|
|||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
//使用4G发送
|
//使用4G发送
|
||||||
|
if (ex.code == 10007) {
|
||||||
|
console.log("蓝牙发送失败,正在重试");
|
||||||
|
task();
|
||||||
|
} else {
|
||||||
console.log("蓝牙发送失败,转4g发送", ex);
|
console.log("蓝牙发送失败,转4g发送", ex);
|
||||||
requestSend();
|
requestSend();
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log("找不到蓝牙设备,使用4G发送")
|
console.log("找不到蓝牙设备,使用4G发送")
|
||||||
@ -1437,6 +1464,8 @@
|
|||||||
dataView.setUint8(6 + i, '0x' + packetData[i]);
|
dataView.setUint8(6 + i, '0x' + packetData[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let inteval = 30;
|
let inteval = 30;
|
||||||
console.log("开始发送一段视频"); //
|
console.log("开始发送一段视频"); //
|
||||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f
|
ble.sendData(f.deviceId, buffer, f.writeServiceId, f
|
||||||
@ -1487,6 +1516,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var sendVideo = (videoPath) => {
|
var sendVideo = (videoPath) => {
|
||||||
|
|
||||||
|
let f = these.getDevice();
|
||||||
|
if (!f) {
|
||||||
|
these.showPop({
|
||||||
|
message: "蓝牙未连接,请连接后再试",
|
||||||
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
|
borderColor: "#e034344d",
|
||||||
|
buttonBgColor: "#E03434",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
let uploadVideo = () => {
|
let uploadVideo = () => {
|
||||||
|
|
||||||
if (these.videoHexArray.length > 0) {
|
if (these.videoHexArray.length > 0) {
|
||||||
@ -1495,7 +1535,9 @@
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
console.log("开始处理,正在上传");
|
console.log("开始处理,正在上传", f);
|
||||||
|
const token = uni.getStorageSync('token');
|
||||||
|
const clientid = uni.getStorageSync('clientID');
|
||||||
|
|
||||||
showLoading(these, {
|
showLoading(these, {
|
||||||
text: "上传中"
|
text: "上传中"
|
||||||
@ -1503,13 +1545,25 @@
|
|||||||
let p1 = these.HoldYouHand("video transmit start", 2200, f.deviceId, f.writeServiceId,
|
let p1 = these.HoldYouHand("video transmit start", 2200, f.deviceId, f.writeServiceId,
|
||||||
f.wirteCharactId);
|
f.wirteCharactId);
|
||||||
let p2 = new Promise((succ, err) => {
|
let p2 = new Promise((succ, err) => {
|
||||||
|
if (!token) {
|
||||||
|
err({
|
||||||
|
code: 401,
|
||||||
|
msg: "请先登陆后再试"
|
||||||
|
});
|
||||||
|
hideLoading(these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log("baseURL=", baseURL);
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: 'http://114.55.111.217/video/upload',
|
// url: 'http://114.55.111.217/video/upload',
|
||||||
|
url: baseURL + "/app/video/upload",
|
||||||
filePath: videoPath,
|
filePath: videoPath,
|
||||||
name: 'file',
|
name: 'file',
|
||||||
header: {
|
header: {
|
||||||
"Method": "POST",
|
"Method": "POST",
|
||||||
"Content-Type": "multipart/form-data"
|
"Content-Type": "multipart/form-data",
|
||||||
|
"Authorization": 'Bearer ' + token,
|
||||||
|
"clientid": clientid
|
||||||
},
|
},
|
||||||
timeout: 600000,
|
timeout: 600000,
|
||||||
fail: (ex) => {
|
fail: (ex) => {
|
||||||
@ -1564,7 +1618,7 @@
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
let f = these.getDevice();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1818,6 +1872,17 @@
|
|||||||
});
|
});
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
|
|
||||||
|
|
||||||
|
// let formdata = {
|
||||||
|
// code: these.formData.usrid,
|
||||||
|
// name: these.formData.usrname,
|
||||||
|
// position: these.formData.job,
|
||||||
|
// unitName: these.formData.company,
|
||||||
|
// deviceId: these.device.id,
|
||||||
|
// deviceImei: these.device.deviceImei
|
||||||
|
// };
|
||||||
|
// registerPersonInfo(formdata);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -125,7 +125,8 @@
|
|||||||
let start = new Date();
|
let start = new Date();
|
||||||
console.log("Common.baseURL=" + Common.baseURL);
|
console.log("Common.baseURL=" + Common.baseURL);
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: Common.baseURL + 'video/upload',
|
// url: Common.baseURL + 'video/upload',
|
||||||
|
url:'http://192.168.110.56:8000/app/video/upload',
|
||||||
filePath: this.videoPath,
|
filePath: this.videoPath,
|
||||||
name: 'file',
|
name: 'file',
|
||||||
header: {
|
header: {
|
||||||
|
|||||||
@ -40,6 +40,7 @@
|
|||||||
var these = null;
|
var these = null;
|
||||||
var eventChannel = null;
|
var eventChannel = null;
|
||||||
var ble = null;
|
var ble = null;
|
||||||
|
var timeInteval = null;
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -57,7 +58,8 @@
|
|||||||
],
|
],
|
||||||
"linkStatu": false,
|
"linkStatu": false,
|
||||||
"macAddress": ""
|
"macAddress": ""
|
||||||
}
|
},
|
||||||
|
serverDevice:null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -121,10 +123,15 @@
|
|||||||
console.log("未获取到设备");
|
console.log("未获取到设备");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let inteval = setInterval(this.initDevice, 5000);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
initDevice: function() {
|
initDevice: function() {
|
||||||
|
clearTimeout(timeInteval);
|
||||||
|
|
||||||
|
timeInteval = setTimeout(() => {
|
||||||
showLoading(these, {
|
showLoading(these, {
|
||||||
text: '正在获取设备信息'
|
text: '正在获取设备信息'
|
||||||
});
|
});
|
||||||
@ -139,13 +146,17 @@
|
|||||||
console.log("获取设备信息", res);
|
console.log("获取设备信息", res);
|
||||||
if (res && res.code == 200) {
|
if (res && res.code == 200) {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
|
this.serverDevice=data;
|
||||||
if (data) {
|
if (data) {
|
||||||
let keys = Object.keys(data);
|
let keys = Object.keys(data);
|
||||||
ble.data.LinkedList.find((v) => {
|
ble.data.LinkedList.find((v) => {
|
||||||
if (v.deviceId == these.device.deviceId) {
|
if (v.deviceId == these.device.deviceId) {
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (var i = 0; i < keys.length; i++) {
|
||||||
let key = keys[i];
|
// let key = keys[i];
|
||||||
v[key] = data[key];
|
// if(!v.device){
|
||||||
|
// v.device={};
|
||||||
|
// }
|
||||||
|
// v.device[key] = data[key];
|
||||||
// console.log("key="+key);
|
// console.log("key="+key);
|
||||||
// console.log("value="+data[key]);
|
// console.log("value="+data[key]);
|
||||||
|
|
||||||
@ -154,7 +165,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ble.setBleData();
|
// ble.setBleData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -170,6 +181,9 @@
|
|||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}, 500);
|
||||||
|
|
||||||
},
|
},
|
||||||
Link() {
|
Link() {
|
||||||
// 调用绑定设备接口
|
// 调用绑定设备接口
|
||||||
@ -207,6 +221,21 @@
|
|||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
these.Statu.bound = true;
|
these.Statu.bound = true;
|
||||||
these.Statu.boundRemark = "设备绑定成功!";
|
these.Statu.boundRemark = "设备绑定成功!";
|
||||||
|
|
||||||
|
ble.data.LinkedList.find((v) => {
|
||||||
|
if (v.deviceId == these.device.deviceId) {
|
||||||
|
for (var i = 0; i < keys.length; i++) {
|
||||||
|
let key = keys[i];
|
||||||
|
if(!v.device){
|
||||||
|
v.device={};
|
||||||
|
}
|
||||||
|
v.device[key] = data[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
ble.setBleData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ble.removeReceiveCallback(pagePath);
|
ble.removeReceiveCallback(pagePath);
|
||||||
|
|
||||||
uni.$emit("refreshDeviceList");
|
uni.$emit("refreshDeviceList");
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
var isReady=false;var onReadyCallbacks=[];
|
var isReady=false;var onReadyCallbacks=[];
|
||||||
var isServiceReady=false;var onServiceReadyCallbacks=[];
|
var isServiceReady=false;var onServiceReadyCallbacks=[];
|
||||||
var __uniConfig = {"pages":["pages/BlueTooth/ModeSetting/index","pages/common/login/index","pages/common/index/index","pages/common/user/index","pages/common/scan/scan","pages/common/qrcode/qrcode","pages/common/send/index","pages/common/userAgreement/index","pages/common/privacyAgreement/index","pages/common/aboutUs/index","pages/6170/deviceControl/index","pages/6170/callPolice/index","pages/210/deviceControl/index","pages/common/operationVideo/index","pages/common/addvideo/index","pages/common/operatingInstruct/index","pages/common/productDes/index","pages/common/addBLE/addEquip","pages/common/addBLE/LinkBle","pages/6155/deviceDetail","pages/6155/ImgCrop","pages/common/map/index","pages/common/allType/index","pages/6170/allShare/index","pages/6170/share/index","pages/6170/shareDevices/index","pages/6170/shareManagement/index","pages/210/onlineDevice/index","pages/210/addDevice/index","pages/210/historyRecords/index","pages/210/call/index","pages/BlueTooth/ModeSetting/VideoSend","pages/BlueTooth/ModeSetting/VideoSend_1","pages/BlueTooth/ModeSetting/VideoSend_670","pages/BlueTooth/ModeSetting/HBY650","pages/BlueTooth/ModeSetting/HBY650_1","pages/BlueTooth/ModeSetting/ModeSetting","pages/BlueTooth/ModeSetting/update","pages/BlueTooth/ModeSetting/HBY6155","pages/BlueTooth/ModeSetting/HBY6155V1","pages/BlueTooth/ModeSetting/HBY670V1","pages/670/HBY670","pages/650/HBY650","pages/670/History","pages/BlueTooth/ModeSetting/4877"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#121212","backgroundColor":"#121212"},"tabBar":{"color":"#fff","selectedColor":"#BBE600","backgroundColor":"#202020","list":[{"pagePath":"pages/common/index/index","text":"我的设备","iconPath":"/static/tabs/device.png","selectedIconPath":"/static/tabs/device-HL.png"},{"pagePath":"pages/common/user/index","text":"我的","iconPath":"/static/tabs/my.png","selectedIconPath":"/static/tabs/my-HL.png"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"JingQuan","compilerVersion":"4.75","entryPagePath":"pages/BlueTooth/ModeSetting/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
var __uniConfig = {"pages":["pages/common/login/index","pages/common/index/index","pages/common/user/index","pages/common/scan/scan","pages/common/qrcode/qrcode","pages/common/send/index","pages/common/userAgreement/index","pages/common/privacyAgreement/index","pages/common/aboutUs/index","pages/6170/deviceControl/index","pages/6170/callPolice/index","pages/210/deviceControl/index","pages/common/operationVideo/index","pages/common/addvideo/index","pages/common/operatingInstruct/index","pages/common/productDes/index","pages/common/addBLE/addEquip","pages/common/addBLE/LinkBle","pages/6155/deviceDetail","pages/6155/ImgCrop","pages/common/map/index","pages/common/allType/index","pages/6170/allShare/index","pages/6170/share/index","pages/6170/shareDevices/index","pages/6170/shareManagement/index","pages/210/onlineDevice/index","pages/210/addDevice/index","pages/210/historyRecords/index","pages/210/call/index","pages/BlueTooth/ModeSetting/VideoSend","pages/BlueTooth/ModeSetting/VideoSend_1","pages/BlueTooth/ModeSetting/VideoSend_670","pages/BlueTooth/ModeSetting/HBY650","pages/BlueTooth/ModeSetting/HBY650_1","pages/BlueTooth/ModeSetting/ModeSetting","pages/BlueTooth/ModeSetting/update","pages/BlueTooth/ModeSetting/HBY6155","pages/BlueTooth/ModeSetting/HBY6155V1","pages/BlueTooth/ModeSetting/HBY670V1","pages/670/HBY670","pages/650/HBY650","pages/670/History","pages/BlueTooth/ModeSetting/4877"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#121212","backgroundColor":"#121212"},"tabBar":{"color":"#fff","selectedColor":"#BBE600","backgroundColor":"#202020","list":[{"pagePath":"pages/common/index/index","text":"我的设备","iconPath":"/static/tabs/device.png","selectedIconPath":"/static/tabs/device-HL.png"},{"pagePath":"pages/common/user/index","text":"我的","iconPath":"/static/tabs/my.png","selectedIconPath":"/static/tabs/my-HL.png"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"星汉物联","compilerVersion":"4.75","entryPagePath":"pages/common/login/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
||||||
var __uniRoutes = [{"path":"/pages/BlueTooth/ModeSetting/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"设备类型"}},{"path":"/pages/common/login/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom","enablePullDownRefresh":true}},{"path":"/pages/common/user/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的"}},{"path":"/pages/common/scan/scan","meta":{},"window":{"navigationBarTitleText":"扫描"}},{"path":"/pages/common/qrcode/qrcode","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/common/send/index","meta":{},"window":{"navigationBarTitleText":"发送信息","enablePullDownRefresh":true}},{"path":"/pages/common/userAgreement/index","meta":{},"window":{"navigationBarTitleText":"用户协议"}},{"path":"/pages/common/privacyAgreement/index","meta":{},"window":{"navigationBarTitleText":"隐私协议"}},{"path":"/pages/common/aboutUs/index","meta":{},"window":{"navigationBarTitleText":"关于我们"}},{"path":"/pages/6170/deviceControl/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/6170/callPolice/index","meta":{},"window":{"navigationBarTitleText":"报警","enablePullDownRefresh":true}},{"path":"/pages/210/deviceControl/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operationVideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addvideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operatingInstruct/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/productDes/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addBLE/addEquip","meta":{},"window":{"navigationBarTitleText":"添加设备"}},{"path":"/pages/common/addBLE/LinkBle","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/6155/deviceDetail","meta":{},"window":{"navigationBarTitleText":"HBY 6155"}},{"path":"/pages/6155/ImgCrop","meta":{},"window":{"navigationBarTitleText":"图像裁剪","navigationStyle":"custom","fullscreen":true}},{"path":"/pages/common/map/index","meta":{},"window":{"navigationBarTitleText":"地图"}},{"path":"/pages/common/allType/index","meta":{},"window":{"navigationBarTitleText":"所有类型"}},{"path":"/pages/6170/allShare/index","meta":{},"window":{"navigationBarTitleText":"所有分享"}},{"path":"/pages/6170/share/index","meta":{},"window":{"navigationBarTitleText":"分享"}},{"path":"/pages/6170/shareDevices/index","meta":{},"window":{"navigationBarTitleText":"分享设备"}},{"path":"/pages/6170/shareManagement/index","meta":{},"window":{"navigationBarTitleText":"分享管理"}},{"path":"/pages/210/onlineDevice/index","meta":{},"window":{"navigationBarTitleText":"联机设备"}},{"path":"/pages/210/addDevice/index","meta":{},"window":{"navigationBarTitleText":"添加联机设备"}},{"path":"/pages/210/historyRecords/index","meta":{},"window":{"navigationBarTitleText":"历史记录"}},{"path":"/pages/210/call/index","meta":{},"window":{"navigationBarTitleText":"呼叫"}},{"path":"/pages/BlueTooth/ModeSetting/VideoSend","meta":{},"window":{"navigationBarTitleText":"发送视频"}},{"path":"/pages/BlueTooth/ModeSetting/VideoSend_1","meta":{},"window":{"navigationBarTitleText":"发送视频"}},{"path":"/pages/BlueTooth/ModeSetting/VideoSend_670","meta":{},"window":{"navigationBarTitleText":"发送视频"}},{"path":"/pages/BlueTooth/ModeSetting/HBY650","meta":{},"window":{"navigationBarTitleText":"HBY650"}},{"path":"/pages/BlueTooth/ModeSetting/HBY650_1","meta":{},"window":{"navigationBarTitleText":"HBY650"}},{"path":"/pages/BlueTooth/ModeSetting/ModeSetting","meta":{},"window":{"navigationBarTitleText":"7307-0.96TFT"}},{"path":"/pages/BlueTooth/ModeSetting/update","meta":{},"window":{"navigationBarTitleText":"版本更新"}},{"path":"/pages/BlueTooth/ModeSetting/HBY6155","meta":{},"window":{"navigationBarTitleText":"HBY6155"}},{"path":"/pages/BlueTooth/ModeSetting/HBY6155V1","meta":{},"window":{"navigationBarTitleText":"HBY6155_V1"}},{"path":"/pages/BlueTooth/ModeSetting/HBY670V1","meta":{},"window":{"navigationBarTitleText":"HBY670"}},{"path":"/pages/670/HBY670","meta":{},"window":{"navigationBarTitleText":"HBY670","navigationStyle":"custom"}},{"path":"/pages/650/HBY650","meta":{},"window":{"navigationBarTitleText":"HBY650"}},{"path":"/pages/670/History","meta":{},"window":{"navigationBarTitleText":"历史记录"}},{"path":"/pages/BlueTooth/ModeSetting/4877","meta":{},"window":{"navigationBarTitleText":""}}];
|
var __uniRoutes = [{"path":"/pages/common/login/index","meta":{"isQuit":true},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom","enablePullDownRefresh":true}},{"path":"/pages/common/user/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的"}},{"path":"/pages/common/scan/scan","meta":{},"window":{"navigationBarTitleText":"扫描"}},{"path":"/pages/common/qrcode/qrcode","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/common/send/index","meta":{},"window":{"navigationBarTitleText":"发送信息","enablePullDownRefresh":true}},{"path":"/pages/common/userAgreement/index","meta":{},"window":{"navigationBarTitleText":"用户协议"}},{"path":"/pages/common/privacyAgreement/index","meta":{},"window":{"navigationBarTitleText":"隐私协议"}},{"path":"/pages/common/aboutUs/index","meta":{},"window":{"navigationBarTitleText":"关于我们"}},{"path":"/pages/6170/deviceControl/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/6170/callPolice/index","meta":{},"window":{"navigationBarTitleText":"报警","enablePullDownRefresh":true}},{"path":"/pages/210/deviceControl/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operationVideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addvideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operatingInstruct/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/productDes/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addBLE/addEquip","meta":{},"window":{"navigationBarTitleText":"添加设备"}},{"path":"/pages/common/addBLE/LinkBle","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/6155/deviceDetail","meta":{},"window":{"navigationBarTitleText":"HBY 6155"}},{"path":"/pages/6155/ImgCrop","meta":{},"window":{"navigationBarTitleText":"图像裁剪","navigationStyle":"custom","fullscreen":true}},{"path":"/pages/common/map/index","meta":{},"window":{"navigationBarTitleText":"地图"}},{"path":"/pages/common/allType/index","meta":{},"window":{"navigationBarTitleText":"所有类型"}},{"path":"/pages/6170/allShare/index","meta":{},"window":{"navigationBarTitleText":"所有分享"}},{"path":"/pages/6170/share/index","meta":{},"window":{"navigationBarTitleText":"分享"}},{"path":"/pages/6170/shareDevices/index","meta":{},"window":{"navigationBarTitleText":"分享设备"}},{"path":"/pages/6170/shareManagement/index","meta":{},"window":{"navigationBarTitleText":"分享管理"}},{"path":"/pages/210/onlineDevice/index","meta":{},"window":{"navigationBarTitleText":"联机设备"}},{"path":"/pages/210/addDevice/index","meta":{},"window":{"navigationBarTitleText":"添加联机设备"}},{"path":"/pages/210/historyRecords/index","meta":{},"window":{"navigationBarTitleText":"历史记录"}},{"path":"/pages/210/call/index","meta":{},"window":{"navigationBarTitleText":"呼叫"}},{"path":"/pages/BlueTooth/ModeSetting/VideoSend","meta":{},"window":{"navigationBarTitleText":"发送视频"}},{"path":"/pages/BlueTooth/ModeSetting/VideoSend_1","meta":{},"window":{"navigationBarTitleText":"发送视频"}},{"path":"/pages/BlueTooth/ModeSetting/VideoSend_670","meta":{},"window":{"navigationBarTitleText":"发送视频"}},{"path":"/pages/BlueTooth/ModeSetting/HBY650","meta":{},"window":{"navigationBarTitleText":"HBY650"}},{"path":"/pages/BlueTooth/ModeSetting/HBY650_1","meta":{},"window":{"navigationBarTitleText":"HBY650"}},{"path":"/pages/BlueTooth/ModeSetting/ModeSetting","meta":{},"window":{"navigationBarTitleText":"7307-0.96TFT"}},{"path":"/pages/BlueTooth/ModeSetting/update","meta":{},"window":{"navigationBarTitleText":"版本更新"}},{"path":"/pages/BlueTooth/ModeSetting/HBY6155","meta":{},"window":{"navigationBarTitleText":"HBY6155"}},{"path":"/pages/BlueTooth/ModeSetting/HBY6155V1","meta":{},"window":{"navigationBarTitleText":"HBY6155_V1"}},{"path":"/pages/BlueTooth/ModeSetting/HBY670V1","meta":{},"window":{"navigationBarTitleText":"HBY670"}},{"path":"/pages/670/HBY670","meta":{},"window":{"navigationBarTitleText":"HBY670","navigationStyle":"custom"}},{"path":"/pages/650/HBY650","meta":{},"window":{"navigationBarTitleText":"HBY650"}},{"path":"/pages/670/History","meta":{},"window":{"navigationBarTitleText":"历史记录"}},{"path":"/pages/BlueTooth/ModeSetting/4877","meta":{},"window":{"navigationBarTitleText":""}}];
|
||||||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
|
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
|
||||||
|
|||||||
2391
unpackage/dist/dev/app-plus/app-service.js
vendored
2391
unpackage/dist/dev/app-plus/app-service.js
vendored
File diff suppressed because one or more lines are too long
3831
unpackage/dist/dev/app-plus/app-view.js
vendored
3831
unpackage/dist/dev/app-plus/app-view.js
vendored
File diff suppressed because one or more lines are too long
2
unpackage/dist/dev/app-plus/manifest.json
vendored
2
unpackage/dist/dev/app-plus/manifest.json
vendored
File diff suppressed because one or more lines are too long
@ -105,15 +105,18 @@ class BleHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
linkAllDevices() {
|
linkAllDevices() {
|
||||||
// console.log("模块启动时,自动连接已连接过的设备", this.data.LinkedList);
|
console.log("模块启动时,自动连接已连接过的设备", this.data.LinkedList);
|
||||||
|
|
||||||
if (this.data.LinkedList && this.data.LinkedList.length > 0) {
|
if (this.data.LinkedList && this.data.LinkedList.length > 0) {
|
||||||
for (var i = 0; i < this.data.LinkedList.length; i++) {
|
for (var i = 0; i < this.data.LinkedList.length; i++) {
|
||||||
let device = this.data.LinkedList[i];
|
let device = this.data.LinkedList[i];
|
||||||
// console.log("自动连接:" + device.deviceId);
|
// console.log("自动连接绑定过的设备:" + device.deviceId);
|
||||||
|
if(device.macAddress && device.device && device.device.id){
|
||||||
this.LinkBlue(device.deviceId, device.writeServiceId, device.wirteCharactId, device
|
this.LinkBlue(device.deviceId, device.writeServiceId, device.wirteCharactId, device
|
||||||
.notifyCharactId);
|
.notifyCharactId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// console.log("无设备连接");
|
// console.log("无设备连接");
|
||||||
}
|
}
|
||||||
@ -386,7 +389,7 @@ class BleHelper {
|
|||||||
this.data.discovering = state.discovering;
|
this.data.discovering = state.discovering;
|
||||||
if (this.data.available && this.data
|
if (this.data.available && this.data
|
||||||
.isOpenBlue) { //蓝牙状态再次可用,重连所有设备
|
.isOpenBlue) { //蓝牙状态再次可用,重连所有设备
|
||||||
|
this.linkAllDevices();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -672,7 +675,8 @@ class BleHelper {
|
|||||||
}
|
}
|
||||||
// console.log("c=", c);
|
// console.log("c=", c);
|
||||||
let startSubScribe = (id, serviceId, characteristicId) => {
|
let startSubScribe = (id, serviceId, characteristicId) => {
|
||||||
|
console.log("serviceId=",serviceId);
|
||||||
|
console.log("characteristicId=",characteristicId);
|
||||||
return new Promise((succ, err) => {
|
return new Promise((succ, err) => {
|
||||||
uni.notifyBLECharacteristicValueChange({
|
uni.notifyBLECharacteristicValueChange({
|
||||||
deviceId: id,
|
deviceId: id,
|
||||||
@ -681,7 +685,7 @@ class BleHelper {
|
|||||||
state: state,
|
state: state,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (state) {
|
if (state) {
|
||||||
// console.log("订阅消息成功", res);
|
console.log("订阅消息成功", res);
|
||||||
} else {
|
} else {
|
||||||
console.log("取消订阅成功", res);
|
console.log("取消订阅成功", res);
|
||||||
}
|
}
|
||||||
@ -701,6 +705,7 @@ class BleHelper {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
let promies = new Array();
|
let promies = new Array();
|
||||||
|
if(c.Characteristics && c.Characteristics.length){
|
||||||
for (var i = 0; i < c.Characteristics.length; i++) {
|
for (var i = 0; i < c.Characteristics.length; i++) {
|
||||||
let item = c.Characteristics[i];
|
let item = c.Characteristics[i];
|
||||||
let serviceId = item.serviceId;
|
let serviceId = item.serviceId;
|
||||||
@ -710,15 +715,17 @@ class BleHelper {
|
|||||||
promies.push(startSubScribe(deviceId, serviceId, characteristicId));
|
promies.push(startSubScribe(deviceId, serviceId, characteristicId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (promies.length > 0) {
|
if (promies.length > 0) {
|
||||||
Promise.allSettled(promies).then((results) => {
|
Promise.allSettled(promies).then((results) => {
|
||||||
|
|
||||||
results.forEach((result, index) => {
|
results.forEach((result, index) => {
|
||||||
if (result.status === "fulfilled") {
|
if (result.status === "fulfilled") {
|
||||||
//console.log(`操作${index + 1}成功:`, result.value);
|
console.log(`操作${index + 1}成功:`, result.value);
|
||||||
} else {
|
} else {
|
||||||
// console.log(`操作${index + 1}失败:`, result.reason
|
console.log(`操作${index + 1}失败:`, result.reason
|
||||||
// .message);
|
.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -732,7 +739,7 @@ class BleHelper {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
}, 20);
|
}, 800);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -939,23 +946,28 @@ class BleHelper {
|
|||||||
|
|
||||||
//连接设备
|
//连接设备
|
||||||
var linkDevice = () => {
|
var linkDevice = () => {
|
||||||
return new Promise((resolve, reject) => {
|
// 添加重试次数限制
|
||||||
|
let retryCount = 0;
|
||||||
|
const maxRetries = 10; // 最大重试次数
|
||||||
|
|
||||||
|
const connect = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
if (fIndex > -1 && f?.Linked) {
|
if (fIndex > -1 && f?.Linked) {
|
||||||
console.log("当前已连接,跳过其他步骤")
|
console.log("当前已连接,跳过其他步骤");
|
||||||
resolve(false);
|
resolve(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.data.available) {
|
if (!this.data.available) {
|
||||||
reject(this.getError({ code: 10001 }));
|
reject(this.getError({ code: 10001 }));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("正在连接" + deviceId);
|
console.log("正在连接" + deviceId);
|
||||||
uni.createBLEConnection({
|
uni.createBLEConnection({
|
||||||
deviceId: deviceId,
|
deviceId: deviceId,
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
success: (info) => {
|
success: (info) => {
|
||||||
|
|
||||||
console.log("新连接成功", this.data.LinkedList);
|
console.log("新连接成功", this.data.LinkedList);
|
||||||
this.getLinkBlue().then((arr) => {
|
this.getLinkBlue().then((arr) => {
|
||||||
let cr = arr.devices.find(c => {
|
let cr = arr.devices.find(c => {
|
||||||
@ -964,54 +976,60 @@ class BleHelper {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (fIndex > -1) {
|
if (fIndex > -1) {
|
||||||
this.data.LinkedList[fIndex].Linked = true;
|
this.data.LinkedList[fIndex].Linked = true;
|
||||||
} else {
|
} else {
|
||||||
this.data.LinkedList.push(cr);
|
this.data.LinkedList.push(cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.setStorageSync(this.StorageKey, this.data
|
uni.setStorageSync(this.StorageKey, this.data.LinkedList);
|
||||||
.LinkedList);
|
console.log("LinkedList=", this.data.LinkedList);
|
||||||
|
|
||||||
let os = plus.os.name;
|
// 处理 MTU 设置
|
||||||
console.log("os=",os);
|
if (plus.os.name === 'Android') {
|
||||||
if (os == 'Android') {
|
|
||||||
uni.setBLEMTU({
|
uni.setBLEMTU({
|
||||||
deviceId: deviceId,
|
deviceId: deviceId,
|
||||||
mtu: 512,
|
mtu: 512,
|
||||||
success: (mtu) => {
|
success: (mtu) => {
|
||||||
|
|
||||||
console.log("mtu设置成功", mtu);
|
console.log("mtu设置成功", mtu);
|
||||||
resolve(true);
|
resolve(true);
|
||||||
},
|
},
|
||||||
fail: () => {
|
fail: () => {
|
||||||
console.log("mtu设置失败")
|
console.log("mtu设置失败");
|
||||||
resolve(true);
|
resolve(true); // MTU设置失败不影响连接成功
|
||||||
},
|
|
||||||
finally:()=>{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
resolve(true);
|
resolve(true);
|
||||||
}
|
}
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
|
|
||||||
reject(this.getError(ex));
|
reject(this.getError(ex));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
fail: (ex) => {
|
fail: (ex) => {
|
||||||
ex = this.getError(ex)
|
ex = this.getError(ex);
|
||||||
console.log("蓝牙连接失败" + JSON.stringify(ex));
|
console.log("蓝牙连接失败" + JSON.stringify(ex));
|
||||||
|
|
||||||
|
// 连接超时后自动重试
|
||||||
|
if (ex.code === 10012 && retryCount < maxRetries) {
|
||||||
|
retryCount++;
|
||||||
|
console.log(`重试连接 (${retryCount}/${maxRetries})`);
|
||||||
|
// 使用 setTimeout 避免递归调用栈溢出
|
||||||
|
setTimeout(() => {
|
||||||
|
connect().then(resolve).catch(reject);
|
||||||
|
}, 1000); // 延迟1秒后重试
|
||||||
|
} else {
|
||||||
reject(ex);
|
reject(ex);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return connect();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1021,19 +1039,32 @@ class BleHelper {
|
|||||||
////console.log("2222222");
|
////console.log("2222222");
|
||||||
return linkDevice(deviceId);
|
return linkDevice(deviceId);
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
////console.log("11111111");
|
|
||||||
if (res) { //新连接
|
if (res) { //新连接
|
||||||
|
console.log("11111111");
|
||||||
if (fIndex == -1) {
|
if (fIndex == -1) {
|
||||||
console.log("开始获取服务", targetServiceId)
|
console.log("开始获取服务", targetServiceId)
|
||||||
return this.getService(deviceId, targetServiceId, writeCharId,
|
return this.getService(deviceId, targetServiceId, writeCharId,
|
||||||
notifyCharId); //获取服务
|
notifyCharId); //获取服务
|
||||||
} else {
|
} else {
|
||||||
|
if(f.wirteCharactId && f.notifyCharactId){
|
||||||
if (!f.notifyState) {
|
if (!f.notifyState) {
|
||||||
|
console.log("开始订阅特征");
|
||||||
this.subScribe(deviceId, true);
|
this.subScribe(deviceId, true);
|
||||||
|
}else{
|
||||||
|
console.log("不订阅消息");
|
||||||
}
|
}
|
||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
|
}else{
|
||||||
|
console.log("开始获取服务", targetServiceId)
|
||||||
|
return this.getService(deviceId, targetServiceId, writeCharId,
|
||||||
|
notifyCharId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else { //已连接过,直接订阅消息
|
} else { //已连接过,直接订阅消息
|
||||||
|
console.log("11111111");
|
||||||
if (fIndex > -1 && f && !f.notifyState) {
|
if (fIndex > -1 && f && !f.notifyState) {
|
||||||
|
|
||||||
this.subScribe(deviceId, true);
|
this.subScribe(deviceId, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user