forked from harmony_car/subject-two
		
	提交
This commit is contained in:
		
							parent
							
								
									e6420a333d
								
							
						
					
					
						commit
						e53f84b3d3
					
				| @ -25,8 +25,8 @@ CommonConstants { | |||||||
|    */ |    */ | ||||||
|   static readonly ACCOUNT_TABLE = { |   static readonly ACCOUNT_TABLE = { | ||||||
|     tableName: 'IpConfigTable', |     tableName: 'IpConfigTable', | ||||||
|     sqlCreate: 'CREATE TABLE IF NOT EXISTS IpConfigTable(id INTEGER PRIMARY KEY AUTOINCREMENT,udplocalIp TEXT,udplocalIpPort TEXT, udpOppositeIp TEXT, udpOppositeIpPort TEXT,tcplocalIp TEXT,tcplocalIpPort TEXT,tcpOppositeIp TEXT,tcpOppositePort TEXT,gateway TEXT,netMask TEXT,dnsServers TEXT,centerIp TEXT,heartPort TEXT,gpsPort TEXT)', |     sqlCreate: 'CREATE TABLE IF NOT EXISTS IpConfigTable(id INTEGER PRIMARY KEY AUTOINCREMENT,udplocalIp TEXT,udplocalIpPort TEXT, udpOppositeIp TEXT, udpOppositeIpPort TEXT,tcplocalIp TEXT,tcplocalIpPort TEXT,tcpOppositeIp TEXT,tcpOppositePort TEXT,gateway TEXT,netMask TEXT,dnsServers TEXT)', | ||||||
|     columns: ['id','udplocalIp', 'udplocalIpPort', 'udpOppositeIp','udpOppositeIpPort','tcplocalIp','tcplocalIpPort','tcpOppositeIp','tcpOppositePort','gateway','netMask','dnsServers','centerIp','heartPort','gpsPort'] |     columns: ['id','udplocalIp', 'udplocalIpPort', 'udpOppositeIp','udpOppositeIpPort','tcplocalIp','tcplocalIpPort','tcpOppositeIp','tcpOppositePort','gateway','netMask','dnsServers'] | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   /** |   /** | ||||||
|  | |||||||
| @ -1,88 +1,59 @@ | |||||||
| import UdpClient from './UdpClient'; | import UdpClient from './UdpClient'; | ||||||
| import UdpClientByCenter from './UdpClientByCenter'; | import UdpClientByCenter from './UdpClientByCenter'; | ||||||
| import { getSyncData } from '../service/initable' | import { getSyncData} from '../service/initable' | ||||||
| import { dateFormat } from '../../common/utils/tools' | import { dateFormat } from '../../common/utils/tools' | ||||||
| import prompt from '@ohos.prompt' | import prompt from '@ohos.prompt' | ||||||
| import TcpClient from './TcpClient'; | import TcpClient from './TcpClient'; | ||||||
| 
 | 
 | ||||||
| 
 | export async function sendMsg(val){ | ||||||
| // getSyncData('IpConfigTable').then((result)=>{
 |   globalThis.udpClient1&&globalThis.udpClient1.sendMsg(val) | ||||||
| //  console.log('result222',result)
 |  | ||||||
| //  if(result){
 |  | ||||||
| //    if(globalThis.udpClient){
 |  | ||||||
| //      globalThis.udpClient.closeUdp()
 |  | ||||||
| //      setTimeout(()=>{
 |  | ||||||
| //        const udpClient: UdpClient =new UdpClient(result[0].localIp, result[0].localIpPort,result[0].oppositeIp,result[0].oppositeIpPort)
 |  | ||||||
| //        udpClient.bindUdp()
 |  | ||||||
| //        udpClient.sendMsg('111')
 |  | ||||||
| //        globalThis.udpClient = udpClient
 |  | ||||||
| //      },1000)
 |  | ||||||
| //    }else{
 |  | ||||||
| //      const udpClient: UdpClient =new UdpClient(result[0].localIp, result[0].localIpPort,result[0].oppositeIp,result[0].oppositeIpPort)
 |  | ||||||
| //      udpClient.bindUdp()
 |  | ||||||
| //      udpClient.sendMsg('111')
 |  | ||||||
| //      globalThis.udpClient = udpClient
 |  | ||||||
| //    }
 |  | ||||||
| //    // globalThis.udpClient = new UdpClient(result[0].localIp, result[0].localIpPort,result[0].oppositeIp,result[0].oppositeIpPort)
 |  | ||||||
| //
 |  | ||||||
| //  }
 |  | ||||||
| // })
 |  | ||||||
| 
 |  | ||||||
| export async function sendMsg(val) { |  | ||||||
|   globalThis.udpClient1 && globalThis.udpClient1.sendMsg(val) |  | ||||||
| } | } | ||||||
| 
 |  | ||||||
| export async function getUDP() { | export async function getUDP() { | ||||||
|   getSyncData('IpConfigTable').then((result: Array<any>) => { |   getSyncData('IpConfigTable').then((result:Array<any>)=>{ | ||||||
|     console.log('result222', JSON.stringify(result)) |     console.log('result222',JSON.stringify(result)) | ||||||
|     if (result.length) { |     if(result.length){ | ||||||
|       if (globalThis.udpClient && globalThis.udpClient.closeUdp) { |       if(globalThis.udpClient&&globalThis.udpClient.closeUdp){ | ||||||
|         globalThis.udpClient.closeUdp(() => { |         globalThis.udpClient.closeUdp(()=>{ | ||||||
|  | 
 | ||||||
|  |           globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort,result[0].udpOppositeIp,result[0].udpOppositeIpPort) | ||||||
| 
 | 
 | ||||||
|           globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp, result[0].udpOppositeIpPort) |  | ||||||
|           // globalThis.udpClient.rebindUdp('192.168.7.170', '20122','192.168.7.124','20022')
 |  | ||||||
|           // setInterval(()=>{
 |  | ||||||
|           //   globalThis.udpClient.sendMsg('111')
 |  | ||||||
|           // },1000)
 |  | ||||||
|           globalThis.udpClient.sendMsg('111') |           globalThis.udpClient.sendMsg('111') | ||||||
| 
 | 
 | ||||||
|           // globalThis.udpClient = udpClient
 |           // globalThis.udpClient = udpClient
 | ||||||
|         }) |         }) | ||||||
|       } else { |       }else{ | ||||||
| 
 | 
 | ||||||
|         const udpClient: UdpClient = new UdpClient(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp, result[0].udpOppositeIpPort) |         const udpClient: UdpClient =new UdpClient(result[0].udplocalIp, result[0].udplocalIpPort,result[0].udpOppositeIp,result[0].udpOppositeIpPort) | ||||||
|         udpClient.bindUdp() |         udpClient.bindUdp() | ||||||
|         udpClient.sendMsg('111') |         udpClient.sendMsg('111') | ||||||
|         globalThis.udpClient = udpClient |         globalThis.udpClient = udpClient | ||||||
|       } |       } | ||||||
|       // globalThis.udpClient = new UdpClient(result[0].localIp, result[0].localIpPort,result[0].oppositeIp,result[0].oppositeIpPort)
 |       // globalThis.udpClient = new UdpClient(result[0].localIp, result[0].localIpPort,result[0].oppositeIp,result[0].oppositeIpPort)
 | ||||||
| 
 | 
 | ||||||
|     } else { |     }else{ | ||||||
|       globalThis.udpClient = {} |       globalThis.udpClient={} | ||||||
|       globalThis.udpClient.onMessage = () => { |       globalThis.udpClient.onMessage=()=>{} | ||||||
|       } |  | ||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function getUDP2() { | export async function getUDP2() { | ||||||
|   getSyncData('IpConfigTable').then(async (result: Array<any>) => { |   getSyncData('IpConfigTable').then(async (result:Array<any>)=>{ | ||||||
|     console.log('result222', JSON.stringify(result)) |     if(result.length){ | ||||||
|     if (result.length) { |       if(globalThis.udpClient2&&globalThis.udpClient2.closeUdp){ | ||||||
|       if (globalThis.udpClient2 && globalThis.udpClient2.closeUdp) { |         globalThis.udpClient2.closeUdp(async ()=>{ | ||||||
|         globalThis.udpClient2.closeUdp(async () => { |  | ||||||
|           // globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800','112.80.35.83','11056')
 |           // globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800','112.80.35.83','11056')
 | ||||||
|           globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800', result[0].centerIp, result[0].heartPort) |           globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800',globalThis.carInfo?.udpAddress,globalThis.carInfo?.messagePort) | ||||||
|           // globalThis.udpClient2.rebindUdp(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
 |           // globalThis.udpClient2.rebindUdp(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
 | ||||||
|           // globalThis.udpClient2.rebindUdp(result[0].udplocalIp, result[0].udpLocalIpByGPS,result[0].udpOppositeIp,result[0].udpOppositeIpPortByGPS)
 |           // globalThis.udpClient2.rebindUdp(result[0].udplocalIp, result[0].udpLocalIpByGPS,result[0].udpOppositeIp,result[0].udpOppositeIpPortByGPS)
 | ||||||
|           globalThis.udpClient2.onMessage((val) => { |           globalThis.udpClient2.onMessage((val)=>{ | ||||||
|             // globalThis.udpClnt2.sendMsg(heartMsg(context))
 |             // globalThis.udpClnt2.sendMsg(heartMsg(context))
 | ||||||
|           }) |           }) | ||||||
| 
 | 
 | ||||||
|         }) |         }) | ||||||
|       } else { |       }else{ | ||||||
|         // const udpClient: UdpClient =new UdpClient(result[0].udplocalIp, result[0].udpLocalIpByGPS,result[0].udpOppositeIp,result[0].udpOppositeIpPortByGPS)
 |         // const udpClient: UdpClient =new UdpClient(result[0].udplocalIp, result[0].udpLocalIpByGPS,result[0].udpOppositeIp,result[0].udpOppositeIpPortByGPS)
 | ||||||
|         const udpClient: UdpClientByCenter = new UdpClientByCenter(result[0].udplocalIp, '8800', result[0].centerIp, result[0].heartPort) |         const udpClient: UdpClientByCenter =new UdpClientByCenter(result[0].udplocalIp, '8800',globalThis.carInfo?.udpAddress,globalThis.carInfo?.messagePort) | ||||||
|         // const udpClient: UdpClientByCenter =new UdpClientByCenter(result[0].udplocalIp, '8800','112.80.35.83','11056')
 |         // const udpClient: UdpClientByCenter =new UdpClientByCenter(result[0].udplocalIp, '8800','112.80.35.83','11056')
 | ||||||
|         // const udpClient: UdpClient =new UdpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
 |         // const udpClient: UdpClient =new UdpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
 | ||||||
| 
 | 
 | ||||||
| @ -91,25 +62,20 @@ export async function getUDP2() { | |||||||
| 
 | 
 | ||||||
|         // globalThis.udpClient2.sendMsg(heartMsg(context))
 |         // globalThis.udpClient2.sendMsg(heartMsg(context))
 | ||||||
| 
 | 
 | ||||||
|         globalThis.udpClient2.onMessage((val) => { |         globalThis.udpClient2.onMessage((val)=>{ | ||||||
| 
 | 
 | ||||||
|           if (val.id == '32') { |           if(val.id=='32'){ | ||||||
|             globalThis.signNum = val.body[1] |             globalThis.signNum=val.body[1] | ||||||
|           } else if (val.id == '46') { |           }else if(val.id=='46'){ | ||||||
| 
 | 
 | ||||||
|             let tmpList = [] |             let tmpList = [] | ||||||
|             console.log('lsh', globalThis.lsh) |             console.log('lsh',globalThis.lsh) | ||||||
|             const str = globalThis.lsh |             const str = globalThis.lsh | ||||||
|             for (let i = 0; i < str.length; i++) { |             for (let i = 0;i < str.length; i++) { | ||||||
|               tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0]) |               tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0]) | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             const param = { |             const param = { id: 47, list: tmpList, carNo: globalThis.carInfo.carNo, placeId: globalThis.carInfo.examinationRoomId } | ||||||
|               id: 47, |  | ||||||
|               list: tmpList, |  | ||||||
|               carNo: globalThis.carInfo.carNo, |  | ||||||
|               placeId: globalThis.carInfo.examinationRoomId |  | ||||||
|             } |  | ||||||
|             globalThis.udpClient2.send(param) |             globalThis.udpClient2.send(param) | ||||||
|           } |           } | ||||||
| 
 | 
 | ||||||
| @ -120,74 +86,23 @@ export async function getUDP2() { | |||||||
|           // },1000)
 |           // },1000)
 | ||||||
|         }) |         }) | ||||||
|       } |       } | ||||||
|     } else { |     }else{ | ||||||
|       globalThis.udpClient2 = {} |       globalThis.udpClient2={} | ||||||
|       globalThis.udpClient2.onMessage = () => { |       globalThis.udpClient2.onMessage=()=>{} | ||||||
|       } |  | ||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function fillZero(str, len) { | export async function setTopLineUdp(){ | ||||||
|   str = str + ''; |  | ||||||
|   if (str.length > len || !len) { |  | ||||||
|     return str |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   let num = len - str.length; |  | ||||||
|   let zeroStr = ''; |  | ||||||
|   for (var i = 0; i < num; i++) { |  | ||||||
|     zeroStr = zeroStr + '0' |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   return zeroStr + str; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // function getByteToInt(arr){
 |  | ||||||
| //   let a = list[0];
 |  | ||||||
| //   let b = list[1];
 |  | ||||||
| //   let c = '0x' + fillZero(b.toString(16),2) + fillZero(a.toString(16),2) ;
 |  | ||||||
| //   let id = Math.floor(+c/1000)
 |  | ||||||
| // }
 |  | ||||||
| export async function getUDPByTopLine() { |  | ||||||
|   getSyncData('IpConfigTable').then((result: Array<any>) => { |  | ||||||
|     if (result.length) { |  | ||||||
|       if (globalThis.udpClientByTopLine && globalThis.udpClientByTopLine.closeUdp) { |  | ||||||
|         globalThis.udpClientByTopLine.closeUdp(() => { |  | ||||||
| 
 |  | ||||||
|           globalThis.udpClientByTopLine.rebindUdp(result[0].udplocalIp, '5509', result[0].udpOppositeIp, result[0].udpOppositeIpPort) |  | ||||||
|           // globalThis.udpClient.rebindUdp('192.168.7.170', '20122','192.168.7.124','20022')
 |  | ||||||
|         }) |  | ||||||
|       } else { |  | ||||||
| 
 |  | ||||||
|         const udpClient: UdpClient = new UdpClient(result[0].udplocalIp, '55509', result[0].udpOppositeIp, result[0].udpOppositeIpPort) |  | ||||||
|         // const udpClient: UdpClient =new UdpClient(result[0].udplocalIp, '8800','192.168.36.9','11111')
 |  | ||||||
|         // const udpClient: UdpClient =new UdpClient('192.168.7.170', '20122','192.168.7.124','20022')
 |  | ||||||
|         // globalThis.udpClient2.rebindUdp('192.168.7.170', '20122','192.168.7.124','20022')
 |  | ||||||
| 
 |  | ||||||
|         udpClient.bindUdp() |  | ||||||
|         globalThis.udpClientByTopLine = udpClient |  | ||||||
|       } |  | ||||||
|       // globalThis.udpClient = new UdpClient(result[0].localIp, result[0].localIpPort,result[0].oppositeIp,result[0].oppositeIpPort)
 |  | ||||||
| 
 |  | ||||||
|     } else { |  | ||||||
|       globalThis.udpClientByTopLine = {} |  | ||||||
|       globalThis.udpClientByTopLine.onMessage = () => { |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|   }) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| export async function setTopLineUdp() { |  | ||||||
|   const config = await getSyncData('IpConfigTable'); |   const config = await getSyncData('IpConfigTable'); | ||||||
|   if (config && config[0] && config[0].udplocalIp) { |   if(config && config[0] && config[0].udplocalIp){ | ||||||
|     const {udplocalIp,udpOppositeIp,udpOppositeIpPort} = config[0]; |     const {udplocalIp,udpOppositeIp,udpOppositeIpPort} = config[0]; | ||||||
|     const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '55509', udpOppositeIp, udpOppositeIpPort) |     const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '55509',udpOppositeIp,udpOppositeIpPort) | ||||||
|     // const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8800','192.168.36.4','33333')
 |     // const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8800','192.168.36.4','33333')
 | ||||||
|     udpClient.bindUdp() |     udpClient.bindUdp() | ||||||
| 
 | 
 | ||||||
|     return { |     return { | ||||||
|       send(bytes) { |       send(bytes){ | ||||||
|         udpClient.sendHeadMsg(bytes) |         udpClient.sendHeadMsg(bytes) | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
| @ -195,26 +110,21 @@ export async function setTopLineUdp() { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| export async function setJudgeUdp() { | export async function setJudgeUdp(){ | ||||||
|   const config = await getSyncData('IpConfigTable'); |   const config = await getSyncData('IpConfigTable'); | ||||||
|   if (config && config[0] && config[0].udplocalIp) { |   if(config && config[0] && config[0].udplocalIp){ | ||||||
|     const {udplocalIp,centerIp,gpsPort} = config[0]; |     const {udplocalIp} = config[0]; | ||||||
|     // const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080','192.168.32.167','33333')
 |     // const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080','192.168.32.167','33333')
 | ||||||
|     const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080', centerIp, gpsPort) |     const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080',globalThis.carInfo?.gpsAddress,globalThis.carInfo?.hintPort) | ||||||
|     // const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8800','192.168.36.4','33333')
 |     // const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8800','192.168.36.4','33333')
 | ||||||
|     udpClient.bindUdp() |     udpClient.bindUdp() | ||||||
|     udpClient.onMessage((val) => { |     udpClient.onMessage((val)=>{ | ||||||
|     }) |     }) | ||||||
|     globalThis.judgeUdpClient = udpClient; |     globalThis.judgeUdpClient = udpClient; | ||||||
|     return { |     return { | ||||||
|       send(bytes) { |       send(bytes){ | ||||||
|         console.log('carInfo111', JSON.stringify(globalThis.carInfo)) |         console.log('carInfo111',JSON.stringify(globalThis.carInfo)) | ||||||
|         udpClient.sendMsg({ |         udpClient.sendMsg({id:45,list:bytes,carNo:globalThis.carInfo.carNo,placeId:globalThis.carInfo.examinationRoomId}) | ||||||
|           id: 45, |  | ||||||
|           list: bytes, |  | ||||||
|           carNo: globalThis.carInfo.carNo, |  | ||||||
|           placeId: globalThis.carInfo.examinationRoomId |  | ||||||
|         }) |  | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -3,7 +3,7 @@ import common from '@ohos.app.ability.common'; | |||||||
| import router from '@ohos.router' | import router from '@ohos.router' | ||||||
| import { getCarInfo, getDeviceInfo } from '../common/service/terminalService' | import { getCarInfo, getDeviceInfo } from '../common/service/terminalService' | ||||||
| import { setCurrentTime } from '../common/service/timeService' | import { setCurrentTime } from '../common/service/timeService' | ||||||
| import {Array2Byte,string2Bytes} from '../common/utils/tools' | import {string2Bytes} from '../common/utils/tools' | ||||||
| import { | import { | ||||||
|   getEsCarModel, |   getEsCarModel, | ||||||
| } from '../common/service/initable' | } from '../common/service/initable' | ||||||
| @ -61,7 +61,7 @@ struct Index { | |||||||
|       Column() { |       Column() { | ||||||
|         Row() { |         Row() { | ||||||
|           if (!this.isSingle) { |           if (!this.isSingle) { | ||||||
|             Image($r('app.media.index_lw')).width('30.5%').height('74%').onClick(() => { |             Image($r('app.media.index_lw')).width('30.5%').height('74%').onClick(async() => { | ||||||
|               if (this.loading) { |               if (this.loading) { | ||||||
|                 return |                 return | ||||||
|               } |               } | ||||||
| @ -72,15 +72,11 @@ struct Index { | |||||||
|               this.angle = 0 |               this.angle = 0 | ||||||
|               //mode为3双中心下载表 |               //mode为3双中心下载表 | ||||||
|               if(globalThis.timeInfo.mode=='3'){ |               if(globalThis.timeInfo.mode=='3'){ | ||||||
|                 getDoubleCeneterTable().then(()=>{ |                await getDoubleCeneterTable() | ||||||
|                   this.loading=false |  | ||||||
|                 }) |  | ||||||
|               }else{ |               }else{ | ||||||
|                 getSingleCenterTable().then(()=>{ |                await getSingleCenterTable() | ||||||
|                  this.loading=false |  | ||||||
|                }) |  | ||||||
|               } |               } | ||||||
| 
 |               this.loading=false | ||||||
| 
 | 
 | ||||||
|             }) |             }) | ||||||
|           } |           } | ||||||
|  | |||||||
| @ -18,31 +18,18 @@ struct Index { | |||||||
|       Column() { |       Column() { | ||||||
|         Row() { |         Row() { | ||||||
|           Image($r('app.media.setting_clzc')).width('30.5%').height('74%').onClick(()=>{ |           Image($r('app.media.setting_clzc')).width('30.5%').height('74%').onClick(()=>{ | ||||||
|             // this.vocObj.playAudio({ |  | ||||||
|             //   type: 1, |  | ||||||
|             //   name: 'media_button.wav' |  | ||||||
|             // }) |  | ||||||
|             this.url='pages/register' |             this.url='pages/register' | ||||||
|             router.pushUrl({ |             router.pushUrl({ | ||||||
|               url: this.url, |               url: this.url, | ||||||
|             },router.RouterMode.Single); |             },router.RouterMode.Single); | ||||||
|           }) |           }) | ||||||
|           Image($r('app.media.setting_spjk')).width('30.5%').height('74%').onClick(()=>{ |           Image($r('app.media.setting_spjk')).width('30.5%').height('74%').onClick(()=>{ | ||||||
|             // this.vocObj.playAudio({ |  | ||||||
|             //   type: 1, |  | ||||||
|             //   name: 'media_button.wav' |  | ||||||
|             // }) |  | ||||||
|             this.url='pages/videoConfig' |             this.url='pages/videoConfig' | ||||||
|             router.pushUrl({ |             router.pushUrl({ | ||||||
|               url: this.url, |               url: this.url, | ||||||
|             },router.RouterMode.Single); |             },router.RouterMode.Single); | ||||||
|           }) |           }) | ||||||
|           Image($r('app.media.setting_xtts')).width('30.5%').height('74%').onClick(()=>{ |           Image($r('app.media.setting_xtts')).width('30.5%').height('74%').onClick(()=>{ | ||||||
|             console.info('jiangsong Button onClick') |  | ||||||
|             // this.vocObj.playAudio({ |  | ||||||
|             //   type: 1, |  | ||||||
|             //   name: 'media_button.wav' |  | ||||||
|             // }) |  | ||||||
|             this.url='pages/TeminalInfos' |             this.url='pages/TeminalInfos' | ||||||
|             router.pushUrl({ |             router.pushUrl({ | ||||||
|               url: this.url, |               url: this.url, | ||||||
| @ -74,21 +61,11 @@ struct Index { | |||||||
|     .backgroundImageSize({ width: '100%', height: '100%' }) |     .backgroundImageSize({ width: '100%', height: '100%' }) | ||||||
|   } |   } | ||||||
|    aboutToAppear() { |    aboutToAppear() { | ||||||
|     console.info('jiangsong:index Index aboutToAppear'); |  | ||||||
|      this.carNum = globalThis.carInfo.plateNo; |      this.carNum = globalThis.carInfo.plateNo; | ||||||
|      this.version = globalThis.version; |      this.version = globalThis.version; | ||||||
|      this.hasAuth = globalThis.hasAuth; |      this.hasAuth = globalThis.hasAuth; | ||||||
|   } |   } | ||||||
|   onPageShow() { | 
 | ||||||
|     console.info('Index onPageShow'); |  | ||||||
|     // tF = new voiceService(async (status,val) => { |  | ||||||
|     //   if (status == 'idle') { |  | ||||||
|     //     router.pushUrl({ |  | ||||||
|     //       url: this.url, |  | ||||||
|     //     }); |  | ||||||
|     //   } |  | ||||||
|     // }); |  | ||||||
|   } |  | ||||||
|   outClick(){ |   outClick(){ | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,10 +1,6 @@ | |||||||
| import router from '@ohos.router' | import router from '@ohos.router' | ||||||
| import UdpClient from '../common/utils/UdpClient'; | import UdpClient from '../common/utils/UdpClient'; | ||||||
| import FileLog from './judgeSDK/utils/file-log' | 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' |  | ||||||
| import signDisplayCom from './compontents/signDisplayCom' | import signDisplayCom from './compontents/signDisplayCom' | ||||||
| @Entry | @Entry | ||||||
| @Component | @Component | ||||||
|  | |||||||
| @ -9,12 +9,12 @@ import { voiceService } from '../common/service/voiceService' | |||||||
| @Entry | @Entry | ||||||
| @Component | @Component | ||||||
| struct Index { | struct Index { | ||||||
|   @State textList1: string[] = ['ftp服务器IP:','响应端口','前置机IP','响应端口', '子网掩码','默认网关','用户名:', '密码:','dns','差分服务器IP: ', '响应端口:','中心服务器IP:','心跳响应端口:', 'GPS响应端口:'] |   @State textList1: string[] = ['ftp服务器IP:','响应端口','前置机IP','响应端口', '子网掩码','默认网关','用户名:', '密码:','dns','差分服务器IP: ', '响应端口:',] | ||||||
|   @State textList2: string[] = ['后置机IP:','响应端口:', '本地端口:'] |   @State textList2: string[] = ['后置机IP:','响应端口:', '本地端口:'] | ||||||
|   @State ratio: number = 850 / 960 |   @State ratio: number = 850 / 960 | ||||||
|   @State inputFontSize:number=12  //12 |   @State inputFontSize:number=12  //12 | ||||||
|   // |   // | ||||||
|   @State inputTextList1: string[] = ['192.168.36.2','8083','192.168.36.92','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.203','8000','192.168.36.9','11111','33333'] |   @State inputTextList1: string[] = ['192.168.36.2','8083','192.168.36.92','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.203','8000',] | ||||||
|   @State inputTextList2: string[] = ['192.168.36.91','20022'] |   @State inputTextList2: string[] = ['192.168.36.91','20022'] | ||||||
|   // 112.80.35.83 11052 |   // 112.80.35.83 11052 | ||||||
|   // @State inputTextList1: string[] = ['192.168.7.254','8084','192.168.7.170','20122','255.255.255.0','192.168.7.1','','','114.114.114.114','112.80.35.83','11052'] |   // @State inputTextList1: string[] = ['192.168.7.254','8084','192.168.7.170','20122','255.255.255.0','192.168.7.1','','','114.114.114.114','112.80.35.83','11052'] | ||||||
| @ -101,13 +101,7 @@ struct Index { | |||||||
|         .borderRadius('25px') |         .borderRadius('25px') | ||||||
|         Column() { |         Column() { | ||||||
|           Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(()=>{ |           Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(()=>{ | ||||||
|             // this.vocObj.playAudio({ |             upDateTableConfig('IpConfigTable',[{udplocalIp:this.inputTextList1[2],udplocalIpPort:this.inputTextList1[3],udpOppositeIp:this.inputTextList2[0],udpOppositeIpPort:this.inputTextList2[1],tcplocalIp:this.inputTextList1[0],tcplocalIpPort:this.inputTextList1[1],tcpOppositeIp:this.inputTextList1[9],tcpOppositePort:this.inputTextList1[10],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[8]}]) | ||||||
|             //   type: 1, |  | ||||||
|             //   name: 'media_button.wav' |  | ||||||
|             // }) |  | ||||||
|             upDateTableConfig('IpConfigTable',[{udplocalIp:this.inputTextList1[2],udplocalIpPort:this.inputTextList1[3],udpOppositeIp:this.inputTextList2[0],udpOppositeIpPort:this.inputTextList2[1],tcplocalIp:this.inputTextList1[0],tcplocalIpPort:this.inputTextList1[1],tcpOppositeIp:this.inputTextList1[9],tcpOppositePort:this.inputTextList1[10],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[8],centerIp:this.inputTextList1[11],heartPort:this.inputTextList1[12],gpsPort:this.inputTextList1[13]}]) |  | ||||||
| 
 |  | ||||||
|             console.log('kkkk2',this.inputTextList2.toString()) |  | ||||||
|             ethernet.setIfaceConfig("eth0", { |             ethernet.setIfaceConfig("eth0", { | ||||||
|               mode: 0, |               mode: 0, | ||||||
|               ipAddr:this.inputTextList1[2], |               ipAddr:this.inputTextList1[2], | ||||||
| @ -123,10 +117,10 @@ struct Index { | |||||||
|                   duration: 3000 |                   duration: 3000 | ||||||
|                 }); |                 }); | ||||||
|               } else { |               } else { | ||||||
|                   prompt.showToast({ |                 prompt.showToast({ | ||||||
|                     message: '设置成功', |                   message: '设置成功', | ||||||
|                     duration: 3000 |                   duration: 3000 | ||||||
|                   }); |                 }); | ||||||
|               } |               } | ||||||
|             }); |             }); | ||||||
|           }) |           }) | ||||||
| @ -151,41 +145,41 @@ struct Index { | |||||||
|     .backgroundImage($r('app.media.index_bg')) |     .backgroundImage($r('app.media.index_bg')) | ||||||
|     .backgroundImageSize({ width: '100%', height: '100%' }) |     .backgroundImageSize({ width: '100%', height: '100%' }) | ||||||
|   } |   } | ||||||
|    aboutToAppear() { |   aboutToAppear() { | ||||||
|      getSyncData('IpConfigTable').then((result:Array<any>)=>{ |     getSyncData('IpConfigTable').then((result:Array<any>)=>{ | ||||||
|        console.log('result222',JSON.stringify(result)) |       console.log('result222',JSON.stringify(result)) | ||||||
|        if(result.length){ |       if(result.length){ | ||||||
|          console.log('tagtag',JSON.stringify(result)) |         console.log('tagtag',JSON.stringify(result)) | ||||||
|          this.inputTextList1[2]=result[0].udplocalIp |         this.inputTextList1[2]=result[0].udplocalIp | ||||||
|          this.inputTextList1[3]=result[0].udplocalIpPort |         this.inputTextList1[3]=result[0].udplocalIpPort | ||||||
|          this.inputTextList2[0]=result[0].udpOppositeIp |         this.inputTextList2[0]=result[0].udpOppositeIp | ||||||
|          this.inputTextList2[1]=result[0].udpOppositeIpPort |         this.inputTextList2[1]=result[0].udpOppositeIpPort | ||||||
| 
 | 
 | ||||||
|          this.inputTextList1[0]=result[0].tcplocalIp |         this.inputTextList1[0]=result[0].tcplocalIp | ||||||
|          this.inputTextList1[1]=result[0].tcplocalIpPort |         this.inputTextList1[1]=result[0].tcplocalIpPort | ||||||
|          this.inputTextList1[9]=result[0].tcpOppositeIp |         this.inputTextList1[9]=result[0].tcpOppositeIp | ||||||
|          this.inputTextList1[10]=result[0].tcpOppositePort |         this.inputTextList1[10]=result[0].tcpOppositePort | ||||||
|          this.inputTextList1[5]=result[0].gateway |         this.inputTextList1[5]=result[0].gateway | ||||||
|          this.inputTextList1[4]=result[0].netMask |         this.inputTextList1[4]=result[0].netMask | ||||||
|          this.inputTextList1[8]=result[0].dnsServers |         this.inputTextList1[8]=result[0].dnsServers | ||||||
|          this.inputTextList1[11]=result[0].centerIp |         this.inputTextList1[11]=result[0].centerIp | ||||||
|          this.inputTextList1[12]=result[0].heartPort |         this.inputTextList1[12]=result[0].heartPort | ||||||
|          this.inputTextList1[13]=result[0].gpsPort |         this.inputTextList1[13]=result[0].gpsPort | ||||||
|        } |       } | ||||||
|      }) |     }) | ||||||
|      ethernet.getIfaceConfig("eth0", (error, value) => { |     ethernet.getIfaceConfig("eth0", (error, value) => { | ||||||
|        if (error) { |       if (error) { | ||||||
|          // that.errorMsg='error' |         // that.errorMsg='error' | ||||||
|          console.log("boot_up getIp_new  callback error = " + JSON.stringify(error)); |         console.log("boot_up getIp_new  callback error = " + JSON.stringify(error)); | ||||||
|        } else { |       } else { | ||||||
|          console.log("boot_up getIp_new callback ipAddr = " + JSON.stringify(value.ipAddr)); // |         console.log("boot_up getIp_new callback ipAddr = " + JSON.stringify(value.ipAddr)); // | ||||||
|          console.log(" boot_up getIp_new callback mode = " + JSON.stringify(value.mode)); |         console.log(" boot_up getIp_new callback mode = " + JSON.stringify(value.mode)); | ||||||
|          console.log("boot_up getIp_new callback route = " + JSON.stringify(value.route)); |         console.log("boot_up getIp_new callback route = " + JSON.stringify(value.route)); | ||||||
|          console.log("boot_up getIp_new callback gateway = " + JSON.stringify(value.gateway)); |         console.log("boot_up getIp_new callback gateway = " + JSON.stringify(value.gateway)); | ||||||
|          console.log("boot_up getIp_new callback netMask = " + JSON.stringify(value.netMask)); |         console.log("boot_up getIp_new callback netMask = " + JSON.stringify(value.netMask)); | ||||||
|          console.log("boot_up getIp_new callback dnsServers = " + JSON.stringify(value.dnsServers)); |         console.log("boot_up getIp_new callback dnsServers = " + JSON.stringify(value.dnsServers)); | ||||||
|        } |       } | ||||||
|      }) |     }) | ||||||
| 
 | 
 | ||||||
|   } |   } | ||||||
|   onPageShow() { |   onPageShow() { | ||||||
|  | |||||||
| @ -664,7 +664,6 @@ struct UserInfo { | |||||||
| 
 | 
 | ||||||
|       if (this.showFaceCompare) { |       if (this.showFaceCompare) { | ||||||
|         FaceCompare({ |         FaceCompare({ | ||||||
|           showFaceCompare: $showFaceCompare, |  | ||||||
|           sfzh: this.currentUser.sfzmhm, |           sfzh: this.currentUser.sfzmhm, | ||||||
|           firstImage: this.currentUser.kszp, |           firstImage: this.currentUser.kszp, | ||||||
|           faceCompareSucess: $faceCompareSucess, |           faceCompareSucess: $faceCompareSucess, | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ import { dateFormat} from '../common/utils/tools' | |||||||
| import deviceManager from '@ohos.distributedHardware.deviceManager' | import deviceManager from '@ohos.distributedHardware.deviceManager' | ||||||
| import { upDateTableConfig } from '../common/service/initable' | import { upDateTableConfig } from '../common/service/initable' | ||||||
| import { voiceService } from '../common/service/voiceService' | import { voiceService } from '../common/service/voiceService' | ||||||
| import prompt from '@ohos.prompt' | import promptAction from '@ohos.promptAction' | ||||||
| @Entry | @Entry | ||||||
| @Component | @Component | ||||||
| struct Index { | struct Index { | ||||||
| @ -19,8 +19,6 @@ struct Index { | |||||||
|   @State @Watch('outClick') outFlag: boolean = false; |   @State @Watch('outClick') outFlag: boolean = false; | ||||||
|   @State subType: string = '2'; |   @State subType: string = '2'; | ||||||
|   onPageShow() { |   onPageShow() { | ||||||
|     // this.ip = globalThis.diskId |  | ||||||
| 
 |  | ||||||
|     this.plateNo=globalThis.carInfo.plateNo |     this.plateNo=globalThis.carInfo.plateNo | ||||||
|     deviceManager.createDeviceManager('com.example.udptest', (error, value) => { |     deviceManager.createDeviceManager('com.example.udptest', (error, value) => { | ||||||
|       if (error) { |       if (error) { | ||||||
| @ -29,9 +27,9 @@ struct Index { | |||||||
|       } |       } | ||||||
|       let dvMgrObj = value; |       let dvMgrObj = value; | ||||||
|       this.deviceName = dvMgrObj.getLocalDeviceInfoSync().deviceName |       this.deviceName = dvMgrObj.getLocalDeviceInfoSync().deviceName | ||||||
|       this.deviceNo=dvMgrObj.getLocalDeviceInfoSync().deviceId |       this.deviceNo=dvMgrObj.getLocalDeviceInfoSync().deviceId.substring(0,10).toUpperCase() | ||||||
|       this.ip='MAC-'+this.deviceName.toUpperCase() |       this.ip='MAC-'+this.deviceNo | ||||||
|       globalThis.deviceNo='MAC-'+this.deviceName |       globalThis.deviceNo='MAC-'+this.deviceNo | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| @ -46,16 +44,11 @@ struct Index { | |||||||
|               .width(50).onChange((isChecked: boolean) => { |               .width(50).onChange((isChecked: boolean) => { | ||||||
|               if(isChecked) |               if(isChecked) | ||||||
|                 this.subType = '2' |                 this.subType = '2' | ||||||
|               this.ip='MAC-'+this.deviceName |               this.ip='MAC-'+this.deviceNo | ||||||
|               globalThis.deviceNo=this.ip |               globalThis.deviceNo=this.ip | ||||||
|               // this.ip = globalThis.diskId |  | ||||||
|             }) |             }) | ||||||
|             Text('网卡').fontSize(34 * this.ratio).fontColor('#FFE0B2').margin({ right: 98.5 * this.ratio }) |             Text('网卡').fontSize(34 * this.ratio).fontColor('#FFE0B2').margin({ right: 98.5 * this.ratio }) | ||||||
| 
 |           } | ||||||
|           }.onClick(() => { |  | ||||||
|             // this.checked = '0' |  | ||||||
|             // this.ip = globalThis.diskId |  | ||||||
|           }) |  | ||||||
| 
 | 
 | ||||||
|           Row() { |           Row() { | ||||||
|             Radio({ value: '1', group: 'radioGroup' }).checked(this.subType=='3'?true:false) |             Radio({ value: '1', group: 'radioGroup' }).checked(this.subType=='3'?true:false) | ||||||
| @ -63,36 +56,15 @@ struct Index { | |||||||
|               .width(50).onChange((isChecked: boolean) => { |               .width(50).onChange((isChecked: boolean) => { | ||||||
|               if(isChecked) |               if(isChecked) | ||||||
|                 this.subType = '3' |                 this.subType = '3' | ||||||
|               this.ip='DISK-'+this.deviceName |               this.ip='DISK-'+this.deviceNo | ||||||
|               globalThis.deviceNo=this.ip |               globalThis.deviceNo=this.ip | ||||||
|                 // this.ip = ip |                 // this.ip = ip | ||||||
|             }) |             }) | ||||||
|             Text('硬盘').fontSize(34 * this.ratio).fontColor('#FFE0B2').margin({ right: 83 * this.ratio }) |             Text('硬盘').fontSize(34 * this.ratio).fontColor('#FFE0B2').margin({ right: 83 * this.ratio }) | ||||||
| 
 |           } | ||||||
|           }.onClick(() => { |  | ||||||
|             // this.checked = '1' |  | ||||||
|             // this.ip = globalThis.deviceNo |  | ||||||
|           }) |  | ||||||
| 
 |  | ||||||
|           // Image($r('app.media.huoqu_nor')).width(185 * this.ratio).height(89 * this.ratio).onClick(() => { |  | ||||||
|           //   // this.checked = '1111' |  | ||||||
|           //   getDeviceInfo() |  | ||||||
|           // }) |  | ||||||
|         }.margin({ top: 35 * this.ratio }) |         }.margin({ top: 35 * this.ratio }) | ||||||
| 
 | 
 | ||||||
|         Row() { |         Row() { | ||||||
|           // Column(){ |  | ||||||
|           //   Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { |  | ||||||
|           //     Text(this.plateNo).fontColor('#fff').fontSize(33.6 * this.ratio) |  | ||||||
|           //   }.width('100%') |  | ||||||
|           //   .height('100%') |  | ||||||
|           //   .padding({ left: 30 * this.ratio, right: 30 * this.ratio }) |  | ||||||
|           // } |  | ||||||
|           // .backgroundImage($r('app.media.xk')) |  | ||||||
|           // .backgroundImageSize({ width: '100%', height: '100%' }) |  | ||||||
|           // .width(220 * this.ratio) |  | ||||||
|           // .height(108 * this.ratio) |  | ||||||
| 
 |  | ||||||
|           Column(){ |           Column(){ | ||||||
|             Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { |             Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { | ||||||
|               Text(this.ip).fontColor('#fff') |               Text(this.ip).fontColor('#fff') | ||||||
| @ -128,14 +100,9 @@ struct Index { | |||||||
|   outClick(){ |   outClick(){ | ||||||
|   } |   } | ||||||
|   registrationDeviceNoFn(){ |   registrationDeviceNoFn(){ | ||||||
|     // this.vocObj.playAudio({ |  | ||||||
|     //   type: 1, |  | ||||||
|     //   name: 'media_button.wav' |  | ||||||
|     // }) |  | ||||||
|     const date=new Date() |     const date=new Date() | ||||||
|     const param={ |     const param={ | ||||||
|       time: dateFormat(date), |       time: dateFormat(date), | ||||||
|       // deviceNo:this.deviceNo, |  | ||||||
|       deviceName:this.ip, |       deviceName:this.ip, | ||||||
|       type:'1' |       type:'1' | ||||||
|     } |     } | ||||||
| @ -143,7 +110,7 @@ struct Index { | |||||||
|     upDateTableConfig('DeviceInfoTable',[{deviceId:this.ip}]) |     upDateTableConfig('DeviceInfoTable',[{deviceId:this.ip}]) | ||||||
|     registrationDeviceNo(param).then(res=>{ |     registrationDeviceNo(param).then(res=>{ | ||||||
|       if(res.registrationDeviceNoRsp.head.resultCode=='0'){ |       if(res.registrationDeviceNoRsp.head.resultCode=='0'){ | ||||||
|         prompt.showToast({ |         promptAction.showToast({ | ||||||
|           message: decodeURIComponent(res.registrationDeviceNoRsp.head.resultMessage), |           message: decodeURIComponent(res.registrationDeviceNoRsp.head.resultMessage), | ||||||
|           duration: 3000 |           duration: 3000 | ||||||
|         }); |         }); | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ | |||||||
|         "name": "EntryAbility", |         "name": "EntryAbility", | ||||||
|         "srcEntrance": "./ets/entryability/EntryAbility.ts", |         "srcEntrance": "./ets/entryability/EntryAbility.ts", | ||||||
|         "description": "$string:EntryAbility_desc", |         "description": "$string:EntryAbility_desc", | ||||||
|         "icon": "$media:icon", |         "icon": "$media:logo_app", | ||||||
|         "label": "$string:EntryAbility_label", |         "label": "$string:EntryAbility_label", | ||||||
|         "startWindowIcon": "$media:icon", |         "startWindowIcon": "$media:icon", | ||||||
|         "startWindowBackground": "$color:start_window_background", |         "startWindowBackground": "$color:start_window_background", | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user