// // Reading and writing // public Time(ByteQueue queue) { readTag(queue); hour = queue.popU1B(); minute = queue.popU1B(); second = queue.popU1B(); hundredth = queue.popU1B(); }
@Override public void writeImpl(ByteQueue queue) { queue.push((byte) hour); queue.push((byte) minute); queue.push((byte) second); queue.push((byte) hundredth); }
@Override protected void readRequest(ByteQueue queue) { startOffset = ModbusUtils.popUnsignedShort(queue); numberOfBits = ModbusUtils.popUnsignedShort(queue); data = new byte[ModbusUtils.popUnsignedByte(queue)]; queue.pop(data); }
@Override protected void writeRequest(ByteQueue queue) { ModbusUtils.pushShort(queue, startOffset); ModbusUtils.pushShort(queue, numberOfBits); ModbusUtils.pushByte(queue, data.length); queue.push(data); }
static void parseData(ByteQueue queue, BaseMessageParser parser) throws Exception { IncomingMessage m; while (true) { queue.mark(); try { m = parser.parseMessage(queue); } catch (Exception e) { System.err.println(e.getMessage()); continue; } if (m == null) { queue.reset(); return; } System.out.println(" " + m); } }
public static BaseError createBaseError(ByteQueue queue) throws BACnetException { byte choice = queue.pop(); switch (choice) { case 8: case 9: return new ChangeListError(choice, queue); case 10: return new CreateObjectError(choice, queue); case 16: return new WritePropertyMultipleError(choice, queue); case 18: return new ConfirmedPrivateTransferError(choice, queue); case 22: return new VTCloseError(choice, queue); } return new BaseError(choice, queue); }
@Override public void write(ByteQueue queue) { queue.push(choice); write(queue, error, 0); writeOptional(queue, listOfVTSessionIdentifiers, 1); }
@Override public void write(ByteQueue queue) { queue.push(choice); write(queue, error); }
public NPCI(ByteQueue queue) { version = queue.popU1B(); control = BigInteger.valueOf(queue.popU1B()); if (control.testBit(5)) { destinationNetwork = queue.popU2B(); destinationLength = queue.popU1B(); if (destinationLength > 0) { destinationAddress = new byte[destinationLength]; queue.pop(destinationAddress); } } if (control.testBit(3)) { sourceNetwork = queue.popU2B(); sourceLength = queue.popU1B(); sourceAddress = new byte[sourceLength]; queue.pop(sourceAddress); } if (control.testBit(5)) hopCount = queue.popU1B(); if (control.testBit(7)) { messageType = queue.popU1B(); if (messageType >= 80) vendorId = queue.popU2B(); } }