Example usage for io.netty.buffer ByteBuf readUnsignedShort

List of usage examples for io.netty.buffer ByteBuf readUnsignedShort

Introduction

In this page you can find the example usage for io.netty.buffer ByteBuf readUnsignedShort.

Prototype

public abstract int readUnsignedShort();

Source Link

Document

Gets an unsigned 16-bit short integer at the current readerIndex and increases the readerIndex by 2 in this buffer.

Usage

From source file:com.digitalpetri.modbus.codec.ModbusRequestDecoder.java

License:Apache License

private ReadHoldingRegistersRequest decodeReadHoldingRegisters(ByteBuf buffer) {
    int address = buffer.readUnsignedShort();
    int quantity = buffer.readUnsignedShort();

    return new ReadHoldingRegistersRequest(address, quantity);
}

From source file:com.digitalpetri.modbus.codec.ModbusRequestDecoder.java

License:Apache License

private ReadInputRegistersRequest decodeReadInputRegisters(ByteBuf buffer) {
    int address = buffer.readUnsignedShort();
    int quantity = buffer.readUnsignedShort();

    return new ReadInputRegistersRequest(address, quantity);
}

From source file:com.digitalpetri.modbus.codec.ModbusRequestDecoder.java

License:Apache License

private WriteSingleCoilRequest decodeWriteSingleCoil(ByteBuf buffer) {
    int address = buffer.readUnsignedShort();
    boolean value = buffer.readUnsignedShort() == 0xFF00;

    return new WriteSingleCoilRequest(address, value);
}

From source file:com.digitalpetri.modbus.codec.ModbusRequestDecoder.java

License:Apache License

private WriteSingleRegisterRequest decodeWriteSingleRegister(ByteBuf buffer) {
    int address = buffer.readUnsignedShort();
    int value = buffer.readUnsignedShort();

    return new WriteSingleRegisterRequest(address, value);
}

From source file:com.digitalpetri.modbus.codec.ModbusRequestDecoder.java

License:Apache License

private WriteMultipleCoilsRequest decodeWriteMultipleCoils(ByteBuf buffer) {
    int address = buffer.readUnsignedShort();
    int quantity = buffer.readUnsignedShort();
    int byteCount = buffer.readUnsignedByte();
    ByteBuf values = buffer.readSlice(byteCount).retain();

    return new WriteMultipleCoilsRequest(address, quantity, values);
}

From source file:com.digitalpetri.modbus.codec.ModbusRequestDecoder.java

License:Apache License

private WriteMultipleRegistersRequest decodeWriteMultipleRegisters(ByteBuf buffer) {
    int address = buffer.readUnsignedShort();
    int quantity = buffer.readUnsignedShort();
    int byteCount = buffer.readByte();
    ByteBuf values = buffer.readSlice(byteCount).retain();

    return new WriteMultipleRegistersRequest(address, quantity, values);
}

From source file:com.digitalpetri.modbus.codec.ModbusRequestDecoder.java

License:Apache License

private MaskWriteRegisterRequest decodeMaskWriteRegister(ByteBuf buffer) {
    int address = buffer.readUnsignedShort();
    int andMask = buffer.readUnsignedShort();
    int orMask = buffer.readUnsignedShort();

    return new MaskWriteRegisterRequest(address, andMask, orMask);
}

From source file:com.digitalpetri.modbus.codec.ModbusResponseDecoder.java

License:Apache License

public WriteSingleCoilResponse decodeWriteSingleCoil(ByteBuf buffer) {
    int address = buffer.readUnsignedShort();
    int value = buffer.readUnsignedShort();

    return new WriteSingleCoilResponse(address, value);
}

From source file:com.digitalpetri.modbus.codec.ModbusResponseDecoder.java

License:Apache License

public WriteSingleRegisterResponse decodeWriteSingleRegister(ByteBuf buffer) {
    int address = buffer.readUnsignedShort();
    int value = buffer.readUnsignedShort();

    return new WriteSingleRegisterResponse(address, value);
}

From source file:com.digitalpetri.modbus.codec.ModbusResponseDecoder.java

License:Apache License

public WriteMultipleCoilsResponse decodeWriteMultipleCoils(ByteBuf buffer) {
    int address = buffer.readUnsignedShort();
    int quantity = buffer.readUnsignedShort();

    return new WriteMultipleCoilsResponse(address, quantity);
}