新增检查设备是否需要冷启动的代码

- 新增 checkAndSendF9PColdStartCommand
- 新增 sendF9PColdStartCommand
This commit is contained in:
fengyarnom 2024-11-25 11:04:33 +08:00
parent 62ad3ae8a9
commit e7d77b8936

View File

@ -4,6 +4,7 @@ import com.imdroid.common.util.DataTypeUtil;
import com.imdroid.common.util.HexUtil;
import com.imdroid.common.util.ThreadManager;
import com.imdroid.secapi.client.BeidouClient;
import com.imdroid.secapi.dto.GnssDevice;
import com.imdroid.secapi.dto.GnssMsg;
import com.imdroid.secapi.dto.GnssMsgMapper;
import com.imdroid.secapi.dto.GnssStatus;
@ -52,8 +53,8 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
//应答
sendD3F1Ack(device);
// 检查是否需要对设备的F9P进行断电操作
checkAndSendF9PPowerOffCommand(device);
// 检查是否需要对设备的F9P进行冷启动操作
checkAndSendF9PColdStartCommand(device);
// 补齐tenantId
message.setTenantId(device.getTenantId());
device.updateRx(message.getHeader(),message.getLen(),1);
@ -94,6 +95,17 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
}
}
private void checkAndSendF9PColdStartCommand(Device device){
if(device.getModel() == GnssDevice.MODEL_G505){
// 连续6个周期无解则发送 F9P 冷启动指令
if(device.getNoFixedAndFloatResult() >= 6){
sendF9PColdStartCommand(device);
logger.debug("{}: 连续{}次无固定解和浮点解,发送 F9P 冷启动指令",device.getDeviceId(), device.getNoFixedAndFloatResult());
device.clearNoResultStat();
}
}
}
void saveMsg(String deviceId, int tenantId, int msgType, String content,boolean isTx){
GnssMsg gnssMsg = new GnssMsg();
gnssMsg.setCreatetime(LocalDateTime.now());
@ -124,6 +136,17 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
saveMsg(device.getDeviceId(), device.getTenantId(),0xD313, sendCmd, true);
}
void sendF9PColdStartCommand(Device device){
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;
rtcmClient.config(device.getDeviceId(), sendCmd);
saveMsg(device.getDeviceId(), device.getTenantId(),0xD310, sendCmd, true);
}
void sendD3F1Ack(Device device){
int flag = 0xD3F1;
short len = (short) (4);