Package jmri.jmrix.ieee802154
Class IEEE802154Node
java.lang.Object
jmri.jmrix.AbstractNode
jmri.jmrix.ieee802154.IEEE802154Node
- Direct Known Subclasses:
SerialNode,XBeeNode
Basic implementation of a node for IEEE 802.15.4 networks.
Integrated with IEEE802154TrafficController.
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
FieldsModifier and TypeFieldDescriptionprotected byte[](package private) booleanprotected byte[]protected byte[]Fields inherited from class jmri.jmrix.AbstractNode
nodeAddress -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of AbstractNodeIEEE802154Node(byte[] pan, byte[] user, byte[] global) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckNodeAddress(int address) Check for valid address with respect to range, etc.abstract AbstractMRMessageCreate the needed Initialization packet (AbstractMRMessage) for this node.abstract AbstractMRMessageCreate an Transmit packet (AbstractMRMessage) to send current statebyte[]Get the Global addressbyte[]Get the PAN addressabstract booleanAre there sensors present, and hence this node will need to be polled?byte[]Get the User addressabstract booleanDeal with a timeout in the transmission controller.booleanmustSend()Return state of needSend flag.voidPublic to reset state of needSend flag.abstract voidA reply was received, so there was not timeout, do any needed processing.voidsetGlobalAddress(byte[] addr) Set global address.voidPublic to set state of needSend flag.voidsetNodeAddress(int address) Public method to set the node address.voidsetPANAddress(byte[] addr) Set PAN address.voidsetUserAddress(byte[] addr) Set User address.Methods inherited from class jmri.jmrix.AbstractNode
getNodeAddress
-
Field Details
-
panaddress
-
useraddress
-
globaladdress
-
needSend
boolean needSend
-
-
Constructor Details
-
IEEE802154Node
public IEEE802154Node()Creates a new instance of AbstractNode -
IEEE802154Node
-
-
Method Details
-
setNodeAddress
Public method to set the node address. Address range is checked in subclasses.- Overrides:
setNodeAddressin classAbstractNode- Parameters:
address- address index to set in node- Throws:
IllegalArgumentException- if out of range
-
checkNodeAddress
Check for valid address with respect to range, etc.- Specified by:
checkNodeAddressin classAbstractNode- Parameters:
address- node number to check.- Returns:
- true if valid
-
setPANAddress
Set PAN address.- Parameters:
addr- byte array containing upper and lower bytes of the 16 bit PAN address.
-
getPANAddress
Get the PAN address- Returns:
- byte array containing the upper and lower bytes of the PAN address
-
setUserAddress
Set User address.- Parameters:
addr- byte array containing upper and lower bytes of the 16 bit user assigned address.
-
getUserAddress
Get the User address- Returns:
- byte array containing the upper and lower bytes of the User assigned address
-
setGlobalAddress
Set global address.- Parameters:
addr- byte array containing bytes of the 64 bit global address.
-
getGlobalAddress
Get the Global address- Returns:
- byte array containing the 8 bytes of the global address
-
createInitPacket
Create the needed Initialization packet (AbstractMRMessage) for this node. Returns null if not needed.- Specified by:
createInitPacketin classAbstractNode- Returns:
- the packet, or 'null' if not needed
-
createOutPacket
Create an Transmit packet (AbstractMRMessage) to send current state- Specified by:
createOutPacketin classAbstractNode- Returns:
- packet to send current node state.
-
getSensorsActive
Are there sensors present, and hence this node will need to be polled? Note: returns 'true' if at least one sensor is active for this node- Specified by:
getSensorsActivein classAbstractNode- Returns:
- 'true' if at least one sensor is active for this node
-
handleTimeout
Deal with a timeout in the transmission controller.- Specified by:
handleTimeoutin classAbstractNode- 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.- Specified by:
resetTimeoutin classAbstractNode- Parameters:
m- message received that has reset the timeout and is waiting to be handled
-
mustSend
Return state of needSend flag.- Overrides:
mustSendin classAbstractNode- Returns:
- state of needSend flag.
-
resetMustSend
Public to reset state of needSend flag. Subclasses may override to enforce conditions.- Overrides:
resetMustSendin classAbstractNode
-
setMustSend
Public to set state of needSend flag.- Overrides:
setMustSendin classAbstractNode
-