diff --git a/dyy-gateway-core/src/main/java/com/dyy/tsp/core/evgb/enumtype/CommandType.java b/dyy-gateway-core/src/main/java/com/dyy/tsp/core/evgb/enumtype/CommandType.java
index a4954c1..26004ca 100644
--- a/dyy-gateway-core/src/main/java/com/dyy/tsp/core/evgb/enumtype/CommandType.java
+++ b/dyy-gateway-core/src/main/java/com/dyy/tsp/core/evgb/enumtype/CommandType.java
@@ -9,9 +9,9 @@ public enum CommandType {
 
     //上行指令
     VEHICLE_LOGIN((short)1, "车辆登入"),
-    VEHICLE_LOGOUT((short)2,"车辆登出"),
-    REALTIME_DATA_REPORTING((short)3,"实时信息上报"),
-    REPLACEMENT_DATA_REPORTING((short)4,"补发信息上报"),
+    VEHICLE_LOGOUT((short)4,"车辆登出"),
+    REALTIME_DATA_REPORTING((short)2,"实时信息上报"),
+    REPLACEMENT_DATA_REPORTING((short)3,"补发信息上报"),
     PLATFORM_LOGIN((short)5,"平台登入"), //国家过检才用
     PLATFORM_LOGOUT((short)6,"平台登出"), //国家过检才用
     HEARTBEAT((short)7,"心跳"),
@@ -49,8 +49,9 @@ public enum CommandType {
 
     public static CommandType valuesOf(Short id) {
         for (CommandType enums : CommandType.values()) {
-            if (enums.getId()==id) {
+            if (enums.getId().shortValue() == id.shortValue()) {
                 return enums;
+
             }
         }
         return null;
diff --git a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/config/RedisConfig.java b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/config/RedisConfig.java
index e55ce45..6fdaada 100644
--- a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/config/RedisConfig.java
+++ b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/config/RedisConfig.java
@@ -19,155 +19,155 @@ import redis.clients.jedis.JedisPoolConfig;
  * 分库提高Redis缓存命中率
  * created by dyy
  */
-@Configuration
-@SuppressWarnings("all")
-public class RedisConfig {
-
-    private static final Logger LOGGER = LoggerFactory.getLogger(RedisConfig.class);
-
-    @Value("${spring.redis.host}")
-    private String hostName;
-
-    @Value("${spring.redis.port}")
-    private Integer port;
-
-    @Value("${spring.redis.password}")
-    private String password;
-
-    @Value("${spring.redis.jedis.maxActive}")
-    private Integer maxTotal;
-
-    @Value("${spring.redis.jedis.maxIdle}")
-    private Integer maxIdle;
-
-    @Value("${spring.redis.jedis.maxWait}")
-    private Long maxWaitMillis;
-
-    @Value("${spring.redis.jedis.onBorrow}")
-    private Boolean testOnBorrow;
-
-    @Bean(name = "vehicleRedisTemplate")
-    public RedisTemplate deviceRedisTemplate(@Value("${spring.redis.database.vehicle}") Integer database ) {
-        RedisTemplate deviceRedisTemplate = new StringRedisTemplate();
-        RedisSerializer stringSerializer = new StringRedisSerializer();
-        deviceRedisTemplate.setKeySerializer(stringSerializer);
-        deviceRedisTemplate.setValueSerializer(stringSerializer);
-        deviceRedisTemplate.setHashKeySerializer(stringSerializer);
-        deviceRedisTemplate.setHashValueSerializer(stringSerializer);
-        deviceRedisTemplate.setConnectionFactory(connectionFactory(hostName, port, password, maxIdle, maxTotal, database, maxWaitMillis, testOnBorrow));
-        return deviceRedisTemplate;
-    }
-
-    @Bean(name = "commandRedisTemplate")
-    public RedisTemplate commandRedisTemplate(@Value("${spring.redis.database.command}") Integer database ) {
-        RedisTemplate commandRedisTemplate = new StringRedisTemplate();
-        RedisSerializer stringSerializer = new StringRedisSerializer();
-        commandRedisTemplate.setKeySerializer(stringSerializer);
-        commandRedisTemplate.setValueSerializer(stringSerializer);
-        commandRedisTemplate.setHashKeySerializer(stringSerializer);
-        commandRedisTemplate.setHashValueSerializer(stringSerializer);
-        commandRedisTemplate.setConnectionFactory(connectionFactory(hostName, port, password, maxIdle, maxTotal, database, maxWaitMillis, testOnBorrow));
-        return commandRedisTemplate;
-    }
-
-    /**
-     *
-     * @param hostName
-     * @param port
-     * @param password
-     * @param maxIdle
-     * @param maxTotal
-     * @param database
-     * @param maxWaitMillis
-     * @param testOnBorrow
-     * @return
-     */
-    public RedisConnectionFactory connectionFactory(String hostName, Integer port, String password, Integer maxIdle, Integer maxTotal, Integer database, Long maxWaitMillis, Boolean testOnBorrow) {
-        JedisConnectionFactory jedis = new JedisConnectionFactory();
-        jedis.setHostName(hostName);
-        jedis.setPort(port);
-        if (StringUtils.isNotBlank(password)) {
-            jedis.setPassword(password);
-        }
-        jedis.setDatabase(database);
-        jedis.setPoolConfig(poolCofig(maxIdle, maxTotal, maxWaitMillis, testOnBorrow));
-        //初始化连接池
-        jedis.afterPropertiesSet();
-        RedisConnectionFactory factory = jedis;
-        LOGGER.debug("init redis {}:{} database:{} success", hostName, port, database);
-        return factory;
-    }
-
-    /**
-     * 加载Redis连接池配置
-     * @param maxIdle
-     * @param maxTotal
-     * @param maxWaitMillis
-     * @param testOnBorrow
-     * @return
-     */
-    public JedisPoolConfig poolCofig(int maxIdle, int maxTotal, long maxWaitMillis, boolean testOnBorrow) {
-        JedisPoolConfig poolCofig = new JedisPoolConfig();
-        poolCofig.setMaxIdle(maxIdle);
-        poolCofig.setMaxTotal(maxTotal);
-        poolCofig.setMaxWaitMillis(maxWaitMillis);
-        poolCofig.setTestOnBorrow(testOnBorrow);
-        return poolCofig;
-    }
-
-    public Integer getMaxTotal() {
-        return maxTotal;
-    }
-
-    public void setMaxTotal(Integer maxTotal) {
-        this.maxTotal = maxTotal;
-    }
-
-    public Integer getMaxIdle() {
-        return maxIdle;
-    }
-
-    public void setMaxIdle(Integer maxIdle) {
-        this.maxIdle = maxIdle;
-    }
-
-    public Long getMaxWaitMillis() {
-        return maxWaitMillis;
-    }
-
-    public void setMaxWaitMillis(Long maxWaitMillis) {
-        this.maxWaitMillis = maxWaitMillis;
-    }
-
-    public Boolean getTestOnBorrow() {
-        return testOnBorrow;
-    }
-
-    public void setTestOnBorrow(Boolean testOnBorrow) {
-        this.testOnBorrow = testOnBorrow;
-    }
-
-    public String getHostName() {
-        return hostName;
-    }
-
-    public void setHostName(String hostName) {
-        this.hostName = hostName;
-    }
-
-    public Integer getPort() {
-        return port;
-    }
-
-    public void setPort(Integer port) {
-        this.port = port;
-    }
-
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
-    }
-}
+//@Configuration
+//@SuppressWarnings("all")
+//public class RedisConfig {
+//
+//    private static final Logger LOGGER = LoggerFactory.getLogger(RedisConfig.class);
+//
+//    @Value("${spring.redis.host}")
+//    private String hostName;
+//
+//    @Value("${spring.redis.port}")
+//    private Integer port;
+//
+//    @Value("${spring.redis.password}")
+//    private String password;
+//
+//    @Value("${spring.redis.jedis.maxActive}")
+//    private Integer maxTotal;
+//
+//    @Value("${spring.redis.jedis.maxIdle}")
+//    private Integer maxIdle;
+//
+//    @Value("${spring.redis.jedis.maxWait}")
+//    private Long maxWaitMillis;
+//
+//    @Value("${spring.redis.jedis.onBorrow}")
+//    private Boolean testOnBorrow;
+//
+//    @Bean(name = "vehicleRedisTemplate")
+//    public RedisTemplate deviceRedisTemplate(@Value("${spring.redis.database.vehicle}") Integer database ) {
+//        RedisTemplate deviceRedisTemplate = new StringRedisTemplate();
+//        RedisSerializer stringSerializer = new StringRedisSerializer();
+//        deviceRedisTemplate.setKeySerializer(stringSerializer);
+//        deviceRedisTemplate.setValueSerializer(stringSerializer);
+//        deviceRedisTemplate.setHashKeySerializer(stringSerializer);
+//        deviceRedisTemplate.setHashValueSerializer(stringSerializer);
+//        deviceRedisTemplate.setConnectionFactory(connectionFactory(hostName, port, password, maxIdle, maxTotal, database, maxWaitMillis, testOnBorrow));
+//        return deviceRedisTemplate;
+//    }
+//
+//    @Bean(name = "commandRedisTemplate")
+//    public RedisTemplate commandRedisTemplate(@Value("${spring.redis.database.command}") Integer database ) {
+//        RedisTemplate commandRedisTemplate = new StringRedisTemplate();
+//        RedisSerializer stringSerializer = new StringRedisSerializer();
+//        commandRedisTemplate.setKeySerializer(stringSerializer);
+//        commandRedisTemplate.setValueSerializer(stringSerializer);
+//        commandRedisTemplate.setHashKeySerializer(stringSerializer);
+//        commandRedisTemplate.setHashValueSerializer(stringSerializer);
+//        commandRedisTemplate.setConnectionFactory(connectionFactory(hostName, port, password, maxIdle, maxTotal, database, maxWaitMillis, testOnBorrow));
+//        return commandRedisTemplate;
+//    }
+//
+//    /**
+//     *
+//     * @param hostName
+//     * @param port
+//     * @param password
+//     * @param maxIdle
+//     * @param maxTotal
+//     * @param database
+//     * @param maxWaitMillis
+//     * @param testOnBorrow
+//     * @return
+//     */
+//    public RedisConnectionFactory connectionFactory(String hostName, Integer port, String password, Integer maxIdle, Integer maxTotal, Integer database, Long maxWaitMillis, Boolean testOnBorrow) {
+//        JedisConnectionFactory jedis = new JedisConnectionFactory();
+//        jedis.setHostName(hostName);
+//        jedis.setPort(port);
+//        if (StringUtils.isNotBlank(password)) {
+//            jedis.setPassword(password);
+//        }
+//        jedis.setDatabase(database);
+//        jedis.setPoolConfig(poolCofig(maxIdle, maxTotal, maxWaitMillis, testOnBorrow));
+//        //初始化连接池
+//        jedis.afterPropertiesSet();
+//        RedisConnectionFactory factory = jedis;
+//        LOGGER.debug("init redis {}:{} database:{} success", hostName, port, database);
+//        return factory;
+//    }
+//
+//    /**
+//     * 加载Redis连接池配置
+//     * @param maxIdle
+//     * @param maxTotal
+//     * @param maxWaitMillis
+//     * @param testOnBorrow
+//     * @return
+//     */
+//    public JedisPoolConfig poolCofig(int maxIdle, int maxTotal, long maxWaitMillis, boolean testOnBorrow) {
+//        JedisPoolConfig poolCofig = new JedisPoolConfig();
+//        poolCofig.setMaxIdle(maxIdle);
+//        poolCofig.setMaxTotal(maxTotal);
+//        poolCofig.setMaxWaitMillis(maxWaitMillis);
+//        poolCofig.setTestOnBorrow(testOnBorrow);
+//        return poolCofig;
+//    }
+//
+//    public Integer getMaxTotal() {
+//        return maxTotal;
+//    }
+//
+//    public void setMaxTotal(Integer maxTotal) {
+//        this.maxTotal = maxTotal;
+//    }
+//
+//    public Integer getMaxIdle() {
+//        return maxIdle;
+//    }
+//
+//    public void setMaxIdle(Integer maxIdle) {
+//        this.maxIdle = maxIdle;
+//    }
+//
+//    public Long getMaxWaitMillis() {
+//        return maxWaitMillis;
+//    }
+//
+//    public void setMaxWaitMillis(Long maxWaitMillis) {
+//        this.maxWaitMillis = maxWaitMillis;
+//    }
+//
+//    public Boolean getTestOnBorrow() {
+//        return testOnBorrow;
+//    }
+//
+//    public void setTestOnBorrow(Boolean testOnBorrow) {
+//        this.testOnBorrow = testOnBorrow;
+//    }
+//
+//    public String getHostName() {
+//        return hostName;
+//    }
+//
+//    public void setHostName(String hostName) {
+//        this.hostName = hostName;
+//    }
+//
+//    public Integer getPort() {
+//        return port;
+//    }
+//
+//    public void setPort(Integer port) {
+//        this.port = port;
+//    }
+//
+//    public String getPassword() {
+//        return password;
+//    }
+//
+//    public void setPassword(String password) {
+//        this.password = password;
+//    }
+//}
diff --git a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/config/TcuProperties.java b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/config/TcuProperties.java
index 87659f0..6ff71f9 100644
--- a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/config/TcuProperties.java
+++ b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/config/TcuProperties.java
@@ -8,20 +8,32 @@ public class TcuProperties {
 
     public static final String PREFIX = "tcu";
 
-    //网关TCP域名或者IP
-    private String gatewayHost = "localhost";
+    //网关域名 TODO:需要替换为您的云网关实例的域名
+    private String gatewayHost = "iot-***********.igw.iothub.aliyuncs.com";
 
-    //网关TCP端口
-    private Integer gatewayPort = 8111;
+    //网关端口 TODO:需要替换为您的云网关实例的端口号
+    private Integer gatewayPort = 8999;
+
+    //是否使用TLS TODO:如果使用了TCP直连，需要将其设置为FALSE
+    private boolean useSSL = Boolean.TRUE;
+
+    //如果没有使用TLS,请忽略；如果用到了，请设置根证书root-ca.crt的路径位置
+    private String CA_PATH = "${Your Absolute Path of root-ca.crt file}";
+
+    //车辆识别代码. 长度为17个字节。TODO: 需要替换为您车辆的vin号，并在控制台以此vin号创建设备
+    private String vin = "1234567890123456a";
+
+    //SIM卡的ICCID号，长度为20位字符串
+    private String iccid = "12345678901234567890";
+
+    //登入流水号，范围为1~65531，长度为2个字节，每次登录都需要对该值+1
+    private Integer serialNum = 1;
 
     //Tbox终端应该设置4秒1次心跳。这里TCP模拟就设置30秒
     private Integer timeout = 30;
 
-    //最大重连次数
-    private Integer reconnectMaxNum = 10000;
-
-    //心跳模拟车辆
-    private String heartVin;
+    //最大重连次数，当前设置为0，表示断线不重连。用户可以修改该值以实现重连
+    private Integer reconnectMaxNum = 0;
 
     private Integer maxFrameLength = 65556;
 
@@ -58,20 +70,20 @@ public class TcuProperties {
         this.gatewayHost = gatewayHost;
     }
 
-    public Integer getGatewayPort() {
-        return gatewayPort;
+    public boolean isUseSSL() {
+        return useSSL;
     }
 
-    public void setGatewayPort(Integer gatewayPort) {
-        this.gatewayPort = gatewayPort;
+    public void setUseSSL(boolean useSSL) {
+        this.useSSL = useSSL;
     }
 
-    public String getHeartVin() {
-        return heartVin;
+    public Integer getGatewayPort() {
+        return gatewayPort;
     }
 
-    public void setHeartVin(String heartVin) {
-        this.heartVin = heartVin;
+    public void setGatewayPort(Integer gatewayPort) {
+        this.gatewayPort = gatewayPort;
     }
 
     public Integer getTimeout() {
@@ -193,4 +205,15 @@ public class TcuProperties {
     public void setReconnectMaxNum(Integer reconnectMaxNum) {
         this.reconnectMaxNum = reconnectMaxNum;
     }
+
+    public String getVin(){return vin; }
+
+    public String getIccid(){return iccid;}
+
+    public Integer getSerialNum(){return serialNum;}
+
+    public String getCA_PATH(){
+        return CA_PATH;
+    }
+
 }
diff --git a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/enumtype/TcuHandlerType.java b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/enumtype/TcuHandlerType.java
index 1d65389..4158524 100644
--- a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/enumtype/TcuHandlerType.java
+++ b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/enumtype/TcuHandlerType.java
@@ -2,23 +2,27 @@ package com.dyy.tsp.gateway.tcu.enumtype;
 
 import com.dyy.tsp.core.base.IStatus;
 import com.dyy.tsp.core.evgb.entity.RealTimeData;
+import com.dyy.tsp.gateway.tcu.vin.QueryCommandHandler;
+import com.dyy.tsp.gateway.tcu.vin.RemoteControlCommandHandler;
+import com.dyy.tsp.gateway.tcu.vin.SetCommandHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 
 public enum TcuHandlerType {
 
     //上行指令
     VEHICLE_LOGIN((short)1, "车辆登入",null, null),
-    VEHICLE_LOGOUT((short)2,"车辆登出",null,null),
-    REALTIME_DATA_REPORTING((short)3,"实时信息上报",new RealTimeData(), null),
-    REPLACEMENT_DATA_REPORTING((short)4,"补发信息上报",new RealTimeData(),null),
+    REALTIME_DATA_REPORTING((short)2,"实时信息上报",new RealTimeData(), null),
+    REPLACEMENT_DATA_REPORTING((short)3,"补发信息上报",new RealTimeData(),null),
+    VEHICLE_LOGOUT((short)4,"车辆登出",null,null),
     PLATFORM_LOGIN((short)5,"平台登入",null, null), //国家过检才用
     PLATFORM_LOGOUT((short)6,"平台登出",null,null), //国家过检才用
     HEARTBEAT((short)7,"心跳",null, null),
     TERMINAL_CHECK_TIME((short)8,"终端校时",null, null),
 
     //下行指令
-    QUERY_COMMAND((short)128,"查询命令",null,null),
-    SET_COMMAND((short)129,"设置命令",null,null),
-    REMOTE_CONTROL((short)130,"车载终端控制命令",null,null),
+    QUERY_COMMAND((short)128,"查询命令",null, QueryCommandHandler.class),
+    SET_COMMAND((short)129,"设置命令",null, SetCommandHandler.class),
+    REMOTE_CONTROL((short)130,"车载终端控制命令", null,RemoteControlCommandHandler.class),
     ;
 
     private Short id;
@@ -67,7 +71,7 @@ public enum TcuHandlerType {
 
     public static TcuHandlerType valuesOf(Short id) {
         for (TcuHandlerType enums : TcuHandlerType.values()) {
-            if (enums.getId()==id) {
+            if (enums.getId().shortValue()==id.shortValue()) {
                 return enums;
             }
         }
diff --git a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/handler/BusinessHandler.java b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/handler/BusinessHandler.java
index 9a4f83b..47cf0c7 100644
--- a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/handler/BusinessHandler.java
+++ b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/handler/BusinessHandler.java
@@ -2,14 +2,27 @@ package com.dyy.tsp.gateway.tcu.handler;
 
 import com.dyy.tsp.core.base.AbstractBusinessHandler;
 import com.dyy.tsp.core.base.IHandler;
-import com.dyy.tsp.core.evgb.entity.EvGBProtocol;
+import com.dyy.tsp.core.evgb.entity.*;
+import com.dyy.tsp.core.evgb.enumtype.CommandType;
+import com.dyy.tsp.core.evgb.enumtype.ResponseType;
+import com.dyy.tsp.gateway.tcu.config.TcuProperties;
 import com.dyy.tsp.gateway.tcu.enumtype.TcuHandlerType;
+import com.dyy.tsp.gateway.tcu.netty.TcuChannel;
+import com.dyy.tsp.gateway.tcu.vo.RealTimeDataVo;
+import com.dyy.tsp.gateway.tcu.vo.VehicleLoginVo;
+import com.dyy.tsp.gateway.tcu.vo.VehicleLogoutVo;
+import io.netty.buffer.ByteBuf;
 import io.netty.channel.Channel;
 import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * 业务处理核心类
  * created by dyy
@@ -17,7 +30,14 @@ import org.springframework.stereotype.Service;
 @Service
 public class BusinessHandler extends AbstractBusinessHandler implements ApplicationContextAware {
 
+    @Autowired
+    TcuProperties tcuProperties;
+
     private ApplicationContext applicationContext;
+    String mVin;
+    String mIccid;
+    Integer mSerial;
+    BeanTime mBeanTime = new BeanTime();
 
     @Override
     public void doBusiness(EvGBProtocol protrocol, Channel channel) {
@@ -32,4 +52,296 @@ public class BusinessHandler extends AbstractBusinessHandler implements Applicat
     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
         this.applicationContext = applicationContext;
     }
+
+    public void startCarSimulator(){
+        mVin = tcuProperties.getVin();
+        mIccid = tcuProperties.getIccid();
+        mSerial = tcuProperties.getSerialNum();
+
+        new Thread(
+                new Runnable() {
+                    @Override
+                    public void run() {
+                        /** 1.登入 **/
+                        carLogin();
+
+                        /** 2.循环上报消息 **/
+                        for(int i=0; i<200; i++){
+
+                            try{
+                                Thread.sleep(10000);
+                            }catch (Exception e){
+                            }
+
+                            /** 2.1 发送心跳包 **/
+                            sendHeartBeat();
+
+                            /** 2.2 上报数据 **/
+                            pubRealTimeData();
+
+                            /** 2.3 实时数据重传 **/
+                            repubRealTimeData();
+                        }
+
+                        /** 3.登出 **/
+                       carLogout();
+                    }
+                }
+        ).start();
+    }
+
+    /**
+     * 车辆登入
+     */
+    private void carLogin(){
+        VehicleLoginVo vehicleLoginVo = new VehicleLoginVo();
+        vehicleLoginVo.setVin(mVin);
+
+        /**
+         * 车辆登入报文的payload部分格式如下：
+         *   1.数据采集时间           6字节
+         *   2.登入流水号             2字节
+         *   3.ICCID                20字节
+         *   4.可充电储能子系统数      1字节
+         *   5.可充电储能系统编码长度   1字节
+         *   6.可充电储能系统编码      n * m字节
+         */
+
+        //1.数据采集时间
+        LocalDateTime now = LocalDateTime.now();
+        short year = 23;   //1 byte, 有效值范围0~99
+        short month = (short) (now.getMonthValue());   //1 byte, 有效值范围1~12
+        short day = (short) (now.getDayOfMonth()) ;     //1 byte, 有效值范围1~31
+        short hour = (short) (now.getHour());    //1 byte, 有效值范围0~23
+        short min = (short) (now.getMinute());     //1 byte, 有效值范围0~59
+        short seconds = (short) (now.getSecond()); //1 byte, 有效值范围0~59
+        mBeanTime.setYear(year);
+        mBeanTime.setMonth(month);
+        mBeanTime.setDay(day);
+        mBeanTime.setHours(hour);
+        mBeanTime.setMinutes(min);
+        mBeanTime.setSeconds(seconds);
+        vehicleLoginVo.setBeanTime(mBeanTime);
+
+        //2.登入流水号
+        vehicleLoginVo.setSerialNum(mSerial);
+
+        //3.ICCID
+        vehicleLoginVo.setIccid(mIccid);
+
+        //4.可充电储能子系统数
+        List<String> codeList = new ArrayList<>();
+        vehicleLoginVo.setCodes(codeList);
+
+        EvGBProtocol protocol = new EvGBProtocol();
+        protocol.setCommandType(CommandType.VEHICLE_LOGIN);
+        protocol.setResponseType(ResponseType.COMMAND);
+        protocol.setVin(vehicleLoginVo.getVin());
+        protocol.setBody(new DataBody(vehicleLoginVo.encode()));
+
+        TcuChannel.INSTANCE.getChannelHandlerContext().channel().writeAndFlush(protocol.encode());
+    }
+
+    /**
+     * 发送心跳包
+     */
+    private void sendHeartBeat(){
+        EvGBProtocol evGBProtocol = new EvGBProtocol();
+        evGBProtocol.setVin(mVin);
+        evGBProtocol.setCommandType(CommandType.HEARTBEAT);
+        evGBProtocol.setBody(null);
+        evGBProtocol.setResponseType(ResponseType.COMMAND);
+        ByteBuf heartBuf = evGBProtocol.encode();
+        TcuChannel.INSTANCE.getChannelHandlerContext().channel().writeAndFlush(heartBuf);
+    }
+
+    /**
+     * 上报实时数据
+     */
+    private void pubRealTimeData(){
+        RealTimeDataVo realTimeDataVo = new RealTimeDataVo();
+        realTimeDataVo.setVin(mVin);
+        realTimeDataVo.setCommandType("REALTIME_DATA_REPORTING");
+
+        /**
+         * 实时数据上报报文的payload部分格式如下：
+         *   1.数据采集时间           6字节
+         *   2.信息类型标志1           1字节
+         *   3.信息体1               20字节
+         *   ...
+         *   信息类型标志n             1字节
+         *   信息体n                  不同类型有不同长度
+         */
+
+        //1.数据采集时间
+        LocalDateTime now = LocalDateTime.now();
+        short year = 23;   //1 byte, 有效值范围0~99
+        short month = (short) (now.getMonthValue());   //1 byte, 有效值范围1~12
+        short day = (short) (now.getDayOfMonth()) ;     //1 byte, 有效值范围1~31
+        short hour = (short) (now.getHour());    //1 byte, 有效值范围0~23
+        short min = (short) (now.getMinute());     //1 byte, 有效值范围0~59
+        short seconds = (short) (now.getSecond()); //1 byte, 有效值范围0~59
+        mBeanTime.setYear(year);
+        mBeanTime.setMonth(month);
+        mBeanTime.setDay(day);
+        mBeanTime.setHours(hour);
+        mBeanTime.setMinutes(min);
+        mBeanTime.setSeconds(seconds);
+        realTimeDataVo.setBeanTime(mBeanTime);
+
+        //驱动电机数据
+        Short driveMotorCnt = 0;
+        realTimeDataVo.setDriveMotorCount(driveMotorCnt);
+        List<DriveMotorData> driveMotorDatas = new ArrayList<>();
+        DriveMotorData driD = new DriveMotorData();
+        driD.setControllerDcBusbarCurrent(11);
+        driveMotorDatas.add(driD);
+        realTimeDataVo.setDriveMotorDatas(driveMotorDatas);
+
+       // 可充电储能装置电压数据
+        SubsystemVoltageData data = new SubsystemVoltageData();
+        data.setVoltage(3);
+        data.setCellCount(4);
+        short s1 = 1;
+        data.setNum(s1);
+        data.setVoltage(5);
+        data.setCurrent(6);
+        data.setBatteryNumber(7);
+        data.setBatteryConnt(s1);
+        List<Integer> cellVoltages = new ArrayList<>();
+        cellVoltages.add(new Integer(10));
+        data.setCellVoltages(cellVoltages);
+        List<SubsystemVoltageData> subvs = new ArrayList<>();
+        subvs.add(data);
+        realTimeDataVo.setSubsystemVoltageDatas(subvs);
+        Short subVlotageCount = (short) subvs.size() ;
+        realTimeDataVo.setSubsystemVoltageCount(subVlotageCount);
+
+        // 可充电储能装置温度数据
+        short tempCnt = 0;
+        realTimeDataVo.setSubsystemTemperatureCount(tempCnt);
+
+        EvGBProtocol protocol = new EvGBProtocol();
+        protocol.setCommandType(CommandType.valuesOf(realTimeDataVo.getCommandType()));
+        protocol.setResponseType(ResponseType.COMMAND);
+        protocol.setVin(realTimeDataVo.getVin());
+        protocol.setBody(new DataBody(realTimeDataVo.encode()));
+
+        TcuChannel.INSTANCE.getChannelHandlerContext().channel().writeAndFlush(protocol.encode());
+    }
+
+    /**
+     * 实时数据补报
+     */
+    private void repubRealTimeData(){
+        RealTimeDataVo realTimeDataVo = new RealTimeDataVo();
+        realTimeDataVo.setVin(mVin);
+        realTimeDataVo.setCommandType("REPLACEMENT_DATA_REPORTING");
+
+        /**
+         * 实时数据上报报文的payload部分格式如下：
+         *   1.数据采集时间           6字节
+         *   2.信息类型标志1           1字节
+         *   3.信息体1               20字节
+         *   ...
+         *   信息类型标志n             1字节
+         *   信息体n                  不同类型有不同长度
+         */
+
+        //1.数据采集时间
+        LocalDateTime now = LocalDateTime.now();
+        short year = 23;   //1 byte, 有效值范围0~99
+        short month = (short) (now.getMonthValue());   //1 byte, 有效值范围1~12
+        short day = (short) (now.getDayOfMonth()) ;     //1 byte, 有效值范围1~31
+        short hour = (short) (now.getHour());    //1 byte, 有效值范围0~23
+        short min = (short) (now.getMinute());     //1 byte, 有效值范围0~59
+        short seconds = (short) (now.getSecond()); //1 byte, 有效值范围0~59
+        mBeanTime.setYear(year);
+        mBeanTime.setMonth(month);
+        mBeanTime.setDay(day);
+        mBeanTime.setHours(hour);
+        mBeanTime.setMinutes(min);
+        mBeanTime.setSeconds(seconds);
+        realTimeDataVo.setBeanTime(mBeanTime);
+
+        //驱动电机数据
+        Short driveMotorCnt = 0;
+        realTimeDataVo.setDriveMotorCount(driveMotorCnt);
+        List<DriveMotorData> driveMotorDatas = new ArrayList<>();
+        DriveMotorData driD = new DriveMotorData();
+        driD.setControllerDcBusbarCurrent(11);
+        driveMotorDatas.add(driD);
+        realTimeDataVo.setDriveMotorDatas(driveMotorDatas);
+
+        // 可充电储能装置电压数据
+        SubsystemVoltageData data = new SubsystemVoltageData();
+        data.setVoltage(3);
+        data.setCellCount(4);
+        short s1 = 1;
+        data.setNum(s1);
+        data.setVoltage(5);
+        data.setCurrent(6);
+        data.setBatteryNumber(7);
+        data.setBatteryConnt(s1);
+        List<Integer> cellVoltages = new ArrayList<>();
+        cellVoltages.add(new Integer(10));
+        data.setCellVoltages(cellVoltages);
+        List<SubsystemVoltageData> subvs = new ArrayList<>();
+        subvs.add(data);
+        realTimeDataVo.setSubsystemVoltageDatas(subvs);
+        Short subVlotageCount = (short) subvs.size() ;
+        realTimeDataVo.setSubsystemVoltageCount(subVlotageCount);
+
+        // 可充电储能装置温度数据
+        short tempCnt = 0;
+        realTimeDataVo.setSubsystemTemperatureCount(tempCnt);
+
+        EvGBProtocol protocol = new EvGBProtocol();
+        protocol.setCommandType(CommandType.valuesOf(realTimeDataVo.getCommandType()));
+        protocol.setResponseType(ResponseType.COMMAND);
+        protocol.setVin(realTimeDataVo.getVin());
+        protocol.setBody(new DataBody(realTimeDataVo.encode()));
+
+        TcuChannel.INSTANCE.getChannelHandlerContext().channel().writeAndFlush(protocol.encode());
+    }
+
+    /**
+     * 车辆登出
+     */
+    private void carLogout(){
+        /**
+         * 车辆登出报文的payload部分格式如下：
+         *   1.登出时间                           6字节
+         *   2.登入流水号（与当次登入流水号一致）      2字节
+         */
+
+        VehicleLogoutVo vehicleLogoutVo = new VehicleLogoutVo();
+        vehicleLogoutVo.setVin(mVin);
+
+        //1.登出时间
+        LocalDateTime now = LocalDateTime.now();
+        short year = 23;                                //1 byte, 有效值范围0~99
+        short month = (short) (now.getMonthValue());   //1 byte, 有效值范围1~12
+        short day = (short) (now.getDayOfMonth()) ;     //1 byte, 有效值范围1~31
+        short hour = (short) (now.getHour());          //1 byte, 有效值范围0~23
+        short min = (short) (now.getMinute());         //1 byte, 有效值范围0~59
+        short seconds = (short) (now.getSecond());     //1 byte, 有效值范围0~59
+        mBeanTime.setYear(year);
+        mBeanTime.setMonth(month);
+        mBeanTime.setDay(day);
+        mBeanTime.setHours(hour);
+        mBeanTime.setMinutes(min);
+        mBeanTime.setSeconds(seconds);
+        vehicleLogoutVo.setBeanTime(mBeanTime);
+        //2.登出流水号
+        vehicleLogoutVo.setSerialNum(mSerial);
+
+        EvGBProtocol protocol = new EvGBProtocol();
+        protocol.setCommandType(CommandType.VEHICLE_LOGOUT);
+        protocol.setResponseType(ResponseType.COMMAND);
+        protocol.setVin(vehicleLogoutVo.getVin());
+        protocol.setBody(new DataBody(vehicleLogoutVo.encode()));
+        TcuChannel.INSTANCE.getChannelHandlerContext().channel().writeAndFlush(protocol.encode());
+    }
+
 }
diff --git a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/handler/RedisHandler.java b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/handler/RedisHandler.java
index 182430d..46d25e2 100644
--- a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/handler/RedisHandler.java
+++ b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/handler/RedisHandler.java
@@ -11,94 +11,94 @@ import java.util.concurrent.TimeUnit;
  * Redis操作类
  * created by dyy
  */
-@Service
-@SuppressWarnings("all")
-public class RedisHandler extends AbstractRedisHandler {
-
-    @Resource(name="vehicleRedisTemplate")
-    private RedisTemplate<String,String> vehicleRedisTemplate;
-
-    @Resource(name="commandRedisTemplate")
-    private RedisTemplate<String,String> commandRedisTemplate;
-
-    /**
-     * 判断key是否存在
-     * @param type
-     * @param key
-     * @return
-     */
-    public boolean hasKey(LibraryType type, String key){
-        return this.getRedisTemplateByType(type).hasKey(key);
-    }
-
-    /**
-     * 设置key
-     * @param type
-     * @param key
-     * @param value
-     */
-    public void set(LibraryType type, String key, String value){
-        this.getRedisTemplateByType(type).opsForValue().set(key,value);
-    }
-
-    /**
-     * 设置key并设置有效时间
-     * @param type
-     * @param key
-     * @param value
-     * @param timeout
-     * @param timeUnit
-     */
-    public void set(LibraryType type,String key,String value,Long timeout,TimeUnit timeUnit){
-        this.getRedisTemplateByType(type).opsForValue().set(key,value,timeout, timeUnit);
-    }
-
-    /**
-     * 设置key的有效时间  多次设置为叠加
-     * @param type
-     * @param key
-     * @param timeout
-     * @param timeUnit
-     */
-    public void expire(LibraryType type,String key,Long timeout,TimeUnit timeUnit){
-        this.getRedisTemplateByType(type).expire(key,timeout, timeUnit);
-    }
-
-    /**
-     * 删除Key
-     * @param type
-     * @param key
-     */
-    public void delete(LibraryType type,String key){
-        this.getRedisTemplateByType(type).delete(key);
-    }
-
-    /**
-     * 获取一个key的value
-     * @param type
-     * @param key
-     * @return
-     */
-    public String get(LibraryType type, String key){
-        return this.getRedisTemplateByType(type).opsForValue().get(key);
-    }
-
-    /**
-     * 根据类型获取对应的RedisTemplate
-     * @param type
-     * @return
-     */
-    public RedisTemplate<String,String> getRedisTemplateByType(LibraryType type){
-        switch (type){
-            case VEHICLE:{
-                return vehicleRedisTemplate;
-            }
-            case COMMAND:{
-                return commandRedisTemplate;
-            }
-            default:
-                return null;
-        }
-    }
-
-}
+//@Service
+//@SuppressWarnings("all")
+//public class RedisHandler extends AbstractRedisHandler {
+//
+//    @Resource(name="vehicleRedisTemplate")
+//    private RedisTemplate<String,String> vehicleRedisTemplate;
+//
+//    @Resource(name="commandRedisTemplate")
+//    private RedisTemplate<String,String> commandRedisTemplate;
+//
+//    /**
+//     * 判断key是否存在
+//     * @param type
+//     * @param key
+//     * @return
+//     */
+//    public boolean hasKey(LibraryType type, String key){
+//        return this.getRedisTemplateByType(type).hasKey(key);
+//    }
+//
+//    /**
+//     * 设置key
+//     * @param type
+//     * @param key
+//     * @param value
+//     */
+//    public void set(LibraryType type, String key, String value){
+//        this.getRedisTemplateByType(type).opsForValue().set(key,value);
+//    }
+//
+//    /**
+//     * 设置key并设置有效时间
+//     * @param type
+//     * @param key
+//     * @param value
+//     * @param timeout
+//     * @param timeUnit
+//     */
+//    public void set(LibraryType type,String key,String value,Long timeout,TimeUnit timeUnit){
+//        this.getRedisTemplateByType(type).opsForValue().set(key,value,timeout, timeUnit);
+//    }
+//
+//    /**
+//     * 设置key的有效时间  多次设置为叠加
+//     * @param type
+//     * @param key
+//     * @param timeout
+//     * @param timeUnit
+//     */
+//    public void expire(LibraryType type,String key,Long timeout,TimeUnit timeUnit){
+//        this.getRedisTemplateByType(type).expire(key,timeout, timeUnit);
+//    }
+//
+//    /**
+//     * 删除Key
+//     * @param type
+//     * @param key
+//     */
+//    public void delete(LibraryType type,String key){
+//        this.getRedisTemplateByType(type).delete(key);
+//    }
+//
+//    /**
+//     * 获取一个key的value
+//     * @param type
+//     * @param key
+//     * @return
+//     */
+//    public String get(LibraryType type, String key){
+//        return this.getRedisTemplateByType(type).opsForValue().get(key);
+//    }
+//
+//    /**
+//     * 根据类型获取对应的RedisTemplate
+//     * @param type
+//     * @return
+//     */
+//    public RedisTemplate<String,String> getRedisTemplateByType(LibraryType type){
+//        switch (type){
+//            case VEHICLE:{
+//                return vehicleRedisTemplate;
+//            }
+//            case COMMAND:{
+//                return commandRedisTemplate;
+//            }
+//            default:
+//                return null;
+//        }
+//    }
+//
+//}
diff --git a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/handler/TcuHandler.java b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/handler/TcuHandler.java
index 5eb84aa..2f2f9d9 100644
--- a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/handler/TcuHandler.java
+++ b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/handler/TcuHandler.java
@@ -1,17 +1,13 @@
 package com.dyy.tsp.gateway.tcu.handler;
 
-import com.alibaba.fastjson.JSONObject;
-import com.dyy.tsp.common.enumtype.LibraryType;
 import com.dyy.tsp.core.evgb.entity.DataBody;
 import com.dyy.tsp.core.evgb.entity.EvGBProtocol;
 import com.dyy.tsp.core.evgb.enumtype.CommandType;
 import com.dyy.tsp.core.evgb.enumtype.ResponseType;
-import com.dyy.tsp.gateway.tcu.config.TcuProperties;
 import com.dyy.tsp.gateway.tcu.netty.TcuChannel;
 import com.dyy.tsp.gateway.tcu.vo.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -23,14 +19,10 @@ public class TcuHandler {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(TcuHandler.class);
 
-    @Autowired
-    private RedisHandler redisHandler;
-
-    @Autowired
-    private TcuProperties tcuProperties;
+//    @Autowired
+//    private RedisHandler redisHandler;
 
     public void commandDown(CommandDownRequestVo commandDownRequestVo) {
-        redisHandler.getRedisTemplateByType(LibraryType.COMMAND).convertAndSend(tcuProperties.getCommandRequestTopic(), JSONObject.toJSONString(commandDownRequestVo));
     }
 
     public void vehicleLogin(VehicleLoginVo vehicleLoginVo) {
@@ -79,8 +71,9 @@ public class TcuHandler {
         protocol.setResponseType(ResponseType.COMMAND);
         protocol.setVin(realTimeDataVo.getVin());
         protocol.setBody(new DataBody(realTimeDataVo.encode()));
+
         TcuChannel.INSTANCE.getChannelHandlerContext().channel().writeAndFlush(protocol.encode());
-        LOGGER.debug("{} {}",realTimeDataVo.getVin(),protocol.getCommandType().getDesc());
+//        LOGGER.debug("{} {}",realTimeDataVo.getVin(),protocol.getCommandType().getDesc());
     }
 
     public void checkTime(String vin) {
@@ -92,4 +85,5 @@ public class TcuHandler {
         TcuChannel.INSTANCE.getChannelHandlerContext().channel().writeAndFlush(protocol.encode());
         LOGGER.debug("{} {}",vin,protocol.getCommandType().getDesc());
     }
+
 }
diff --git a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/netty/TcuClient.java b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/netty/TcuClient.java
index 68cbe3c..dffcbae 100644
--- a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/netty/TcuClient.java
+++ b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/netty/TcuClient.java
@@ -3,16 +3,19 @@ package com.dyy.tsp.gateway.tcu.netty;
 import com.dyy.tsp.core.base.EvGBDecode;
 import com.dyy.tsp.core.client.netty.AbstractNettyClient;
 import com.dyy.tsp.gateway.tcu.config.TcuProperties;
-import com.dyy.tsp.gateway.tcu.handler.RedisHandler;
 import io.netty.channel.ChannelInitializer;
 import io.netty.channel.ChannelPipeline;
 import io.netty.channel.socket.SocketChannel;
 import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
 import io.netty.handler.logging.LogLevel;
 import io.netty.handler.logging.LoggingHandler;
+import io.netty.handler.ssl.SslContext;
+import io.netty.handler.ssl.SslContextBuilder;
 import io.netty.handler.timeout.IdleStateHandler;
 import org.springframework.beans.factory.annotation.Autowired;
+
 import javax.annotation.PostConstruct;
+import java.io.File;
 
 /**
  * TCU模拟终端
@@ -28,9 +31,6 @@ public class TcuClient extends AbstractNettyClient {
     @Autowired
     private TcuProperties tcuProperties;
 
-    @Autowired
-    private RedisHandler redisHandler;
-
     @Autowired
     private TcuParseHandler tcuParseHandler;
 
@@ -42,12 +42,22 @@ public class TcuClient extends AbstractNettyClient {
             @Override
             protected void initChannel(SocketChannel ch) throws Exception {
                 ChannelPipeline pipeline = ch.pipeline();
+
+                if(tcuProperties.isUseSSL()){
+                    File certFile  = new File(tcuProperties.getCA_PATH());
+                    SslContext sslCtx = SslContextBuilder.forClient()
+                            .trustManager(certFile)
+                            .build();
+
+                    pipeline.addLast(sslCtx.newHandler(ch.alloc()));
+                }
+
                 pipeline.addLast(
                         new LoggingHandler(LogLevel.DEBUG),
                         new LengthFieldBasedFrameDecoder(tcuProperties.getMaxFrameLength(), tcuProperties.getLengthFieldOffset()
                                 , tcuProperties.getLengthFieldLength(), tcuProperties.getLengthAdjustment()
                                 , tcuProperties.getInitialBytesToStrip(), tcuProperties.getFailFast()),
-                        new EvGBDecode(redisHandler,tcuParseHandler,Boolean.FALSE,Boolean.TRUE),
+                        new EvGBDecode(null,tcuParseHandler,Boolean.FALSE,Boolean.TRUE),
                         new IdleStateHandler(tcuProperties.getTimeout(),tcuProperties.getTimeout(), 0),
                         tcuNettyHandler
                 );
diff --git a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/netty/TcuNettyHandler.java b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/netty/TcuNettyHandler.java
index 8aeb7b2..9df1896 100644
--- a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/netty/TcuNettyHandler.java
+++ b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/netty/TcuNettyHandler.java
@@ -2,12 +2,8 @@ package com.dyy.tsp.gateway.tcu.netty;
 
 import com.alibaba.fastjson.JSONObject;
 import com.dyy.tsp.core.evgb.entity.EvGBProtocol;
-import com.dyy.tsp.core.evgb.enumtype.CommandType;
-import com.dyy.tsp.core.evgb.enumtype.ResponseType;
 import com.dyy.tsp.core.handler.AbstractNettyHandler;
-import com.dyy.tsp.gateway.tcu.config.TcuProperties;
 import com.dyy.tsp.gateway.tcu.handler.BusinessHandler;
-import io.netty.buffer.ByteBuf;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.handler.timeout.IdleState;
@@ -27,15 +23,12 @@ public class TcuNettyHandler extends AbstractNettyHandler {
 
     private final static Logger LOGGER = LoggerFactory.getLogger(TcuNettyHandler.class);
 
-    @Autowired
-    private TcuProperties tcuProperties;
-
     @Autowired
     private BusinessHandler businessHandler;
 
     @Override
     public void doLogic(ChannelHandlerContext ctx, EvGBProtocol protocol) {
-        LOGGER.debug("parse protocol:{}", JSONObject.toJSONString(protocol));
+        LOGGER.info("parse protocol:{}", JSONObject.toJSONString(protocol));
         businessHandler.doBusiness(protocol,ctx.channel());
     }
 
@@ -44,6 +37,7 @@ public class TcuNettyHandler extends AbstractNettyHandler {
         TcuChannel.INSTANCE.setChannelHandlerContext(ctx);
         LOGGER.debug("server ip[{}] connected succeed",ctx.channel().remoteAddress().toString());
         super.channelActive(ctx);
+        businessHandler.startCarSimulator();
     }
 
     @Override
@@ -57,22 +51,11 @@ public class TcuNettyHandler extends AbstractNettyHandler {
         if(evt instanceof IdleStateEvent){
             IdleState state = ((IdleStateEvent)evt).state();
             if(state == IdleState.WRITER_IDLE){
-                ByteBuf heartBuf = this.getHeartBeat();
-                ctx.channel().writeAndFlush(heartBuf);
+//                System.out.println("now triggering userEventTriggered");
+//                ByteBuf heartBuf = this.getHeartBeat();
+//                ctx.channel().writeAndFlush(heartBuf);
             }
         }
     }
 
-    /**
-     * 获取模拟心跳包
-     * @return
-     */
-    private ByteBuf getHeartBeat() {
-        EvGBProtocol evGBProtocol = new EvGBProtocol();
-        evGBProtocol.setVin(tcuProperties.getHeartVin());
-        evGBProtocol.setCommandType(CommandType.HEARTBEAT);
-        evGBProtocol.setBody(null);
-        evGBProtocol.setResponseType(ResponseType.COMMAND);
-        return evGBProtocol.encode();
-    }
 }
diff --git a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/vin/QueryCommandHandler.java b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/vin/QueryCommandHandler.java
new file mode 100644
index 0000000..aa107b1
--- /dev/null
+++ b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/vin/QueryCommandHandler.java
@@ -0,0 +1,55 @@
+package com.dyy.tsp.gateway.tcu.vin;
+
+import com.dyy.tsp.core.base.AbstractBusinessHandler;
+import com.dyy.tsp.core.evgb.entity.DataBody;
+import com.dyy.tsp.core.evgb.entity.EvGBProtocol;
+import com.dyy.tsp.core.evgb.entity.SubsystemVoltageData;
+import com.dyy.tsp.core.evgb.enumtype.CommandType;
+import com.dyy.tsp.core.evgb.enumtype.ResponseType;
+import com.dyy.tsp.gateway.tcu.netty.TcuChannel;
+import io.netty.channel.Channel;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static com.dyy.tsp.core.evgb.enumtype.CommandType.QUERY_COMMAND;
+
+/**
+ * @Author xicai.cxc
+ * @Date 9:08 下午
+ */
+@Service
+public class QueryCommandHandler extends AbstractBusinessHandler {
+
+    @Override
+    public void doBusiness(EvGBProtocol protocol, Channel channel){
+           System.out.println("hello hit query command output!!!");
+
+        SubsystemVoltageData data = new SubsystemVoltageData();
+        data.setVoltage(3);
+        data.setCellCount(4);
+        short s1 = 1;
+        data.setNum(s1);
+        data.setVoltage(5);
+        data.setCurrent(6);
+        data.setBatteryNumber(7);
+        data.setBatteryConnt(s1);
+        List<Integer> cellVoltages = new ArrayList<>();
+        cellVoltages.add(new Integer(10));
+        data.setCellVoltages(cellVoltages);
+
+        //protocol.setCommandType(QUERY_COMMAND);
+        protocol.setResponseType(ResponseType.SUCCESS);
+        protocol.setVin(protocol.getVin());
+        protocol.setBody(new DataBody(data.encode()));
+       // protocol.setBody(null);
+
+        TcuChannel.INSTANCE.getChannelHandlerContext().channel().writeAndFlush(protocol.encode());
+
+
+        System.out.println("send 2hit query command reply!!!");
+
+    };
+
+}
diff --git a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/vin/RemoteControlCommandHandler.java b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/vin/RemoteControlCommandHandler.java
new file mode 100644
index 0000000..eeef375
--- /dev/null
+++ b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/vin/RemoteControlCommandHandler.java
@@ -0,0 +1,28 @@
+package com.dyy.tsp.gateway.tcu.vin;
+
+import com.dyy.tsp.core.base.AbstractBusinessHandler;
+import com.dyy.tsp.core.evgb.entity.DataBody;
+import com.dyy.tsp.core.evgb.entity.EvGBProtocol;
+import com.dyy.tsp.core.evgb.enumtype.ResponseType;
+import com.dyy.tsp.gateway.tcu.netty.TcuChannel;
+import io.netty.channel.Channel;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author xicai.cxc
+ * @Date 9:08 下午
+ */
+@Service
+public class RemoteControlCommandHandler extends AbstractBusinessHandler {
+
+    @Override
+    public void doBusiness(EvGBProtocol protocol, Channel channel){
+        protocol.setResponseType(ResponseType.SUCCESS);
+        protocol.setVin(protocol.getVin());
+        protocol.setBody(null);
+
+        TcuChannel.INSTANCE.getChannelHandlerContext().channel().writeAndFlush(protocol.encode());
+           System.out.println("hello hit remote control command output!!!");
+    };
+
+}
diff --git a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/vin/SetCommandHandler.java b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/vin/SetCommandHandler.java
new file mode 100644
index 0000000..4050707
--- /dev/null
+++ b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/vin/SetCommandHandler.java
@@ -0,0 +1,27 @@
+package com.dyy.tsp.gateway.tcu.vin;
+
+import com.dyy.tsp.core.base.AbstractBusinessHandler;
+import com.dyy.tsp.core.evgb.entity.EvGBProtocol;
+import com.dyy.tsp.core.evgb.enumtype.ResponseType;
+import com.dyy.tsp.gateway.tcu.netty.TcuChannel;
+import io.netty.channel.Channel;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author xicai.cxc
+ * @Date 9:08 下午
+ */
+@Service
+public class SetCommandHandler extends AbstractBusinessHandler {
+
+    @Override
+    public void doBusiness(EvGBProtocol protocol, Channel channel){
+        protocol.setResponseType(ResponseType.SUCCESS);
+        protocol.setVin(protocol.getVin());
+        protocol.setBody(null);
+
+        TcuChannel.INSTANCE.getChannelHandlerContext().channel().writeAndFlush(protocol.encode());
+           System.out.println("hello hit set command output!!!");
+    };
+
+}
diff --git a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/websocket/DebugWebSocketHandler.java b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/websocket/DebugWebSocketHandler.java
index 368b426..9c185b0 100644
--- a/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/websocket/DebugWebSocketHandler.java
+++ b/dyy-gateway-tcu/src/main/java/com/dyy/tsp/gateway/tcu/websocket/DebugWebSocketHandler.java
@@ -3,7 +3,7 @@ package com.dyy.tsp.gateway.tcu.websocket;
 import com.alibaba.fastjson.JSONObject;
 import com.dyy.tsp.common.entity.CommandDownRequest;
 import com.dyy.tsp.common.enumtype.LibraryType;
-import com.dyy.tsp.gateway.tcu.handler.RedisHandler;
+//import com.dyy.tsp.gateway.tcu.handler.RedisHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,8 +33,6 @@ public class DebugWebSocketHandler implements WebSocketHandler {
 
     private static final String SRM_COMMAND_REQUEST = "dyy_command_request_data";
 
-    private static RedisHandler redisHandler;
-
     @Override
     public void afterConnectionEstablished(WebSocketSession session) throws Exception {
         String vin = session.getUri().toString().split("vin=")[1];
@@ -43,7 +41,7 @@ public class DebugWebSocketHandler implements WebSocketHandler {
             LOGGER.info("{} webSocket console open",vin);
             //通知网关开始监控
             CommandDownRequest request = new CommandDownRequest(vin, OPEN_DEBUG);
-            redisHandler.getRedisTemplateByType(LibraryType.COMMAND).convertAndSend(SRM_COMMAND_REQUEST, JSONObject.toJSONString(request));
+//            redisHandler.getRedisTemplateByType(LibraryType.COMMAND).convertAndSend(SRM_COMMAND_REQUEST, JSONObject.toJSONString(request));
             LOGGER.info("{} send gateway open debug",vin);
         }
     }
@@ -70,7 +68,7 @@ public class DebugWebSocketHandler implements WebSocketHandler {
         LOGGER.info("{} webSocket console close",vin);
         //通知网关停止监控
         CommandDownRequest request = new CommandDownRequest(vin, CLOSE_DEBUG);
-        redisHandler.getRedisTemplateByType(LibraryType.COMMAND).convertAndSend(SRM_COMMAND_REQUEST, JSONObject.toJSONString(request));
+//        redisHandler.getRedisTemplateByType(LibraryType.COMMAND).convertAndSend(SRM_COMMAND_REQUEST, JSONObject.toJSONString(request));
         LOGGER.info("{} send gateway close debug",vin);
     }
 
@@ -134,13 +132,4 @@ public class DebugWebSocketHandler implements WebSocketHandler {
         return devices;
     }
 
-    public RedisHandler getRedisHandler() {
-        return redisHandler;
-    }
-
-    @Autowired
-    public void setRedisHandler(RedisHandler redisHandler) {
-        this.redisHandler = redisHandler;
-    }
-
 }
diff --git a/dyy-gateway-tcu/src/main/resources/logback.xml b/dyy-gateway-tcu/src/main/resources/logback.xml
index aadacb8..f52a5b3 100644
--- a/dyy-gateway-tcu/src/main/resources/logback.xml
+++ b/dyy-gateway-tcu/src/main/resources/logback.xml
@@ -7,7 +7,7 @@
         </encoder>
     </appender>
     <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>/logs/tcu.log</file>
+        <file>client.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
             <fileNamePattern>/logs/tcu.%i.log.zip</fileNamePattern>
             <minIndex>1</minIndex>
@@ -22,7 +22,7 @@
     </appender>
 
     <!-- root级别 项目日志级别在配置文件中设置-->
-    <root level="INFO">
+    <root level="DEBUG">
         <!-- 控制台输出 -->
         <appender-ref ref="STDOUT"/>
         <!-- 文件输出 -->
diff --git a/dyy-gateway-tcu/src/main/resources/root-ca.crt b/dyy-gateway-tcu/src/main/resources/root-ca.crt
new file mode 100644
index 0000000..b0a457f
--- /dev/null
+++ b/dyy-gateway-tcu/src/main/resources/root-ca.crt
@@ -0,0 +1,3 @@
+-----BEGIN CERTIFICATE-----
+{TODO: replace with Your root-ca.crt file}
+-----END CERTIFICATE-----
