|
|
|
@ -53,15 +53,22 @@ import { showModal, msg } from "@/utils/traoAPI";
|
|
|
|
import InstrumentTypeEnum from "../InstrumentTypeEnum";
|
|
|
|
import InstrumentTypeEnum from "../InstrumentTypeEnum";
|
|
|
|
import OtaDeviceTypeEnum from "../OtaDeviceTypeEnum";
|
|
|
|
import OtaDeviceTypeEnum from "../OtaDeviceTypeEnum";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 定义一个变量,用于存放获取版本定时器
|
|
|
|
let isGetVersionTimer: any = null;
|
|
|
|
let isGetVersionTimer: any = null;
|
|
|
|
|
|
|
|
// 定义一个变量,用于存放获取子设备定时器
|
|
|
|
let isGetSubDeviceTimer: any = null;
|
|
|
|
let isGetSubDeviceTimer: any = null;
|
|
|
|
|
|
|
|
// 定义一个变量,用于存放获取同步录制定时器
|
|
|
|
let isGetSyncRecordingTimer: any = null;
|
|
|
|
let isGetSyncRecordingTimer: any = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 定义一个变量,用于存放超时定时器
|
|
|
|
let overTimer: any = null;
|
|
|
|
let overTimer: any = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 定义一个变量,用于存放获取子设备定时器次数
|
|
|
|
let isGetSubDeviceTimerNum = 0;
|
|
|
|
let isGetSubDeviceTimerNum = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 定义一个变量,用于存放发送获取版本定时器
|
|
|
|
let sendgetversionTimer: any = null;
|
|
|
|
let sendgetversionTimer: any = null;
|
|
|
|
|
|
|
|
// 定义一个变量,用于存放发送获取版本定时器次数
|
|
|
|
let sendGetVersionTimerNum = 0;
|
|
|
|
let sendGetVersionTimerNum = 0;
|
|
|
|
|
|
|
|
|
|
|
|
let searchBluetootTimers: any = null; // 搜索蓝牙定时器
|
|
|
|
let searchBluetootTimers: any = null; // 搜索蓝牙定时器
|
|
|
|
@ -121,9 +128,9 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
clearTimeout(isGetVersionTimer);
|
|
|
|
clearTimeout(isGetVersionTimer);
|
|
|
|
clearTimeout(isGetSyncRecordingTimer);
|
|
|
|
clearTimeout(isGetSyncRecordingTimer);
|
|
|
|
if (overTimer) clearTimeout(overTimer);
|
|
|
|
if (overTimer) clearTimeout(overTimer);
|
|
|
|
|
|
|
|
// 重新开始
|
|
|
|
this.again();
|
|
|
|
this.again();
|
|
|
|
// this.triggerEvent("close", "connection_guide");
|
|
|
|
// 关闭弹窗
|
|
|
|
console.log("this.close");
|
|
|
|
|
|
|
|
this.onClose();
|
|
|
|
this.onClose();
|
|
|
|
Taro.closeBluetoothAdapter();
|
|
|
|
Taro.closeBluetoothAdapter();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -428,17 +435,15 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
let jsonStatus: any = null;
|
|
|
|
let jsonStatus: any = null;
|
|
|
|
let querySubDeviceArrayBuffer;
|
|
|
|
let querySubDeviceArrayBuffer;
|
|
|
|
if (deviceInfo.model == "WL200") {
|
|
|
|
if (deviceInfo.model == "WL200") {
|
|
|
|
// querySubDeviceArrayBuffer =
|
|
|
|
querySubDeviceArrayBuffer =
|
|
|
|
// deviceToolKitInstanceWL200.toBleCommand(
|
|
|
|
deviceToolKitInstanceWL200.toBleCommand(
|
|
|
|
// bleCommandSamples.querySubDevice as any
|
|
|
|
bleCommandSamples.querySubDevice as any
|
|
|
|
// );
|
|
|
|
);
|
|
|
|
// jsonStatus = deviceToolKitInstanceWL200.toJsonStatus(
|
|
|
|
jsonStatus = deviceToolKitInstanceWL200.toJsonStatus(value.value);
|
|
|
|
// value.value
|
|
|
|
// jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
|
|
|
|
// );
|
|
|
|
// querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
|
|
|
|
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
|
|
|
|
// bleCommandSamples.querySubDevice as any
|
|
|
|
querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
|
|
|
|
// ); // todo
|
|
|
|
bleCommandSamples.querySubDevice as any
|
|
|
|
|
|
|
|
); // todo
|
|
|
|
|
|
|
|
} else if (deviceInfo.model == "M01") {
|
|
|
|
} else if (deviceInfo.model == "M01") {
|
|
|
|
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
|
|
|
|
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
|
|
|
|
querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
|
|
|
|
querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
|
|
|
|
@ -469,8 +474,8 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
islian: true, // 不需要离线记录,但暂未完全删除这部分逻辑,所以直接设为true
|
|
|
|
islian: true, // 不需要离线记录,但暂未完全删除这部分逻辑,所以直接设为true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.pairingChange(this.state); // 临时添加,用于跳转
|
|
|
|
// this.pairingChange(this.state); // 临时添加,用于跳转
|
|
|
|
// this.detectVersionUpdate(); // 获取升级信息
|
|
|
|
this.detectVersionUpdate(); // 获取升级信息
|
|
|
|
// todo 连接成功需删除离线记录,暂时未缓存离线记录
|
|
|
|
// todo 连接成功需删除离线记录,暂时未缓存离线记录
|
|
|
|
if (this.state.connectionSuccess) return;
|
|
|
|
if (this.state.connectionSuccess) return;
|
|
|
|
// 暂时不需要查询是否连接子设备, 直接进入查询版本信息
|
|
|
|
// 暂时不需要查询是否连接子设备, 直接进入查询版本信息
|
|
|
|
@ -533,7 +538,7 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
// const hadOpen = checkSameKey(pages, matchPageList, 'route');
|
|
|
|
// const hadOpen = checkSameKey(pages, matchPageList, 'route');
|
|
|
|
// if (!hadOpen) {
|
|
|
|
// if (!hadOpen) {
|
|
|
|
// this.triggerEvent("pairingChange", { deviceVersionNo });
|
|
|
|
// this.triggerEvent("pairingChange", { deviceVersionNo });
|
|
|
|
this.pairingChange({ deviceVersionNo });
|
|
|
|
// this.pairingChange({ deviceVersionNo });
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// } else {
|
|
|
|
// this.sendSyncRecording()
|
|
|
|
// this.sendSyncRecording()
|
|
|
|
@ -635,11 +640,14 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
infoQueryType: "versionInfo",
|
|
|
|
infoQueryType: "versionInfo",
|
|
|
|
otaDeviceType,
|
|
|
|
otaDeviceType,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// const value =
|
|
|
|
|
|
|
|
// deviceInfo.model == InstrumentTypeEnum.WL200
|
|
|
|
|
|
|
|
// ? deviceToolKitInstanceM01.toBleCommand(versionCommand as any)
|
|
|
|
|
|
|
|
// : deviceToolKitInstanceM01.toBleCommand(versionCommand as any);
|
|
|
|
const value =
|
|
|
|
const value =
|
|
|
|
deviceInfo.model == InstrumentTypeEnum.WL200
|
|
|
|
deviceInfo.type == InstrumentTypeEnum.WL200
|
|
|
|
? deviceToolKitInstanceM01.toBleCommand(versionCommand as any)
|
|
|
|
? deviceToolKitInstanceWL200.toBleCommand(versionCommand as any)
|
|
|
|
: deviceToolKitInstanceM01.toBleCommand(versionCommand as any);
|
|
|
|
: deviceToolKitInstanceM01.toBleCommand(versionCommand as any);
|
|
|
|
// const value = deviceInfo.type == instrumentTypeEnum.WL200 ? deviceToolKitInstanceWL200.toBleCommand(versionCommand) : deviceToolKitInstanceM01.toBleCommand(versionCommand);
|
|
|
|
|
|
|
|
sendCommand({ value });
|
|
|
|
sendCommand({ value });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -648,7 +656,7 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
sendofflist() {
|
|
|
|
sendofflist() {
|
|
|
|
// log.info()
|
|
|
|
// log.info()
|
|
|
|
if (this.state.offlineDataindex == this.state.offlineDataList.length) {
|
|
|
|
if (this.state.offlineDataindex == this.state.offlineDataList.length) {
|
|
|
|
console.log("离线记录获取完成");
|
|
|
|
console.log("离线记录获取完成", this.state);
|
|
|
|
// log.info(commandMap.finishOfflineData, this.state.offlineDataList);
|
|
|
|
// log.info(commandMap.finishOfflineData, this.state.offlineDataList);
|
|
|
|
/****
|
|
|
|
/****
|
|
|
|
* 发送同步时间
|
|
|
|
* 发送同步时间
|
|
|
|
@ -658,8 +666,6 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
console.log("版本号:" + this.state.versionInfo.version);
|
|
|
|
console.log("版本号:" + this.state.versionInfo.version);
|
|
|
|
this.setState({ islian: true });
|
|
|
|
this.setState({ islian: true });
|
|
|
|
clearTimeout(connectionTimer);
|
|
|
|
clearTimeout(connectionTimer);
|
|
|
|
// this.triggerEvent("offlineChange", this.state);
|
|
|
|
|
|
|
|
console.log("this.triggerEvent", this.state);
|
|
|
|
|
|
|
|
this.offlineChange(this.state);
|
|
|
|
this.offlineChange(this.state);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -752,64 +758,6 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 发送记录 */
|
|
|
|
|
|
|
|
sendOfflistPost(str) {
|
|
|
|
|
|
|
|
let facehour = hex2int(str.substring(12, 14)); //脸部小时
|
|
|
|
|
|
|
|
let faceminutes = hex2int(str.substring(14, 16)); //脸部分钟
|
|
|
|
|
|
|
|
let faceseconds = hex2int(str.substring(16, 18)); //脸部秒
|
|
|
|
|
|
|
|
let faceposition1 = hex2int(str.substring(18, 20)); //当前档位
|
|
|
|
|
|
|
|
let facenum = hex2int(str.substring(20, 22)); //次数
|
|
|
|
|
|
|
|
let faceyear = hex2int(str.substring(22, 24)); //年份
|
|
|
|
|
|
|
|
let facemonth = hex2int(str.substring(24, 26)); //月份
|
|
|
|
|
|
|
|
let faceday = hex2int(str.substring(26, 28)); //日期
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let eyehour = hex2int(str.substring(28, 30)); //眼部小时
|
|
|
|
|
|
|
|
let eyeminutes = hex2int(str.substring(30, 32)); //眼部分钟
|
|
|
|
|
|
|
|
let eyeseconds = hex2int(str.substring(32, 34)); //眼部秒
|
|
|
|
|
|
|
|
let eyeposition1 = hex2int(str.substring(34, 36)); //当前档位
|
|
|
|
|
|
|
|
let eyenum = hex2int(str.substring(36, 38)); //次数
|
|
|
|
|
|
|
|
let eyeyear = hex2int(str.substring(38, 40)); //年份
|
|
|
|
|
|
|
|
let eyemonth = hex2int(str.substring(40, 42)); //月份
|
|
|
|
|
|
|
|
let eyeday = hex2int(str.substring(42, 44)); //日期
|
|
|
|
|
|
|
|
// console.log('脸部小时:' + facehour)
|
|
|
|
|
|
|
|
// console.log('脸部分钟:' + faceminutes)
|
|
|
|
|
|
|
|
// console.log('脸部秒:' + faceseconds)
|
|
|
|
|
|
|
|
// console.log('当前档位:' + faceposition1)
|
|
|
|
|
|
|
|
// console.log('脸部次数:' + facenum)
|
|
|
|
|
|
|
|
// console.log('年:' + faceyear)
|
|
|
|
|
|
|
|
// console.log('月:' + facemonth)
|
|
|
|
|
|
|
|
// console.log('日:' + faceday)
|
|
|
|
|
|
|
|
// console.log('-------------------')
|
|
|
|
|
|
|
|
// console.log('眼部小时:' + eyehour)
|
|
|
|
|
|
|
|
// console.log('眼部分钟:' + eyeminutes)
|
|
|
|
|
|
|
|
// console.log('眼部秒:' + eyeseconds)
|
|
|
|
|
|
|
|
// console.log('当前档位:' + eyeposition1)
|
|
|
|
|
|
|
|
// console.log('眼部次数:' + eyenum)
|
|
|
|
|
|
|
|
// console.log('年:' + eyeyear)
|
|
|
|
|
|
|
|
// console.log('月:' + eyemonth)
|
|
|
|
|
|
|
|
// console.log('日:' + eyeday)
|
|
|
|
|
|
|
|
let { offlineDataList } = this.state;
|
|
|
|
|
|
|
|
offlineDataList.push({
|
|
|
|
|
|
|
|
facehour,
|
|
|
|
|
|
|
|
faceminutes,
|
|
|
|
|
|
|
|
faceseconds,
|
|
|
|
|
|
|
|
faceposition1,
|
|
|
|
|
|
|
|
facenum,
|
|
|
|
|
|
|
|
faceyear,
|
|
|
|
|
|
|
|
facemonth,
|
|
|
|
|
|
|
|
faceday,
|
|
|
|
|
|
|
|
eyehour,
|
|
|
|
|
|
|
|
eyeminutes,
|
|
|
|
|
|
|
|
eyeseconds,
|
|
|
|
|
|
|
|
eyeposition1,
|
|
|
|
|
|
|
|
eyenum,
|
|
|
|
|
|
|
|
eyeyear,
|
|
|
|
|
|
|
|
eyemonth,
|
|
|
|
|
|
|
|
eyeday,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
this.setState({ offlineDataList });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 同步时间 */
|
|
|
|
/** 同步时间 */
|
|
|
|
sendAsyncTime() {
|
|
|
|
sendAsyncTime() {
|
|
|
|
console.log("同步时间");
|
|
|
|
console.log("同步时间");
|
|
|
|
@ -973,7 +921,7 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
// 获取版本信息
|
|
|
|
// 获取版本信息
|
|
|
|
detectVersionUpdate() {
|
|
|
|
detectVersionUpdate() {
|
|
|
|
this.closeQuerySubDevice();
|
|
|
|
this.closeQuerySubDevice();
|
|
|
|
this.sendGetVersion();
|
|
|
|
this.sendGetVersion(); // 获取版本信息
|
|
|
|
sendGetVersionTimerNum = 0;
|
|
|
|
sendGetVersionTimerNum = 0;
|
|
|
|
// 600毫秒查询一次版本号是否返回,若返回则跳转护理页
|
|
|
|
// 600毫秒查询一次版本号是否返回,若返回则跳转护理页
|
|
|
|
if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
|
|
|
|
if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
|
|
|
|
@ -989,7 +937,6 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
connectionStatus: true,
|
|
|
|
connectionStatus: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// this.triggerEvent("pairingChange", this.state);
|
|
|
|
|
|
|
|
console.log("this.pairingChange", this.state);
|
|
|
|
console.log("this.pairingChange", this.state);
|
|
|
|
this.pairingChange(this.state);
|
|
|
|
this.pairingChange(this.state);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|