use of sugar.free.sightparser.pipeline.ByteBuf in project SightRemote by TebbeUbben.
the class ServiceChallengeMessage method getData.
@Override
protected byte[] getData() throws Exception {
ByteBuf byteBuf = new ByteBuf(3);
byteBuf.putByte(serviceID);
byteBuf.putShort(version);
return byteBuf.getBytes();
}
use of sugar.free.sightparser.pipeline.ByteBuf in project SightRemote by TebbeUbben.
the class OpenHistoryReadingSessionMessage method getData.
@Override
protected byte[] getData() throws Exception {
ByteBuf byteBuf = new ByteBuf(8);
byteBuf.putShort(historyType.getValue());
byteBuf.putShort(readingDirection.getValue());
byteBuf.putUInt32LE(offset);
return byteBuf.getBytes();
}
use of sugar.free.sightparser.pipeline.ByteBuf in project SightRemote by TebbeUbben.
the class DismissAlertMessage method getData.
@Override
protected byte[] getData() throws Exception {
ByteBuf byteBuf = new ByteBuf(2);
byteBuf.putUInt16LE(alertID);
return byteBuf.getBytes();
}
use of sugar.free.sightparser.pipeline.ByteBuf in project SightRemote by TebbeUbben.
the class StandardBolusMessage method getData.
@Override
protected byte[] getData() throws Exception {
ByteBuf data = new ByteBuf(22);
data.putShort((short) 0x2503);
data.putShort((short) 0x1F00);
data.putShort((short) 0x1F00);
data.putShort((short) 0x0000);
data.putUInt16LE(Helpers.roundDoubleToInt(amount * 100D));
data.putShort((short) 0x0000);
data.putShort((short) 0x0000);
data.putShort((short) 0x0000);
data.putUInt16LE(Helpers.roundDoubleToInt(amount * 100D));
data.putShort((short) 0x0000);
data.putShort((short) 0x0000);
return data.getBytes();
}
use of sugar.free.sightparser.pipeline.ByteBuf in project SightRemote by TebbeUbben.
the class AppLayerMessage method serialize.
public byte[] serialize() throws Exception {
byte[] data = getData();
ByteBuf byteBuf = new ByteBuf(4 + data.length + (outCRC() ? 2 : 0));
byteBuf.putByte(VERSION);
byteBuf.putByte(getService().getServiceID());
byteBuf.putShort(getCommand());
byteBuf.putBytes(data);
if (outCRC())
byteBuf.putUInt16LE(Cryptograph.calculateCRC(data));
return byteBuf.getBytes();
}
Aggregations