2024-05-09 13:42:56 +08:00
|
|
|
import { GlobalConfig } from '../../../config/index'
|
2024-01-05 11:11:15 +08:00
|
|
|
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
|
|
|
|
|
import onvifclient from '@ohos.onvifclient';
|
|
|
|
|
import fs from '@ohos.file.fs'
|
|
|
|
|
import util from '@ohos.util';
|
|
|
|
|
import FileUtil from '../../../common/utils/File'
|
2024-03-12 15:32:48 +08:00
|
|
|
import {takePhoto} from '../../../common/service/videoService'
|
2024-01-05 11:11:15 +08:00
|
|
|
interface Params{
|
|
|
|
|
userName:string
|
|
|
|
|
pwd:string
|
|
|
|
|
ip:string
|
|
|
|
|
port:string
|
|
|
|
|
rlls:string
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-31 14:42:14 +08:00
|
|
|
export default class FilePhoto{
|
2024-01-05 11:11:15 +08:00
|
|
|
|
|
|
|
|
private params:Params
|
|
|
|
|
private context:any
|
|
|
|
|
private fileUtil:FileUtil
|
|
|
|
|
public mediaTest
|
|
|
|
|
|
|
|
|
|
constructor(context) {
|
2024-02-21 14:53:53 +08:00
|
|
|
(async ()=>{
|
|
|
|
|
const fileUtil = new FileUtil(context)
|
2024-05-09 13:42:56 +08:00
|
|
|
const strConfig = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress+'/config/config3.txt');
|
2024-02-21 14:53:53 +08:00
|
|
|
const config = JSON.parse(strConfig)
|
|
|
|
|
const {userName,ip,pwd,port,rlls} = config
|
|
|
|
|
this.params = {userName,pwd,ip,port,rlls}
|
|
|
|
|
this.context = context
|
|
|
|
|
this.fileUtil = fileUtil
|
|
|
|
|
})()
|
2024-01-05 11:11:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async getPhoto(){
|
2024-05-09 13:42:56 +08:00
|
|
|
const {params,context} = this;
|
|
|
|
|
const {base64} =await takePhoto(params,context,'jt/')
|
|
|
|
|
return base64
|
2024-01-05 11:11:15 +08:00
|
|
|
}
|
|
|
|
|
}
|