润和串口调试

This commit is contained in:
lvyuankang 2024-05-30 15:49:06 +08:00
parent c3c5c2063c
commit 8dcdb29f61
5 changed files with 137 additions and 250 deletions

View File

@ -258,48 +258,55 @@ export async function takePhotoFn(context) {
}, 3000)
}
let fd
const devPath="/dev/ttyS3"
function openChuankouFn() {
fd = testNapi.SerialOpen(devPath);
const devPath="/dev/ttyUSB0"
async function openChuankouFn():Promise<number> {
console.log('fdfd1111 start')
fd = await testNapi.SerialOpen(devPath);
globalThis.fd=fd
console.log('fdfd1111',globalThis.fd)
let parity = 0x4e; // 'N'
let ret = testNapi.SerialSet(globalThis.fd, 115200, 0, 8, 1, parity);
let ret = await testNapi.SerialSet(globalThis.fd, 115200, 0, 8, 1, parity);
console.log('setNum',ret)
return ret
}
function getChuankouFnMsg() {
async function getChuankouFnMsg() {
let timeout = 50000; // 2秒超时
let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
console.log('fdfd',globalThis.fd)
let ret = testNapi.SerialSend(globalThis.fd, databuff);
console.log('mmmm',ret)
let revTestInfo = testNapi?.SerialRecv(globalThis.fd, timeout);
console.log('revTestInfo',revTestInfo.recevedBuf.length)
const message = revTestInfo?.recevedBuf?.toString()
console.log('chuankou',message)
if (message == '') {
return
}
const msg = message?.split(',')
if(!msg?.length){
return
}
if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
return
}
globalThis.chuankoMsg=msg[9]
let uint8Arr = new Uint8Array(databuff);
testNapi.SerialSend(globalThis.fd, uint8Arr).then((ret) => {
console.log('mmmm',ret)
testNapi?.SerialRecv(globalThis.fd, timeout,12).then((revTestInfo) => {
console.log('revTestInfo',revTestInfo.recevedBuf.length)
const message = revTestInfo?.recevedBuf?.toString()
console.log('chuankou',message)
if (message == '') {
return
}
const msg = message?.split(',')
if(!msg?.length){
return
}
if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
return
}
globalThis.chuankoMsg=msg[9]
})
});
}
export async function getChuankouFn(){
if(globalThis.fd){
return
}
openChuankouFn()
setInterval(()=>{
getChuankouFnMsg()
},1000)
openChuankouFn().then((fd) => {
setInterval(()=>{
getChuankouFnMsg()
},1000)
})
}

View File

@ -92,43 +92,45 @@ interface takePhotoParam {
*/
const fileHelper = new FileHelper();
export async function takePhoto(param, context,dir,flag=1,callback?) {
//
// var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${param.pztd}/main/av_stream`;
// // var video_uri = `rtsp://admin:openharmony1@192.168.1.66:554/Streaming/Channels/3`;
//
// const num = Math.floor(Math.random() * 10000)
// const fileName = `picture_record${num}.jpg`
//
//
// console.log(`baoyihu Rtsprecord baohaowen getVideoSnapshot fileName` + fileName);
// // @ts-ignore
// // var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, '', dir);
// if(flag==0){
// rtsp_server.detectVideoSnapshotSize(video_uri,fileName,(err,snapResult)=>{
// console.log("baohaowen_detectLoop round end size1:"+snapResult.fileSize);
// callback({fileSize:snapResult.fileSize })
// });
// // rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,false,(err,snapResult)=>{
// // console.log(`baoyihu getVideoSnapshot return `);
// // console.log(`baoyihu getVideoSnapshot file_name` + snapResult.fileName);
// // console.log(`baoyihu getVideoSnapshot file_path` + snapResult.filePath);
// // console.log(`baoyihu getVideoSnapshot fileSize` + snapResult.fileSize);
// // fileHelper.addFile(fileName,1)
// // callback({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize })
// // console.log('getmyLog01')
// // });
// }
// else{
// return new Promise<takePhotoParam>((resolve,reject)=>{
// rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,true,(err,snapResult)=>{
// console.log('getPhtot')
// resolve({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize })
// });
// })
// console.log('getmyLog02')
//
// }
// console.log('getmyLog03')
var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${param.pztd}/main/av_stream`;
// var video_uri = `rtsp://admin:openharmony1@192.168.1.66:554/Streaming/Channels/3`;
const num = Math.floor(Math.random() * 10000)
const fileName = `picture_record${num}.jpg`
console.log(`baoyihu Rtsprecord baohaowen getVideoSnapshot fileName` + fileName);
// @ts-ignore
// var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, '', dir);
if(flag==0){
// @ts-ignore
rtsp_server.detectVideoSnapshotSize(video_uri,fileName,(err,snapResult)=>{
console.log("baohaowen_detectLoop round end size1:"+snapResult.fileSize);
callback({fileSize:snapResult.fileSize })
});
// rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,false,(err,snapResult)=>{
// console.log(`baoyihu getVideoSnapshot return `);
// console.log(`baoyihu getVideoSnapshot file_name` + snapResult.fileName);
// console.log(`baoyihu getVideoSnapshot file_path` + snapResult.filePath);
// console.log(`baoyihu getVideoSnapshot fileSize` + snapResult.fileSize);
// fileHelper.addFile(fileName,1)
// callback({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize })
// console.log('getmyLog01')
// });
}
else{
return new Promise<takePhotoParam>((resolve,reject)=>{
// @ts-ignore
rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,true,(err,snapResult)=>{
console.log('getPhtot')
resolve({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize })
});
})
console.log('getmyLog02')
}
console.log('getmyLog03')
}
@ -183,37 +185,3 @@ export async function deleteAllVideos(context,type: photoAccessHelper.AlbumType,
}
}
}
// export async function takePhoto(param, context, type = 0, dir) {
// return new Promise((reslove, reject) => {
// console.log('mmmmmmmttt,04', type)
//
// // const rtsp_server = record.createServer();
// var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${param.pztd}/main/av_stream`;
// // var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, dir);
// // console.log(`baoyihu Rtsprecord getVideoSnapshot file` + snapResult.dataString);
//
// console.log(`baoyihu Rtsprecord getVideoSnapshot begin`);
// // const num = Math.floor(Math.random() * 10000)
// console.log('mmmmmmmttt,05', video_uri)
//
// const num = Math.floor(Math.random() * 10000)
// const fileName = `picture_record${num}.jpg`
// console.log(`baoyihu Rtsprecord baohaowen getVideoSnapshot fileName` + fileName);
// // @ts-ignore
// var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, fileName, dir, (ret) => {
// const str = ret.dataString
// if (type == 1) {
// console.log('mmmmmmmttt',str.length)
// reslove(str)
// } else {
// reslove('')
// }
// })
// // console.log('mmmmmmmttt,06',snapResult.dataString)
//
// // console.log(`baoyihu Rtsprecord getVideoSnapshot file` + snapResult.fileName);
// // console.log(`baoyihu Rtsprecord getVideoSnapshot dataLen` + snapResult.dataString.length);
// // console.log('datadata1',snapResult.dataString.length)
// })
//
// }

View File

@ -1,62 +0,0 @@
import buffer from '@ohos.buffer';
import testNapi from '@ohos.hiserialsdk'
const TAG = '[TcpDemo.TcpClient]'
import prompt from '@ohos.prompt'
/**
* devPath
*j36--ttyS5
* j37--ttyS7
* j38--ttyS9
*/
export default class SerialPortClient {
private devPath: string = ''
private len: any = ''
private fd: number = -1
private speed: number = 115200 //波特率
private databits: number = 8 //数据位
private flow_ctrl:number=0 //流控制
private stopbits:number=1 //停止位
private parity:number=0x4e //停止位
constructor(devPath?:string) {
this.devPath = devPath || '/dev/ttyS5'
}
openSerial() {
this.fd = testNapi.SerialOpen(this.devPath);
}
SerialSet(param?) {
this.speed = param?.speed || 115200
this.flow_ctrl=param?.flow_ctrl||0
this.databits = param?.databits||8
this.stopbits=param?.stopbits||1
this.parity=param?.parity || 0x4e
testNapi.SerialSet(this.fd, this.speed , this.flow_ctrl, this.databits, this.stopbits,this.parity);
}
SerialSend(data?) {
const sendArr = data || [0x61, 0xAA, 0x0A, 0X15, 0X00] //档位查询
testNapi.SerialSend(this.fd, sendArr);
}
SerialRecv(timeout?: number) {
let revTestInfo = testNapi.SerialRecv(this.fd, timeout);
//let revTestInfo = testNapi.SerialRecv(this.fd, timeout, 6);
const message = revTestInfo?.recevedBuf?.toString()
console.log('revTestInfo.recevedBuf.toString()',revTestInfo.recevedBuf)
console.log('revTestInfo.recevedBuf.toString()',revTestInfo.recevedBuf.toString())
this.len = revTestInfo.recevedLen
return {
msg: message, recevedLen: this.len
}
}
SerialClose(callback) {
testNapi.SerialClose(this.fd);
}
}

View File

@ -27,6 +27,7 @@ struct Index {
private img: ImageBitmap = new ImageBitmap("/resources/base/media/1.png")
async aboutToAppear() {
globalThis.radio2=0.5
globalThis.windowClass.setWindowSystemBarEnable([''])
const time = await getCurrentTime()
const examSubject = globalThis.carInfo.examSubject
@ -409,19 +410,19 @@ struct Index {
Column() {
Row() {
Row() {
Image($rawfile('judge/signal_logoS.png')).width(120)
Text(this.time).fontColor('#CCB48F').fontSize(32).padding({ left: 10, right: 5 })
Image($rawfile('judge/xh_green.png')).width(50)
}.padding({left:20})
Image($rawfile('judge/signal_logoS.png')).width(120*globalThis.radio2)
Text(this.time).fontColor('#CCB48F').fontSize(32*globalThis.radio2).padding({ left: 10*globalThis.radio2, right: 5*globalThis.radio2 })
Image($rawfile('judge/xh_green.png')).width(50*globalThis.radio2)
}.padding({left:20*globalThis.radio2})
Row() {
Text(`当前项目:${this.xmmcStr || '无'} `).fontColor('#E5CCA1').fontSize(32)
Text(`当前项目:${this.xmmcStr || '无'} `).fontColor('#E5CCA1').fontSize(32*globalThis.radio2)
}
}
.width('100%')
.height('96')
.backgroundColor('#001A33')
.padding({ left: 15, right: 15 })
.padding({ left: 15*globalThis.radio2, right: 15*globalThis.radio2 })
.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Center)
@ -433,12 +434,12 @@ struct Index {
Row() {
Text('考生姓名:').fontColor('#E5CCA1').fontSize(this.FONTSIZE)
Text(this.name).fontColor('#FFF').fontSize(this.FONTSIZE)
}.margin({ bottom: 10 })
}.margin({ bottom: 10*globalThis.radio2 })
Row() {
Text('开始时间:').fontColor('#E5CCA1').fontSize(this.FONTSIZE)
Text(this.startTime).fontColor('#FFF').fontSize(this.FONTSIZE)
}.margin({ bottom: 10 })
}.margin({ bottom: 10*globalThis.radio2 })
if(this.examSubject == 3){
Row() {
@ -453,17 +454,17 @@ struct Index {
Row() {
Text('身份证号:').fontColor('#E5CCA1').fontSize(this.FONTSIZE)
Text(this.idCard).fontColor('#FFF').fontSize(this.FONTSIZE)
}.margin({ bottom: 10 })
}.margin({ bottom: 10*globalThis.radio2 })
Row() {
Text('考试用时:').fontColor('#E5CCA1').fontSize(this.FONTSIZE)
Text(formatTime(this.examTime)).fontColor('#FFF').fontSize(this.FONTSIZE)
}.margin({ bottom: 10 })
}.margin({ bottom: 10*globalThis.radio2 })
if(this.examSubject == 3){
Row() {
if(this.judgeConfigObj['375'] == '0'){
Text(`应行驶:${this.examMileage}m`).fontColor('#E5CCA1').fontSize(this.FONTSIZE).padding({right:20})
Text(`应行驶:${this.examMileage}m`).fontColor('#E5CCA1').fontSize(this.FONTSIZE).padding({right:20*globalThis.radio2})
}
Text(`已行驶:${this.jl}m`).fontColor('#FFAD33').fontSize(this.FONTSIZE)
}
@ -476,7 +477,7 @@ struct Index {
Column() {
Row(){
Text(this.carztStr).fontColor('#FFA500').fontSize(this.FONTSIZE)
}.height(40)
}.height(40*globalThis.radio2)
Row() {
Flex({ direction: FlexDirection.Column }) {
List({}) {
@ -490,23 +491,23 @@ struct Index {
.width('100%')
.backgroundColor('#38260B')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ top: 12, bottom: 12, left: 8, right: 5 })
.padding({ top: 12*globalThis.radio2, bottom: 12*globalThis.radio2, left: 8*globalThis.radio2, right: 5*globalThis.radio2 })
Text(item.desc)
.fontSize(this.BIGFONTSIZE)
.fontColor('#E5CBA1')
.margin({ top: 10, bottom: 8, left: 5, right: 5 })
}.margin({ top: 15 }).alignItems(HorizontalAlign.Start)
.margin({ top: 10*globalThis.radio2, bottom: 8*globalThis.radio2, left: 5*globalThis.radio2, right: 5*globalThis.radio2 })
}.margin({ top: 15*globalThis.radio2 }).alignItems(HorizontalAlign.Start)
}.margin({bottom:25})
}.margin({bottom:25*globalThis.radio2})
})
}.padding({left:15,right:15,top:30,bottom:5})
}.padding({left:15*globalThis.radio2,right:15*globalThis.radio2,top:30*globalThis.radio2,bottom:5*globalThis.radio2})
}
.backgroundImage($rawfile('judge/score_bg.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.width(514)
.height(618)
.padding({ top: 18, bottom: 15, left: 13, right: 14 })
.width(514*globalThis.radio2)
.height(618*globalThis.radio2)
.padding({ top: 18*globalThis.radio2, bottom: 15*globalThis.radio2, left: 13*globalThis.radio2, right: 14*globalThis.radio2 })
//科目二
if(this.examSubject == 2){
@ -518,19 +519,19 @@ struct Index {
Row(){
//#FF7566 #00FFD5 #E6DECF
// Text(this.projectsObj[item[0].projectCode])
Text(item[0].abbreviation).fontSize(item[0].abbreviation.length > 5?28:32).fontColor(this.getProjectColor(this.projectsObj[item[0].projectCode].type))
}.backgroundImage($rawfile('judge/project_item.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width('48.5%').height(115).margin({bottom:5}).justifyContent(FlexAlign.Center)
Text(item[0].abbreviation).fontSize(item[0].abbreviation.length > 5?28*globalThis.radio2:32*globalThis.radio2).fontColor(this.getProjectColor(this.projectsObj[item[0].projectCode].type))
}.backgroundImage($rawfile('judge/project_item.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width('48.5%').height(115*globalThis.radio2).margin({bottom:5*globalThis.radio2}).justifyContent(FlexAlign.Center)
if(item[1]){
Row(){
//#FF7566 #00FFD5 #E6DECF
Text(item[1].abbreviation).fontSize(item[1].abbreviation.length > 5?28:32).fontColor(this.getProjectColor(this.projectsObj[item[1].projectCode].type))
}.backgroundImage($rawfile('judge/project_item.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width('48.5%').height(115).margin({left:5,bottom:5}).justifyContent(FlexAlign.Center)
Text(item[1].abbreviation).fontSize(item[1].abbreviation.length > 5?28*globalThis.radio2:32*globalThis.radio2).fontColor(this.getProjectColor(this.projectsObj[item[1].projectCode].type))
}.backgroundImage($rawfile('judge/project_item.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width('48.5%').height(115*globalThis.radio2).margin({left:5*globalThis.radio2,bottom:5*globalThis.radio2}).justifyContent(FlexAlign.Center)
}
}
}
});
}
}.backgroundImage($rawfile('judge/project_bg.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width('57%').height('100%').padding(30).margin({right:10})
}.backgroundImage($rawfile('judge/project_bg.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width('57%').height('100%').padding(30*globalThis.radio2).margin({right:10*globalThis.radio2})
}
//科目三
@ -542,11 +543,11 @@ struct Index {
ListItem(){
Text(project.name){
}.fontColor(this.getProjectColor(this.projectsObj[project.projectCode].type)).margin({bottom:5}).fontSize(26)
}.margin({bottom:8})
}.fontColor(this.getProjectColor(this.projectsObj[project.projectCode].type)).margin({bottom:5*globalThis.radio2}).fontSize(26*globalThis.radio2)
}.margin({bottom:8*globalThis.radio2})
})
}.lanes(2).margin({left:25})
}.width('100%').height('50%').backgroundImage($rawfile('judge/project_km3_bg.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).padding(30).margin({right:5})
}.lanes(2).margin({left:25*globalThis.radio2})
}.width('100%').height('50%').backgroundImage($rawfile('judge/project_km3_bg.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).padding(30*globalThis.radio2).margin({right:5*globalThis.radio2})
Flex({wrap:FlexWrap.Wrap,direction:FlexDirection.Row,justifyContent:FlexAlign.SpaceAround}){
List(){
@ -555,7 +556,7 @@ struct Index {
$rawfile(
`judge/km3/${this.getIsExitManualProject(index) ? item : (item+'_gray')}.png`
),ImageRepeat.NoRepeat)
.backgroundImageSize({width:'100%',height:'100%'}).width(174).height(118).margin({bottom:15})
.backgroundImageSize({width:'100%',height:'100%'}).width(174*globalThis.radio2).height(118*globalThis.radio2).margin({bottom:15*globalThis.radio2})
.onClick(()=>{
if(this.getIsExitManualProject(index)){
// 靠边停车时候可以触发
@ -578,26 +579,26 @@ struct Index {
}
})
})
}.lanes(3).margin({left:5,top:18})
}.lanes(3).margin({left:5*globalThis.radio2,top:18*globalThis.radio2})
}
}.backgroundImage($rawfile('judge/project_bg.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width(660).height(640).padding(44).margin({right:10})
}.backgroundImage($rawfile('judge/project_bg.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width(660*globalThis.radio2).height(640*globalThis.radio2).padding(44*globalThis.radio2).margin({right:10*globalThis.radio2})
}
}.margin({ top: 15 }).height('80%').justifyContent(FlexAlign.SpaceBetween)
}.width('100%').height('100%').alignItems(HorizontalAlign.Start).margin({ top: 10 })
}.margin({ top: 15*globalThis.radio2 }).height('80%').justifyContent(FlexAlign.SpaceBetween)
}.width('100%').height('100%').alignItems(HorizontalAlign.Start).margin({ top: 10*globalThis.radio2 })
}.height('100%').alignItems(HorizontalAlign.Start)
}.width('75%').height('100%')
Column() {
Column() {
Row() {
Text(this.totalScore + '').fontColor('#FFEECC').fontSize(55)
Text('分').fontColor('#FFEECC').fontSize(30).padding({ top: 5 })
Text(this.totalScore + '').fontColor('#FFEECC').fontSize(55*globalThis.radio2)
Text('分').fontColor('#FFEECC').fontSize(30*globalThis.radio2).padding({ top: 5*globalThis.radio2 })
}
.width(334)
.height(120)
.width(334*globalThis.radio2)
.height(120*globalThis.radio2)
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.border({ width: 5, color: '#4D4136', radius: 30 })
.border({ width: 5*globalThis.radio2, color: '#4D4136', radius: 30 })
.onClick(() => {
this.signDisplayComVisible = true
})
@ -605,24 +606,24 @@ struct Index {
Row() {
Image(this.kszp).width('85%').height('85%')
}
.width(226)
.height(312)
.width(226*globalThis.radio2)
.height(312*globalThis.radio2)
.backgroundImage($rawfile('judge/photo_bg.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.margin({ top: 30 ,bottom:15})
.margin({ top: 30*globalThis.radio2,bottom:15*globalThis.radio2})
}
Column(){
if(this.examSubject == 3){
Row(){
Row(){}.width(60).height(60).backgroundImage($rawfile('judge/manual_judge.png'), ImageRepeat.NoRepeat).backgroundImageSize({ width: '100%', height: '100%' })
Text('人工评判').fontColor('#FFF').fontSize(32).padding({right:12})
}.width(334).height(110).justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Center)
Row(){}.width(60*globalThis.radio2).height(60*globalThis.radio2).backgroundImage($rawfile('judge/manual_judge.png'), ImageRepeat.NoRepeat).backgroundImageSize({ width: '100%', height: '100%' })
Text('人工评判').fontColor('#FFF').fontSize(32*globalThis.radio2).padding({right:12*globalThis.radio2})
}.width(334*globalThis.radio2).height(110*globalThis.radio2).justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Center)
.backgroundImage($rawfile('judge/button_nor.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({bottom:10})
.margin({bottom:10*globalThis.radio2})
.onClick(()=>{
if(this.judgeConfigObj['342'] == 0){
this.isDeductedPopShow = true
@ -637,16 +638,16 @@ struct Index {
Row(){
Row(){}.width(60).height(60).backgroundImage($rawfile('judge/phone.png'), ImageRepeat.NoRepeat).backgroundImageSize({ width: '100%', height: '100%' })
Text('呼叫请求').fontColor('#FFF').fontSize(32).padding({right:12})
}.width(334).height(110).justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Center)
Row(){}.width(60*globalThis.radio2).height(60*globalThis.radio2).backgroundImage($rawfile('judge/phone.png'), ImageRepeat.NoRepeat).backgroundImageSize({ width: '100%', height: '100%' })
Text('呼叫请求').fontColor('#FFF').fontSize(32*globalThis.radio2).padding({right:12*globalThis.radio2})
}.width(334*globalThis.radio2).height(110*globalThis.radio2).justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Center)
.backgroundImage($rawfile('judge/button_nor.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({bottom:10})
.margin({bottom:10*globalThis.radio2})
Row() {}
.width(334)
.height(100)
.width(334*globalThis.radio2)
.height(100*globalThis.radio2)
.backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.onClick(() => {
@ -659,15 +660,15 @@ struct Index {
});
}
})
}.margin({bottom:30})
}.margin({bottom:30*globalThis.radio2})
}
.width('25%')
.height('100%')
.justifyContent(FlexAlign.SpaceBetween)
.alignItems(HorizontalAlign.Center)
.margin({ bottom: 20 })
}.height('90%').justifyContent(FlexAlign.Start).padding({ top: 37, left: 60, bottom: 35, right: 60 })
.margin({ bottom: 20*globalThis.radio2 })
}.height('90%').justifyContent(FlexAlign.Start).padding({ top: 37*globalThis.radio2, left: 60*globalThis.radio2, bottom: 35*globalThis.radio2, right: 60*globalThis.radio2 })
//结束考试弹窗
if (this.endPopupVisible) {
@ -706,9 +707,9 @@ struct Index {
}).margin({ top: 100 })
Row() {}
.width(240)
.height(240)
.position({ x: '81%', y: 80 })
.width(240*globalThis.radio2)
.height(240*globalThis.radio2)
.position({ x: '81%', y: 80*globalThis.radio2 })
.backgroundImage($rawfile('judge/close.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '33.33%', height: '33.33%' })
.onClick(() => {

View File

@ -3,7 +3,6 @@ import UdpClient from '../../common/utils/UdpClient';
import FileLog from '../judgeSDK/utils/file-log'
import { voiceService } from '../../common/service/voiceService'
import prompt from '@ohos.prompt'
import SerialPortClient from '../../common/utils/SerialPortClient'
import RealTime from '../compontents/judge/real-time'
@Component
struct SignDisplayCom {
@ -397,20 +396,7 @@ struct SignDisplayCom {
const that = this
const {showBack,getSignal} = this
const serialPortClient = new SerialPortClient()
serialPortClient.openSerial()
serialPortClient.SerialSet()
this.interval=setInterval(() => {
serialPortClient.SerialSend()
const data = serialPortClient.SerialRecv()
// if (data?.recevedLen) {
// const msg = data.msg.split(',')
// if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
// return
// }
// this.sjxhColum[18].value = msg[9]
// }
}, 1000)
if(showBack){
globalThis.udpClient.onMessage((msg) => {
console.log('msgmsg',msg)
@ -441,21 +427,8 @@ struct SignDisplayCom {
// }
// }
// });
const serialPortClient = new SerialPortClient()
serialPortClient.openSerial()
serialPortClient.SerialSet()
const getSignal = this.getSignal;
this.interval=setInterval(() => {
serialPortClient.SerialSend()
const data = serialPortClient.SerialRecv()
// if (data.recevedLen) {
// const msg = data.msg.split(',')
// if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
// return
// }
// this.sjxhColum[18].value = msg[9]
// }
}, 1000)
const that = this
const showBack = this.showBack;
if(showBack){