001package jmri.jmrix.ipocs.protocol.packets; 002 003import java.nio.ByteBuffer; 004 005/** 006 * Request IPOCS unit to periodically send sign of life notifications. 007 * 008 * @author Fredrik Elestedt Copyright (C) 2020 009 * @since 4.21.2 010 */ 011@org.openide.util.lookup.ServiceProvider(service = Packet.class) 012public class SignOfLifeTimerPacket extends Packet { 013 public final static byte IDENT = 8; 014 private short interval; 015 016 @Override 017 public byte getId() { 018 return IDENT; 019 } 020 021 @Override 022 protected void parseSpecific(ByteBuffer buffer) { 023 interval = buffer.getShort(); 024 } 025 026 @Override 027 protected byte[] serializeSpecific() { 028 ByteBuffer buffer = ByteBuffer.allocate(2); 029 buffer.putShort(interval); 030 buffer.rewind(); 031 return buffer.array(); 032 } 033 034 public short getInterval() { 035 return interval; 036 } 037 038 public void setInterval(short interval) { 039 this.interval = interval; 040 } 041}