use of jmri.jmrix.ieee802154.xbee.XBeeConnectionMemo 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.XBeeConnectionMemo in project JMRI by JMRI.
the class NodeConfigFrame method discoverButtonActionPerformed.
/**
* Method to handle discover button
*/
public void discoverButtonActionPerformed() {
if (xtc.getXBee().getNetwork().isDiscoveryRunning()) {
log.debug("Discovery process already running");
discoverButton.setEnabled(false);
statusText1.setText(Bundle.getMessage("FeedBackDiscover"));
return;
}
jmri.jmrix.ieee802154.IEEE802154SystemConnectionMemo memo = xtc.getAdapterMemo();
if (memo instanceof XBeeConnectionMemo) {
XBeeConnectionMemo m = (XBeeConnectionMemo) memo;
// call the node discovery code in the node manager.
m.getXBeeNodeManager().startNodeDiscovery();
discoverButton.setEnabled(false);
}
// provide user feedback
statusText1.setText(Bundle.getMessage("FeedBackDiscover"));
errorInStatus1 = true;
resetNotes2();
}
use of jmri.jmrix.ieee802154.xbee.XBeeConnectionMemo in project JMRI by JMRI.
the class EditNodeFrameTest method setUp.
@Before
public void setUp() {
JUnitUtil.resetInstanceManager();
tc = new XBeeInterfaceScaffold();
m = new XBeeConnectionMemo();
m.setSystemPrefix("ABC");
tc.setAdapterMemo(m);
}
use of jmri.jmrix.ieee802154.xbee.XBeeConnectionMemo in project JMRI by JMRI.
the class NodeConfigActionTest method testStringMemoCtor.
@Test
public void testStringMemoCtor() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
NodeConfigAction action = new NodeConfigAction("IEEE 802.15.4 test Action", new XBeeConnectionMemo());
Assert.assertNotNull("exists", action);
}
use of jmri.jmrix.ieee802154.xbee.XBeeConnectionMemo 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);
}
Aggregations