| | |
| | | import { ElMessage } from 'element-plus' |
| | | const { SerialPort } = require('serialport') |
| | | const { DelimiterParser } = require('@serialport/parser-delimiter') |
| | | import {sockteStore} from '@/stores/sockteInfo' |
| | | |
| | | |
| | | let serialport={} |
| | | // 解析器分隔符 |
| | |
| | | const hex4e=value[0] |
| | | const hex0e=value[1] |
| | | const wendu=(hex4e+hex0e*256)/100 |
| | | ElMessage({ |
| | | message: '收到温度:'+wendu, |
| | | type: 'success', |
| | | }) |
| | | if(wendu>20){ |
| | | sockteStore().setWendu(wendu) |
| | | console.log('解析到的温度'+wendu) |
| | | // ElMessage({ |
| | | // message: '收到温度:'+wendu, |
| | | // type: 'success', |
| | | // }) |
| | | }else{ |
| | | console.log('读取温度异常'+wendu) |
| | | } |
| | | |
| | | } |
| | | }) |
| | | } |