增加进制转换

master
18201612589 2021-12-09 14:46:03 +08:00
parent f756cd50e3
commit 0fd1d87f4f
2 changed files with 4 additions and 3 deletions

View File

@ -72,7 +72,7 @@ public class VehicleOperateController {
vehicleData.setLongitude(split[0]); vehicleData.setLongitude(split[0]);
vehicleData.setLatitude(split[1]); vehicleData.setLatitude(split[1]);
NettyClientMsg.sendMsg(Config.VEHICLE_MSG_SUF + "7E " + ConversionUtil.strToSixteen(vehicleData.getMsg()) + "7E " + "7E") ; NettyClientMsg.sendMsg(Config.VEHICLE_MSG_SUF + vehicleData.getMsg()) ;
NettyClientLogQueue.add(vehicleData.getVehicleMsgLog()); NettyClientLogQueue.add(vehicleData.getVehicleMsgLog());
return Response.success(); return Response.success();
} }

View File

@ -2,6 +2,7 @@ package com.muyu.netty.operate;
import com.muyu.common.Config; import com.muyu.common.Config;
import com.muyu.utils.ConversionUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -22,7 +23,7 @@ public class NettyClientMsg {
*/ */
public static void sendMsg(String msg){ public static void sendMsg(String msg){
log.info("客户端发送消息:{}",msg); log.info("客户端发送消息:{}",msg);
Config.ctx.writeAndFlush(msg + Config.DATA_PACK_SEPARATOR); Config.ctx.writeAndFlush(ConversionUtil.strToSixteen(msg) + Config.DATA_PACK_SEPARATOR);
} }
/** /**
@ -30,7 +31,7 @@ public class NettyClientMsg {
*/ */
public static void destroy(){ public static void destroy(){
log.info("发送断开连接消息:"+Config.NETTY_CLOSE); log.info("发送断开连接消息:"+Config.NETTY_CLOSE);
Config.ctx.writeAndFlush(Config.NETTY_WILL_CLOSE+ Config.VIN + Config.DATA_PACK_SEPARATOR); sendMsg(Config.NETTY_WILL_CLOSE + Config.VIN);
Config.ctx = null; Config.ctx = null;
} }