|
@@ -437,15 +437,21 @@ const store = new Vuex.Store({
|
|
*/
|
|
*/
|
|
signInList: [],
|
|
signInList: [],
|
|
isSignIn: false,
|
|
isSignIn: false,
|
|
-
|
|
|
|
|
|
+
|
|
//读取文件的名称
|
|
//读取文件的名称
|
|
- readDataName:"",
|
|
|
|
|
|
+ readDataName: "",
|
|
filesList: [],
|
|
filesList: [],
|
|
|
|
+
|
|
|
|
+ //灯带灯光闪烁
|
|
|
|
+ lightInterval: null,
|
|
|
|
+ showLight: '',
|
|
|
|
+ showLightArray: [],
|
|
|
|
+ lightCount: 0,
|
|
},
|
|
},
|
|
mutations: {
|
|
mutations: {
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 蓝牙解析后的数据,转化成对应的坐标系方向
|
|
* 蓝牙解析后的数据,转化成对应的坐标系方向
|
|
* @param {Object} context
|
|
* @param {Object} context
|
|
@@ -1987,7 +1993,7 @@ const store = new Vuex.Store({
|
|
},
|
|
},
|
|
onWriteBLEConnectionValue(state, context) {
|
|
onWriteBLEConnectionValue(state, context) {
|
|
//#ifdef H5
|
|
//#ifdef H5
|
|
- console.warn("h5不支持蓝牙:", 'onWriteBLEConnectionValue');
|
|
|
|
|
|
+ console.warn("h5不支持蓝牙:");
|
|
return;
|
|
return;
|
|
//#endif
|
|
//#endif
|
|
let {
|
|
let {
|
|
@@ -2117,6 +2123,8 @@ const store = new Vuex.Store({
|
|
state.sandbagAlgorithmLastTime = new Date().getTime();
|
|
state.sandbagAlgorithmLastTime = new Date().getTime();
|
|
state.sandbagAlgorithm = new o0ProjectRelease.SandbagAlgorithm();
|
|
state.sandbagAlgorithm = new o0ProjectRelease.SandbagAlgorithm();
|
|
console.log("gCreateSandbagAlgorithm");
|
|
console.log("gCreateSandbagAlgorithm");
|
|
|
|
+
|
|
|
|
+ this.commit("onUpdateShowLightArray");
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
* 更新 沙袋打击对象 数据
|
|
* 更新 沙袋打击对象 数据
|
|
@@ -2211,9 +2219,68 @@ const store = new Vuex.Store({
|
|
}
|
|
}
|
|
|
|
|
|
// let hitCount = temp.hitCount;
|
|
// let hitCount = temp.hitCount;
|
|
|
|
+ // 打击灯带时候播放一段闪烁
|
|
|
|
+ // if (temp.type == 'hit') {
|
|
|
|
+ // console.log("onHitOpenBLELight");
|
|
|
|
+ // this.commit("onHitOpenBLELight");
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ onHitOpenBLELight(state) {
|
|
|
|
+ // this.commit('B_WriteHexToBLECharacteristic', {
|
|
|
|
+ // value: "5B06015200470042005D"
|
|
|
|
+ // });
|
|
|
|
+ if (state.lightInterval != null) {
|
|
|
|
+ clearInterval(state.lightInterval);
|
|
|
|
+ state.lightInterval == null;
|
|
|
|
+ };
|
|
|
|
+ state.lightCount = 0;
|
|
|
|
+ let timerCount = 0;
|
|
|
|
+ state.lightInterval = setInterval(() => {
|
|
|
|
+ state.showLight = state.showLightArray[state.lightCount];
|
|
|
|
+ // console.log(state.showLight);
|
|
|
|
+ this.commit('B_WriteHexToBLECharacteristic', {
|
|
|
|
+ value: state.showLight
|
|
|
|
+ });
|
|
|
|
+ if (state.lightCount >= state.showLightArray.length - 1) {
|
|
|
|
+ state.lightCount = 0;
|
|
|
|
+ } else {
|
|
|
|
+ state.lightCount += 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ timerCount++;
|
|
|
|
+ if (timerCount > 5) {
|
|
|
|
+ if (state.lightInterval != null) {
|
|
|
|
+ clearInterval(state.lightInterval);
|
|
|
|
+ state.lightInterval == null;
|
|
|
|
+ };
|
|
|
|
+ state.lightCount = 0;
|
|
|
|
+ //关闭红绿蓝
|
|
|
|
+ this.commit('B_WriteHexToBLECharacteristic', {
|
|
|
|
+ value: "5B06015202470242025D"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }, 100)
|
|
|
|
+ },
|
|
|
|
+ //更新一个灯光数组
|
|
|
|
+ onUpdateShowLightArray(state) {
|
|
|
|
+ state.showLightArray = [];
|
|
|
|
+
|
|
|
|
+ let openRed = "5B06015201470042005D";
|
|
|
|
+ let shutRed = "5B06015202470042005D";
|
|
|
|
+ // state.showLightArray.push(openRed);
|
|
|
|
+ // state.showLightArray.push(shutRed);
|
|
|
|
+ let openGreen = "5B06015200470142005D";
|
|
|
|
+ let shutGreen = "5B06015200470242005D";
|
|
|
|
+ state.showLightArray.push(openGreen);
|
|
|
|
+ state.showLightArray.push(shutGreen);
|
|
|
|
+ let openBlue = "5B06015200470042015D";
|
|
|
|
+ let shutBlue = "5B06015200470042025D";
|
|
|
|
+ state.showLightArray.push(openBlue);
|
|
|
|
+ state.showLightArray.push(shutBlue);
|
|
|
|
+ },
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 开启加速计,陀螺仪,并且模拟ble发送
|
|
* 开启加速计,陀螺仪,并且模拟ble发送
|
|
* @param {Object} state
|
|
* @param {Object} state
|
|
@@ -2935,14 +3002,14 @@ const store = new Vuex.Store({
|
|
let _sendData;
|
|
let _sendData;
|
|
if (bSendHex) {
|
|
if (bSendHex) {
|
|
|
|
|
|
- state.bRopeKeyTwo = 0;
|
|
|
|
- state.bRopeKeyOne = 0;
|
|
|
|
|
|
+ // state.bRopeKeyTwo = 0;
|
|
|
|
+ // state.bRopeKeyOne = 0;
|
|
|
|
|
|
- //如果是发送16进制
|
|
|
|
- state.bListenerHexUpdate = true;
|
|
|
|
|
|
+ //不用解析跳绳模式
|
|
|
|
+ state.bListenerHexUpdate = false;
|
|
|
|
|
|
- //重置原 update
|
|
|
|
- state.bListenerUpdate = false;
|
|
|
|
|
|
+ //不用关闭原始数据更新
|
|
|
|
+ state.bListenerUpdate = true;
|
|
|
|
|
|
let typedArray = new Uint8Array(value.match(/[\da-f]{2}/gi).map(function(h) {
|
|
let typedArray = new Uint8Array(value.match(/[\da-f]{2}/gi).map(function(h) {
|
|
return parseInt(h, 16)
|
|
return parseInt(h, 16)
|
|
@@ -2965,27 +3032,15 @@ const store = new Vuex.Store({
|
|
}
|
|
}
|
|
if (value == "3") {
|
|
if (value == "3") {
|
|
if (state.bListenerUpdate) {
|
|
if (state.bListenerUpdate) {
|
|
- // uni.showToast({
|
|
|
|
- // title: "原始数据已开启"
|
|
|
|
- // })
|
|
|
|
console.warn("原始数据已开启");
|
|
console.warn("原始数据已开启");
|
|
- // return;
|
|
|
|
}
|
|
}
|
|
state.bListenerUpdate = true;
|
|
state.bListenerUpdate = true;
|
|
}
|
|
}
|
|
|
|
|
|
if (value == "6") {
|
|
if (value == "6") {
|
|
- // state.bListenerJson = false;
|
|
|
|
state.bListenerAccArray = false;
|
|
state.bListenerAccArray = false;
|
|
}
|
|
}
|
|
if (value == "5") {
|
|
if (value == "5") {
|
|
- // if (state.bListenerJson) {
|
|
|
|
- // uni.showToast({
|
|
|
|
- // title: "步数数据已开启"
|
|
|
|
- // })
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
- // state.bListenerJson = true;
|
|
|
|
if (state.bListenerAccArray) {
|
|
if (state.bListenerAccArray) {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: "加速计组数据已开启"
|
|
title: "加速计组数据已开启"
|
|
@@ -3039,6 +3094,58 @@ const store = new Vuex.Store({
|
|
})
|
|
})
|
|
|
|
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+ B_WriteHexToBLECharacteristic(state, context) {
|
|
|
|
+ let {
|
|
|
|
+ value,
|
|
|
|
+ retryCount = 5,
|
|
|
|
+ success = null,
|
|
|
|
+ getFail = null,
|
|
|
|
+ } = context;
|
|
|
|
+ if (!value && value === '') {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: "指令为空"
|
|
|
|
+ })
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let typedArray = new Uint8Array(value.match(/[\da-f]{2}/gi).map(function(h) {
|
|
|
|
+ return parseInt(h, 16)
|
|
|
|
+ }))
|
|
|
|
+ uni.writeBLECharacteristicValue({
|
|
|
|
+ deviceId: state.deviceId,
|
|
|
|
+ serviceId: state.serviceId,
|
|
|
|
+ characteristicId: state.writeCharacteristicId,
|
|
|
|
+ value: typedArray.buffer,
|
|
|
|
+ success: (res) => {
|
|
|
|
+ console.log('B_WriteHexToBLECharacteristicSuccess', res.errMsg, value,
|
|
|
|
+ retryCount);
|
|
|
|
+ if (success) {
|
|
|
|
+ success(res);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ fail: (fail) => {
|
|
|
|
+ console.log(fail)
|
|
|
|
+ //重新写入
|
|
|
|
+ if (retryCount > 0) {
|
|
|
|
+ console.log("B_WriteHexToBLECharacteristicRewrite =======>" +
|
|
|
|
+ value + " == " + retryCount);
|
|
|
|
+ retryCount--;
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.commit("B_WriteHexToBLECharacteristic", {
|
|
|
|
+ value,
|
|
|
|
+ retryCount,
|
|
|
|
+ success,
|
|
|
|
+ getFail
|
|
|
|
+ });
|
|
|
|
+ }, 300);
|
|
|
|
+ }
|
|
|
|
+ if (getFail) {
|
|
|
|
+ getFail(fail);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
|
|
/**
|
|
/**
|
|
* 断开蓝牙连接
|
|
* 断开蓝牙连接
|
|
@@ -3839,8 +3946,8 @@ const store = new Vuex.Store({
|
|
// data: JSON.stringify(msg)
|
|
// data: JSON.stringify(msg)
|
|
// });
|
|
// });
|
|
},
|
|
},
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
//jumpIdenModule 算法插件 start
|
|
//jumpIdenModule 算法插件 start
|
|
jumpIdenModule_SearchData(state, context) {
|
|
jumpIdenModule_SearchData(state, context) {
|
|
if (uni.getSystemInfoSync().platform == "ios") {
|
|
if (uni.getSystemInfoSync().platform == "ios") {
|
|
@@ -3856,15 +3963,15 @@ const store = new Vuex.Store({
|
|
name: state.readDataName
|
|
name: state.readDataName
|
|
}
|
|
}
|
|
console.log('requestData search ===== url:' + url);
|
|
console.log('requestData search ===== url:' + url);
|
|
- reqUtil.requestData(url, _temp,'POST').then(res => {
|
|
|
|
-
|
|
|
|
|
|
+ reqUtil.requestData(url, _temp, 'POST').then(res => {
|
|
|
|
+
|
|
let strArray = res.split('\n');
|
|
let strArray = res.split('\n');
|
|
- console.log(strArray);
|
|
|
|
- for (let i = 0; i < strArray.length-1; i++) {
|
|
|
|
|
|
+ console.log(strArray);
|
|
|
|
+ for (let i = 0; i < strArray.length - 1; i++) {
|
|
let _name = strArray[i].split('.')[0];
|
|
let _name = strArray[i].split('.')[0];
|
|
if (_name.Length <= 0) continue;
|
|
if (_name.Length <= 0) continue;
|
|
let item = Object.assign({}, {
|
|
let item = Object.assign({}, {
|
|
- cname:_name,
|
|
|
|
|
|
+ cname: _name,
|
|
bRatio: false
|
|
bRatio: false
|
|
});
|
|
});
|
|
state.filesList.push(item);
|
|
state.filesList.push(item);
|
|
@@ -3886,7 +3993,7 @@ const store = new Vuex.Store({
|
|
})
|
|
})
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- jumpIdenModule_DownloadReadData(state,context) {
|
|
|
|
|
|
+ jumpIdenModule_DownloadReadData(state, context) {
|
|
if (uni.getSystemInfoSync().platform == "ios") {
|
|
if (uni.getSystemInfoSync().platform == "ios") {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -3896,16 +4003,18 @@ const store = new Vuex.Store({
|
|
} = context;
|
|
} = context;
|
|
let downloadUrl = "http://42.192.165.168:2022/download";
|
|
let downloadUrl = "http://42.192.165.168:2022/download";
|
|
console.log('requestData downloadUrl ===== url:' + downloadUrl);
|
|
console.log('requestData downloadUrl ===== url:' + downloadUrl);
|
|
- reqUtil.requestData(downloadUrl, {name:data.cname},'POST').then(res => {
|
|
|
|
|
|
+ reqUtil.requestData(downloadUrl, {
|
|
|
|
+ name: data.cname
|
|
|
|
+ }, 'POST').then(res => {
|
|
//console.log(res);
|
|
//console.log(res);
|
|
uni.setStorageSync('readData', res);
|
|
uni.setStorageSync('readData', res);
|
|
- if(callback)
|
|
|
|
|
|
+ if (callback)
|
|
callback(res);
|
|
callback(res);
|
|
//读取的数据传入android端
|
|
//读取的数据传入android端
|
|
let _temp = jumpIdenModule.onJumpInitInputData({
|
|
let _temp = jumpIdenModule.onJumpInitInputData({
|
|
data: res
|
|
data: res
|
|
})
|
|
})
|
|
-
|
|
|
|
|
|
+
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: '' + _temp.msg,
|
|
title: '' + _temp.msg,
|
|
icon: 'none',
|
|
icon: 'none',
|
|
@@ -3929,19 +4038,19 @@ const store = new Vuex.Store({
|
|
}
|
|
}
|
|
let res = jumpIdenModule.onJumpInit();
|
|
let res = jumpIdenModule.onJumpInit();
|
|
uni.showToast({
|
|
uni.showToast({
|
|
- title: ''+ res.code,
|
|
|
|
|
|
+ title: '' + res.code,
|
|
icon: 'none',
|
|
icon: 'none',
|
|
duration: 1000,
|
|
duration: 1000,
|
|
mask: true
|
|
mask: true
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- jumpIdenModule_onJumpInitLocalData(){
|
|
|
|
|
|
+ jumpIdenModule_onJumpInitLocalData() {
|
|
if (uni.getSystemInfoSync().platform == "ios") {
|
|
if (uni.getSystemInfoSync().platform == "ios") {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
let res = jumpIdenModule.onJumpInitLocalData();
|
|
let res = jumpIdenModule.onJumpInitLocalData();
|
|
uni.showToast({
|
|
uni.showToast({
|
|
- title: ''+ res.code,
|
|
|
|
|
|
+ title: '' + res.code,
|
|
icon: 'none',
|
|
icon: 'none',
|
|
duration: 1000,
|
|
duration: 1000,
|
|
mask: true
|
|
mask: true
|
|
@@ -3965,17 +4074,19 @@ const store = new Vuex.Store({
|
|
jumpIdenModule_onTestUpdate() {
|
|
jumpIdenModule_onTestUpdate() {
|
|
jumpIdenModule.onTestUpdate();
|
|
jumpIdenModule.onTestUpdate();
|
|
},
|
|
},
|
|
- jumpIdenModule_onJump6AxisDataUpdate(state,context){
|
|
|
|
|
|
+ jumpIdenModule_onJump6AxisDataUpdate(state, context) {
|
|
let {
|
|
let {
|
|
data,
|
|
data,
|
|
callback = null
|
|
callback = null
|
|
} = context;
|
|
} = context;
|
|
- let res = jumpIdenModule.onJump6AxisDataUpdate({hex:data.hex});
|
|
|
|
- if(callback)
|
|
|
|
|
|
+ let res = jumpIdenModule.onJump6AxisDataUpdate({
|
|
|
|
+ hex: data.hex
|
|
|
|
+ });
|
|
|
|
+ if (callback)
|
|
callback(res);
|
|
callback(res);
|
|
},
|
|
},
|
|
-
|
|
|
|
- onGetReadDataName(state){
|
|
|
|
|
|
+
|
|
|
|
+ onGetReadDataName(state) {
|
|
state.readDataName = uni.getStorageSync('readDataName');
|
|
state.readDataName = uni.getStorageSync('readDataName');
|
|
},
|
|
},
|
|
onSetReadDataName(state, value) {
|
|
onSetReadDataName(state, value) {
|