fix: 一代机

This commit is contained in:
wangzhongjie 2025-02-21 15:22:23 +08:00
parent 95a53a04e0
commit 912f5636db
6 changed files with 383 additions and 382 deletions

View File

@ -1,56 +1,14 @@
import Want from '@ohos.app.ability.Want' import Want from '@ohos.app.ability.Want'
import promptAction from '@ohos.promptAction' import promptAction from '@ohos.promptAction'
import fileAccess from '@ohos.file.fileAccess'
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl' import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'
import common from '@ohos.app.ability.common' import common from '@ohos.app.ability.common'
import fs from '@ohos.file.fs' import fs from '@ohos.file.fs'
const LOGTAG = 'LOGTAG' const LOGTAG = 'LOGTAG'
export default class FileUtil { export default class FileUtil {
private context: common.UIAbilityContext
private wantInfos: Want[]
private fileAccessHelper: fileAccess.FileAccessHelper
//后续文件路径待替换
private absolutePath = '/mnt/hmdfs/100/account/device_view/local/files/duolun'
public destFile: string public destFile: string
public filePathFdObj: Object = {} public filePathFdObj: Object = {}
constructor(wantInfos) {
const {requestPermission} = this;
this.wantInfos = wantInfos;
requestPermission();
fs.mkdir(this.absolutePath)
}
/*
* @desc
*
*/
public initFolder = async (folderPath:string) => {
const {absolutePath} = this;
const folderList = folderPath.split('/').filter(folderName => folderName !== '');
let path = absolutePath
folderList.forEach((folderName=>{
path += `/${folderName}`;
try {
const isExit = fs.accessSync(path);
if(!isExit){
fs.mkdirSync(path)
}
} catch (e) {
console.info('初始化文件夹失败',path)
promptAction.showToast({
message:`初始化文件夹失败`+ folderPath + JSON.stringify(e),
duration:4000,
})
}
}));
return path;
}
/* /*
* @desc * @desc
* *
@ -105,7 +63,6 @@ export default class FileUtil{
console.error(LOGTAG, JSON.stringify(e)) console.error(LOGTAG, JSON.stringify(e))
} }
} }
/* /*
* @desc * @desc
* *
@ -118,7 +75,6 @@ export default class FileUtil{
console.info(LOGTAG, filePath + '文件关闭成功') console.info(LOGTAG, filePath + '文件关闭成功')
} }
} }
/* /*
* @desc * @desc
* *
@ -138,7 +94,6 @@ export default class FileUtil{
} }
} }
/* /*
* @desc获取系统目录里的文件列表 * @desc获取系统目录里的文件列表
*/ */
@ -146,44 +101,36 @@ export default class FileUtil{
const {absolutePath,getFilePathList} = this; const {absolutePath,getFilePathList} = this;
return getFilePathList(`${absolutePath}/${folderPath}`, false) return getFilePathList(`${absolutePath}/${folderPath}`, false)
}; };
private context: common.UIAbilityContext
private wantInfos: Want[]
private fileAccessHelper: any
//后续文件路径待替换
private absolutePath = '/mnt/hmdfs/100/account/device_view/local/files/duolun'
private getFilePathList = async (filePath: string, isSdcard: boolean) => {
let fileName = [], sdCardFileName = [];
// 删除文件夹或者文件 try {
/* const filenames = await fs.listFile(filePath);
* @desc for (let i = 0; i < filenames.length; i++) {
* @param{{type}} 1:文件夹 2 3 console.error(LOGTAG, `目录:${filePath}的子文件:${filenames[i]}`);
**/ if (isSdcard) {
sdCardFileName.push(filenames[i])
public deleteF = async (path:string,type: 1 | 2 | 3) => { } else {
const {getFilePathList,absolutePath} = this fileName.push(filenames[i])
if(type === 1){
const fileList = await getFilePathList(`${absolutePath}/${path}`,false);
fileList.forEach(filePath =>{
fs.unlinkSync(`${absolutePath}/${path}/${filePath}`);
})
fs.rmdirSync(`${absolutePath}/${path}`);
return true
}
if(type === 2){
fs.unlinkSync(`${absolutePath}/${path}`);
return true
}
if(type === 3){
fs.unlinkSync(`${path}`);
return true
} }
} }
return isSdcard ? sdCardFileName : fileName
// 获取系统文件绝对路径 } catch (e) {
public getAbsolutePath = () =>{ console.error(LOGTAG, JSON.stringify(e));
const {absolutePath} = this;
return absolutePath
} }
}
// 检索文件列表 // 检索文件列表
public getSdCardPathList = async () => { public getSdCardPathList = async () => {
//@ts-ignore
this.wantInfos = await fileAccess.getFileAccessAbilityInfo(); this.wantInfos = await fileAccess.getFileAccessAbilityInfo();
const {wantInfos,context} = this; const {wantInfos,context} = this;
//@ts-ignore
const fileAccessHelper = fileAccess.createFileAccessHelper(this.context, this.wantInfos); const fileAccessHelper = fileAccess.createFileAccessHelper(this.context, this.wantInfos);
this.fileAccessHelper = fileAccessHelper; this.fileAccessHelper = fileAccessHelper;
@ -218,34 +165,11 @@ export default class FileUtil{
} }
} }
public getFileContent = (filePath:string) => { // 删除文件夹或者文件
const {absolutePath} = this; /*
const { READ_WRITE }= fs.OpenMode * @desc
const path = `${absolutePath}/${filePath}` * @param{{type}} 1:文件夹 2 3
const str = fs.readTextSync(path); **/
return str
}
private getFilePathList = async (filePath:string,isSdcard:boolean) => {
let fileName = [],sdCardFileName = [];
try {
const filenames = await fs.listFile(filePath);
for (let i = 0; i < filenames.length; i++) {
console.error(LOGTAG,`目录:${filePath}的子文件:${filenames[i]}`);
if(isSdcard){
sdCardFileName.push(filenames[i])
}else{
fileName.push(filenames[i])
}
}
return isSdcard ? sdCardFileName : fileName
}catch (e){
console.error(LOGTAG,JSON.stringify(e));
}
}
// 文件系统初始化 // 文件系统初始化
private requestPermission = async () => { private requestPermission = async () => {
const {context,absolutePath} = this; const {context,absolutePath} = this;
@ -253,6 +177,7 @@ export default class FileUtil{
'ohos.permission.READ_MEDIA', 'ohos.permission.READ_MEDIA',
'ohos.permission.WRITE_MEDIA' 'ohos.permission.WRITE_MEDIA'
]; ];
// @ts-ignore
this.wantInfos = await fileAccess.getFileAccessAbilityInfo(); this.wantInfos = await fileAccess.getFileAccessAbilityInfo();
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager() let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager()
atManager.requestPermissionsFromUser(context, permissions, async (code, result) => { atManager.requestPermissionsFromUser(context, permissions, async (code, result) => {
@ -267,5 +192,72 @@ export default class FileUtil{
}) })
} }
constructor(wantInfos) {
const {requestPermission} = this;
this.wantInfos = wantInfos;
requestPermission();
fs.mkdir(this.absolutePath)
}
/*
* @desc
*
*/
public initFolder = async (folderPath: string) => {
const {absolutePath} = this;
const folderList = folderPath.split('/').filter(folderName => folderName !== '');
let path = absolutePath
folderList.forEach((folderName => {
path += `/${folderName}`;
try {
const isExit = fs.accessSync(path);
if (!isExit) {
fs.mkdirSync(path)
}
} catch (e) {
console.info('初始化文件夹失败', path)
promptAction.showToast({
message: `初始化文件夹失败` + folderPath + JSON.stringify(e),
duration: 4000,
})
}
}));
return path;
}
public deleteF = async (path: string, type: 1 | 2 | 3) => {
const {getFilePathList,absolutePath} = this
if (type === 1) {
const fileList = await getFilePathList(`${absolutePath}/${path}`, false);
fileList.forEach(filePath => {
fs.unlinkSync(`${absolutePath}/${path}/${filePath}`);
})
fs.rmdirSync(`${absolutePath}/${path}`);
return true
}
if (type === 2) {
fs.unlinkSync(`${absolutePath}/${path}`);
return true
}
if (type === 3) {
fs.unlinkSync(`${path}`);
return true
}
}
// 获取系统文件绝对路径
public getAbsolutePath = () => {
const {absolutePath} = this;
return absolutePath
}
public getFileContent = (filePath: string) => {
const {absolutePath} = this;
const { READ_WRITE } = fs.OpenMode
const path = `${absolutePath}/${filePath}`
const str = fs.readTextSync(path);
return str
}
} }

View File

@ -164,7 +164,6 @@ class TcpUtils {
if (log) { if (log) {
console.log(tag, 'send', message) console.log(tag, 'send', message)
} }
this.fileUtil.addFile(this.path + 'temp.txt', `^#${message}#$`)
this.socket.send({ this.socket.send({
data: `^#${message}#$` data: `^#${message}#$`
}).then(() => { }).then(() => {

View File

@ -1,5 +1,7 @@
import socket from '@ohos.net.socket'; import socket from '@ohos.net.socket';
import { PLCGPSData } from '../../mock'; import { PLCGPSData } from '../../mock/PLCGPSData';
// import { PLCGPSData } from '../../mock';
export default class UdpByOne { export default class UdpByOne {
// PLC udp // PLC udp
@ -12,7 +14,7 @@ export default class UdpByOne {
// PLC oppositeIpPort // PLC oppositeIpPort
private PLCOppositeIpPort: string = '30012'; private PLCOppositeIpPort: string = '30012';
// PLC消息 // PLC消息
private PLCMsg: number[]; private PLCMsg: ArrayBuffer;
// GPS udp // GPS udp
private GPSUDP: any; private GPSUDP: any;
// GPS localIp // GPS localIp
@ -21,7 +23,7 @@ export default class UdpByOne {
// GPS oppositeIpPort // GPS oppositeIpPort
private GPSOppositeIpPort: string = '30013'; private GPSOppositeIpPort: string = '30013';
// GPS消息 // GPS消息
private GPSMsg: string; private GPSMsg: any;
constructor() { constructor() {
// 初始化UDP // 初始化UDP
@ -72,16 +74,13 @@ export default class UdpByOne {
this.sendGPSMsg('1111') this.sendGPSMsg('1111')
this.PLCUDP.on("message", (res, remoteInfo) => { this.PLCUDP.on("message", (res, remoteInfo) => {
console.log('heartMsg', 'getPlc') console.log('heartMsg', 'getPlc')
this.PLCMsg = res.message; this.PLCMsg = res.message;
// 组合数据 // 组合数据
let newMessage = this.handleMsg(res.message) let newMessage = this.handleMsg()
callback(newMessage) callback(newMessage)
}) })
return
this.GPSUDP.on("message", (res1, remoteInfo) => { this.GPSUDP.on("message", (res1, remoteInfo) => {
console.log('heartMsg', 'GPSUDP') console.log('heartMsg', 'GPSUDP')
let dataView = new DataView(res1.message) let dataView = new DataView(res1.message)
let str = "" let str = ""
for (let i = 0; i < dataView?.byteLength; ++i) { for (let i = 0; i < dataView?.byteLength; ++i) {
@ -91,32 +90,25 @@ export default class UdpByOne {
} }
} }
this.GPSMsg = str; this.GPSMsg = str;
console.log('heartMsgGPSstr', str) let newMessage = this.handleMsg()
return this.PLCUDP.on("message", (res2, remoteInfo) => { callback(newMessage)
this.PLCMsg = res2.message;
// 组合数据
// let newMessage = this.handleMsg()
// callback(newMessage)
})
}) })
} }
// 处理消息 // 处理消息
public handleMsg(plcMessage) { public handleMsg() {
let newMessage = PLCGPSData; let newMessage = PLCGPSData;
console.log('heartMsg000', PLCGPSData) console.log('heartMsg000', PLCGPSData)
// 海拔高度 if (this.GPSMsg) {
// 原始GPS消息字符串
// this.GPSMsg = `$GPGGA,021126.00,2955.5885178,N,11953.8931034,E,5,12,0.8,13.191,M,6.838,M,2.000,0000*49$GPRMC,021126.00,A,2955.5885178,N,11953.8931034,E,4.881,318.3,170623,0.0,E,F*37$GPGST,021126.00,3.30,1.77,3.30,0.0000,1.77,1.25,3.30*67$PTNL,AVR,021126.00,+47.3119,Yaw,+0.4832,Tilt,,,0.817,3,1.7,25*09`;
// 使用正则表达式提取$GPGGA消息 // 使用正则表达式提取$GPGGA消息
let GPGGAMsg = this.GPSMsg.match(/\$GPGGA[^$]*/)[0]; let GPGGAMsg = this.GPSMsg.match(/\$GPGGA[^$]*/)[0];
let GPGGAMsgArr = GPGGAMsg.split(",").slice(0, 15); let GPGGAMsgArr = GPGGAMsg ? GPGGAMsg.split(",").slice(0, 15) : [];
// 使用正则提取$GPRMC消息 // 使用正则提取$GPRMC消息
let GPRMCMsg = this.GPSMsg.match(/\$GPRMC[^$]*/)[0]; let GPRMCMsg = this.GPSMsg.match(/\$GPRMC[^$]*/)[0];
let GPRMCMsgArr = GPRMCMsg.split(",").slice(0, 14); let GPRMCMsgArr = GPRMCMsg ? GPRMCMsg.split(",").slice(0, 14) : [];
// 使用正则表达式提取$GPGST消息] // 使用正则表达式提取$GPGST消息
let GPGSTMsg = this.GPSMsg.match(/\$GPGST[^$]*/)[0]; let GPGSTMatch = this.GPSMsg.match(/\$GPGST[^$]*/);
let GPGSTMsgArr = GPGSTMsg.split(",").slice(0, 9); let GPGSTMsgArr = GPGSTMatch ? GPGSTMatch[0].split(",").slice(0, 9) : [];
// 使用正则提取$PTNL消息 // 使用正则提取$PTNL消息
let PTNLMsg = this.GPSMsg.match(/\$PTNL[^$]*/)[0]; let PTNLMsg = this.GPSMsg.match(/\$PTNL[^$]*/)[0];
let PTNLMsgArr = PTNLMsg.split(",").slice(0, 14); let PTNLMsgArr = PTNLMsg.split(",").slice(0, 14);
@ -151,57 +143,59 @@ export default class UdpByOne {
newMessage[96] = GPGGAMsgArr[2]; newMessage[96] = GPGGAMsgArr[2];
// 速度97 // 速度97
newMessage[97] = GPRMCMsgArr[7]; newMessage[97] = GPRMCMsgArr[7];
let dataView = new DataView(plcMessage) }
if (this.PLCMsg) {
let dataView = new DataView(this.PLCMsg)
let PLCByteArr = [] let PLCByteArr = []
for (let i = 0; i < dataView?.byteLength; ++i) { for (let i = 0; i < dataView?.byteLength; ++i) {
let c = dataView?.getUint8(i).toString(2).padStart(8, "0") let c = dataView?.getUint8(i).toString(2).padStart(8, "0")
console.log('heartMsgheartMsg', c)
PLCByteArr.push(c.toString()) PLCByteArr.push(c.toString())
} }
// return if (PLCByteArr.length < 55) {
// let PLCByteArr = this.PLCMsg.map((num) => num.toString(2).padStart(8, "0")); return newMessage.join(",")
}
console.log("heartMsgheartMsg1", PLCByteArr.toString()); console.log("heartMsgheartMsg1", PLCByteArr.toString());
// 左方向灯 2 // 左方向灯 2
newMessage[2] = PLCByteArr[6][2]; newMessage[2] = PLCByteArr[6][5];
// 右方向灯 3 // 右方向灯 3 .
newMessage[3] = PLCByteArr[6][3]; newMessage[3] = PLCByteArr[6][4];
// 喇叭 4 // 喇叭 4
newMessage[4] = PLCByteArr[8][2]; newMessage[4] = PLCByteArr[8][4];
// 点火1 5 // 点火1 5
newMessage[5] = PLCByteArr[8][0]; newMessage[5] = PLCByteArr[8][7];
// 点火2 6 // 点火2 6
newMessage[6] = PLCByteArr[8][1]; newMessage[6] = PLCByteArr[8][6];
// 近光灯 7 // 近光灯 7
newMessage[7] = PLCByteArr[6][0]; newMessage[7] = PLCByteArr[6][7];
// 远光灯 8 // 远光灯 8
newMessage[8] = PLCByteArr[6][1]; newMessage[8] = PLCByteArr[6][6];
// 示廓灯 9 // 示廓灯 9
newMessage[9] = PLCByteArr[6][5]; newMessage[9] = PLCByteArr[6][2];
// 雾灯 10 // 雾灯 10
// 雨刮器 11 // 雨刮器 11
newMessage[11] = PLCByteArr[8][2]; newMessage[11] = PLCByteArr[8][5];
// 脚刹 12 // 脚刹 12
newMessage[12] = PLCByteArr[7][2]; newMessage[12] = PLCByteArr[7][5];
// 手刹 13 // 手刹 13
newMessage[13] = PLCByteArr[7][3]; newMessage[13] = PLCByteArr[7][4];
// 主驾驶门 14 // 主驾驶门 14
newMessage[14] = PLCByteArr[7][0]; newMessage[14] = PLCByteArr[7][7];
// NC 15 // NC 15
// TODO // TODO
// SA15 16 // SA15 16
// TODO // TODO
// 离合 17 // 离合 17
newMessage[17] = PLCByteArr[7][1]; newMessage[17] = PLCByteArr[7][6];
// 副刹车 18 // 副刹车 18
newMessage[18] = PLCByteArr[7][4]; newMessage[18] = PLCByteArr[7][3];
// 安全带 19 // 安全带 19
newMessage[19] = PLCByteArr[7][7]; newMessage[19] = PLCByteArr[7][0];
// 双跳灯 20 // 双跳灯 20
newMessage[20] = PLCByteArr[6][4]; newMessage[20] = PLCByteArr[6][3];
// 其他门 21 // 其他门 21
// TODO // TODO
// 转速过高 22 // 转速过高 22
newMessage[22] = PLCByteArr[9][7]; newMessage[22] = PLCByteArr[9][0];
// 车速 23 // 车速 23
newMessage[23] = PLCByteArr[11]; newMessage[23] = PLCByteArr[11];
// 累计脉冲 24 // 累计脉冲 24
@ -261,6 +255,8 @@ export default class UdpByOne {
// GPS错误次数 60 // GPS错误次数 60
// 已工作时长/设定的工作时长 61 // 已工作时长/设定的工作时长 61
// 改正数数据长度*数据长度-基准站RTCM改正数类型 62 // 改正数数据长度*数据长度-基准站RTCM改正数类型 62
}
console.log('heartMsgend', newMessage.join(",")) console.log('heartMsgend', newMessage.join(","))
return newMessage.join(",") return newMessage.join(",")

View File

@ -303,7 +303,7 @@ export default class UdpClientByCenter {
onMessage_1(callback?) { onMessage_1(callback?) {
this.onMessage_1Callback = callback; this.onMessage_1Callback = callback;
this.UPDOne.receiveMsg(callback); this.UPDOne.receiveMsg(callback);
this.udp && this.udp.on('message', this.message_1Fn); // this.udp && this.udp.on('message', this.message_1Fn);
} }

View File

@ -1,11 +1,9 @@
import TopLogo from './compontents/TopLogo' import TopLogo from './compontents/TopLogo'
import { registrationDeviceNo } from '../api/checkCar' import { registrationDeviceNo } from '../api/checkCar'
import { dateFormat } from '../common/utils/tools' import { dateFormat } from '../common/utils/tools'
import deviceManager from '@ohos.distributedHardware.deviceManager'
import { upDateTableByArray } from '../common/service/initable'
import promptAction from '@ohos.promptAction' import promptAction from '@ohos.promptAction'
import FileUtil from '../common/utils/File' import FileUtil from '../common/utils/File'
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common'
@Entry @Entry
@Component @Component
@ -25,6 +23,7 @@ export default struct Index {
// this.plateNo=globalThis.carInfo.plateNo // this.plateNo=globalThis.carInfo.plateNo
console.log('createDeviceManagerstart') console.log('createDeviceManagerstart')
try { try {
// @ts-ignore
deviceManager.createDeviceManager('com.oh.dts', (error, value) => { deviceManager.createDeviceManager('com.oh.dts', (error, value) => {
if (error) { if (error) {
console.error('createDeviceManager failed.'); console.error('createDeviceManager failed.');

View File

@ -1,9 +1,5 @@
import TopLogo from './compontents/TopLogo';
import TopLogo from './compontents/TopLogo' import prompt from '@ohos.prompt';
import ethernet from '@ohos.net.ethernet';
import prompt from '@ohos.prompt'
import { upDateTableByArray} from '../common/service/initable'
import { getSyncData} from '../common/service/initable'
import FileUtil from '../common/utils/File'; import FileUtil from '../common/utils/File';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import { GlobalConfig } from '../config'; import { GlobalConfig } from '../config';
@ -12,7 +8,6 @@ import { GlobalConfig } from '../config';
@Entry @Entry
@Component @Component
struct Index { struct Index {
@State textList1: string[] = ['差分服务器Ip', '响应端口', '中心服务器IP', '响应端口', '子网掩码', '默认网关', 'dns', '后置机IP ', '响应端口', '前置机IP', '本地端口'] @State textList1: string[] = ['差分服务器Ip', '响应端口', '中心服务器IP', '响应端口', '子网掩码', '默认网关', 'dns', '后置机IP ', '响应端口', '前置机IP', '本地端口']
// @State textList2: string[] = [] // @State textList2: string[] = []
@State ratio: number = 1700 / 960 @State ratio: number = 1700 / 960
@ -27,12 +22,13 @@ struct Index {
// @State inputTextList2: string[] = [] // @State inputTextList2: string[] = []
// 112.80.35.83 11052 // 112.80.35.83 11052
// @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000'] // @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000']
@State @Watch('outClick') outFlag: boolean = false;
scroller: Scroller = new Scroller()
// @State inputTextList2: string[] = ['192.168.36.139','20022'] // @State inputTextList2: string[] = ['192.168.36.139','20022']
private fileUtil: FileUtil private fileUtil: FileUtil
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
private vocObj = null;
@State @Watch('outClick') outFlag: boolean = false; private vocObj = null;
scroller: Scroller = new Scroller()
build() { build() {
Column() { Column() {
TopLogo({ outFlag: $outFlag }) TopLogo({ outFlag: $outFlag })
@ -61,7 +57,8 @@ struct Index {
angle: 0, angle: 0,
colors: [[0x403C36, 0.0], [0x4D473D, 0.34], [0x3D3A34, 1.0]] colors: [[0x403C36, 0.0], [0x4D473D, 0.34], [0x3D3A34, 1.0]]
}).onChange((value: string) => { })
.onChange((value: string) => {
this.inputTextList1[index] = value this.inputTextList1[index] = value
}) })
@ -81,13 +78,29 @@ struct Index {
.width('100%') .width('100%')
.height('80%') .height('80%')
.borderRadius('25px') .borderRadius('25px')
Column() { Column() {
Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(async () => { Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(async () => {
const fileUtil = new FileUtil(this.context) const fileUtil = new FileUtil(this.context)
const folderPath = await fileUtil.initFolder(`/config`); const folderPath = await fileUtil.initFolder(`/config`);
const param={udplocalIp:this.inputTextList1[9],udplocalIpPort:this.inputTextList1[10],udpOppositeIp:this.inputTextList1[7],udpOppositeIpPort:this.inputTextList1[8],tcplocalIp:this.inputTextList1[9],tcplocalIpPort:'8088',tcpOppositeIp:this.inputTextList1[0],tcpOppositePort:this.inputTextList1[1],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[6],centerIp:this.inputTextList1[2],centerPort:this.inputTextList1[3]} const param = {
udplocalIp: this.inputTextList1[9],
udplocalIpPort: this.inputTextList1[10],
udpOppositeIp: this.inputTextList1[7],
udpOppositeIpPort: this.inputTextList1[8],
tcplocalIp: this.inputTextList1[9],
tcplocalIpPort: '8088',
tcpOppositeIp: this.inputTextList1[0],
tcpOppositePort: this.inputTextList1[1],
netMask: this.inputTextList1[4],
gateway: this.inputTextList1[5],
dnsServers: this.inputTextList1[6],
centerIp: this.inputTextList1[2],
centerPort: this.inputTextList1[3]
}
fileUtil.addFile(`${folderPath}/ipConfig.txt`, JSON.stringify(param), '') fileUtil.addFile(`${folderPath}/ipConfig.txt`, JSON.stringify(param), '')
// upDateTableByArray('IpConfigTable',[]) // upDateTableByArray('IpConfigTable',[])
// @ts-ignore
ethernet.setIfaceConfig("eth0", { ethernet.setIfaceConfig("eth0", {
mode: 0, mode: 0,
ipAddr: this.inputTextList1[9], ipAddr: this.inputTextList1[9],
@ -157,7 +170,7 @@ struct Index {
this.inputTextList1[3] = result.centerPort this.inputTextList1[3] = result.centerPort
} }
//@ts-ignore
ethernet.getIfaceConfig("eth0", (error, value) => { ethernet.getIfaceConfig("eth0", (error, value) => {
if (error) { if (error) {
// that.errorMsg='error' // that.errorMsg='error'
@ -173,9 +186,11 @@ struct Index {
}) })
} }
onPageShow() { onPageShow() {
console.info('Index onPageShow'); console.info('Index onPageShow');
} }
outClick() { outClick() {
} }