| | |
| | | package com.ard.utils.udp; |
| | | |
| | | import com.ard.alarm.tube.service.TubeAlarmService; |
| | | import com.ard.utils.SpringTool; |
| | | import com.ard.utils.spring.SpringUtils; |
| | | import io.netty.buffer.ByteBuf; |
| | | import io.netty.buffer.Unpooled; |
| | | import io.netty.channel.ChannelHandlerContext; |
| | |
| | | ByteBuf byteBuf = packet.content(); |
| | | String str = byteBuf.toString(Charset.forName("GBK")); |
| | | log.info("udp收到数据: " + str); |
| | | TubeAlarmService tubeAlarmService = (TubeAlarmService) SpringTool.getApplicationContext().getBean("tubeAlarmService"); |
| | | TubeAlarmService tubeAlarmService = SpringUtils.getBean(TubeAlarmService.class); |
| | | tubeAlarmService.alarmHandler(str); |
| | | String resStr = "ok"; |
| | | byte[] resBytes = resStr.getBytes(Charset.forName("GBK")); |