Package jmri.jmrix.ieee802154.xbee
Class XBeeNode
java.lang.Object
jmri.jmrix.AbstractNode
jmri.jmrix.ieee802154.IEEE802154Node
jmri.jmrix.ieee802154.xbee.XBeeNode
Implementation of a Node for XBee networks.
Integrated with XBeeTrafficController.
Each node has 3 addresses associated with it:
- A 16 bit PAN (Personal Area Network) ID assigned by the user
- A 16 bit User Assigned Address
- A 64 bit Globally Unique ID assigned by the manufacturer
All nodes in a given network must have the same PAN ID
-
Field Summary
Fields inherited from class jmri.jmrix.ieee802154.IEEE802154Node
globaladdress, panaddress, useraddressFields inherited from class jmri.jmrix.AbstractNode
nodeAddress -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidConnect and configure a StreamConnectionConfig object to the XBeeIOStream associated with this node.voidConnect and configure a StreamPortController object to the XBeeIOStream associated with this node.Create the needed Initialization packet (AbstractMRMessage) for this node.Create an Transmit packet (AbstractMRMessage) to send current state.Get the StreamConnectionConfig ojbect associated with the XBeeIOStream associated with this node.Get the stream object associated with this node.booleangetPinAssigned(int pin) Ask if a specified pin is assigned to a bean.getPinBean(int pin) Get the bean associated with the specified pin.booleangetPoll()Get the isPolled attribute.Get the StreamPortController ojbect associated with the XBeeIOStream associated with this node.Get the prefered name for this XBee Node.Get the prefered transmit address for this XBee Node.(package private) Sensor.PullResistancegetPRValueForPin(int pin) Package protected method to check to see if the PR parameter indicates the specified pin has the pull-up resistor enabled.booleanAre sensors present, and hence will this node need to be polled?com.digi.xbee.api.RemoteXBeeDevicegetXBee()com.digi.xbee.api.models.XBee16BitAddressConvert the 16 bit user address to an XBee16BitAddress object.com.digi.xbee.api.models.XBee64BitAddressConvert the 64 bit address to an XBee64BitAddress object.booleanDeal with a timeout in the transmission controller.booleanremovePinBean(int pin, NamedBean bean) Remove the bean associated with the specified pin.voidA reply was received, so there was not timeout; do any needed processing.voidsetIdentifier(String id) XBee Nodes store an identifier. we want to be able to store and retrieve this information.booleansetPinBean(int pin, NamedBean bean) Set the bean associated with the specified pin.voidsetPoll(boolean poll) Set the isPolled attribute.voidConnect a StreamConnectionConfig object to the XBeeIOStream associated with this node.voidConnect a StreamPortController object to the XBeeIOStream associated with this node.(package private) voidsetPRParameter(int pin, Sensor.PullResistance pr) Package protected method to set the PR (Pull Resistance) parameter of the node.voidsetTrafficController(XBeeTrafficController controller) Set the Traffic Controller associated with this node.voidsetXBee(com.digi.xbee.api.RemoteXBeeDevice rxd) Set the RemoteXBeeDevice associated with this node and configure address information.toString()Provide a string representation of this XBee Node.Methods inherited from class jmri.jmrix.ieee802154.IEEE802154Node
checkNodeAddress, getGlobalAddress, getPANAddress, getUserAddress, mustSend, resetMustSend, setGlobalAddress, setMustSend, setNodeAddress, setPANAddress, setUserAddressMethods inherited from class jmri.jmrix.AbstractNode
getNodeAddress
-
Constructor Details
-
Method Details
-
setTrafficController
Set the Traffic Controller associated with this node.- Parameters:
controller- system connection traffic controller.
-
createInitPacket
Create the needed Initialization packet (AbstractMRMessage) for this node.- Specified by:
createInitPacketin classIEEE802154Node- Returns:
- null because not needed for XBeeNode
-
createOutPacket
Create an Transmit packet (AbstractMRMessage) to send current state.- Specified by:
createOutPacketin classIEEE802154Node- Returns:
- packet to send current node state.
-
getSensorsActive
Are sensors present, and hence will this node need to be polled?- Specified by:
getSensorsActivein classIEEE802154Node- Returns:
- 'true' if at least one sensor is active for this node
-
setPoll
Set the isPolled attribute.- Parameters:
poll- true to set flag polled, else false.
-
getPoll
Get the isPolled attribute.- Returns:
- true if isPolled flag set, else false.
-
handleTimeout
Deal with a timeout in the transmission controller.- Specified by:
handleTimeoutin classIEEE802154Node- Parameters:
m- message that didn't receive a replyl- listener that sent the message- Returns:
- true if initialization required
-
resetTimeout
A reply was received, so there was not timeout; do any needed processing. Implementation does nothing.- Specified by:
resetTimeoutin classIEEE802154Node- Parameters:
m- message to process.
-
getXBeeAddress16
Convert the 16 bit user address to an XBee16BitAddress object.- Returns:
- converted address object.
-
getXBeeAddress64
Convert the 64 bit address to an XBee64BitAddress object.- Returns:
- converted address object.
-
setIdentifier
XBee Nodes store an identifier. we want to be able to store and retrieve this information.- Parameters:
id- text id for node
-
getIdentifier
-
setPinBean
Set the bean associated with the specified pin.- Parameters:
pin- is the XBee pin assigned.bean- is the bean we are attempting to add.- Returns:
- true if bean added, false if previous assignment exists.
-
removePinBean
Remove the bean associated with the specified pin.- Parameters:
pin- is the XBee pin assigned.bean- is the bean we are attempting to remove.- Returns:
- true if bean removed, false if specified bean was not assigned to the pin.
-
getPinBean
Get the bean associated with the specified pin.- Parameters:
pin- is the XBee pin assigned.- Returns:
- the bean assigned to the pin, or null if no bean is assigned.
-
getPinAssigned
Ask if a specified pin is assigned to a bean.- Parameters:
pin- is the XBee pin assigned.- Returns:
- true if the pin has a bean assigned to it, false otherwise.
-
getPreferedName
Get the prefered name for this XBee Node.- Returns:
- the identifier string if it is not blank then a string representation of the bytes of the 16 bit address if it is not a broadcast address. Otherwise return the 64 bit GUID.
-
getPreferedTransmitAddress
Get the prefered transmit address for this XBee Node.- Returns:
- the 16 bit address if it is not a broadcast address. Otherwise return the 64 bit GUID.
-
getXBee
- Returns:
- RemoteXBeeDevice associated with this node
-
setXBee
Set the RemoteXBeeDevice associated with this node and configure address information.- Parameters:
rxd- the RemoteXBeeDevice associated with this node.
-
getIOStream
Get the stream object associated with this node.- Returns:
- stream object, created if does not exist.
-
connectPortController
Connect and configure a StreamPortController object to the XBeeIOStream associated with this node.- Parameters:
cont- AbstractSTreamPortController object to connect
-
setPortController
Connect a StreamPortController object to the XBeeIOStream associated with this node.- Parameters:
cont- AbstractSTreamPortController object to connect
-
getPortController
Get the StreamPortController ojbect associated with the XBeeIOStream associated with this node.- Returns:
- connected
AbstractStreamPortController
-
connectPortController
Connect and configure a StreamConnectionConfig object to the XBeeIOStream associated with this node.- Parameters:
cfg- AbstractStreamConnectionConfig object to connect
-
setPortController
Connect a StreamConnectionConfig object to the XBeeIOStream associated with this node.- Parameters:
cfg- AbstractStreamConnectionConfig object to connect
-
getConnectionConfig
Get the StreamConnectionConfig ojbect associated with the XBeeIOStream associated with this node.- Returns:
- connected
AbstractStreamConnectionConfig
-
toString
Provide a string representation of this XBee Node. -
setPRParameter
void setPRParameter(int pin, Sensor.PullResistance pr) throws com.digi.xbee.api.exceptions.TimeoutException, com.digi.xbee.api.exceptions.XBeeException Package protected method to set the PR (Pull Resistance) parameter of the node.- Parameters:
pin- the pin number to change.pr- a jmri.Sensor.PullResistance value used to configure the pin.- Throws:
com.digi.xbee.api.exceptions.TimeoutException- lock timed outcom.digi.xbee.api.exceptions.XBeeException- invalid Xbee values, pins
-
getPRValueForPin
Sensor.PullResistance getPRValueForPin(int pin) throws com.digi.xbee.api.exceptions.TimeoutException, com.digi.xbee.api.exceptions.XBeeException Package protected method to check to see if the PR parameter indicates the specified pin has the pull-up resistor enabled.- Parameters:
pin- the pin number- Returns:
- a jmri.Sensor.PullResistance value indicating the current state of the pullup resistor.
- Throws:
com.digi.xbee.api.exceptions.TimeoutException- lock timeoutcom.digi.xbee.api.exceptions.XBeeException- invalid pins or values
-