fix:报文-蓝牙解析(日志打印)
All checks were successful
JT808 CI/CD / build-and-deploy (push) Successful in 26s
All checks were successful
JT808 CI/CD / build-and-deploy (push) Successful in 26s
This commit is contained in:
@@ -20,6 +20,9 @@ import com.hua.transport.jt808.service.ApiLogService;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hua.transport.jt808.common.Consts;
|
||||
import com.hua.transport.jt808.entity.request.LocationPack;
|
||||
|
||||
public class TCPServerHandler extends ChannelInboundHandlerAdapter { // (1)
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@@ -58,8 +61,19 @@ public class TCPServerHandler extends ChannelInboundHandlerAdapter { // (1)
|
||||
logMap.put("phone", header.getTerminalPhone());
|
||||
logMap.put("flowId", header.getFlowId());
|
||||
logMap.put("summary", "TCP Message Received");
|
||||
// Add raw object if needed, or string representation
|
||||
logMap.put("details", packageData.toString());
|
||||
|
||||
// Special handling for Location Upload (0x0200) to show parsed details including Bluetooth
|
||||
if (msgId == Consts.MSGID_LOCATION_UPLOAD) {
|
||||
try {
|
||||
LocationPack locPack = this.decoder.toLocationInfoUploadMsg(packageData);
|
||||
logMap.put("details", locPack.toString());
|
||||
} catch (Exception e) {
|
||||
logMap.put("details", packageData.toString() + " (Parse Error: " + e.getMessage() + ")");
|
||||
}
|
||||
} else {
|
||||
logMap.put("details", packageData.toString());
|
||||
}
|
||||
|
||||
apiLogService.broadcastLog("TCP", logMap);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user