|
|
|
@ -32,43 +32,58 @@ import {
|
|
|
|
getofflineData,
|
|
|
|
getofflineData,
|
|
|
|
hex2int,
|
|
|
|
hex2int,
|
|
|
|
getTimeCode,
|
|
|
|
getTimeCode,
|
|
|
|
|
|
|
|
isNeedToUpdate,
|
|
|
|
} from "@/utils/util";
|
|
|
|
} from "@/utils/util";
|
|
|
|
const log = require("@/utils/log");
|
|
|
|
const log = require("@/utils/log");
|
|
|
|
import commandMap from "@/utils/commandMap";
|
|
|
|
import commandMap from "@/utils/commandMap";
|
|
|
|
import { bleCommandSamples } from "./test";
|
|
|
|
import { bleCommandSamples } from "./test";
|
|
|
|
|
|
|
|
|
|
|
|
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
|
|
|
|
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
|
|
|
|
const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WE100", "WL200");
|
|
|
|
const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WL200", "WL200");
|
|
|
|
deviceToolKitInstanceWL200.setDebug(true);
|
|
|
|
deviceToolKitInstanceWL200.setDebug(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const _deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WE100", "WL200");
|
|
|
|
|
|
|
|
|
|
|
|
const deviceToolKitInstanceM01 = new DeviceToolKitWE100("WE100", "M01");
|
|
|
|
const deviceToolKitInstanceM01 = new DeviceToolKitWE100("WE100", "M01");
|
|
|
|
deviceToolKitInstanceM01.setDebug(true);
|
|
|
|
deviceToolKitInstanceM01.setDebug(true);
|
|
|
|
|
|
|
|
|
|
|
|
const deviceToolKitInstanceFR200 = new DeviceToolKitFR200("FR200");
|
|
|
|
const deviceToolKitInstanceFR200 = new DeviceToolKitFR200("FR200");
|
|
|
|
|
|
|
|
|
|
|
|
import { DeviceToolKit as DeviceToolKitFR200 } from "@flossom-npm/iot-translater";
|
|
|
|
import { DeviceToolKit as DeviceToolKitFR200 } from "@flossom-npm/iot-translater";
|
|
|
|
import { showModal, msg } from "@/utils/traoAPI";
|
|
|
|
import {
|
|
|
|
|
|
|
|
showModal,
|
|
|
|
|
|
|
|
msg,
|
|
|
|
|
|
|
|
setStorageSync,
|
|
|
|
|
|
|
|
getStorageSync,
|
|
|
|
|
|
|
|
} from "@/utils/traoAPI";
|
|
|
|
|
|
|
|
|
|
|
|
// const { InstrumentTypeEnum, OtaDeviceTypeEnum } = app.globalData;
|
|
|
|
// const { InstrumentTypeEnum, OtaDeviceTypeEnum } = app.globalData;
|
|
|
|
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; // 搜索蓝牙定时器
|
|
|
|
let searchBluetootTimersNum = 0; // 搜索蓝牙秒数
|
|
|
|
let searchBluetootTimersNum = 15; // 搜索蓝牙秒数 15秒
|
|
|
|
|
|
|
|
|
|
|
|
let connectionTimer: any = null; // 连接蓝牙定时器
|
|
|
|
let connectionTimer: any = null; // 连接蓝牙定时器
|
|
|
|
let connectionTimerNum = 0;
|
|
|
|
let connectionTimerNumber = 10000; // 连接蓝牙超时毫秒
|
|
|
|
|
|
|
|
|
|
|
|
let sendPairingTimer: any = null; // 发送配对
|
|
|
|
let sendPairingTimer: any = null; // 发送配对
|
|
|
|
|
|
|
|
|
|
|
|
@ -99,6 +114,16 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
offlineDataindex: 0, //离线记录发送下标index
|
|
|
|
offlineDataindex: 0, //离线记录发送下标index
|
|
|
|
versionInfo: {}, //版本号
|
|
|
|
versionInfo: {}, //版本号
|
|
|
|
offlineDataList: [], //离线数据
|
|
|
|
offlineDataList: [], //离线数据
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prefix: "12CAA", // WL200蓝牙搜索前缀
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// WL200匹配
|
|
|
|
|
|
|
|
tranType: [
|
|
|
|
|
|
|
|
"WE100", // 发箍
|
|
|
|
|
|
|
|
"WE200", // 发箍
|
|
|
|
|
|
|
|
"WL200", // 发箍
|
|
|
|
|
|
|
|
"12CAA", // 面罩前缀名
|
|
|
|
|
|
|
|
],
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -115,15 +140,23 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
|
|
async initData() {}
|
|
|
|
async initData() {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isWL200() {
|
|
|
|
|
|
|
|
let currentDevicesName = getStorageSync("currentDevicesName");
|
|
|
|
|
|
|
|
if (currentDevicesName.indexOf("12CAA") > -1) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
close() {
|
|
|
|
close() {
|
|
|
|
clearInterval(sendPairingTimer);
|
|
|
|
clearInterval(sendPairingTimer);
|
|
|
|
clearInterval(sendgetversionTimer);
|
|
|
|
clearInterval(sendgetversionTimer);
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -260,7 +293,7 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
"searchBluetootTimersNum value => ",
|
|
|
|
"searchBluetootTimersNum value => ",
|
|
|
|
searchBluetootTimersNum
|
|
|
|
searchBluetootTimersNum
|
|
|
|
);
|
|
|
|
);
|
|
|
|
if (searchBluetootTimersNum === 8) {
|
|
|
|
if (searchBluetootTimersNum === 15) {
|
|
|
|
clearInterval(searchBluetootTimers);
|
|
|
|
clearInterval(searchBluetootTimers);
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
error: true,
|
|
|
|
error: true,
|
|
|
|
@ -282,43 +315,36 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
onBluetoothDeviceFound() {
|
|
|
|
onBluetoothDeviceFound() {
|
|
|
|
Taro.onBluetoothDeviceFound((item: any) => {
|
|
|
|
Taro.onBluetoothDeviceFound((item: any) => {
|
|
|
|
console.log("蓝牙查找item", item, item.devices[0].name);
|
|
|
|
console.log("蓝牙查找item", item, item.devices[0].name);
|
|
|
|
/*
|
|
|
|
|
|
|
|
* 这里增加判断,类型不同识别的设备名称不一样
|
|
|
|
|
|
|
|
* type1 FR200
|
|
|
|
|
|
|
|
* type2 WM100
|
|
|
|
|
|
|
|
* type3 we100
|
|
|
|
|
|
|
|
* type4 FR380
|
|
|
|
|
|
|
|
* */
|
|
|
|
|
|
|
|
// const tranType = {
|
|
|
|
|
|
|
|
// 1: "FR200",
|
|
|
|
|
|
|
|
// 3: "WE200", // WL200
|
|
|
|
|
|
|
|
// 4: "FR380",
|
|
|
|
|
|
|
|
// 5: "FR390",
|
|
|
|
|
|
|
|
// 6: "WE200", // M01
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
// let type = this.props.yiqiInfo.model || "FR200";
|
|
|
|
|
|
|
|
let type = "WE200";
|
|
|
|
|
|
|
|
// this.props.yiqiInfo.model = type;
|
|
|
|
|
|
|
|
console.log("this.props.yiqiInfo.model", this.props.yiqiInfo.model);
|
|
|
|
|
|
|
|
console.info("搜索到到蓝牙设备 value => ", item.devices[0]?.name);
|
|
|
|
console.info("搜索到到蓝牙设备 value => ", item.devices[0]?.name);
|
|
|
|
|
|
|
|
console.log(">>>>>>>当前传入设备类型>>>>>", this.props.deviceInfo.model);
|
|
|
|
|
|
|
|
// 先匹配到哪个连接哪个
|
|
|
|
|
|
|
|
let tranType = [
|
|
|
|
|
|
|
|
this.props.deviceInfo.model, // 当前传入设备类型
|
|
|
|
|
|
|
|
...this.state.tranType,
|
|
|
|
|
|
|
|
];
|
|
|
|
for (let i = 0; i < item.devices.length; i++) {
|
|
|
|
for (let i = 0; i < item.devices.length; i++) {
|
|
|
|
if (
|
|
|
|
let devicesName = item.devices[i].localName || item.devices[i].name;
|
|
|
|
item.devices[i].connectable &&
|
|
|
|
console.log("devicesName", devicesName);
|
|
|
|
(item.devices[i].localName
|
|
|
|
console.log("tranType", tranType);
|
|
|
|
? item.devices[i].localName
|
|
|
|
// 是否匹配可连接设备
|
|
|
|
: item.devices[i].name
|
|
|
|
let isAvailable = tranType.some(
|
|
|
|
).indexOf(`${type}`) !== -1
|
|
|
|
(item) => devicesName && devicesName.indexOf(item) > -1
|
|
|
|
) {
|
|
|
|
);
|
|
|
|
console.log("连接的设备信息", item.devices[i], type);
|
|
|
|
console.log("isAvailable", isAvailable);
|
|
|
|
|
|
|
|
// 判断设备是否可连接
|
|
|
|
|
|
|
|
if (item.devices[i].connectable && isAvailable) {
|
|
|
|
|
|
|
|
// 缓存当前连接设备名 可能是发箍或面罩
|
|
|
|
|
|
|
|
setStorageSync("currentDevicesName", devicesName);
|
|
|
|
|
|
|
|
console.log("连接的设备信息", item.devices[i], devicesName);
|
|
|
|
|
|
|
|
|
|
|
|
let params = {
|
|
|
|
let params = {
|
|
|
|
deviceId: item.devices[i].deviceId,
|
|
|
|
deviceId: item.devices[i].deviceId,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.props.setDeviceId(params);
|
|
|
|
this.props.setDeviceId(params); // 设置蓝牙连接设备ID
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
clearInterval(searchBluetootTimers);
|
|
|
|
clearInterval(searchBluetootTimers);
|
|
|
|
Taro.stopBluetoothDevicesDiscovery(); //停止搜索蓝牙
|
|
|
|
Taro.stopBluetoothDevicesDiscovery(); //停止搜索蓝牙
|
|
|
|
// app.globalData.deviceInfo.deviceId = item.devices[i].deviceId;
|
|
|
|
|
|
|
|
this.createBLEConnection();
|
|
|
|
this.createBLEConnection();
|
|
|
|
}, 10);
|
|
|
|
}, 10);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
@ -335,11 +361,7 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
await closeBLEConnection(this.props.bluetoothInfo.deviceId);
|
|
|
|
await closeBLEConnection(this.props.bluetoothInfo.deviceId);
|
|
|
|
} catch (e) {}
|
|
|
|
} catch (e) {}
|
|
|
|
clearTimeout(connectionTimer);
|
|
|
|
clearTimeout(connectionTimer);
|
|
|
|
const { yiqiInfo: deviceInfo } = this.props;
|
|
|
|
const { deviceInfo } = this.props;
|
|
|
|
console.log(
|
|
|
|
|
|
|
|
"this.props.bluetoothInfo.deviceId",
|
|
|
|
|
|
|
|
this.props.bluetoothInfo.deviceId
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
/*********开始主动连接*******/
|
|
|
|
/*********开始主动连接*******/
|
|
|
|
createBLEConnection(this.props.bluetoothInfo.deviceId)
|
|
|
|
createBLEConnection(this.props.bluetoothInfo.deviceId)
|
|
|
|
.then((res) => {
|
|
|
|
.then((res) => {
|
|
|
|
@ -347,15 +369,12 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
let { errno, errMsg } = res;
|
|
|
|
let { errno, errMsg } = res;
|
|
|
|
if (errno == 0) {
|
|
|
|
if (errno == 0) {
|
|
|
|
if (deviceInfo.model === "WL200") {
|
|
|
|
if (deviceInfo.model === "WL200") {
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
connectionStatus: true,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
connectionTimer = setTimeout(() => {
|
|
|
|
connectionTimer = setTimeout(() => {
|
|
|
|
if (!this.state.islian) {
|
|
|
|
if (!this.state.islian) {
|
|
|
|
if (overTimer) clearTimeout(overTimer);
|
|
|
|
if (overTimer) clearTimeout(overTimer);
|
|
|
|
this.failErrorCode(-1, "连接蓝牙失败,请重新开机后重试");
|
|
|
|
this.failErrorCode(-1, "连接蓝牙失败,请重新开机后重试");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 10000);
|
|
|
|
}, connectionTimerNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.getBLEDeviceServices(); //获取特征
|
|
|
|
this.getBLEDeviceServices(); //获取特征
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -400,7 +419,7 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
/** 7.通知BLE特征值更改 */
|
|
|
|
/** 7.通知BLE特征值更改 */
|
|
|
|
notifyBLECharacteristicValueChange() {
|
|
|
|
notifyBLECharacteristicValueChange() {
|
|
|
|
console.log("7.通知BLE特征值更改");
|
|
|
|
console.log("7.通知BLE特征值更改");
|
|
|
|
const { yiqiInfo: deviceInfo } = this.props;
|
|
|
|
const { deviceInfo } = this.props;
|
|
|
|
const bluetoothInfo = this.props.bluetoothInfo;
|
|
|
|
const bluetoothInfo = this.props.bluetoothInfo;
|
|
|
|
notifyBLECharacteristicValueChange({
|
|
|
|
notifyBLECharacteristicValueChange({
|
|
|
|
deviceId: bluetoothInfo.deviceId,
|
|
|
|
deviceId: bluetoothInfo.deviceId,
|
|
|
|
@ -417,39 +436,32 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
console.log("onBLECharacteristicValueChange value => ", value);
|
|
|
|
console.log("onBLECharacteristicValueChange value => ", value);
|
|
|
|
let str = ab2hex(value.value); //转为16进制字符串
|
|
|
|
let str = ab2hex(value.value); //转为16进制字符串
|
|
|
|
console.log("转为16进制字符串 str", str);
|
|
|
|
console.log("转为16进制字符串 str", str);
|
|
|
|
let connectionStatus = [
|
|
|
|
|
|
|
|
"FR200",
|
|
|
|
|
|
|
|
"WL200",
|
|
|
|
|
|
|
|
"FR380",
|
|
|
|
|
|
|
|
"FR390",
|
|
|
|
|
|
|
|
"M01",
|
|
|
|
|
|
|
|
].includes(deviceInfo.model);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let jsonStatus: any = null;
|
|
|
|
let jsonStatus: any = null;
|
|
|
|
let querySubDeviceArrayBuffer;
|
|
|
|
let querySubDeviceArrayBuffer;
|
|
|
|
|
|
|
|
|
|
|
|
if (deviceInfo.model == "WL200") {
|
|
|
|
if (deviceInfo.model == "WL200") {
|
|
|
|
// querySubDeviceArrayBuffer =
|
|
|
|
if (this.isWL200()) {
|
|
|
|
// deviceToolKitInstanceWL200.toBleCommand(
|
|
|
|
jsonStatus = deviceToolKitInstanceWL200.toJsonStatus(
|
|
|
|
// bleCommandSamples.querySubDevice as any
|
|
|
|
value.value
|
|
|
|
// );
|
|
|
|
);
|
|
|
|
// jsonStatus = deviceToolKitInstanceWL200.toJsonStatus(
|
|
|
|
querySubDeviceArrayBuffer =
|
|
|
|
// value.value
|
|
|
|
deviceToolKitInstanceWL200.toBleCommand(
|
|
|
|
// );
|
|
|
|
bleCommandSamples.querySubDevice as any
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
|
|
|
|
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
|
|
|
|
querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
|
|
|
|
querySubDeviceArrayBuffer =
|
|
|
|
|
|
|
|
deviceToolKitInstanceM01.toBleCommand(
|
|
|
|
bleCommandSamples.querySubDevice as any
|
|
|
|
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(
|
|
|
|
bleCommandSamples.querySubDevice as any
|
|
|
|
bleCommandSamples.querySubDevice as any
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// log.info(
|
|
|
|
|
|
|
|
// commandMap.reciviedBLECommand,
|
|
|
|
|
|
|
|
// `仪器模式: ${deviceInfo.model}`,
|
|
|
|
|
|
|
|
// jsonStatus
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
console.log(
|
|
|
|
console.log(
|
|
|
|
commandMap.reciviedBLECommand,
|
|
|
|
commandMap.reciviedBLECommand,
|
|
|
|
`仪器模式: ${deviceInfo.model}`,
|
|
|
|
`仪器模式: ${deviceInfo.model}`,
|
|
|
|
@ -465,12 +477,11 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
if (overTimer) clearTimeout(overTimer);
|
|
|
|
if (overTimer) clearTimeout(overTimer);
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
connectionSuccess: true,
|
|
|
|
connectionSuccess: true,
|
|
|
|
connectionStatus,
|
|
|
|
|
|
|
|
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;
|
|
|
|
// 暂时不需要查询是否连接子设备, 直接进入查询版本信息
|
|
|
|
// 暂时不需要查询是否连接子设备, 直接进入查询版本信息
|
|
|
|
@ -482,7 +493,7 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
}*/
|
|
|
|
}*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "BleStatusSync":
|
|
|
|
case "BleStatusSync": // 设备连接状态
|
|
|
|
if (jsonStatus.connectMessage?.connectType == "CONNECTED") {
|
|
|
|
if (jsonStatus.connectMessage?.connectType == "CONNECTED") {
|
|
|
|
switch (jsonStatus.connectMessage?.deviceName) {
|
|
|
|
switch (jsonStatus.connectMessage?.deviceName) {
|
|
|
|
case OtaDeviceTypeEnum.WE100:
|
|
|
|
case OtaDeviceTypeEnum.WE100:
|
|
|
|
@ -518,26 +529,27 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
subDeviceConnectedStatus: true,
|
|
|
|
subDeviceConnectedStatus: true,
|
|
|
|
synchronousStatus: true,
|
|
|
|
synchronousStatus: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
const deviceVersionNo = jsonStatus.versionNo;
|
|
|
|
|
|
|
|
const latestVersionNo = deviceInfo.iot_versions;
|
|
|
|
let currentDevicesName = getStorageSync("currentDevicesName");
|
|
|
|
// const isNeedToUpdateBl = isNeedToUpdate(deviceVersionNo, latestVersionNo)
|
|
|
|
let deviceVersionNo = jsonStatus.versionNo;
|
|
|
|
// 判断是否需要升级
|
|
|
|
let latestVersionNo = deviceInfo.iotVersion;
|
|
|
|
// M01和WL200 不需要在这里进行蓝牙更新
|
|
|
|
if (currentDevicesName.indexOf("12CAA") === -1) {
|
|
|
|
// if (isNeedToUpdateBl) {
|
|
|
|
latestVersionNo = deviceInfo.we200IotVersion;
|
|
|
|
// const pages = getCurrentPages();
|
|
|
|
}
|
|
|
|
// const matchPageList = [{
|
|
|
|
// 判断版本号是否需要升级
|
|
|
|
// route: 'pages/MatrixWL200/pages/index/index'
|
|
|
|
const isNeedToUpdateBl = isNeedToUpdate(
|
|
|
|
// },{
|
|
|
|
deviceVersionNo,
|
|
|
|
// route: 'pages/MatrixM01/pages/index/index'
|
|
|
|
latestVersionNo
|
|
|
|
// }];
|
|
|
|
);
|
|
|
|
// const hadOpen = checkSameKey(pages, matchPageList, 'route');
|
|
|
|
console.log("isNeedToUpdateBl", isNeedToUpdateBl);
|
|
|
|
// if (!hadOpen) {
|
|
|
|
if (isNeedToUpdateBl) {
|
|
|
|
// this.triggerEvent("pairingChange", { deviceVersionNo });
|
|
|
|
// 版本号需要更新: 告诉父级页面,关闭连接弹窗,显示更新弹窗
|
|
|
|
this.pairingChange({ deviceVersionNo });
|
|
|
|
this.props.upgradeFun();
|
|
|
|
// }
|
|
|
|
} else {
|
|
|
|
// } else {
|
|
|
|
// 不需要升级,跳转进入仪器详情页
|
|
|
|
// this.sendSyncRecording()
|
|
|
|
if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
|
|
|
|
// }
|
|
|
|
this.pairingChange(this.state);
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "offlineClockSummary":
|
|
|
|
case "offlineClockSummary":
|
|
|
|
clearTimeout(isGetSyncRecordingTimer);
|
|
|
|
clearTimeout(isGetSyncRecordingTimer);
|
|
|
|
@ -546,9 +558,12 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
hasSyncRecord: true,
|
|
|
|
hasSyncRecord: true,
|
|
|
|
synchronousStatus: true,
|
|
|
|
synchronousStatus: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
console.log("offlineClockSummary value =>", jsonStatus);
|
|
|
|
console.log(
|
|
|
|
|
|
|
|
"离线汇总offlineClockSummary value =>",
|
|
|
|
|
|
|
|
jsonStatus
|
|
|
|
|
|
|
|
);
|
|
|
|
// this.triggerEvent("pairingChange", this.state);
|
|
|
|
// this.triggerEvent("pairingChange", this.state);
|
|
|
|
this.pairingChange(this.state);
|
|
|
|
// this.pairingChange(this.state);
|
|
|
|
// TODO 查询离线记录结果
|
|
|
|
// TODO 查询离线记录结果
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
@ -610,7 +625,7 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
|
|
// 8.发送指令:获取仪器版本号
|
|
|
|
// 8.发送指令:获取仪器版本号
|
|
|
|
sendGetVersion() {
|
|
|
|
sendGetVersion() {
|
|
|
|
const { yiqiInfo: deviceInfo } = this.props;
|
|
|
|
const { deviceInfo } = this.props;
|
|
|
|
const isFRDevice = ["FR200", "FR380", "FR390"].includes(deviceInfo.model);
|
|
|
|
const isFRDevice = ["FR200", "FR380", "FR390"].includes(deviceInfo.model);
|
|
|
|
// log.info(commandMap.sendVersionCommand, `仪器:${deviceInfo.model}`);
|
|
|
|
// log.info(commandMap.sendVersionCommand, `仪器:${deviceInfo.model}`);
|
|
|
|
console.log(commandMap.sendVersionCommand, `仪器:${deviceInfo.model}`);
|
|
|
|
console.log(commandMap.sendVersionCommand, `仪器:${deviceInfo.model}`);
|
|
|
|
@ -624,22 +639,21 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
value: `dbf0a00300${ccrc8("dbf0a00300")}de`,
|
|
|
|
value: `dbf0a00300${ccrc8("dbf0a00300")}de`,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// const otaDeviceType = deviceInfo.type == instrumentTypeEnum.WL200 ? OtaDeviceTypeEnum.WL200 : OtaDeviceTypeEnum.WE100;
|
|
|
|
const otaDeviceType = this.isWL200()
|
|
|
|
// 通过发箍连 都用we100
|
|
|
|
? OtaDeviceTypeEnum.WL200
|
|
|
|
const otaDeviceType =
|
|
|
|
|
|
|
|
deviceInfo.model == InstrumentTypeEnum.WL200
|
|
|
|
|
|
|
|
? OtaDeviceTypeEnum.WE100
|
|
|
|
|
|
|
|
: OtaDeviceTypeEnum.WE100;
|
|
|
|
: OtaDeviceTypeEnum.WE100;
|
|
|
|
const versionCommand = {
|
|
|
|
const versionCommand = {
|
|
|
|
commandType: "InfoQuery",
|
|
|
|
commandType: "InfoQuery",
|
|
|
|
infoQueryType: "versionInfo",
|
|
|
|
infoQueryType: "versionInfo",
|
|
|
|
otaDeviceType,
|
|
|
|
otaDeviceType,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const value =
|
|
|
|
console.log("versionCommand", versionCommand);
|
|
|
|
deviceInfo.model == InstrumentTypeEnum.WL200
|
|
|
|
|
|
|
|
? deviceToolKitInstanceM01.toBleCommand(versionCommand as any)
|
|
|
|
// 区分WL200 和 发箍
|
|
|
|
|
|
|
|
const value = this.isWL200()
|
|
|
|
|
|
|
|
? 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 +662,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 +672,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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -693,7 +705,7 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
/** 9.发送配对码 */
|
|
|
|
/** 9.发送配对码 */
|
|
|
|
sendPairingSignal() {
|
|
|
|
sendPairingSignal() {
|
|
|
|
console.log("9.发送配对码 sendPairingSignal");
|
|
|
|
console.log("9.发送配对码 sendPairingSignal");
|
|
|
|
const { yiqiInfo: deviceInfo } = this.props;
|
|
|
|
const { deviceInfo } = this.props;
|
|
|
|
// log.info(commandMap.sendMatchCode, `仪器:${deviceInfo.model}发送匹配码`);
|
|
|
|
// log.info(commandMap.sendMatchCode, `仪器:${deviceInfo.model}发送匹配码`);
|
|
|
|
console.log(commandMap.sendMatchCode, `仪器:${deviceInfo.model}发送匹配码`);
|
|
|
|
console.log(commandMap.sendMatchCode, `仪器:${deviceInfo.model}发送匹配码`);
|
|
|
|
let matchArrayBuffer: any = null;
|
|
|
|
let matchArrayBuffer: any = null;
|
|
|
|
@ -704,14 +716,20 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case InstrumentTypeEnum.WL200:
|
|
|
|
case InstrumentTypeEnum.WL200:
|
|
|
|
// console.log("WL200无法配对,只能用M01");
|
|
|
|
|
|
|
|
console.log("正在发送WL200", bleCommandSamples.match);
|
|
|
|
console.log("正在发送WL200", bleCommandSamples.match);
|
|
|
|
// matchArrayBuffer = deviceToolKitInstanceWL200.toBleCommand(
|
|
|
|
let currentDevicesName = getStorageSync("currentDevicesName");
|
|
|
|
// bleCommandSamples.match as any
|
|
|
|
// 区分面罩和发箍
|
|
|
|
// );
|
|
|
|
if (currentDevicesName.indexOf("12CAA") > -1) {
|
|
|
|
|
|
|
|
console.log("12CAA");
|
|
|
|
|
|
|
|
matchArrayBuffer = deviceToolKitInstanceWL200.toBleCommand(
|
|
|
|
|
|
|
|
bleCommandSamples.match as any
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
matchArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
|
|
|
|
matchArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
|
|
|
|
bleCommandSamples.match as any
|
|
|
|
bleCommandSamples.match as any
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case InstrumentTypeEnum.FR380:
|
|
|
|
case InstrumentTypeEnum.FR380:
|
|
|
|
writeBLECharacteristicValue({
|
|
|
|
writeBLECharacteristicValue({
|
|
|
|
@ -752,64 +770,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("同步时间");
|
|
|
|
@ -853,9 +813,6 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
case 10000:
|
|
|
|
case 10000:
|
|
|
|
errorText = "未初始化蓝牙适配器";
|
|
|
|
errorText = "未初始化蓝牙适配器";
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 10000:
|
|
|
|
|
|
|
|
errorText = "未初始化蓝牙适配器";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 10001:
|
|
|
|
case 10001:
|
|
|
|
errorText = "当前蓝牙适配器不可用";
|
|
|
|
errorText = "当前蓝牙适配器不可用";
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
@ -957,7 +914,8 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
isGetSubDeviceTimer = setInterval(() => {
|
|
|
|
isGetSubDeviceTimer = setInterval(() => {
|
|
|
|
sendCommand({ value });
|
|
|
|
sendCommand({ value });
|
|
|
|
isGetSubDeviceTimerNum += 1;
|
|
|
|
isGetSubDeviceTimerNum += 1;
|
|
|
|
if (isGetSubDeviceTimerNum == 8) {
|
|
|
|
// 15秒超时
|
|
|
|
|
|
|
|
if (isGetSubDeviceTimerNum === 15) {
|
|
|
|
this.closeQuerySubDevice();
|
|
|
|
this.closeQuerySubDevice();
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
error: true,
|
|
|
|
error: true,
|
|
|
|
@ -973,30 +931,25 @@ 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);
|
|
|
|
isGetVersionTimer = setInterval(() => {
|
|
|
|
isGetVersionTimer = setInterval(() => {
|
|
|
|
if (this.state.hasVersionInfo) {
|
|
|
|
if (this.state.hasVersionInfo) {
|
|
|
|
if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
|
|
|
|
if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
|
|
|
|
// that.sendSyncRecording()
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
sendGetVersionTimerNum += 1;
|
|
|
|
sendGetVersionTimerNum += 1;
|
|
|
|
if (sendGetVersionTimerNum >= 10) {
|
|
|
|
if (sendGetVersionTimerNum >= 10) {
|
|
|
|
// 超时未返回版本号
|
|
|
|
// 超时未返回版本号
|
|
|
|
if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
|
|
|
|
if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
|
|
|
|
this.setState({
|
|
|
|
console.log("超时未返回版本号 this.pairingChange", this.state);
|
|
|
|
connectionStatus: true,
|
|
|
|
// this.pairingChange(this.state);
|
|
|
|
});
|
|
|
|
|
|
|
|
// this.triggerEvent("pairingChange", this.state);
|
|
|
|
|
|
|
|
console.log("this.pairingChange", this.state);
|
|
|
|
|
|
|
|
this.pairingChange(this.state);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.sendGetVersion();
|
|
|
|
this.sendGetVersion();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 600);
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
|
|
|
|
// 5秒后没有收到版本返回,直接跳去护理页
|
|
|
|
// 5秒后没有收到版本返回,直接跳去护理页
|
|
|
|
// if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
|
|
|
|
// if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
|
|
|
|
@ -1011,13 +964,12 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
|
|
/** 发送同步记录 */
|
|
|
|
/** 发送同步记录 */
|
|
|
|
sendSyncRecording() {
|
|
|
|
sendSyncRecording() {
|
|
|
|
const { yiqiInfo: deviceInfo } = this.props;
|
|
|
|
const { deviceInfo } = this.props;
|
|
|
|
const versionCommand = {
|
|
|
|
const versionCommand = {
|
|
|
|
commandType: "InfoQuery",
|
|
|
|
commandType: "InfoQuery",
|
|
|
|
infoQueryType: "offlineClockSummary",
|
|
|
|
infoQueryType: "offlineClockSummary",
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const value =
|
|
|
|
const value = this.isWL200()
|
|
|
|
deviceInfo.model == InstrumentTypeEnum.WL200
|
|
|
|
|
|
|
|
? deviceToolKitInstanceWL200.toBleCommand(versionCommand as any)
|
|
|
|
? deviceToolKitInstanceWL200.toBleCommand(versionCommand as any)
|
|
|
|
: deviceToolKitInstanceM01.toBleCommand(versionCommand as any);
|
|
|
|
: deviceToolKitInstanceM01.toBleCommand(versionCommand as any);
|
|
|
|
sendCommand({ value }).then();
|
|
|
|
sendCommand({ value }).then();
|
|
|
|
@ -1053,18 +1005,16 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
let { name, isConnection, connectionStatus, connectionSuccess, error } =
|
|
|
|
let { name, isConnection, connectionSuccess, error } = this.state;
|
|
|
|
this.state;
|
|
|
|
let { deviceInfo } = this.props;
|
|
|
|
let { yiqiInfo } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Block>
|
|
|
|
<Block>
|
|
|
|
<DeviceConnectPopup
|
|
|
|
<DeviceConnectPopup
|
|
|
|
close={this.onClose}
|
|
|
|
close={this.onClose}
|
|
|
|
confirm={this.onConfirm}
|
|
|
|
confirm={this.onConfirm}
|
|
|
|
reconnect={this.onReconnect}
|
|
|
|
reconnect={this.onReconnect}
|
|
|
|
data={yiqiInfo}
|
|
|
|
data={deviceInfo}
|
|
|
|
isShow={true}
|
|
|
|
isShow={true}
|
|
|
|
// connectionStatus={connectionStatus}
|
|
|
|
|
|
|
|
connectionSuccess={connectionSuccess}
|
|
|
|
connectionSuccess={connectionSuccess}
|
|
|
|
isConnection={isConnection}
|
|
|
|
isConnection={isConnection}
|
|
|
|
error={error}
|
|
|
|
error={error}
|
|
|
|
|