All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.yamcs.tctm.UdpTcTmDataLinkHandler Maven / Gradle / Ivy

There is a newer version: 5.10.9
Show newest version
package org.yamcs.tctm;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.socket.DatagramPacket;

public class UdpTcTmDataLinkHandler extends SimpleChannelInboundHandler {

    private UdpTcTmDataLink link;

    public UdpTcTmDataLinkHandler(UdpTcTmDataLink link) {
        this.link = link;
    }

    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        super.channelActive(ctx);
    }

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
        var buf = msg.content();
        var packet = new byte[buf.readableBytes()];
        buf.readBytes(packet);
        link.handleIncomingPacket(packet);
    }

    @Override
    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
        super.channelInactive(ctx);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy