use of jmri.jmrix.can.CanReply in project JMRI by JMRI.
the class ReplyTest method testThree.
public void testThree() {
Reply g = new Reply("T00000123412345678\r");
CanReply r = g.createReply();
Assert.assertEquals("extended", true, r.isExtended());
// not clear how to assert RTR in this protocol
//Assert.assertEquals("rtr", true, r.isRtr());
Assert.assertEquals("header", 0x123, r.getHeader());
Assert.assertEquals("num elements", 4, r.getNumDataElements());
Assert.assertEquals("el 0", 0x12, r.getElement(0));
Assert.assertEquals("el 1", 0x34, r.getElement(1));
Assert.assertEquals("el 2", 0x56, r.getElement(2));
Assert.assertEquals("el 3", 0x78, r.getElement(3));
}
use of jmri.jmrix.can.CanReply in project JMRI by JMRI.
the class MonitorPaneTest method testDisplay.
@Test
public void testDisplay() throws Exception {
TrafficControllerScaffold tcs = new TrafficControllerScaffold();
MonitorPane f = new MonitorPane();
CanSystemConnectionMemo memo = new CanSystemConnectionMemo();
memo.setTrafficController(tcs);
f.initComponents(memo);
//pane.MonitorPane.Default;
/*MonitorFrame f = new MonitorFrame(){
{ rawCheckBox.setSelected(true);}
};
f.initComponents();
f.setVisible(true);*/
// show std message
CanMessage m = new CanMessage(0x123);
m.setNumDataElements(3);
m.setElement(0, (byte) 0x02);
m.setElement(1, (byte) 0xA2);
m.setElement(2, (byte) 0x31);
f.message(m);
// show ext message
m = new CanMessage(0x654321);
m.setExtended(true);
m.setNumDataElements(3);
m.setElement(0, (byte) 0x02);
m.setElement(1, (byte) 0xA2);
m.setElement(2, (byte) 0x31);
f.message(m);
// show reply
CanReply r = new CanReply();
r.setNumDataElements(3);
r.setElement(0, (byte) 0x11);
r.setElement(1, (byte) 0x82);
r.setElement(2, (byte) 0x33);
f.reply(r);
// close panel
f.dispose();
memo.dispose();
}
use of jmri.jmrix.can.CanReply in project JMRI by JMRI.
the class OlcbAddressTest method testCbusIdParseMatchReply.
public void testCbusIdParseMatchReply() {
CanReply c = new CanReply(new int[] { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0 });
assertTrue(!new OlcbAddress("x123456789ABCDEF0").match(c));
c.setExtended(true);
c.setHeader(0x195B4000);
assertTrue(new OlcbAddress("x123456789ABCDEF0").match(c));
c = new CanReply(new int[] { 0x01, 0x34, 0x05, 0x00, 0x9A, 0x0B, 0x0E, 0x00 });
assertTrue(!new OlcbAddress("1.34.5.0.9A.B.E.0").match(c));
c.setExtended(true);
c.setHeader(0x195B4000);
assertTrue(new OlcbAddress("1.34.5.0.9A.B.E.0").match(c));
}
Aggregations