Class IEEE802154Node

java.lang.Object
jmri.jmrix.AbstractNode
jmri.jmrix.ieee802154.IEEE802154Node
Direct Known Subclasses:
SerialNode, XBeeNode

public abstract class IEEE802154Node extends AbstractNode
Basic implementation of a node for IEEE 802.15.4 networks.

Integrated with IEEE802154TrafficController.

Each node has 3 addresses associated with it:

  1. A 16 bit PAN (Personal Area Network) ID assigned by the user
  2. A 16 bit User Assigned Address
  3. A 64 bit Globally Unique ID assigned by the manufacturer

All nodes in a given network must have the same PAN ID

  • Field Details

  • Constructor Details

    • IEEE802154Node

      public IEEE802154Node()
      Creates a new instance of AbstractNode
    • IEEE802154Node

      public IEEE802154Node(byte[] pan, byte[] user, byte[] global)
  • Method Details

    • setNodeAddress

      public void setNodeAddress(int address)
      Public method to set the node address. Address range is checked in subclasses.
      Overrides:
      setNodeAddress in class AbstractNode
      Parameters:
      address - address index to set in node
      Throws:
      IllegalArgumentException - if out of range
    • checkNodeAddress

      protected boolean checkNodeAddress(int address)
      Check for valid address with respect to range, etc.
      Specified by:
      checkNodeAddress in class AbstractNode
      Parameters:
      address - node number to check.
      Returns:
      true if valid
    • setPANAddress

      public void setPANAddress(byte[] addr)
      Set PAN address.
      Parameters:
      addr - byte array containing upper and lower bytes of the 16 bit PAN address.
    • getPANAddress

      public byte[] getPANAddress()
      Get the PAN address
      Returns:
      byte array containing the upper and lower bytes of the PAN address
    • setUserAddress

      public void setUserAddress(byte[] addr)
      Set User address.
      Parameters:
      addr - byte array containing upper and lower bytes of the 16 bit user assigned address.
    • getUserAddress

      public byte[] getUserAddress()
      Get the User address
      Returns:
      byte array containing the upper and lower bytes of the User assigned address
    • setGlobalAddress

      public void setGlobalAddress(byte[] addr)
      Set global address.
      Parameters:
      addr - byte array containing bytes of the 64 bit global address.
    • getGlobalAddress

      public byte[] 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:
      createInitPacket in class AbstractNode
      Returns:
      the packet, or 'null' if not needed
    • createOutPacket

      Create an Transmit packet (AbstractMRMessage) to send current state
      Specified by:
      createOutPacket in class AbstractNode
      Returns:
      packet to send current node state.
    • getSensorsActive

      public abstract boolean 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:
      getSensorsActive in class AbstractNode
      Returns:
      'true' if at least one sensor is active for this node
    • handleTimeout

      public abstract boolean handleTimeout(AbstractMRMessage m, AbstractMRListener l)
      Deal with a timeout in the transmission controller.
      Specified by:
      handleTimeout in class AbstractNode
      Parameters:
      m - message that didn't receive a reply
      l - listener that sent the message
      Returns:
      true if initialization required
    • resetTimeout

      public abstract void resetTimeout(AbstractMRMessage m)
      A reply was received, so there was not timeout, do any needed processing.
      Specified by:
      resetTimeout in class AbstractNode
      Parameters:
      m - message received that has reset the timeout and is waiting to be handled
    • mustSend

      public boolean mustSend()
      Return state of needSend flag.
      Overrides:
      mustSend in class AbstractNode
      Returns:
      state of needSend flag.
    • resetMustSend

      public void resetMustSend()
      Public to reset state of needSend flag. Subclasses may override to enforce conditions.
      Overrides:
      resetMustSend in class AbstractNode
    • setMustSend

      public void setMustSend()
      Public to set state of needSend flag.
      Overrides:
      setMustSend in class AbstractNode