use of jmri.jmrix.ieee802154.IEEE802154Node in project JMRI by JMRI.
the class NodeConfigFrame method initAddressBoxes.
// Initilize the drop down box for the address lists.
protected void initAddressBoxes() {
IEEE802154Node current = null;
nodeAddrField.removeAllItems();
nodeAddr64Field.removeAllItems();
for (int i = 0; i < itc.getNumNodes(); i++) {
current = (IEEE802154Node) itc.getNode(i);
nodeAddrField.insertItemAt(jmri.util.StringUtil.hexStringFromBytes(current.getUserAddress()), i);
nodeAddr64Field.insertItemAt(jmri.util.StringUtil.hexStringFromBytes(current.getGlobalAddress()), i);
}
nodeAddrField.insertItemAt("", 0);
nodeAddrField.setEditable(true);
nodeAddr64Field.insertItemAt("", 0);
}
use of jmri.jmrix.ieee802154.IEEE802154Node in project JMRI by JMRI.
the class SerialTrafficControllerTest method testGetNodeFromAddressGlobalByteTest.
@Test
@Override
public void testGetNodeFromAddressGlobalByteTest() {
// test the code to get an IEEE802154 node from its Global address
// specified as a byte array.
IEEE802154Node node = ((SerialTrafficController) tc).newNode();
((SerialTrafficController) tc).registerNode(node);
node.setNodeAddress(28055);
byte[] uad = { (byte) 0x6D, (byte) 0x97 };
node.setUserAddress(uad);
node.setPANAddress(uad);
byte[] gad = { (byte) 0x00, (byte) 0x13, (byte) 0xA2, (byte) 0x00, (byte) 0x40, (byte) 0xA0, (byte) 0x4D, (byte) 0x2D };
node.setGlobalAddress(gad);
((SerialTrafficController) tc).registerNode(node);
IEEE802154Node n = (IEEE802154Node) ((SerialTrafficController) tc).getNodeFromAddress(gad);
Assert.assertNotNull("node not found", n);
}
use of jmri.jmrix.ieee802154.IEEE802154Node in project JMRI by JMRI.
the class SerialTrafficControllerTest method testCreateNode.
@Test
public void testCreateNode() {
// test the code to get a new IEEE802154 node
IEEE802154Node node = ((SerialTrafficController) tc).newNode();
Assert.assertNotNull("node create failed", node);
}
use of jmri.jmrix.ieee802154.IEEE802154Node in project JMRI by JMRI.
the class SerialTrafficControllerTest method testGetNodeFromAddressTest.
@Test
@Override
public void testGetNodeFromAddressTest() {
// test the code to get an IEEE802154 node from its address
// specified as a string to make sure it returns null on failure.
IEEE802154Node node = ((SerialTrafficController) tc).newNode();
node.setNodeAddress(28055);
byte[] uad = { (byte) 0x6D, (byte) 0x97 };
node.setUserAddress(uad);
node.setPANAddress(uad);
byte[] gad = { (byte) 0x00, (byte) 0x13, (byte) 0xA2, (byte) 0x00, (byte) 0x40, (byte) 0xA0, (byte) 0x4D, (byte) 0x2D };
node.setGlobalAddress(gad);
((SerialTrafficController) tc).registerNode(node);
IEEE802154Node n = (IEEE802154Node) ((SerialTrafficController) tc).getNodeFromAddress("00 01");
Assert.assertNull("node found", n);
}
use of jmri.jmrix.ieee802154.IEEE802154Node in project JMRI by JMRI.
the class SerialTrafficControllerTest method testGetNodeFromAddressGlobalIntTest.
@Test
@Override
public void testGetNodeFromAddressGlobalIntTest() {
// test the code to get an IEEE802154 node from its Global address
// specified as an integer array.
IEEE802154Node node = ((SerialTrafficController) tc).newNode();
node.setNodeAddress(28055);
byte[] uad = { (byte) 0x6D, (byte) 0x97 };
node.setUserAddress(uad);
node.setPANAddress(uad);
byte[] gad = { (byte) 0x00, (byte) 0x13, (byte) 0xA2, (byte) 0x00, (byte) 0x40, (byte) 0xA0, (byte) 0x4D, (byte) 0x2D };
int[] iad = { 0x00, 0x13, 0xA2, 0x00, 0x40, 0xA0, 0x4D, 0x2D };
node.setGlobalAddress(gad);
((SerialTrafficController) tc).registerNode(node);
IEEE802154Node n = (IEEE802154Node) ((SerialTrafficController) tc).getNodeFromAddress(iad);
Assert.assertNotNull("node not found", n);
}
Aggregations