001package jmri.jmrix.ieee802154.xbee;
002
003import com.digi.xbee.api.models.XBee16BitAddress;
004import com.digi.xbee.api.models.XBeeTransmitOptions;
005import com.digi.xbee.api.packet.XBeeAPIPacket;
006import com.digi.xbee.api.packet.raw.TX16Packet;
007import jmri.jmrix.BroadcastMessage;
008
009/**
010 * This is an extension of the XBeeMessage class for messages
011 * that are to be sent as broadcast messages.
012 *
013 * @author Paul Bender Copyright (C) 2023
014 */
015public class XBeeBroadcastMessage extends XBeeMessage implements BroadcastMessage {
016
017
018    private XBeeBroadcastMessage(){}
019
020    private XBeeBroadcastMessage(XBeeAPIPacket xbp){
021        super(xbp);
022    }
023
024    /**
025     * Get an XBee Message for broadcasting a payload to the network.
026     *
027     * @param payload A byte array containing the bytes to be broadcast as the low order word of the integer.
028     * @return XBeeMessage with remote transmission request for the provided address containing the provided payload.
029     */
030    public static XBeeBroadcastMessage getTX16BroadcastMessage(byte[] payload) {
031        return new XBeeBroadcastMessage(
032                new TX16Packet(0x00,XBee16BitAddress.BROADCAST_ADDRESS,XBeeTransmitOptions.NONE, payload));
033
034    }
035}