| New file |
| | |
| | | // 欧姆龙 HBP-9030 115200 |
| | | import { ElMessage } from 'element-plus' |
| | | const { SerialPort } = require('serialport') |
| | | const { DelimiterParser } = require('@serialport/parser-delimiter') |
| | | const { ByteLengthParser } = require('@serialport/parser-byte-length') |
| | | import {sockteStore} from '@/stores/sockteInfo' |
| | | |
| | | |
| | | const initPort=(path:String,baudRate:Number)=>{ |
| | | console.log('初始化打开测温端口') |
| | | const serialport = new SerialPort({ path, baudRate }, (err: any) => { |
| | | if (err) { |
| | | console.log(err) |
| | | ElMessage({ |
| | | message: '端口打开失败!', |
| | | type: 'error', |
| | | }) |
| | | console.log(err) |
| | | }else{ |
| | | ElMessage({ |
| | | message: '端口打开成功', |
| | | type: 'success', |
| | | }) |
| | | } |
| | | }) |
| | | serialport.on("close",(err: any)=>{ |
| | | console.log('端口异常端口链接断开') |
| | | console.log(err) |
| | | }) |
| | | // 解析分割数据流 |
| | | const parser = serialport.pipe(new ByteLengthParser({ length: 14*4-1 })) |
| | | parser.on('data', (value: string | any[])=>{ |
| | | console.log(value.toString()) |
| | | const str=value.toString() |
| | | const list=str.split(',') |
| | | console.log(list) |
| | | if(list.length===11){ |
| | | |
| | | sockteStore().setxyjSockte( |
| | | { |
| | | deviceName:'HBP-9030', |
| | | type:"血压计", |
| | | result:list[7]+','+list[8]+','+list[9], |
| | | resultTime:new Date().toString(), |
| | | state:2 |
| | | } |
| | | ) |
| | | } |
| | | |
| | | }) |
| | | } |
| | | |
| | | export { |
| | | initPort, |
| | | } |
| | |
| | | face_push:3, |
| | | Is_ce_wen:false, |
| | | portPath:'COM5', |
| | | baudRate:115200 |
| | | baudRate:115200, |
| | | Is_xyj:false, |
| | | xueyanjiPortPath:"COM35", |
| | | xueyanjiBaudRate:115200 |
| | | |
| | | }) |
| | | /** |
| | |
| | | import { confingInfoStore } from '@/stores/StoresConfing' |
| | | import {base64toFile} from '@/samples/faceApi' |
| | | import{initPort} from '@/samples/portApi' |
| | | import{initPort as oumulongHbp9030 } from '@/samples/deviceApi/oumulong-HBP-9030' |
| | | import { ElLoading, ElMessage } from 'element-plus' |
| | | let trackerTask: any = null; |
| | | // 标识用的画布 |
| | |
| | | if(is_ce_wen.value){ |
| | | initPort(configData.value.portPath,configData.value.baudRate) |
| | | } |
| | | // 是否开启血压计联机 |
| | | if(configData.value.Is_xyj){ |
| | | oumulongHbp9030(configData.value.xueyanjiPortPath,configData.value.xueyanjiBaudRate) |
| | | } |
| | | // 是否开启脸识别 |
| | | isUseFaceRecogService.value = configData.value.isUseFaceRecogService |
| | | console.log('人脸识别',isUseFaceRecogService.value) |