use of jmri.jmrix.ieee802154.xbee.XBeeTrafficController in project JMRI by JMRI.
the class ConnectionConfigXml method extendElement.
/**
* Write out the SerialNode objects too
*
* @param e Element being extended
*/
@Override
protected void extendElement(Element e) {
XBeeConnectionMemo xcm;
XBeeTrafficController xtc;
try {
xcm = (XBeeConnectionMemo) adapter.getSystemConnectionMemo();
xtc = (XBeeTrafficController) xcm.getTrafficController();
} catch (NullPointerException npe) {
// The adapter doesn't have a memo, so no nodes can be defined.
if (log.isDebugEnabled()) {
log.debug("No memo defined; no nodes to save.");
}
return;
}
try {
XBeeNode node = (XBeeNode) xtc.getNode(0);
int index = 1;
while (node != null) {
// add node as an element
Element n = new Element("node");
n.setAttribute("name", "" + node.getNodeAddress());
e.addContent(n);
// add parameters to the node as needed
n.addContent(makeParameter("address", "" + jmri.util.StringUtil.hexStringFromBytes(node.getUserAddress())));
n.addContent(makeParameter("PAN", "" + jmri.util.StringUtil.hexStringFromBytes(node.getPANAddress())));
n.addContent(makeParameter("GUID", "" + jmri.util.StringUtil.hexStringFromBytes(node.getGlobalAddress())));
n.addContent(makeParameter("name", node.getIdentifier()));
n.addContent(makeParameter("polled", node.getPoll() ? "yes" : "no"));
jmri.jmrix.AbstractStreamPortController pc = null;
if ((pc = node.getPortController()) != null) {
n.addContent(makeParameter("StreamController", pc.getClass().getName()));
}
// look for the next node
node = (XBeeNode) xtc.getNode(index);
index++;
}
} catch (java.lang.NullPointerException npe2) {
// no nodes defined.
return;
}
}
use of jmri.jmrix.ieee802154.xbee.XBeeTrafficController in project JMRI by JMRI.
the class XBeeComponentFactoryTest method setUp.
@Before
public void setUp() {
Log4JFixture.setUp();
JUnitUtil.resetInstanceManager();
tc = new XBeeTrafficController() {
@Override
public void setInstance() {
}
@Override
protected jmri.jmrix.AbstractMRReply newReply() {
return null;
}
@Override
public jmri.jmrix.ieee802154.IEEE802154Node newNode() {
return null;
}
};
m = new XBeeConnectionMemo();
m.setSystemPrefix("ABC");
tc.setAdapterMemo(m);
}
use of jmri.jmrix.ieee802154.xbee.XBeeTrafficController in project JMRI by JMRI.
the class XBeeMenuTest method setUp.
@Before
public void setUp() {
Log4JFixture.setUp();
JUnitUtil.resetInstanceManager();
tc = new XBeeTrafficController() {
@Override
public void setInstance() {
}
@Override
protected jmri.jmrix.AbstractMRReply newReply() {
return null;
}
@Override
public jmri.jmrix.ieee802154.IEEE802154Node newNode() {
return null;
}
};
m = new XBeeConnectionMemo();
m.setSystemPrefix("ABC");
tc.setAdapterMemo(m);
}
use of jmri.jmrix.ieee802154.xbee.XBeeTrafficController in project JMRI by JMRI.
the class PacketGenActionTest method testStringCTor.
@Test
public void testStringCTor() {
XBeeTrafficController tc = new XBeeInterfaceScaffold();
XBeeConnectionMemo m = new XBeeConnectionMemo();
InstanceManager.store(m, XBeeConnectionMemo.class);
PacketGenAction t = new PacketGenAction("Test Action");
Assert.assertNotNull("exists", t);
}
use of jmri.jmrix.ieee802154.xbee.XBeeTrafficController in project JMRI by JMRI.
the class PacketGenActionTest method testStringMemoCTor.
@Test
public void testStringMemoCTor() {
XBeeTrafficController tc = new XBeeInterfaceScaffold();
XBeeConnectionMemo m = new XBeeConnectionMemo();
PacketGenAction t = new PacketGenAction("Test Action", m);
Assert.assertNotNull("exists", t);
}
Aggregations