diff --git a/entry/src/main/ets/common/service/usbService.ts b/entry/src/main/ets/common/service/usbService.ts index bdea7272..10a2f615 100644 --- a/entry/src/main/ets/common/service/usbService.ts +++ b/entry/src/main/ets/common/service/usbService.ts @@ -18,7 +18,6 @@ function stringToArr(str){ return arr } - const initUsbServicesFn = () => { // 获取设备列表。 let deviceList : Array = usb.getDevices(); @@ -32,26 +31,23 @@ const initUsbServicesFn = () => { // if(vendorId === 2385 && productId === 5734){ // 申请操作指定的device的操作权限。 try { - const isExit = await usb.requestRight(device.name); + const isExit = await usb.requestRight(device.name); + console.info('surenjun',isExit) if(isExit){ let devicepipe : usb.USBDevicePipe = usb.connectDevice(device); let interfaces = device.configs[0].interfaces[0]; let ret = usb.claimInterface(devicepipe, interfaces,true); - + console.info('surenjun',ret); if(ret === 0 ){ - console.info('surenjun',ret) let outEndpoint : usb.USBEndpoint = interfaces.endpoints[0]; - const outputData = new Uint8Array(65); // 要发送的数据包 setInterval(()=>{ const wuXiDataStr = '$KSXT,20240320134841021,118.27269490,32.20290610,46.5220,190.31,0.13,0,5,0.00,3,3,25,20,0,0,0,0,0,0,E046,0081,1308,0xFFFFFFFF*'; // const wuXiDataStr = '$KSXT,19700101091317.10,117.13159937,31.80907367,24.973,269.4,0.91,,11.232,,4,,,,,,,,,,0005,0001,816,0xFFFFFFF' const arr = stringToArr(wuXiDataStr); - const firstArr = [0x00,63].concat(arr.slice(0,63)); const secondArr = [0x00,62].concat(arr.slice(64,127)).concat([0x00]); - // $KSXT,19700101091317.10,117.13159937,31.80907367,24.973,269.4,0.91,,11.232,,4,,,,,,,,,,00017,0010,816,0xFFFFFFF // $KSXT,20190719020615.80,117.12960038,31.80900947,23.8370,89.50,1.96,89.90,33.623,0.00,3,3,33,32,-1192.153,-2413.781,-30.162,,,,1.10,1.0,*BB if(wuXiDataStr){ @@ -68,7 +64,6 @@ const initUsbServicesFn = () => { console.info(" surenjunusb writeData error : " + JSON.stringify(error)); }); } - },200) }else{ console.info('surenjun','usb claimInterface failed') diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 9e41bdde..e63de946 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -245,9 +245,8 @@ struct Index { onPageShow() { this.loading = false globalThis.singlePlay = true; - - // initUsbServicesFn(); - this.userAuth(); + initUsbServicesFn(); + // this.userAuth(); // const judgeTag = 'SURENJUN_JUDGE' // let tcp = socket.constructTCPSocketInstance(); // tcp.bind({address: '192.168.100.120', port: 22001, family: 1}, err => { diff --git a/entry/src/main/ets/pages/judgeSDK/judge.ts b/entry/src/main/ets/pages/judgeSDK/judge.ts index ea57026d..f12886ee 100644 --- a/entry/src/main/ets/pages/judgeSDK/judge.ts +++ b/entry/src/main/ets/pages/judgeSDK/judge.ts @@ -1106,7 +1106,7 @@ export default class Judge{ // 中心所有项目转换 getTranslateProject = () => { - const {testKmItems} = this; + // const {testKmItems} = this; const tempItems = testKmItems.map(item=>{ const current = testKmItems[item.code]; return {