| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description: 雷达接口 |
| | |
| | | byte[] payloadCrc32 = ByteUtils.parseCrc32(payload);//负载头+负载的crc32校验 |
| | | byte[] footer = {0x01, 0x02, 0x00};//包尾 |
| | | byte[] data = ByteUtils.appendArrays(header, payload, payloadCrc32, footer); |
| | | System.out.println(ByteUtils.printHexBinary(data)); |
| | | |
| | | ByteBuf message = channel.alloc().buffer(); |
| | | message.writeBytes(data); |
| | | channel.writeAndFlush(message); |
| | | return AjaxResult.success(); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("distance",distance); |
| | | map.put("p",p); |
| | | map.put("t",t); |
| | | return AjaxResult.success(map); |
| | | } |
| | | } |