1、增加博通异常复位功能

This commit is contained in:
weidong 2024-12-04 18:20:01 +08:00
parent e05e5092e4
commit 38da126854
2 changed files with 80 additions and 9 deletions

View File

@ -17,6 +17,8 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Timer;
import java.util.TimerTask;
/**
@ -31,6 +33,11 @@ import java.time.LocalDateTime;
public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessage, Void> {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
final String F9PColdStartCmd = "b56206040400000002001068";
final String BTCloseMneaCmd = "424be8e1020a00040000ffff";
final String BTOpenGGACmd = "424b852c0208000400000001";
final String BTSaveCmd = "424bcc1726040000";
@Autowired
private DataPersistService dataPersistService;
@Autowired
@ -61,6 +68,7 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
ThreadManager.getFixedThreadPool().submit(() -> {
// 检查是否需要对设备的F9P进行冷启动操作
checkAndSendF9PColdStartCommand(device);
checkAndResetBTGnss(device);
// 通知beidou服务设备上线这里会触发参数同步
GnssStatus lastGnssStatus = dataPersistService.getDeviceState(message.getId());
try {
@ -102,8 +110,7 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
device.getDeviceType() == Device.DEVICE_ROVER){
// 连续6个周期无解则发送 F9P 冷启动指令
if((device.getWarningcode()&WarningCfg.TYPE_NO_FIXED_RESULT) !=0){
sendF9PColdStartCommand(device);
logger.info("{}: 连续{}次无固定解和浮点解,发送 F9P 冷启动指令",device.getDeviceId(), device.getNoFixedAndFloatResult());
startF9PColdStartTask(device);
device.clearNoResultStat();
}
}
@ -139,13 +146,11 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
saveMsg(device.getDeviceId(), device.getTenantId(),0xD313, sendCmd, true);
}
*/
void sendF9PColdStartCommand(Device device){
void sendGnssCommand(Device device, String gnssCmd){
int msgType = 0xD310;
// F9P 冷启动 b5 62 06 04 04 00 00 00 02 00 10 68
String sendCmd = "b56206040400000002001068";
short len = (short) (sendCmd.length()/2+4);
sendCmd = Integer.toHexString(msgType) + HexUtil.Short2HexString(len)+
HexUtil.Int2HexString(Integer.parseInt(device.getDeviceId()))+sendCmd;
short len = (short) (gnssCmd.length()/2+4);
String sendCmd = Integer.toHexString(msgType) + HexUtil.Short2HexString(len)+
HexUtil.Int2HexString(Integer.parseInt(device.getDeviceId()))+gnssCmd;
rtcmClient.config(device.getDeviceId(), sendCmd);
saveMsg(device.getDeviceId(), device.getTenantId(),0xD310, sendCmd, true);
}
@ -159,4 +164,66 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
rtcmClient.config(device.getDeviceId(), sendCmd);
}
private void checkAndResetBTGnss(Device device){
if(device.getModel() == GnssDevice.MODEL_G510 &&
device.getDeviceType() == Device.DEVICE_ROVER){
// 连续6个周期无解则发送 F9P 冷启动指令
if(device.getNoFixedAndFloatResult()>0 &&device.getAbnormalD341Num()>10){
startBTResetTask(device);
device.clearNoResultStat();
}
}
}
void startF9PColdStartTask(Device device){
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
sendGnssCommand(device, F9PColdStartCmd);
logger.info("{}: 连续{}次无固定解和浮点解,发送 F9P 冷启动指令",device.getDeviceId(), device.getNoFixedAndFloatResult());
}
},1000);
}
void startBTResetTask(Device device){
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
sendGnssCommand(device, BTCloseMneaCmd);
}
},1000);
timer.schedule(new TimerTask() {
@Override
public void run() {
sendGnssCommand(device, BTCloseMneaCmd);
}
},4000);
timer.schedule(new TimerTask() {
@Override
public void run() {
sendGnssCommand(device, BTOpenGGACmd);
}
},7000);
timer.schedule(new TimerTask() {
@Override
public void run() {
sendGnssCommand(device, BTOpenGGACmd);
}
},10000);
timer.schedule(new TimerTask() {
@Override
public void run() {
sendGnssCommand(device, BTSaveCmd);
}
},13000);
timer.schedule(new TimerTask() {
@Override
public void run() {
sendGnssCommand(device, BTSaveCmd);
}
},16000);
}
}

View File

@ -1,5 +1,6 @@
package com.imdroid.sideslope.sal;
import com.imdroid.secapi.dto.GnssDevice;
import com.imdroid.sideslope.bd.Gga;
import com.imdroid.sideslope.bd.UBXUtil;
import lombok.Data;
@ -75,6 +76,7 @@ public class Device {
int floatNum = 0;
LocalDateTime lastValidCalcDataTime; //最近一次有效解
int warningcode = 0;
short abnormalD341Num = 0;
public void updateRx(int head, int bytes,int count){
lastRxHead = head;
@ -96,6 +98,7 @@ public class Device {
d341Count+=count;
d341bytes += bytes;
lastRxTime = LocalDateTime.now();
if(model== GnssDevice.MODEL_G510 && bytes>100) abnormalD341Num++;
break;
case 0xd342:
d342Count ++;
@ -124,7 +127,7 @@ public class Device {
}
public void clearStat(){
if(fixedNum+floatNum == 0 && deviceType == DEVICE_ROVER) noFixedAndFloatResult++;
if(fixedNum+floatNum <= 5 && deviceType == DEVICE_ROVER) noFixedAndFloatResult++;
else noFixedAndFloatResult = 0;
d3xxCount = 0;
@ -146,6 +149,7 @@ public class Device {
public void clearNoResultStat(){
noFixedAndFloatResult = 0;
warningcode = 0;
abnormalD341Num = 0;
}
}