Merge branch 'dev' into dev_remote
This commit is contained in:
commit
50b63e471d
@ -3,7 +3,7 @@ import { getSyncData } from '../service/initable';
|
||||
import hilog from '@ohos.hilog';
|
||||
import FileUtil from '../../common/utils/File'
|
||||
import { GlobalConfig } from '../../config/index'
|
||||
|
||||
const TAG = 'socketTag[TcpDemo.TcpClient]'
|
||||
export async function getTCP(flag=false) {
|
||||
globalThis.getCloseTcp=true
|
||||
const fileUtil = new FileUtil(globalThis.context)
|
||||
@ -35,10 +35,16 @@ export async function getTCP(flag=false) {
|
||||
console.log('ttttttt00')
|
||||
|
||||
clearInterval(globalThis.intervalSendmsg)
|
||||
globalThis.intervalSendmsg=setInterval(()=>{
|
||||
globalThis.intervalSendmsg=setInterval(async()=>{
|
||||
console.log('getCloseTcp',globalThis.carInfo.carNo)
|
||||
if(!globalThis.getCloseTcp){
|
||||
globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
|
||||
await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
|
||||
globalThis.tcpStep+=1
|
||||
if(globalThis.tcpStep>30){
|
||||
console.log(TAG,'tcp重连开始')
|
||||
globalThis.tcpStep=0
|
||||
getTCP()
|
||||
}
|
||||
}
|
||||
},1000/3)
|
||||
globalThis.TcpClient.onError((val) => {
|
||||
@ -68,10 +74,16 @@ export async function getTCP(flag=false) {
|
||||
console.log('ttttttt12')
|
||||
|
||||
clearInterval(globalThis.intervalSendmsg)
|
||||
globalThis.intervalSendmsg=setInterval(()=>{
|
||||
globalThis.intervalSendmsg=setInterval(async()=>{
|
||||
// console.log('getCloseTcp',globalThis.getCloseTcp)
|
||||
if(!globalThis.getCloseTcp){
|
||||
globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
|
||||
await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
|
||||
globalThis.tcpStep+=1
|
||||
if(globalThis.tcpStep>30){
|
||||
console.log(TAG,'tcp重连开始')
|
||||
globalThis.tcpStep=0
|
||||
getTCP()
|
||||
}
|
||||
}
|
||||
},1000/3)
|
||||
globalThis.TcpClient.onError((val) => {
|
||||
|
||||
@ -148,13 +148,12 @@ export default class TcpClient {
|
||||
this.tcpSendNum=0
|
||||
return
|
||||
}
|
||||
globalThis.getCloseTcp=true
|
||||
console.log(`${TAG} TCPsend error ${JSON.stringify(err)}`)
|
||||
// this.writeLog({
|
||||
// time:dateFormat(new Date()),
|
||||
// message: `${TAG} TCPsend error ${JSON.stringify(err)}`,
|
||||
// })
|
||||
reslove(false)
|
||||
reject(false)
|
||||
});
|
||||
})
|
||||
}
|
||||
@ -165,6 +164,7 @@ export default class TcpClient {
|
||||
// time:dateFormat(new Date()),
|
||||
// PLC:`${TAG} Tcponmessage`,
|
||||
// })
|
||||
globalThis.tcpStep=0
|
||||
globalThis.tcpUdpError = false
|
||||
if (value) {
|
||||
callback && callback(value.message)
|
||||
|
||||
@ -38,6 +38,8 @@ export default class EntryAbility extends UIAbility {
|
||||
|
||||
async onWindowStageCreate(windowStage: window.WindowStage) {
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
|
||||
await tcpUtil.init()
|
||||
globalThis.tcpStep=0
|
||||
|
||||
globalThis.carInfo = {}
|
||||
globalThis.examinerInfo = {}
|
||||
@ -63,11 +65,15 @@ export default class EntryAbility extends UIAbility {
|
||||
globalThis.pathDir = this.context.filesDir;
|
||||
globalThis.context = this.context;
|
||||
globalThis.isJudgeInitBool = false
|
||||
console.info('jiangsong globalThis.pathDir = ' + globalThis.pathDir);
|
||||
// this.requestPermission(this.context)
|
||||
// this.featureAbilityAuth()
|
||||
|
||||
const windowClass = await windowStage.getMainWindow();
|
||||
globalThis.windowClass = windowClass
|
||||
await windowClass.setWindowLayoutFullScreen(true)
|
||||
await windowClass.setWindowSystemBarEnable([])
|
||||
// await windowClass.setWindowLayoutFullScreen(true)
|
||||
// await windowClass.setWindowSystemBarEnable([]) //全屏
|
||||
await windowClass.setWindowSystemBarEnable(['navigation'])
|
||||
|
||||
windowStage.loadContent('pages/Index', (err, data) => {
|
||||
if (err.code) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user