use of jmri.jmrix.AbstractMRMessage in project JMRI by JMRI.
the class SerialNodeTest method testOutputBits1.
public void testOutputBits1() {
// IO48 with several output bits set
SerialNode g = new SerialNode(5, SerialNode.DAUGHTER);
Assert.assertTrue("must Send", g.mustSend());
g.resetMustSend();
Assert.assertTrue("must Send off", !(g.mustSend()));
g.setOutputBit(2, false);
g.setOutputBit(1, false);
g.setOutputBit(23, false);
g.setOutputBit(21, false);
g.setOutputBit(31, true);
g.setOutputBit(2, true);
g.setOutputBit(19, true);
g.setOutputBit(5, true);
g.setOutputBit(26, false);
g.setOutputBit(28, true);
Assert.assertTrue("must Send on", g.mustSend());
AbstractMRMessage m = g.createOutPacket();
Assert.assertEquals("packet size", 9, m.getNumDataElements());
Assert.assertEquals("node address", 5, m.getElement(0));
Assert.assertEquals("byte 1 lo nibble", 0x02, m.getElement(1));
Assert.assertEquals("byte 1 hi nibble", 0x11, m.getElement(2));
Assert.assertEquals("byte 2 lo nibble", 0x20, m.getElement(3));
Assert.assertEquals("byte 2 hi nibble", 0x30, m.getElement(4));
Assert.assertEquals("byte 3 lo nibble", 0x44, m.getElement(5));
Assert.assertEquals("byte 3 hi nibble", 0x50, m.getElement(6));
Assert.assertEquals("byte 4 lo nibble", 0x68, m.getElement(7));
Assert.assertEquals("byte 4 hi nibble", 0x74, m.getElement(8));
}
Aggregations