Package jmri.jmrix.ieee802154.xbee
Class XBeeMessage
java.lang.Object
jmri.jmrix.AbstractMessage
jmri.jmrix.AbstractMRMessage
jmri.jmrix.ieee802154.IEEE802154Message
jmri.jmrix.ieee802154.xbee.XBeeMessage
- All Implemented Interfaces:
Message
- Direct Known Subclasses:
XBeeBroadcastMessage
This is a wrapper class for a Digi XBeeAPIPacket.
-
Field Summary
Fields inherited from class jmri.jmrix.AbstractMRMessage
LONG_TIMEOUT, SHORT_TIMEOUTFields inherited from class jmri.jmrix.AbstractMessage
_dataChars, _nDataChars -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSuppress the default ctor, as the length must always be specifiedXBeeMessage(byte[] a, int l) This ctor interprets the byte array as a sequence of characters to send.XBeeMessage(int l) XBeeMessage(com.digi.xbee.api.packet.XBeeAPIPacket request) This ctor interprets the parameter as an XBeeAPIPacket message.XBeeMessage(String m, int l) This ctor interprets the String as the exact sequence to send, byte-for-byte. -
Method Summary
Modifier and TypeMethodDescriptionbooleancheck whether the message has a valid paritystatic XBeeMessagestatic XBeeMessagegetForceSampleMessage(Object address) Get an XBee Message requesting an IO sample from the node.static XBeeMessagestatic XBeeMessagegetRemoteDoutMessage(Object address, int pin) Get an XBee Message requesting the status of a digital IO pin.static XBeeMessagegetRemoteDoutMessage(Object address, int pin, boolean on) Get an XBee Message requesting a digital output pin be turned on or off.static XBeeMessagegetRemoteTransmissionRequest(com.digi.xbee.api.models.XBee16BitAddress address, byte[] payload) Get an XBee Message requesting data be sent to the serial port on a remote node.static XBeeMessagegetRemoteTransmissionRequest(com.digi.xbee.api.models.XBee64BitAddress address, byte[] payload) Get an XBee Message requesting data be sent to the serial port on a remote node.static XBeeMessagegetRemoteTransmissionRequest(Object address, byte[] payload) Get an XBee Message requesting data be sent to the serial port on a remote node.com.digi.xbee.api.packet.XBeeAPIPacketbooleanIs a reply expected to this message?voidvoidsetXBeeRequest(com.digi.xbee.api.packet.XBeeAPIPacket request) toString()Methods inherited from class jmri.jmrix.ieee802154.IEEE802154Message
getResponseLength, setResponseLengthMethods inherited from class jmri.jmrix.AbstractMRMessage
addIntAsFourHex, addIntAsThree, addIntAsThreeHex, addIntAsTwoHex, getNeededMode, getOpCode, getOpCodeHex, getRetries, getTimeout, isBinary, setBinary, setNeededMode, setOpCode, setRetries, setTimeoutMethods inherited from class jmri.jmrix.AbstractMessage
equals, getElement, getNumDataElements, hashCode, setElement
-
Constructor Details
-
XBeeMessage
protected XBeeMessage()Suppress the default ctor, as the length must always be specified -
XBeeMessage
-
XBeeMessage
This ctor interprets the String as the exact sequence to send, byte-for-byte.- Parameters:
m- messagel- length
-
XBeeMessage
This ctor interprets the byte array as a sequence of characters to send.- Parameters:
a- Array of bytes to sendl- length
-
XBeeMessage
This ctor interprets the parameter as an XBeeAPIPacket message. This is the message form that will generally be used by the implementation.- Parameters:
request- an XBeeAPIPacket of bytes to send
-
-
Method Details
-
replyExpected
Description copied from class:AbstractMRMessageIs a reply expected to this message?By default, a reply is expected to every message; either a reply or a timeout is needed before the next message can be sent.
If this returns false, the transmit queue will immediately go on to transmit the next message (if any).
- Overrides:
replyExpectedin classAbstractMRMessage- Returns:
- true by default in Abstract MR message.
-
getXBeeRequest
-
setXBeeRequest
-
toMonitorString
- Returns:
- a human-readable representation of the message.
-
toString
Description copied from interface:Message- Specified by:
toStringin interfaceMessage- Overrides:
toStringin classAbstractMRMessage
-
checkParity
check whether the message has a valid parity- Overrides:
checkParityin classIEEE802154Message- Returns:
- true if parity is valid
-
setParity
- Overrides:
setParityin classIEEE802154Message
-
getHardwareVersionRequest
-
getFirmwareVersionRequest
-
getRemoteDoutMessage
Get an XBee Message requesting a digital output pin be turned on or off.- Parameters:
address- XBee Address of the node. This can be either 16 bit or 64 bit.pin- the DIO Pin on the XBee to use.on- boolean value stating whether the pin should be turned on (true) or off (false)- Returns:
- XBeeMessage with a message requesting a digital IO pin be turned on or off.
-
getRemoteDoutMessage
Get an XBee Message requesting the status of a digital IO pin.- Parameters:
address- XBee Address of the node. This can be either 16 bit or 64 bit.pin- the DIO Pin on the XBee to use.- Returns:
- XBeeMessage with a digital IO pin status request.
-
getForceSampleMessage
Get an XBee Message requesting an IO sample from the node.- Parameters:
address- XBee Address of the node. This can be either- Returns:
- XBeeMessage with a force IO sample request. 16 bit or 64 bit.
-
getRemoteTransmissionRequest
Get an XBee Message requesting data be sent to the serial port on a remote node.- Parameters:
address- XBee Address of the node. This can be either 16 bit or 64 bit.payload- An byte array containing the bytes to be transfered, as the low order word of the integer.- Returns:
- XBeeMessage with remote transmission request for the provided address containing the provided payload.
-
getRemoteTransmissionRequest
public static XBeeMessage getRemoteTransmissionRequest(com.digi.xbee.api.models.XBee16BitAddress address, byte[] payload) Get an XBee Message requesting data be sent to the serial port on a remote node.- Parameters:
address- XBee16BitAddress of the node.payload- A byte array containing the bytes to be transfered, as the low order word of the integer.- Returns:
- XBeeMessage with remote transmission request for the provided address containing the provided payload.
-
getRemoteTransmissionRequest
public static XBeeMessage getRemoteTransmissionRequest(com.digi.xbee.api.models.XBee64BitAddress address, byte[] payload) Get an XBee Message requesting data be sent to the serial port on a remote node.- Parameters:
address- XBee64BitAddress of the node.payload- A byte array containing the bytes to be transfered, as the low order word of the integer.- Returns:
- XBeeMessage with remote transmission request for the provided address containing the provided payload.
-