| | |
| | | package com.zy.core.netty.handle; |
| | | |
| | | import com.zy.asrs.service.impl.MainServiceImpl; |
| | | import com.zy.core.netty.AbstractInboundHandler; |
| | | import com.zy.core.netty.cache.ChannelCache; |
| | | import com.zy.core.netty.constant.Constant; |
| | | import com.zy.core.netty.constant.FireDataType; |
| | | import com.zy.core.netty.domain.ChPackage; |
| | | import com.zy.core.netty.domain.fire.Fire_3030; |
| | |
| | | import io.netty.channel.ChannelHandler; |
| | | import io.netty.channel.ChannelHandlerContext; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | |
| | | @ChannelHandler.Sharable |
| | | public class PackageServerHandler extends AbstractInboundHandler<ChPackage> { |
| | | |
| | | @Autowired |
| | | private MainServiceImpl mainService; |
| | | |
| | | @Override |
| | | protected boolean channelRead0(ChannelHandlerContext ctx, ChPackage pac) { |
| | |
| | | switch (dataType) { |
| | | case HEARTBEAT: |
| | | Fire_3030 fire3030 = new Fire_3030().readFromBytes(pac.getBytes()); |
| | | String now = "20" + fire3030.getYear() + "-" + fire3030.getMonth() + "-" + fire3030.getDay() |
| | | + " " + fire3030.getHour() + ":" + fire3030.getMinute() + ":" + fire3030.getSeconds(); |
| | | |
| | | ChannelCache.setChannel(String.valueOf(fire3030.getNo()), ctx.channel()); |
| | | Constant.errorMap.remove(fire3030.getNo()); |
| | | break; |
| | | case FIRE_ALARM: |
| | | |
| | | break; |
| | | default: |
| | | break; |