|
|
|
|
@ -37,17 +37,19 @@ import {
|
|
|
|
|
// const log = require("@/utils/log");
|
|
|
|
|
import commandMap from "@/utils/commandMap";
|
|
|
|
|
import { bleCommandSamples } from "./wl200";
|
|
|
|
|
import { fr200BleCommand, fr200DeviceControlCommand } from "./fr200";
|
|
|
|
|
|
|
|
|
|
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
|
|
|
|
|
import { DeviceToolKit as DeviceToolKitFR200 } from "@flossom-npm/iot-translater";
|
|
|
|
|
|
|
|
|
|
const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WL200", "WL200");
|
|
|
|
|
deviceToolKitInstanceWL200.setDebug(true);
|
|
|
|
|
|
|
|
|
|
const deviceToolKitInstanceM01 = new DeviceToolKitWE100("WE100", "M01");
|
|
|
|
|
deviceToolKitInstanceM01.setDebug(true);
|
|
|
|
|
|
|
|
|
|
const deviceToolKitInstanceFR200 = new DeviceToolKitFR200("FR200");
|
|
|
|
|
deviceToolKitInstanceFR200.setDebug(true);
|
|
|
|
|
|
|
|
|
|
import { DeviceToolKit as DeviceToolKitFR200 } from "@flossom-npm/iot-translater";
|
|
|
|
|
import {
|
|
|
|
|
showModal,
|
|
|
|
|
msg,
|
|
|
|
|
@ -113,13 +115,13 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
versionInfo: {}, //版本号
|
|
|
|
|
offlineDataList: [], //离线数据
|
|
|
|
|
|
|
|
|
|
prefix: "12CAA", // WL200蓝牙搜索前缀
|
|
|
|
|
// WL200匹配
|
|
|
|
|
tranType: [
|
|
|
|
|
"WE100", // 发箍
|
|
|
|
|
"WE200", // 发箍
|
|
|
|
|
"WL200", // 面罩
|
|
|
|
|
"12CAA", // 面罩前缀名
|
|
|
|
|
"FR200", // FR200
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
currentDeviceType: "", // 现在的设备类型: WE200 WL200
|
|
|
|
|
@ -422,6 +424,40 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**获取附属设备信息与设置当前设备名字*/
|
|
|
|
|
getQueryMatchStatusAndSetName(value) {
|
|
|
|
|
const { deviceInfo } = this.props;
|
|
|
|
|
let querySubDeviceArrayBuffer: any = null;
|
|
|
|
|
let jsonStatus: any = null;
|
|
|
|
|
if (deviceInfo.model == "WL200") {
|
|
|
|
|
if (this.isWL200()) {
|
|
|
|
|
this.setState({ currentDeviceType: "WL200" });
|
|
|
|
|
jsonStatus = deviceToolKitInstanceWL200.toJsonStatus(value);
|
|
|
|
|
querySubDeviceArrayBuffer = deviceToolKitInstanceWL200.toBleCommand(
|
|
|
|
|
bleCommandSamples.querySubDevice as any
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({ currentDeviceType: "WE200" });
|
|
|
|
|
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value);
|
|
|
|
|
querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
|
|
|
|
|
bleCommandSamples.querySubDevice as any
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} else if (deviceInfo.model == "M01") {
|
|
|
|
|
this.setState({ currentDeviceType: "M01" });
|
|
|
|
|
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
|
|
|
|
|
querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
|
|
|
|
|
bleCommandSamples.querySubDevice as any
|
|
|
|
|
);
|
|
|
|
|
} else if (deviceInfo.model === "FR200") {
|
|
|
|
|
// FR200 不需要查询子设备
|
|
|
|
|
jsonStatus = deviceToolKitInstanceFR200.toJsonStatus(value.value);
|
|
|
|
|
this.setState({ currentDeviceType: "FR200" });
|
|
|
|
|
}
|
|
|
|
|
// if (querySubDeviceArrayBuffer) this.sendQuerySubDevice(querySubDeviceArrayBuffer)
|
|
|
|
|
return jsonStatus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 7.通知BLE特征值更改 */
|
|
|
|
|
notifyBLECharacteristicValueChange() {
|
|
|
|
|
console.log("7.通知BLE特征值更改");
|
|
|
|
|
@ -443,39 +479,13 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
let str = ab2hex(value.value); //转为16进制字符串
|
|
|
|
|
console.log("转为16进制字符串 str", str);
|
|
|
|
|
|
|
|
|
|
let jsonStatus: any = null;
|
|
|
|
|
let querySubDeviceArrayBuffer;
|
|
|
|
|
|
|
|
|
|
if (deviceInfo.model == "WL200") {
|
|
|
|
|
if (this.isWL200()) {
|
|
|
|
|
this.setState({ currentDeviceType: "WL200" });
|
|
|
|
|
jsonStatus = deviceToolKitInstanceWL200.toJsonStatus(
|
|
|
|
|
value.value
|
|
|
|
|
);
|
|
|
|
|
querySubDeviceArrayBuffer =
|
|
|
|
|
deviceToolKitInstanceWL200.toBleCommand(
|
|
|
|
|
bleCommandSamples.querySubDevice as any
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({ currentDeviceType: "WE200" });
|
|
|
|
|
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
|
|
|
|
|
querySubDeviceArrayBuffer =
|
|
|
|
|
deviceToolKitInstanceM01.toBleCommand(
|
|
|
|
|
bleCommandSamples.querySubDevice as any
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} else if (deviceInfo.model == "M01") {
|
|
|
|
|
this.setState({ currentDeviceType: "M01" });
|
|
|
|
|
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
|
|
|
|
|
querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
|
|
|
|
|
bleCommandSamples.querySubDevice as any
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
let jsonStatus = this.getQueryMatchStatusAndSetName(value.value);
|
|
|
|
|
console.log(
|
|
|
|
|
commandMap.reciviedBLECommand,
|
|
|
|
|
`仪器模式: ${deviceInfo.model}`,
|
|
|
|
|
jsonStatus
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
console.log("jsonStatus", jsonStatus);
|
|
|
|
|
if (jsonStatus?.commandType === "BleMatch") {
|
|
|
|
|
switch (jsonStatus?.bleCommandType) {
|
|
|
|
|
@ -489,17 +499,9 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
islian: true, // 不需要离线记录,但暂未完全删除这部分逻辑,所以直接设为true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// this.pairingChange(this.state); // 临时添加,用于跳转
|
|
|
|
|
this.detectVersionUpdate(); // 获取升级信息
|
|
|
|
|
// todo 连接成功需删除离线记录,暂时未缓存离线记录
|
|
|
|
|
if (this.state.connectionSuccess) return;
|
|
|
|
|
// 暂时不需要查询是否连接子设备, 直接进入查询版本信息
|
|
|
|
|
// this.detectVersionUpdate();
|
|
|
|
|
/*if(deviceInfo.type == instrumentTypeEnum.M01) {
|
|
|
|
|
this.detectVersionUpdate()
|
|
|
|
|
} else {
|
|
|
|
|
this.sendQuerySubDevice(querySubDeviceArrayBuffer)
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "BleStatusSync": // 设备连接状态
|
|
|
|
|
@ -519,6 +521,10 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
console.log("面罩连上了 value => ", jsonStatus);
|
|
|
|
|
this.detectVersionUpdate();
|
|
|
|
|
break;
|
|
|
|
|
case "FR200":
|
|
|
|
|
console.log("FR200连上了 value => ", jsonStatus);
|
|
|
|
|
this.detectVersionUpdate();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@ -526,7 +532,10 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
console.log("BleStatusSync value => ", jsonStatus);
|
|
|
|
|
break;
|
|
|
|
|
case "QueryMatchStatus":
|
|
|
|
|
console.log("QueryMatchStatus value => ", jsonStatus);
|
|
|
|
|
console.log(
|
|
|
|
|
"查询附属设备QueryMatchStatus value => ",
|
|
|
|
|
jsonStatus
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
@ -536,16 +545,6 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
console.log("当前设备:", jsonStatus.otaDeviceType);
|
|
|
|
|
console.log("当前设备版本号:", jsonStatus.versionNo);
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
jsonStatus.otaDeviceType === "WE100" ||
|
|
|
|
|
jsonStatus.otaDeviceType === "WE200"
|
|
|
|
|
) {
|
|
|
|
|
console.log("closeBLEConnection");
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.againConnection();
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (jsonStatus.infoQueryType) {
|
|
|
|
|
case "versionInfo":
|
|
|
|
|
if (this.state.hasVersionInfo) return;
|
|
|
|
|
@ -560,7 +559,7 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
let currentDevicesName = getStorageSync("currentDevicesName");
|
|
|
|
|
let deviceVersionNo = jsonStatus.versionNo;
|
|
|
|
|
let latestVersionNo = deviceInfo.iotVersion;
|
|
|
|
|
if (currentDevicesName.indexOf("12CAA") === -1) {
|
|
|
|
|
if (currentDevicesName.indexOf("WE") > -1) {
|
|
|
|
|
latestVersionNo = deviceInfo.we200IotVersion;
|
|
|
|
|
}
|
|
|
|
|
// 判断版本号是否需要升级
|
|
|
|
|
@ -573,6 +572,16 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
// 版本号需要更新: 告诉父级页面,关闭连接弹窗,显示更新弹窗
|
|
|
|
|
this.props.upgradeFun();
|
|
|
|
|
} else {
|
|
|
|
|
if (
|
|
|
|
|
currentDevicesName === "WE100" ||
|
|
|
|
|
currentDevicesName === "WE200"
|
|
|
|
|
) {
|
|
|
|
|
console.log("closeBLEConnection");
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.againConnection();
|
|
|
|
|
}, 1000);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
console.log("不需要升级,跳转进入仪器详情页");
|
|
|
|
|
// 不需要升级,跳转进入仪器详情页
|
|
|
|
|
if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
|
|
|
|
|
@ -615,7 +624,6 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
} else if (deviceInfo.model == "WL200" || deviceInfo.model == "M01") {
|
|
|
|
|
if (sendPairingTimer) clearInterval(sendPairingTimer);
|
|
|
|
|
sendPairingTimer = setInterval(() => {
|
|
|
|
|
console.log("test WL200");
|
|
|
|
|
this.sendPairingSignal();
|
|
|
|
|
}, 1000);
|
|
|
|
|
} else if (
|
|
|
|
|
@ -661,44 +669,54 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const isWEorWL = ["WL200", "WE200", "WE100"].includes(model);
|
|
|
|
|
const isFRDevice = ["FR200", "FR380", "FR390"].includes(model);
|
|
|
|
|
console.log(commandMap.sendVersionCommand, `仪器:${model}`);
|
|
|
|
|
if (isFRDevice) {
|
|
|
|
|
writeBLECharacteristicValue({
|
|
|
|
|
//发送获取仪器版本号
|
|
|
|
|
deviceId: this.props.bluetoothInfo.deviceId,
|
|
|
|
|
servicesuuid: this.props.bluetoothInfo.servicesuuid,
|
|
|
|
|
characteristicsuuid1: this.props.bluetoothInfo.characteristicsuuid1,
|
|
|
|
|
characteristicsuuid0: this.props.bluetoothInfo.characteristicsuuid0,
|
|
|
|
|
value: `dbf0a00300${ccrc8("dbf0a00300")}de`,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
const otaDeviceType = this.isWL200()
|
|
|
|
|
? OtaDeviceTypeEnum.WL200
|
|
|
|
|
: OtaDeviceTypeEnum.WE100;
|
|
|
|
|
if (model === "FR200") {
|
|
|
|
|
const value = deviceToolKitInstanceFR200.toBleCommand(
|
|
|
|
|
fr200BleCommand.InfoQuery.versionInfo as any
|
|
|
|
|
);
|
|
|
|
|
sendCommand({ value });
|
|
|
|
|
} else {
|
|
|
|
|
writeBLECharacteristicValue({
|
|
|
|
|
//发送获取仪器版本号
|
|
|
|
|
deviceId: this.props.bluetoothInfo.deviceId,
|
|
|
|
|
servicesuuid: this.props.bluetoothInfo.servicesuuid,
|
|
|
|
|
characteristicsuuid1: this.props.bluetoothInfo.characteristicsuuid1,
|
|
|
|
|
characteristicsuuid0: this.props.bluetoothInfo.characteristicsuuid0,
|
|
|
|
|
value: `dbf0a00300${ccrc8("dbf0a00300")}de`,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else if (isWEorWL) {
|
|
|
|
|
const versionCommand = {
|
|
|
|
|
commandType: "InfoQuery",
|
|
|
|
|
infoQueryType: "versionInfo",
|
|
|
|
|
otaDeviceType,
|
|
|
|
|
otaDeviceType: "",
|
|
|
|
|
};
|
|
|
|
|
console.log("versionCommand", versionCommand);
|
|
|
|
|
|
|
|
|
|
// 区分WL200 和 发箍
|
|
|
|
|
const value = this.isWL200()
|
|
|
|
|
? deviceToolKitInstanceWL200.toBleCommand(versionCommand as any)
|
|
|
|
|
: deviceToolKitInstanceM01.toBleCommand(versionCommand as any);
|
|
|
|
|
|
|
|
|
|
console.log(otaDeviceType, " value", value);
|
|
|
|
|
sendCommand({ value });
|
|
|
|
|
if (this.isWL200()) {
|
|
|
|
|
// WL200
|
|
|
|
|
const otaDeviceType = OtaDeviceTypeEnum.WL200;
|
|
|
|
|
versionCommand.otaDeviceType = otaDeviceType;
|
|
|
|
|
const value = deviceToolKitInstanceWL200.toBleCommand(
|
|
|
|
|
versionCommand as any
|
|
|
|
|
);
|
|
|
|
|
sendCommand({ value });
|
|
|
|
|
} else {
|
|
|
|
|
// WE200 WE100
|
|
|
|
|
const otaDeviceType = OtaDeviceTypeEnum.WE100;
|
|
|
|
|
versionCommand.otaDeviceType = otaDeviceType;
|
|
|
|
|
const value = deviceToolKitInstanceM01.toBleCommand(
|
|
|
|
|
versionCommand as any
|
|
|
|
|
);
|
|
|
|
|
sendCommand({ value });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 获取离线记录 */
|
|
|
|
|
sendofflist() {
|
|
|
|
|
// log.info()
|
|
|
|
|
if (this.state.offlineDataindex == this.state.offlineDataList.length) {
|
|
|
|
|
console.log("离线记录获取完成", this.state);
|
|
|
|
|
// log.info(commandMap.finishOfflineData, this.state.offlineDataList);
|
|
|
|
|
/****
|
|
|
|
|
* 发送同步时间
|
|
|
|
|
* ****/
|
|
|
|
|
@ -711,51 +729,65 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
console.log("发送获取离线记录(细)指令");
|
|
|
|
|
// log.info(commandMap.finishOfflineData, "发送获取离线记录(细)指令");
|
|
|
|
|
writeBLECharacteristicValue({
|
|
|
|
|
//发送获取离线记录
|
|
|
|
|
deviceId: this.props.bluetoothInfo.deviceId,
|
|
|
|
|
servicesuuid: this.props.bluetoothInfo.servicesuuid,
|
|
|
|
|
characteristicsuuid1: this.props.bluetoothInfo.characteristicsuuid1,
|
|
|
|
|
characteristicsuuid0: this.props.bluetoothInfo.characteristicsuuid0,
|
|
|
|
|
value: this.state.offlineData[this.state.offlineDataList.length],
|
|
|
|
|
});
|
|
|
|
|
const { deviceInfo } = this.props;
|
|
|
|
|
let model = deviceInfo.model;
|
|
|
|
|
if (model === "FR200") {
|
|
|
|
|
let matchArrayBuffer = deviceToolKitInstanceFR200.toBleCommand(
|
|
|
|
|
fr200BleCommand.InfoQuery.clockDetail as any
|
|
|
|
|
);
|
|
|
|
|
sendCommand({ value: matchArrayBuffer });
|
|
|
|
|
} else {
|
|
|
|
|
writeBLECharacteristicValue({
|
|
|
|
|
//发送获取离线记录
|
|
|
|
|
deviceId: this.props.bluetoothInfo.deviceId,
|
|
|
|
|
servicesuuid: this.props.bluetoothInfo.servicesuuid,
|
|
|
|
|
characteristicsuuid1: this.props.bluetoothInfo.characteristicsuuid1,
|
|
|
|
|
characteristicsuuid0: this.props.bluetoothInfo.characteristicsuuid0,
|
|
|
|
|
value: this.state.offlineData[this.state.offlineDataList.length],
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/** 获取离线记录(汇总) */
|
|
|
|
|
sendofflistSummary() {
|
|
|
|
|
let str = "DBF0A00200";
|
|
|
|
|
console.log("发送离线记录汇总指令 ==》", str);
|
|
|
|
|
this.setState({ offlineDataList: [] }); // 置空重查离线记录
|
|
|
|
|
// log.info(commandMap.finishOfflineData, `发送获取离线记录(总)指令`);
|
|
|
|
|
writeBLECharacteristicValue({
|
|
|
|
|
//发送获取离线记录
|
|
|
|
|
deviceId: this.props.bluetoothInfo.deviceId,
|
|
|
|
|
servicesuuid: this.props.bluetoothInfo.servicesuuid,
|
|
|
|
|
characteristicsuuid1: this.props.bluetoothInfo.characteristicsuuid1,
|
|
|
|
|
characteristicsuuid0: this.props.bluetoothInfo.characteristicsuuid0,
|
|
|
|
|
value: `${str}${ccrc8(str)}DE`,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const { deviceInfo } = this.props;
|
|
|
|
|
let model = deviceInfo.model;
|
|
|
|
|
if (model === "FR200") {
|
|
|
|
|
let matchArrayBuffer = deviceToolKitInstanceFR200.toBleCommand(
|
|
|
|
|
fr200BleCommand.InfoQuery.clockSummary as any
|
|
|
|
|
);
|
|
|
|
|
sendCommand({ value: matchArrayBuffer });
|
|
|
|
|
} else {
|
|
|
|
|
writeBLECharacteristicValue({
|
|
|
|
|
//发送获取离线记录
|
|
|
|
|
deviceId: this.props.bluetoothInfo.deviceId,
|
|
|
|
|
servicesuuid: this.props.bluetoothInfo.servicesuuid,
|
|
|
|
|
characteristicsuuid1: this.props.bluetoothInfo.characteristicsuuid1,
|
|
|
|
|
characteristicsuuid0: this.props.bluetoothInfo.characteristicsuuid0,
|
|
|
|
|
value: `${str}${ccrc8(str)}DE`,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 9.发送配对码 */
|
|
|
|
|
sendPairingSignal() {
|
|
|
|
|
console.log("9.发送配对码 sendPairingSignal");
|
|
|
|
|
const { deviceInfo } = this.props;
|
|
|
|
|
// log.info(commandMap.sendMatchCode, `仪器:${deviceInfo.model}发送匹配码`);
|
|
|
|
|
console.log(commandMap.sendMatchCode, `仪器:${deviceInfo.model}发送匹配码`);
|
|
|
|
|
let matchArrayBuffer: any = null;
|
|
|
|
|
switch (deviceInfo.model) {
|
|
|
|
|
case InstrumentTypeEnum.FR200:
|
|
|
|
|
matchArrayBuffer = deviceToolKitInstanceFR200.toBleCommand(
|
|
|
|
|
bleCommandSamples.match as any
|
|
|
|
|
fr200BleCommand.match as any
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case InstrumentTypeEnum.WL200:
|
|
|
|
|
console.log("正在发送WL200", bleCommandSamples.match);
|
|
|
|
|
let currentDevicesName = getStorageSync("currentDevicesName");
|
|
|
|
|
// 区分面罩和发箍
|
|
|
|
|
if (currentDevicesName.indexOf("12CAA") > -1) {
|
|
|
|
|
console.log("12CAA");
|
|
|
|
|
matchArrayBuffer = deviceToolKitInstanceWL200.toBleCommand(
|
|
|
|
|
bleCommandSamples.match as any
|
|
|
|
|
);
|
|
|
|
|
@ -945,6 +977,8 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
errorText,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**发送消息获取子设备*/
|
|
|
|
|
sendQuerySubDevice(value) {
|
|
|
|
|
isGetSubDeviceTimer = setInterval(() => {
|
|
|
|
|
sendCommand({ value });
|
|
|
|
|
@ -995,14 +1029,35 @@ class ConnectionBluetoot extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
/** 发送同步记录 */
|
|
|
|
|
sendSyncRecording() {
|
|
|
|
|
const versionCommand = {
|
|
|
|
|
const clockSummaryCommand = {
|
|
|
|
|
commandType: "InfoQuery",
|
|
|
|
|
infoQueryType: "offlineClockSummary",
|
|
|
|
|
};
|
|
|
|
|
const value = this.isWL200()
|
|
|
|
|
? deviceToolKitInstanceWL200.toBleCommand(versionCommand as any)
|
|
|
|
|
: deviceToolKitInstanceM01.toBleCommand(versionCommand as any);
|
|
|
|
|
sendCommand({ value }).then();
|
|
|
|
|
|
|
|
|
|
const { deviceInfo } = this.props;
|
|
|
|
|
let model = deviceInfo.model;
|
|
|
|
|
if (model === "WL200") {
|
|
|
|
|
if (!this.isWL200()) {
|
|
|
|
|
model = "WE200";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const isWEorWL = ["WL200", "WE200", "WE100"].includes(model);
|
|
|
|
|
const isFRDevice = ["FR200", "FR380", "FR390"].includes(model);
|
|
|
|
|
if (isFRDevice) {
|
|
|
|
|
if (model === "FR200") {
|
|
|
|
|
let value = deviceToolKitInstanceFR200.toBleCommand(
|
|
|
|
|
fr200BleCommand.InfoQuery.clockSummary as any
|
|
|
|
|
);
|
|
|
|
|
sendCommand({ value }).then();
|
|
|
|
|
}
|
|
|
|
|
} else if (isWEorWL) {
|
|
|
|
|
const value = this.isWL200()
|
|
|
|
|
? deviceToolKitInstanceWL200.toBleCommand(clockSummaryCommand as any)
|
|
|
|
|
: deviceToolKitInstanceM01.toBleCommand(clockSummaryCommand as any);
|
|
|
|
|
sendCommand({ value }).then();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isGetSyncRecordingTimer) clearTimeout(isGetSyncRecordingTimer);
|
|
|
|
|
isGetSyncRecordingTimer = setTimeout(() => {
|
|
|
|
|
if (this.state.hasSyncRecord) {
|
|
|
|
|
|