|
|
|
@ -39,9 +39,13 @@ export default class BluetoothContainer {
|
|
|
|
...WE200DeviceControlCommand.workByPatitionSet,
|
|
|
|
...WE200DeviceControlCommand.workByPatitionSet,
|
|
|
|
workMode: workMode, // 使用模式
|
|
|
|
workMode: workMode, // 使用模式
|
|
|
|
gearTakeEffectOffline: gearTakeEffectOffline, // 是否离线生效
|
|
|
|
gearTakeEffectOffline: gearTakeEffectOffline, // 是否离线生效
|
|
|
|
partitionStatus: partitionStatus // 默认用官配模式
|
|
|
|
partitionStatus: partitionStatus, // 默认用官配模式
|
|
|
|
|
|
|
|
deviceSyncCommandType: 'onlySyncStatusToDevice',
|
|
|
|
|
|
|
|
totalWorkingMinutes: 0,
|
|
|
|
|
|
|
|
totalWorkingSeconds: 0,
|
|
|
|
|
|
|
|
// deviceSyncCommandType: "onlySyncStatusToDevice",
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const pauseArrayBuffer = this.deviceToolKitInstance.toBleCommand(
|
|
|
|
const pauseArrayBuffer = this.deviceToolKitInstance?.toBleCommand(
|
|
|
|
sendParams as any
|
|
|
|
sendParams as any
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
@ -60,6 +64,11 @@ export default class BluetoothContainer {
|
|
|
|
let sendParams: any = {
|
|
|
|
let sendParams: any = {
|
|
|
|
...WE200DeviceControlCommand.pause,
|
|
|
|
...WE200DeviceControlCommand.pause,
|
|
|
|
workMode: workMode, // 使用模式
|
|
|
|
workMode: workMode, // 使用模式
|
|
|
|
|
|
|
|
workStatus: 'standby',
|
|
|
|
|
|
|
|
deviceSyncCommandType: 'onlySyncStatusToDevice',
|
|
|
|
|
|
|
|
totalWorkingMinutes: 0,
|
|
|
|
|
|
|
|
totalWorkingSeconds: 0,
|
|
|
|
|
|
|
|
// deviceSyncCommandType: "onlySyncStatusToDevice",
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const pauseArrayBuffer = this.deviceToolKitInstance?.toBleCommand(
|
|
|
|
const pauseArrayBuffer = this.deviceToolKitInstance?.toBleCommand(
|
|
|
|
sendParams as any
|
|
|
|
sendParams as any
|
|
|
|
@ -100,14 +109,14 @@ export default class BluetoothContainer {
|
|
|
|
partitionStatus
|
|
|
|
partitionStatus
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// 根据不同模式进行控制传参处理
|
|
|
|
// 根据不同模式进行控制传参处理
|
|
|
|
switch (workMode) {
|
|
|
|
// switch (workMode) {
|
|
|
|
case "private_custom_current":
|
|
|
|
// case "private_custom_current":
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
case "official_specific_effective":
|
|
|
|
// case "official_specific_effective":
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
case 'DiyFacial_Custom':
|
|
|
|
// case 'DiyFacial_Custom':
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
const pauseArrayBuffer = this.deviceToolKitInstance?.toBleCommand(
|
|
|
|
const pauseArrayBuffer = this.deviceToolKitInstance?.toBleCommand(
|
|
|
|
sendParams as any
|
|
|
|
sendParams as any
|
|
|
|
@ -124,8 +133,9 @@ export default class BluetoothContainer {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/** @name 设备控制:结束 */
|
|
|
|
/** @name 设备控制:结束 */
|
|
|
|
end: (workMode = '') => {
|
|
|
|
end: (workMode = '') => {
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
let sendParams: any = {
|
|
|
|
let sendParams: any = {
|
|
|
|
...WE200DeviceControlCommand.pause,
|
|
|
|
...WE200DeviceControlCommand.end,
|
|
|
|
workMode: workMode, // 使用模式
|
|
|
|
workMode: workMode, // 使用模式
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const pauseArrayBuffer = this.deviceToolKitInstance?.toBleCommand(
|
|
|
|
const pauseArrayBuffer = this.deviceToolKitInstance?.toBleCommand(
|
|
|
|
@ -138,7 +148,25 @@ export default class BluetoothContainer {
|
|
|
|
this.that.resetTimer();
|
|
|
|
this.that.resetTimer();
|
|
|
|
console.info(`发送结束指令成功 参数为 =>`, sendParams);
|
|
|
|
console.info(`发送结束指令成功 参数为 =>`, sendParams);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询设备护理报告
|
|
|
|
|
|
|
|
getCurrentFacialReportInfo:(workMode = '') => {
|
|
|
|
|
|
|
|
const infoQueryComment = {
|
|
|
|
|
|
|
|
commandType: 'InfoQuery',
|
|
|
|
|
|
|
|
infoQueryType: 'currentFacialReportInfo',
|
|
|
|
|
|
|
|
workMode: workMode,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const value = this.deviceToolKitInstance?.toBleCommand(infoQueryComment);
|
|
|
|
|
|
|
|
sendCommand({
|
|
|
|
|
|
|
|
value: value
|
|
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
|
|
console.info('下发指令查询护理报告==》', JSON.stringify(infoQueryComment));
|
|
|
|
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 离线记录汇总 */
|
|
|
|
syncOfflineSummary: () => {
|
|
|
|
syncOfflineSummary: () => {
|
|
|
|
const queryOfflineSummary = this.deviceToolKitInstance?.toBleCommand({
|
|
|
|
const queryOfflineSummary = this.deviceToolKitInstance?.toBleCommand({
|
|
|
|
...WE200BleCommand.InfoQuery.offlineSummary
|
|
|
|
...WE200BleCommand.InfoQuery.offlineSummary
|
|
|
|
@ -147,6 +175,7 @@ export default class BluetoothContainer {
|
|
|
|
value: queryOfflineSummary,
|
|
|
|
value: queryOfflineSummary,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
/** 最新一条离线记录详情 */
|
|
|
|
syncOfflineDetail: () => {
|
|
|
|
syncOfflineDetail: () => {
|
|
|
|
const queryOfflineDetail = this.deviceToolKitInstance?.toBleCommand({
|
|
|
|
const queryOfflineDetail = this.deviceToolKitInstance?.toBleCommand({
|
|
|
|
...WE200BleCommand.InfoQuery.offlineDetail
|
|
|
|
...WE200BleCommand.InfoQuery.offlineDetail
|
|
|
|
@ -154,6 +183,18 @@ export default class BluetoothContainer {
|
|
|
|
sendCommand({
|
|
|
|
sendCommand({
|
|
|
|
value: queryOfflineDetail,
|
|
|
|
value: queryOfflineDetail,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 同步设备状态
|
|
|
|
|
|
|
|
sendOnlySyncStatusToDevice() {
|
|
|
|
|
|
|
|
console.log('主动查询设备状态指令发送');
|
|
|
|
|
|
|
|
const queryM01DeviceArrayBuffer = this.deviceToolKitInstance?.toBleCommand({
|
|
|
|
|
|
|
|
commandType: "DeviceStatusSync",
|
|
|
|
|
|
|
|
deviceSyncCommandType: 'onlySyncStatusToDevice'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
sendCommand({
|
|
|
|
|
|
|
|
value: queryM01DeviceArrayBuffer
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -168,7 +209,13 @@ export default class BluetoothContainer {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** @name 设备响应:暂停 */
|
|
|
|
/** @name 设备响应:暂停 */
|
|
|
|
private syncPause(jsonStatus) {
|
|
|
|
private syncPause(jsonStatus) {
|
|
|
|
console.log("上报暂停", jsonStatus)
|
|
|
|
console.log("上报暂停", jsonStatus,this.that.state)
|
|
|
|
|
|
|
|
let {ishandPause,checkedMembraneCloth} =this.that.state
|
|
|
|
|
|
|
|
// isHand为true的时候代表他正在运行中,正在运行中的时候,如果他自己暂停的情况下,需要我自己在次发送
|
|
|
|
|
|
|
|
if(ishandPause){
|
|
|
|
|
|
|
|
this.DeviceControl.working(checkedMembraneCloth)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let isDisconnect = false;
|
|
|
|
let isDisconnect = false;
|
|
|
|
// true代表暂停
|
|
|
|
// true代表暂停
|
|
|
|
if (isDisconnect) {
|
|
|
|
if (isDisconnect) {
|
|
|
|
@ -182,6 +229,7 @@ export default class BluetoothContainer {
|
|
|
|
isError: false
|
|
|
|
isError: false
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -227,20 +275,13 @@ export default class BluetoothContainer {
|
|
|
|
|
|
|
|
|
|
|
|
/** @name 设备响应:通用状态响应 */
|
|
|
|
/** @name 设备响应:通用状态响应 */
|
|
|
|
private syncCommonStatus(jsonStatus) {
|
|
|
|
private syncCommonStatus(jsonStatus) {
|
|
|
|
|
|
|
|
if (jsonStatus?.workMode) {
|
|
|
|
|
|
|
|
this.that.jsonStatus = jsonStatus;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** @name 设备响应:控制指令响应 */
|
|
|
|
|
|
|
|
private syncDeviceControl(jsonStatus) {
|
|
|
|
|
|
|
|
console.log("设备控制响应", jsonStatus);
|
|
|
|
|
|
|
|
if (jsonStatus.responseStatus == "OK") {
|
|
|
|
|
|
|
|
console.log("发送控制指令成功");
|
|
|
|
|
|
|
|
this.that.workJsonStatus = jsonStatus;
|
|
|
|
|
|
|
|
this.that.workStatus = jsonStatus.workStatus;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (jsonStatus.battery) {
|
|
|
|
if (jsonStatus.battery) {
|
|
|
|
this.that.setState({
|
|
|
|
this.that.setState({
|
|
|
|
Electricity: jsonStatus.battery,
|
|
|
|
Electricity: jsonStatus.matrixBattery,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -292,6 +333,15 @@ export default class BluetoothContainer {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @name 设备响应:控制指令响应 */
|
|
|
|
|
|
|
|
private syncDeviceControl(jsonStatus) {
|
|
|
|
|
|
|
|
console.log("设备控制响应", jsonStatus);
|
|
|
|
|
|
|
|
// if (jsonStatus.responseStatus == "OK") {
|
|
|
|
|
|
|
|
// console.log("发送控制指令成功");
|
|
|
|
|
|
|
|
// // this.that.workJsonStatus = jsonStatus;
|
|
|
|
|
|
|
|
// // this.that.workStatus = jsonStatus.workStatus;
|
|
|
|
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -313,7 +363,7 @@ export default class BluetoothContainer {
|
|
|
|
if (!jsonStatus || jsonStatus == null) {
|
|
|
|
if (!jsonStatus || jsonStatus == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.that.workStatus = jsonStatus.workStatus; // 记录工作状态
|
|
|
|
// this.that.workStatus = jsonStatus.workStatus; // 记录工作状态
|
|
|
|
|
|
|
|
|
|
|
|
// end 和 endWork 都是护理结束, endWork不关机, end 关机, 对小程序而言处理流程都一样
|
|
|
|
// end 和 endWork 都是护理结束, endWork不关机, end 关机, 对小程序而言处理流程都一样
|
|
|
|
if (jsonStatus.workStatus && jsonStatus.workStatus == "endWork") {
|
|
|
|
if (jsonStatus.workStatus && jsonStatus.workStatus == "endWork") {
|
|
|
|
@ -346,7 +396,7 @@ export default class BluetoothContainer {
|
|
|
|
if (jsonStatus.battery) {
|
|
|
|
if (jsonStatus.battery) {
|
|
|
|
// 防止抖动
|
|
|
|
// 防止抖动
|
|
|
|
this.that.setState({
|
|
|
|
this.that.setState({
|
|
|
|
Electricity: jsonStatus.battery,
|
|
|
|
Electricity: jsonStatus.matrixBattery,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -370,6 +420,7 @@ export default class BluetoothContainer {
|
|
|
|
//设备对控制指令的响应
|
|
|
|
//设备对控制指令的响应
|
|
|
|
case "DeviceControl":
|
|
|
|
case "DeviceControl":
|
|
|
|
this.syncDeviceControl(jsonStatus);
|
|
|
|
this.syncDeviceControl(jsonStatus);
|
|
|
|
|
|
|
|
this.syncCommonStatus(jsonStatus);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
// 设备对信息查询指令的响应
|
|
|
|
// 设备对信息查询指令的响应
|
|
|
|
case "InfoQuery":
|
|
|
|
case "InfoQuery":
|
|
|
|
@ -451,6 +502,11 @@ export default class BluetoothContainer {
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
// }, 20000);
|
|
|
|
// }, 20000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
this.DeviceControl.sendOnlySyncStatusToDevice()
|
|
|
|
|
|
|
|
}, 1000)
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|