Search in sources :

Example 1 with Algorithm

use of org.traccar.helper.Checksum.Algorithm in project traccar by tananaev.

the class NavisProtocolDecoder method sendFlexReply.

private void sendFlexReply(Channel channel, ByteBuf data) {
    if (channel != null) {
        ByteBuf cs = Unpooled.buffer(1);
        cs.writeByte(Checksum.crc8(new Algorithm(8, 0x31, 0xFF, false, false, 0x00), data.nioBuffer()));
        channel.writeAndFlush(new NetworkMessage(Unpooled.wrappedBuffer(data, cs), channel.remoteAddress()));
    }
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) NetworkMessage(org.traccar.NetworkMessage) Algorithm(org.traccar.helper.Checksum.Algorithm)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 NetworkMessage (org.traccar.NetworkMessage)1 Algorithm (org.traccar.helper.Checksum.Algorithm)1