合并dev
This commit is contained in:
parent
0820ac658c
commit
140c07d39e
@ -190,6 +190,7 @@ export async function getSingleCenterTable(param) {
|
||||
let interval
|
||||
|
||||
export async function takePhotoFn(context) {
|
||||
return
|
||||
let param = {
|
||||
videoNum: '1',
|
||||
spls: '1',
|
||||
@ -287,12 +288,14 @@ const devPath="/dev/ttyS1"
|
||||
async function openChuankouFn() {
|
||||
fd =await testNapi.SerialOpen(devPath);
|
||||
globalThis.fd=fd
|
||||
console.log('chuankoufd',globalThis.fd)
|
||||
console.log('chuankoufd',globalThis.fd)
|
||||
|
||||
// let parity = 0x4e; // 'N'
|
||||
let ret =await testNapi.SerialSet(fd, 115200,0, 8, 1, 0)
|
||||
console.log('daihairet',ret)
|
||||
}
|
||||
async function getChuankouFnMsg() {
|
||||
let timeout = 1000; // 2秒超时
|
||||
let timeout = 5000; // 2秒超时
|
||||
let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
|
||||
let uint8Arr = new Uint8Array(databuff);
|
||||
console.log('daihai',globalThis.fd)
|
||||
@ -300,20 +303,20 @@ async function getChuankouFnMsg() {
|
||||
console.log('daihai SerialSend ret: ' + ret)
|
||||
|
||||
|
||||
testNapi.SerialRecv(globalThis.fd, timeout,12).then(revTestInfo=>{
|
||||
testNapi.SerialRecv(globalThis.fd, timeout,12).then(revTestInfo=>{
|
||||
console.log('daihai',revTestInfo?.recevedBuf?.toString())
|
||||
const message = revTestInfo?.recevedBuf?.toString()
|
||||
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]
|
||||
const message = revTestInfo?.recevedBuf?.toString()
|
||||
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]
|
||||
}).catch((err)=>{
|
||||
console.log('daihaierror',JSON.stringify(err))
|
||||
})
|
||||
@ -325,6 +328,6 @@ export async function getChuankouFn(){
|
||||
openChuankouFn()
|
||||
setInterval(()=>{
|
||||
getChuankouFnMsg()
|
||||
},1500)
|
||||
},1000)
|
||||
|
||||
}
|
||||
|
||||
@ -5,13 +5,12 @@ import fs from '@ohos.file.fs'
|
||||
// @ts-ignore
|
||||
import photoAccessHelper from '@ohos.file.photoAccessHelper'
|
||||
import dataSharePredicates from '@ohos.data.dataSharePredicates'
|
||||
import { dateFormat, getCurrentTime, isSevenDaysAgo } from '../utils/tools'
|
||||
// import rtsp_server from '@ohos.rtsprecord';
|
||||
import record from '@ohos.rtsprecord';
|
||||
import { dateFormat, getCurrentTime } from '../utils/tools'
|
||||
import rtsp_server from '@ohos.rtsprecord';
|
||||
// import record from '@ohos.rtsprecord';
|
||||
import { FileHelper } from './FileHelper';
|
||||
import FileUtil from '../utils/File';
|
||||
import { GlobalConfig } from '../../config';
|
||||
import promptAction from '@ohos.promptAction';
|
||||
|
||||
// const rtsp_server = record.createServer();
|
||||
//开始录屏
|
||||
@ -31,58 +30,8 @@ const FILE_ASSET_FETCH_COLUMNS = [photoAccessHelper.PhotoKeys.URI,
|
||||
photoAccessHelper.PhotoKeys.POSITION,
|
||||
photoAccessHelper.PhotoKeys.DATE_TRASHED,
|
||||
photoAccessHelper.PhotoKeys.HIDDEN];
|
||||
|
||||
// const rtsp_server = record.createServer();
|
||||
|
||||
export async function startRecordVideo(param, td, context, dir, path?,index?) {
|
||||
return new Promise(async (reslove, reject) => {
|
||||
// const fileUtil = new FileUtil(globalThis.context)
|
||||
// const date=dateFormat(new Date).split(' ')[0]
|
||||
|
||||
// const folderPath = await fileUtil.initFolder(`/PLC/${date}/${dir}`);
|
||||
var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${td}/main/av_stream`;
|
||||
// if (rtsp_server != null) {
|
||||
// console.log(`Rtsprecord startRecordVideo begin,video_uri`, video_uri);
|
||||
// const num = Math.floor(Math.random() * 10000)
|
||||
// let fileName
|
||||
// if (!path) {
|
||||
// fileName = `movie_record${num}.mp4`
|
||||
// } else {
|
||||
// fileName = `${path}_${index||num}.mp4`
|
||||
// }
|
||||
//
|
||||
// // @ts-ignore
|
||||
// var recordResult = rtsp_server.startRecordVideo(context, video_uri, fileName, dir);
|
||||
// const handleId = recordResult.dataInt;
|
||||
// reslove(handleId)
|
||||
// }
|
||||
// else {
|
||||
// console.log(`Rtsprecord startRecordVideo rtsp_server isnull`);
|
||||
// reslove(0)
|
||||
// }
|
||||
console.log(`Rtsprecord startRecordVideo end`);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
//结束录屏
|
||||
export async function endRecordVideo(record_handleObj) {
|
||||
for (let key in record_handleObj) {
|
||||
// if (rtsp_server != null && record_handleObj[key] > 0) {
|
||||
// console.log(`Rtsprecord endRecordVideo begin`);
|
||||
// // @ts-ignore
|
||||
// var recordResult = rtsp_server.endRecordVideo(record_handleObj[key]);
|
||||
// console.log(`Rtsprecord endRecordVideo record_handle` + record_handleObj[key].dataInt + ` filename:` + record_handleObj[key].fileName);
|
||||
//
|
||||
// }
|
||||
// else {
|
||||
// console.log(`Rtsprecord endRecordVideo handleId isnull`);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export async function saveStartRecordVideo(path) {
|
||||
return new Promise(async (reslove, reject) => {
|
||||
const fileUtil = new FileUtil(globalThis.context)
|
||||
@ -108,7 +57,6 @@ export async function saveStartRecordVideo(path) {
|
||||
reslove(record_handle)
|
||||
})
|
||||
}
|
||||
|
||||
async function getfilehandleCode(td, param, dir, path, index) {
|
||||
return new Promise(async (reslove, reject) => {
|
||||
console.log('pathpath1', path)
|
||||
@ -119,55 +67,65 @@ async function getfilehandleCode(td, param, dir, path, index) {
|
||||
})
|
||||
|
||||
}
|
||||
export async function startRecordVideo(param?, td?, context?, dir?,path?,index?) {
|
||||
return new Promise(async(reslove, reject) => {
|
||||
|
||||
|
||||
export async function getUserAlbumItemByDisplayName(displayName: string, day?, type?): Promise<photoAccessHelper.Album> {
|
||||
let fetchResult = null
|
||||
let album: photoAccessHelper.Album = null
|
||||
try {
|
||||
console.log('getUserAlbumItemByDisplayName');
|
||||
let predicates = new dataSharePredicates.DataSharePredicates();
|
||||
predicates.equalTo(photoAccessHelper.AlbumKeys.ALBUM_NAME, displayName)
|
||||
let fetchOptions = {
|
||||
fetchColumns: [],
|
||||
predicates: predicates
|
||||
};
|
||||
const userFileMgr = photoAccessHelper.getPhotoAccessHelper(globalThis.context);
|
||||
|
||||
fetchResult = await userFileMgr.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, fetchOptions);
|
||||
console.log('get getUserAlbumItemByDisplayName, count: ' + JSON.stringify(fetchResult));
|
||||
if (fetchResult.getCount() > 0) {
|
||||
const albums = await fetchResult.getLastObject();
|
||||
console.log('get getUserAlbumItemByDisplayName album111', albums.albumName)
|
||||
|
||||
if (isSevenDaysAgo(albums.albumName, day)) {
|
||||
deleteAllFileByPiC(albums.albumName, type)
|
||||
var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${td}/main/av_stream`;
|
||||
if (rtsp_server != null) {
|
||||
console.log(`Rtsprecord startRecordVideo begin,video_uri`, video_uri);
|
||||
const num = Math.floor(Math.random() * 10000)
|
||||
const time = await getCurrentTime()
|
||||
const date = time.split(' ')[0]
|
||||
let fileName
|
||||
if (!path) {
|
||||
fileName = `${date}_movie_record${num}.mp4`
|
||||
} else {
|
||||
fileName = `${date}_${path}_${index || num}.mp4`
|
||||
}
|
||||
console.log('get getUserAlbumItemByDisplayName album',)
|
||||
// @ts-ignore
|
||||
var recordResult = rtsp_server.startRecordVideo(context, video_uri, fileName, dir);
|
||||
const handleId = recordResult.dataInt;
|
||||
console.log(`Rtsprecord startRecordVideo begin,handleId`, handleId);
|
||||
|
||||
reslove(handleId)
|
||||
console.log(`Rtsprecord startRecordVideo record_handle` + recordResult.dataInt);
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('get Album getUserAlbumItemByDisplayName fetchResult failed with err: ' + err);
|
||||
} finally {
|
||||
if (fetchResult != null) {
|
||||
fetchResult.close();
|
||||
else {
|
||||
console.log(`Rtsprecord startRecordVideo rtsp_server isnull`);
|
||||
reslove(0)
|
||||
}
|
||||
}
|
||||
return album;
|
||||
console.log(`Rtsprecord startRecordVideo end`);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
//结束录屏
|
||||
export async function endRecordVideo(record_handle) {
|
||||
if (rtsp_server != null && record_handle > 0) {
|
||||
console.log(`Rtsprecord endRecordVideo begin`);
|
||||
// @ts-ignore
|
||||
var recordResult = rtsp_server.endRecordVideo(record_handle);
|
||||
console.log(`Rtsprecord startRecordVideo record_handle` + recordResult.dataInt + ` filename:` + recordResult.fileName);
|
||||
}
|
||||
else {
|
||||
console.log(`Rtsprecord endRecordVideo handleId isnull`);
|
||||
}
|
||||
// var result = onvifclient.endRecordVideo(record_handle);
|
||||
// fs.closeSync(record_handle);
|
||||
// file_asset.close(record_handle);
|
||||
|
||||
}
|
||||
/**
|
||||
*拍照
|
||||
* @param param
|
||||
* @param context
|
||||
* @param type=0不获取base64
|
||||
*/
|
||||
interface takePhotoParam {
|
||||
name?: string,
|
||||
base64?: string,
|
||||
fileSize?: number,
|
||||
errorCode?: number
|
||||
interface takePhotoParam {
|
||||
name?:string,
|
||||
base64?:string,
|
||||
fileSize?:number,
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param param
|
||||
@ -178,38 +136,41 @@ interface takePhotoParam {
|
||||
* @returns
|
||||
*/
|
||||
const fileHelper = new FileHelper();
|
||||
export async function takePhoto(param, context,dir,flag=1,callback?) {
|
||||
|
||||
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('baoyihubaoyihu', video_uri, flag)
|
||||
|
||||
|
||||
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, errorCode: snapResult.errorCode })
|
||||
if(flag==0){
|
||||
// @ts-ignore
|
||||
rtsp_server.detectVideoSnapshotSize(video_uri,fileName).then((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 {
|
||||
console.log('baoyihubaoyihu1', video_uri, flag)
|
||||
return new Promise<takePhotoParam>((resolve, reject) => {
|
||||
// rtsp_server.getVideoSnapshot(context, video_uri, fileName, dir, true, (err, snapResult) => {
|
||||
// console.log('baoyihubaoyihu', video_uri, flag, JSON.stringify(snapResult))
|
||||
// console.log('getPhtot', JSON.stringify(snapResult))
|
||||
// resolve({
|
||||
// base64: snapResult.dataString,
|
||||
// name: snapResult.fileName,
|
||||
// fileSize: snapResult.fileSize,
|
||||
// errorCode: snapResult.errorCode
|
||||
// })
|
||||
// });
|
||||
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')
|
||||
|
||||
@ -219,13 +180,12 @@ export async function takePhoto(param, context, dir, flag = 1, callback?) {
|
||||
|
||||
}
|
||||
|
||||
//type:1 是图片 2是视频
|
||||
export async function deleteAllFileByPiC(dirName, type = 1) {
|
||||
export async function deleteAllFileByPiC(dirName) {
|
||||
// const fileHelper = new FileHelper();
|
||||
fileHelper.deleteFileOfAlbum(dirName, type);
|
||||
fileHelper.deleteFileOfAlbum(dirName,1);
|
||||
}
|
||||
|
||||
export async function deleteAllVideos(context, type: photoAccessHelper.AlbumType, subType: photoAccessHelper.AlbumSubtype): Promise<void> {
|
||||
export async function deleteAllVideos(context,type: photoAccessHelper.AlbumType, subType: photoAccessHelper.AlbumSubtype): Promise<void> {
|
||||
let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = null;
|
||||
try {
|
||||
const userFileMgr = photoAccessHelper.getPhotoAccessHelper(context);
|
||||
@ -269,4 +229,4 @@ export async function deleteAllVideos(context, type: photoAccessHelper.AlbumType
|
||||
fetchResult.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ import socket, { UDPSocket } from '@ohos.net.socket';
|
||||
import { Array2Byte } from '../utils/tools'
|
||||
import FileUtil from '../../common/utils/File'
|
||||
import { fillZero, string2Bytes } from '../utils/tools'
|
||||
import {getChuankouFn} from '../../common/service/indexService'
|
||||
|
||||
const TAG = '[UdpDemo.UdpClient]'
|
||||
import hilog from '@ohos.hilog';
|
||||
import prompt from '@ohos.prompt'
|
||||
|
||||
@ -4,7 +4,7 @@ import { testKm2Items,testKm3Items } from '../../pages/judgeSDK/dataTest/index'
|
||||
import { judgeConfig } from '../../pages/judgeSDK/utils/judgeConfig';
|
||||
import { setJudgeUdp, setTopLineUdp } from './GlobalUdp';
|
||||
import { convertGpsCoord2 } from '../utils/tools';
|
||||
import {examCalcGpsDistance} from '../../pages/judgeSDK/api'
|
||||
// import {examCalcGpsDistance} from '../../pages/judgeSDK/api'
|
||||
import GetDistance from '../utils/GetDistance'
|
||||
export const initJudgeUdp = async () => {
|
||||
globalThis.serialIndex = 0;
|
||||
@ -36,13 +36,13 @@ export const initJudgeUdp = async () => {
|
||||
const wd = convertGpsCoord2(msgArr[95]*1 || 0);
|
||||
udp.send(bytes)
|
||||
if(prevJd && msgArr[83] == 4){
|
||||
const distance = await examCalcGpsDistance({
|
||||
jd1:prevJd,
|
||||
wd1:preWd,
|
||||
jd2:jd,
|
||||
wd2:wd,
|
||||
h:msgArr[90]*1 || 1,
|
||||
})
|
||||
// const distance = await examCalcGpsDistance({
|
||||
// jd1:prevJd,
|
||||
// wd1:preWd,
|
||||
// jd2:jd,
|
||||
// wd2:wd,
|
||||
// h:msgArr[90]*1 || 1,
|
||||
// })
|
||||
//@ts-ignore
|
||||
// globalThis.distanceClass?.setTimeData(((distance / 100).toFixed(2)) * 1)
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import { DwMapData, PassData, RealNumData, StackValueData, WarnFlagData, WarnFla
|
||||
@Component
|
||||
export default struct Index {
|
||||
@State angle: number = 0
|
||||
@State ratio: number = 1920 /1080
|
||||
@State ratio: number = 1700 / 960
|
||||
@State index: number = -1
|
||||
@State time: string = ''
|
||||
@State msg: string = ''
|
||||
|
||||
@ -10,7 +10,7 @@ import imageBtn from './compontents/imageBtn'
|
||||
@Entry
|
||||
@Component
|
||||
export default struct Index {
|
||||
@State ratio: number = 1920 /1080
|
||||
@State ratio: number = 1700 / 960
|
||||
@State url: string = ''
|
||||
@State inputPlaceholderArr: string[] = ['用户账户', '密码'];
|
||||
@State inputTextArr: string[] = ['', ''];
|
||||
|
||||
@ -567,13 +567,13 @@ struct Index {
|
||||
}
|
||||
|
||||
async createAlbum() {
|
||||
this.fileHelper = new FileHelper();
|
||||
const time = await getCurrentTime()
|
||||
const date = time.split(' ')[0]
|
||||
this.fileHelper.createAlbum('jt')
|
||||
// this.fileHelper.createAlbum('2025-01-02')
|
||||
this.fileHelper.createAlbum('pz');
|
||||
this.fileHelper.createAlbum(date);
|
||||
// this.fileHelper = new FileHelper();
|
||||
// const time = await getCurrentTime()
|
||||
// const date = time.split(' ')[0]
|
||||
// this.fileHelper.createAlbum('jt')
|
||||
// // this.fileHelper.createAlbum('2025-01-02')
|
||||
// this.fileHelper.createAlbum('pz');
|
||||
// this.fileHelper.createAlbum(date);
|
||||
|
||||
}
|
||||
|
||||
@ -618,12 +618,12 @@ struct Index {
|
||||
getTCP()
|
||||
this.deviceId = globalThis.carInfo.carNo
|
||||
await setCurrentTime();
|
||||
// if (!globalThis.distanceClass) {
|
||||
// const distanceClass = new GetDistance(globalThis.context)
|
||||
// await distanceClass.initFolder()
|
||||
// globalThis.distanceClass = distanceClass
|
||||
// console.info('surenjun', 'distanceClass=>初始化完成')
|
||||
// }
|
||||
if (!globalThis.distanceClass) {
|
||||
const distanceClass = new GetDistance(globalThis.context)
|
||||
await distanceClass.initFolder()
|
||||
globalThis.distanceClass = distanceClass
|
||||
console.info('surenjun', 'distanceClass=>初始化完成')
|
||||
}
|
||||
this.carNum = globalThis.carInfo.plateNo;
|
||||
this.version = globalThis.version;
|
||||
this.hasAuth = globalThis.hasAuth;
|
||||
|
||||
@ -135,6 +135,7 @@ struct Index {
|
||||
// 获取扣分代码信息
|
||||
async initMarkRules(markRules ?: MarkRule[]) {
|
||||
const markRuleParams = markRules || (await getSyncData('MA_MARKRULE') as MarkRule[])
|
||||
|
||||
markRuleParams.forEach(mark => {
|
||||
const tempObj = {
|
||||
itemno: mark.itemno * 1,
|
||||
@ -540,7 +541,7 @@ struct Index {
|
||||
const examSubject = globalThis.carInfo.examSubject;
|
||||
this.examSubject = isTrajectoryOpen ? (initDataObj.kskm * 1) : examSubject;
|
||||
globalThis.carInfo.examSubject = this.examSubject
|
||||
this.singlePlay = beginDataObj.exam == 0;
|
||||
// this.singlePlay = beginDataObj.exam == 0;
|
||||
this.carName = initDataObj.name;
|
||||
// globalThis.singlePlay = beginDataObj.exam == 0;
|
||||
await this.initSystemParam(initDataObj.systemparm)
|
||||
|
||||
@ -10,7 +10,7 @@ import common from '@ohos.app.ability.common';
|
||||
@Entry
|
||||
@Component
|
||||
export default struct Index {
|
||||
@State ratio: number = 1920 /1080
|
||||
@State ratio: number = 1700 / 960
|
||||
@State ip: string = ''
|
||||
@State deviceNo: string = ''
|
||||
@State deviceName: string = ''
|
||||
|
||||
@ -15,7 +15,7 @@ struct Index {
|
||||
|
||||
@State textList1: string[] = ['差分服务器Ip','响应端口','中心服务器IP','响应端口', '子网掩码','默认网关','dns','后置机IP ', '响应端口','前置机IP','本地端口']
|
||||
// @State textList2: string[] = []
|
||||
@State ratio: number = 1920 /1080
|
||||
@State ratio: number = 1700 / 960
|
||||
@State inputFontSize:number=12 //12
|
||||
//
|
||||
// @State inputTextList1: string[] = ['192.168.7.170','8084','192.168.7.170','20122','255.255.255.0','192.168.7.1','','','114.114.114.114','112.80.35.83','11055' +
|
||||
@ -47,7 +47,7 @@ struct Index {
|
||||
.height('100%')
|
||||
.fontColor('#E5CBA1')
|
||||
.padding({'left': '35px'})
|
||||
.fontSize(this.inputFontSize*globalThis.ratio)
|
||||
.fontSize(this.inputFontSize*this.ratio)
|
||||
TextInput({'text':this.inputTextList1[index]?this.inputTextList1[index]: ''})
|
||||
.width('50%')
|
||||
.height('60%')
|
||||
@ -55,7 +55,7 @@ struct Index {
|
||||
.borderColor('#E6E0D8')
|
||||
.borderRadius('10px')
|
||||
.borderWidth('2px')
|
||||
.fontSize(this.inputFontSize*globalThis.ratio)
|
||||
.fontSize(this.inputFontSize*this.ratio)
|
||||
.padding({top:0,bottom:0})
|
||||
.linearGradient({
|
||||
angle: 0,
|
||||
|
||||
@ -10,7 +10,7 @@ import { VideoConfigData } from '../mock';
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State ratio: number = 1920 /1080
|
||||
@State ratio: number = 1700 / 960
|
||||
@State videoSrc: string = 'rtsp://admin12345qwe@192.168.36.94:554/h264/ch3/main/av_stream'
|
||||
@State previewUri: Resource = $r('app.media.2_nor')
|
||||
@State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X
|
||||
|
||||
@ -78,7 +78,6 @@ export default struct RealTime {
|
||||
.height(this.heightNumber)
|
||||
.onLoad(() => {
|
||||
libJudgeSdk.examJudgeMapSetDrawing(true); //停止绘制地图轨迹,false:表示结束绘制
|
||||
|
||||
})
|
||||
.onDestroy(() => {
|
||||
libJudgeSdk.examJudgeMapSetDrawing(false); //停止绘制地图轨迹,false:表示结束绘制
|
||||
@ -98,6 +97,7 @@ export default struct RealTime {
|
||||
Row(){
|
||||
Image($rawfile('judge/big.png')).width(60).onClick(()=>{
|
||||
this.scaleFn( -this.getScaleNum() )
|
||||
console.info('surenjun getScaleNum',-this.getScaleNum())
|
||||
})
|
||||
Image($rawfile('judge/small.png')).width(60).onClick(()=>{
|
||||
this.scaleFn( this.getScaleNum() )
|
||||
@ -185,6 +185,7 @@ export default struct RealTime {
|
||||
|
||||
scaleFn = async (num)=>{
|
||||
const scaleNum = this.scaleNum
|
||||
console.info('surenjun getScaleNum',scaleNum)
|
||||
if(scaleNum >0 && scaleNum < 5000){
|
||||
this.scaleNum += num;
|
||||
}
|
||||
|
||||
@ -64,11 +64,7 @@ export async function examJudgeSetRealExamCallback(fn){
|
||||
* @desc 设置轨迹图像回调函数
|
||||
*/
|
||||
export async function examJudgeMapImageSetCallback(fn){
|
||||
console.log('examJudgeMapexamJudgeMapImageSetCallbackStart')
|
||||
|
||||
const temp = libJudgeSdk.examJudgeMapImageSetCallback(fn);
|
||||
console.log('examJudgeMapexamJudgeMapImageSetCallbackEnd')
|
||||
|
||||
return await handle(temp,'examJudgeMapImageSetCallback')
|
||||
}
|
||||
|
||||
@ -109,10 +105,7 @@ export async function examJudgeArtificialItem(
|
||||
* @desc 设置地图轨迹图像绘制的开关
|
||||
*/
|
||||
export async function examJudgeMapSetDrawing(fn){
|
||||
console.log('examJudgeMapexamJudgeMapSetDrawingStart')
|
||||
const temp = libJudgeSdk.examJudgeMapSetDrawing(fn);
|
||||
console.log('examJudgeMapexamJudgeMapSetDrawingEnd')
|
||||
|
||||
return await handle(temp,'examJudgeMapSetDrawing')
|
||||
}
|
||||
|
||||
@ -158,11 +151,7 @@ export async function examJudgeDestroy(){
|
||||
*
|
||||
*/
|
||||
export async function examJudgeMapSetParam(width:number,height:number){
|
||||
console.log('examJudgeMapSetstart')
|
||||
|
||||
const temp = libJudgeSdk.examJudgeMapSetParam(width,height );
|
||||
console.log('examJudgeMapSetEnd')
|
||||
|
||||
return await handle(temp,'examJudgeMapSetParam')
|
||||
}
|
||||
|
||||
@ -171,10 +160,7 @@ export async function examJudgeMapSetParam(width:number,height:number){
|
||||
*
|
||||
*/
|
||||
export async function examJudgeMapSetScaling(scaling?:number){
|
||||
console.log('examJudgeMapscanl')
|
||||
const temp = libJudgeSdk.examJudgeMapSetScaling(scaling || 1);
|
||||
console.log('examJudgeMapscanlend')
|
||||
|
||||
return await handle(temp,'examJudgeMapSetScaling')
|
||||
}
|
||||
|
||||
|
||||
@ -151,7 +151,6 @@ export default class Judge {
|
||||
}
|
||||
//获取科目三的评判初始化配置
|
||||
getKm3JudgeInitConfig = async () => {
|
||||
console.log('modelsmodels00')
|
||||
const {judgeUI,getModelData} = this;
|
||||
const {mapPointArr,mapPointItemArr} = judgeUI;
|
||||
return {
|
||||
@ -306,23 +305,23 @@ export default class Judge {
|
||||
private tempData: any
|
||||
//实时计算gps经纬度距离
|
||||
handDistance = async () => {
|
||||
const {jd,wd,hxj,dwzt,jdzt} = this.tempData.gps;
|
||||
const tJD = convertGpsCoord2(jd)
|
||||
const tWD = convertGpsCoord2(wd)
|
||||
const {prevJd,prevWd} = this
|
||||
if (prevJd && dwzt == 4 && jdzt == 3) {
|
||||
const distance = await examCalcGpsDistance({
|
||||
jd1: prevJd,
|
||||
wd1: prevWd,
|
||||
jd2: tJD,
|
||||
wd2: tWD,
|
||||
h: hxj || 1,
|
||||
})
|
||||
//@ts-ignore
|
||||
globalThis.distanceClass?.setTimeData(((distance / 100).toFixed(2)) * 1)
|
||||
}
|
||||
this.prevJd = tJD;
|
||||
this.prevWd = tWD;
|
||||
// const {jd,wd,hxj,dwzt,jdzt} = this.tempData.gps;
|
||||
// const tJD = convertGpsCoord2(jd)
|
||||
// const tWD = convertGpsCoord2(wd)
|
||||
// const {prevJd,prevWd} = this
|
||||
// if (prevJd && dwzt == 4 && jdzt == 3) {
|
||||
// const distance = await examCalcGpsDistance({
|
||||
// jd1: prevJd,
|
||||
// wd1: prevWd,
|
||||
// jd2: tJD,
|
||||
// wd2: tWD,
|
||||
// h: hxj || 1,
|
||||
// })
|
||||
// //@ts-ignore
|
||||
// globalThis.distanceClass?.setTimeData(((distance / 100).toFixed(2)) * 1)
|
||||
// }
|
||||
// this.prevJd = tJD;
|
||||
// this.prevWd = tWD;
|
||||
}
|
||||
private performInfo: any
|
||||
private isEndTip: boolean = false;
|
||||
@ -703,7 +702,6 @@ export default class Judge {
|
||||
|
||||
// 获取评判初始化数据
|
||||
getJudgeInitData = async () => {
|
||||
console.log('modelsmodels0000')
|
||||
const {getModelData,getKm3JudgeInitConfig} = this
|
||||
const carInfo = globalThis.carInfo;
|
||||
const { examSubject,plateNo,carId } = carInfo;
|
||||
@ -723,8 +721,6 @@ export default class Judge {
|
||||
}
|
||||
//获取版本号
|
||||
const sdkver = await examJudgeVersion();
|
||||
console.info(judgeTag, '3.1获取评判初始化数据完成')
|
||||
|
||||
const initInfo = {
|
||||
sdkver,
|
||||
appver: globalThis.version,
|
||||
@ -1644,10 +1640,8 @@ export default class Judge {
|
||||
|
||||
// 获取模型数据
|
||||
getModelData = (modelName) => {
|
||||
console.log('modelsmodels0')
|
||||
const modelPath = this.modelPath
|
||||
const fileModel = this.fileModel;
|
||||
console.log('modelsmodels',modelPath,fileModel)
|
||||
const modelData = fileModel.getModelContent(modelPath, modelName);
|
||||
return modelData
|
||||
}
|
||||
@ -1748,13 +1742,12 @@ export default class Judge {
|
||||
let strArr = [];
|
||||
if (isTrajectoryOpen) {
|
||||
const folderPath = await this.fileUtil.initFolder(trajectoryPath);
|
||||
console.log('surenjun','folderPath',folderPath)
|
||||
const str = await fileUtil.readFile(folderPath)
|
||||
strArr = str.split('\n')
|
||||
}
|
||||
//日志回调
|
||||
console.info(judgeTag, '1.进入评判入口')
|
||||
await examJudgeSetLogCallback(6, async (level, info, len) => {
|
||||
await examJudgeSetLogCallback(3, async (level, info, len) => {
|
||||
console.log('评判日志:' + info)
|
||||
await fileLog.setExamJudgeLogData(info);
|
||||
})
|
||||
@ -1819,7 +1812,6 @@ export default class Judge {
|
||||
// }
|
||||
|
||||
this.judgeUI.draw = true
|
||||
|
||||
// 处理轨迹plc信息
|
||||
if (isTrajectoryOpen) {
|
||||
handleTrajectoryUdp(strArr);
|
||||
|
||||
@ -22,7 +22,6 @@ export default class FileModel{
|
||||
const {fileUtil} = this
|
||||
await fileUtil.initFolder(`/models/model_enc`);
|
||||
const folderPath = await fileUtil.initFolder(`/models`);
|
||||
console.log('surenjun','modelsmodels',folderPath)
|
||||
this.folderPath = folderPath;
|
||||
}
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
//考试回放开关
|
||||
export const judgeConfig = {
|
||||
//本地目录开关
|
||||
isTrajectoryOpen: true,
|
||||
isTrajectoryOpen: false,
|
||||
//是否开启拍照
|
||||
isPhotoOpen: false,
|
||||
isPhotoOpen: true,
|
||||
//扣分语音是否强制开启
|
||||
kfVoiceOpen: false,
|
||||
//忽略的考试项目
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user