feat:c++代码更新

This commit is contained in:
Surenjun 2024-10-14 15:38:35 +08:00
parent 1b4b0b7b1b
commit 5ca98b5474
10 changed files with 75 additions and 68 deletions

View File

@ -6,11 +6,11 @@ import fs from '@ohos.file.fs'
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import dataSharePredicates from '@ohos.data.dataSharePredicates'
import { getCurrentTime } from '../utils/tools'
import rtsp_server from '@ohos.rtsprecord';
// import rtsp_server from '@ohos.rtsprecord';
// import record from '@ohos.rtsprecord';
import { FileHelper } from './FileHelper';
const rtsp_server = record.createServer();
// const rtsp_server = record.createServer();
//开始录屏
const FILE_ASSET_FETCH_COLUMNS = [photoAccessHelper.PhotoKeys.URI,
photoAccessHelper.PhotoKeys.PHOTO_TYPE,
@ -33,22 +33,22 @@ photoAccessHelper.PhotoKeys.HIDDEN];
export async function startRecordVideo(param, td, context, dir) {
return new Promise((reslove, reject) => {
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 fileName = `movie_record${num}.mp4`
// @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);
}
else {
console.log(`Rtsprecord startRecordVideo rtsp_server isnull`);
reslove(0)
}
// if (rtsp_server != null) {
// console.log(`Rtsprecord startRecordVideo begin,video_uri`, video_uri);
// const num = Math.floor(Math.random() * 10000)
// const fileName = `movie_record${num}.mp4`
// // @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);
// }
// else {
// console.log(`Rtsprecord startRecordVideo rtsp_server isnull`);
// reslove(0)
// }
console.log(`Rtsprecord startRecordVideo end`);
})
@ -56,15 +56,15 @@ export async function startRecordVideo(param, td, context, dir) {
//结束录屏
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`);
}
// 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);

View File

@ -44,7 +44,7 @@ export default class EntryAbility extends UIAbility {
}
globalThis.signNum=0//心跳指令编号
globalThis.lsh='0000000000000'//学员流水号
globalThis.ratio= 1700 / 960 //适配比例
globalThis.ratio= 1920 /1080 //适配比例
globalThis.statue=1//考试状态
globalThis.pathDir = this.context.filesDir;
globalThis.context = this.context;

View File

@ -10,7 +10,7 @@ import { DwMapData, PassData, RealNumData, StackValueData, WarnFlagData, WarnFla
@Component
export default struct Index {
@State angle: number = 0
@State ratio: number = 1700 / 960
@State ratio: number = 1920 /1080
@State index: number = -1
@State time: string = ''
@State msg: string = ''

View File

@ -7,7 +7,7 @@ import promptAction from '@ohos.promptAction';
@Entry
@Component
export default struct Index {
@State ratio: number = 1700 / 960
@State ratio: number = 1920 /1080
@State url: string = ''
@State inputPlaceholderArr: string[] = ['用户账户', '密码'];
@State inputTextArr: string[] = ['', ''];

View File

@ -16,6 +16,7 @@ import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
import worker, { MessageEvents } from '@ohos.worker';
import promptAction from '@ohos.promptAction'
import { voiceService } from '../common/service/voiceService';
import display from '@ohos.display'
@Entry
@Component
@ -27,7 +28,7 @@ struct Index {
@State isSingle: boolean = false;
@State deviceId: string = '';
@State angle: number = 0
@State ratio: number = 1700 / 960
@State ratio: number = 1920 /1080
@State loading: boolean = true
@State fd: number = -1;
@State num: number = 0;
@ -300,7 +301,12 @@ struct Index {
this.isSingle = globalThis.singlePlay
console.info('Index onPageShow');
//获取屏幕宽高
const width = display.getDefaultDisplaySync().width;
const height = display.getDefaultDisplaySync().height;
console.info('surenjun',width)
console.info('surenjun',height)
}
async createAlbum() {
@ -316,22 +322,22 @@ struct Index {
let atManager = abilityAccessCtrl.createAtManager();
// requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗
atManager.requestPermissionsFromUser(context, permissions).then((data) => {
this.initParams()
let grantStatus: Array<number> = data.authResults;
let length: number = grantStatus.length;
for (let i = 0; i < length; i++) {
if (grantStatus[i] === 0) {
// 用户授权,可以继续访问目标操作
} else {
// 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限
return;
}
}
// 授权成功
}).catch((err) => {
console.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`);
})
// atManager.requestPermissionsFromUser(context, permissions).then((data) => {
// this.initParams()
// let grantStatus: Array<number> = data.authResults;
// let length: number = grantStatus.length;
// for (let i = 0; i < length; i++) {
// if (grantStatus[i] === 0) {
// // 用户授权,可以继续访问目标操作
// } else {
// // 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限
// return;
// }
// }
// // 授权成功
// }).catch((err) => {
// console.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`);
// })
}
async initParams() {

View File

@ -10,7 +10,7 @@ import common from '@ohos.app.ability.common';
@Entry
@Component
export default struct Index {
@State ratio: number = 1700 / 960
@State ratio: number = 1920 /1080
@State ip: string = ''
@State deviceNo: string = ''
@State deviceName: string = ''

View File

@ -11,7 +11,7 @@ import { getSyncData} from '../common/service/initable'
struct Index {
@State textList1: string[] = ['差分服务器Ip','响应端口','中心服务器IP','响应端口', '子网掩码','默认网关','dns','后置机IP ', '响应端口','前置机IP','本地端口']
// @State textList2: string[] = []
@State ratio: number = 1700 / 960
@State ratio: number = 1920 /1080
@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' +

View File

@ -30,7 +30,7 @@ struct UserInfo {
private avPlayer
@State pageIndex: number = 0
@State ratio: number = 1700 / 960
@State ratio: number = 1920 /1080
@State index: number = 0
@State stepFlag: boolean = false;
@State errorMsg: string = ''
@ -718,20 +718,6 @@ struct UserInfo {
.margin({ left: 53 * globalThis.ratio })
Column() {
Image($r('app.media.yydj_btn'))
.commStyle()
Image($r('app.media.gx_btn'))
.commStyle()
.onClick(() => {
this.faceCompareSucess = 0
this.numCount = 0
this.getExaminationStudentInfoFn()
})
Image($r('app.media.qk_btn'))
.commStyle()
.onClick(() => {
this.qkFlag = true
})
if (this.isBoardPrePareSetPopupOpen && !this.isFirstBoardPrePareSetPopupBtnShow) {
//上车准备
@ -786,6 +772,21 @@ struct UserInfo {
})
}
Image($r('app.media.yydj_btn'))
.commStyle()
Image($r('app.media.gx_btn'))
.commStyle()
.onClick(() => {
this.faceCompareSucess = 0
this.numCount = 0
this.getExaminationStudentInfoFn()
})
Image($r('app.media.qk_btn'))
.commStyle()
.onClick(() => {
this.qkFlag = true
})
}
}

View File

@ -10,7 +10,7 @@ import { VideoConfigData } from '../mock';
@Entry
@Component
struct Index {
@State ratio: number = 1700 / 960
@State ratio: number = 1920 /1080
@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

View File

@ -2,9 +2,9 @@
//考试回放开关
export const judgeConfig = {
//本地目录开关
isTrajectoryOpen: false,
isTrajectoryOpen: true,
//是否开启拍照
isPhotoOpen: true,
isPhotoOpen: false,
//扣分语音是否强制开启
kfVoiceOpen: true,
// 是否忽略考试前熄火、车门检查
@ -14,7 +14,7 @@ export const judgeConfig = {
// 本地模型地址
modelPath: 'models/model_enc',
// 济南科目三
trajectoryPath: 'logs/2024_08_07/2024_08_07_11_35_39_0000000000001_342323199501470011_测试学员1/judge_exam_data.txt',
trajectoryPath: 'logs/2024_08_07_13_15_39_9999945345838_614384489851629952_管婕/judge_exam_data.txt',
//四合一画面配置
fourInOneScreen:{
//gps位数