001package jmri.jmrix.ieee802154.serialdriver; 002 003import java.util.Arrays; 004import jmri.jmrix.AbstractMRListener; 005import jmri.jmrix.AbstractMRMessage; 006import jmri.jmrix.ieee802154.IEEE802154Node; 007import org.slf4j.Logger; 008import org.slf4j.LoggerFactory; 009 010/** 011 * Implementation of a Serial Node for IEEE 802.15.4 networks. 012 * <p> 013 * Integrated with {@link SerialTrafficController}. 014 * <p> 015 * Each node has 3 addresses associated with it: 016 * <ol> 017 * <li>A 16 bit PAN (Personal Area Network) ID assigned by the user</li> 018 * <li>A 16 bit User Assigned Address</li> 019 * <li>A 64 bit Globally Unique ID assigned by the manufacturer</li> 020 * </ol> 021 * <p> 022 * All nodes in a given network must have the same PAN ID 023 * 024 * @author Paul Bender Copyright 2013 025 */ 026public class SerialNode extends IEEE802154Node { 027 028 /** 029 * Creates a new instance of AbstractNode 030 */ 031 public SerialNode() { 032 } 033 034 public SerialNode(byte pan[], byte user[], byte global[]) { 035 super(pan, user, global); 036 if (log.isDebugEnabled()) { 037 log.debug("Created new node with panId: {} userId: {} and GUID: {}", Arrays.toString(pan), Arrays.toString(user), Arrays.toString(global)); 038 } 039 } 040 041 /** 042 * Create the needed Initialization packet (AbstractMRMessage) for this 043 * node. Returns null if not needed. 044 */ 045 @Override 046 public AbstractMRMessage createInitPacket() { 047 return null; 048 } 049 050 /** 051 * Create an Transmit packet (AbstractMRMessage) to send current state 052 */ 053 @Override 054 public AbstractMRMessage createOutPacket() { 055 return null; 056 } 057 058 /** 059 * Are there sensors present, and hence this node will need to be polled? 060 * Note: returns 'true' if at least one sensor is active for this node 061 */ 062 @Override 063 public boolean getSensorsActive() { 064 return false; 065 } 066 067 /** 068 * Deal with a timeout in the transmission controller. 069 * 070 * @param m message that didn't receive a reply 071 * @param l listener that sent the message 072 * @return true if initialization required 073 */ 074 @Override 075 public boolean handleTimeout(AbstractMRMessage m, AbstractMRListener l) { 076 return false; 077 } 078 079 /** 080 * A reply was received, so there was not timeout, do any needed processing. 081 */ 082 @Override 083 public void resetTimeout(AbstractMRMessage m) { 084 return; 085 } 086 087 private final static Logger log = LoggerFactory.getLogger(SerialNode.class); 088}