use of jmri.jmrix.can.CanMessage in project JMRI by JMRI.
the class MessageTest method testTwo.
// T0000F00D0
public void testTwo() {
CanMessage m = new CanMessage(0xF00D);
m.setExtended(true);
m.setRtr(false);
m.setNumDataElements(0);
Message g = new Message(m);
Assert.assertEquals("standard format 2 byte", "T0000F00D0\r", g.toString());
}
use of jmri.jmrix.can.CanMessage in project JMRI by JMRI.
the class MessageTest method testFour.
// T0000F00D0
public void testFour() {
CanMessage m = new CanMessage(0xF00D);
m.setExtended(true);
m.setRtr(false);
m.setNumDataElements(8);
m.setElement(0, 0x78);
m.setElement(1, 0x78);
m.setElement(2, 0x78);
m.setElement(3, 0x78);
m.setElement(4, 0x78);
m.setElement(5, 0x78);
m.setElement(6, 0x78);
m.setElement(7, 0x78);
Message g = new Message(m);
Assert.assertEquals("standard format 2 byte", "T0000F00D87878787878787878\r", g.toString());
}
use of jmri.jmrix.can.CanMessage in project JMRI by JMRI.
the class MessageTest method testOne.
// t123412345678
public void testOne() {
CanMessage m = new CanMessage(0x123);
m.setExtended(false);
m.setRtr(false);
m.setNumDataElements(4);
m.setElement(0, 0x12);
m.setElement(1, 0x34);
m.setElement(2, 0x56);
m.setElement(3, 0x78);
Message g = new Message(m);
Assert.assertEquals("standard format 2 byte", "t123412345678\r", g.toString());
}
use of jmri.jmrix.can.CanMessage in project JMRI by JMRI.
the class MessageTest method testThree.
public void testThree() {
CanMessage m = new CanMessage(0x123);
m.setExtended(true);
// not clear how to set RTR in this protocol
//m.setRtr(true);
m.setNumDataElements(4);
m.setElement(0, 0x12);
m.setElement(1, 0x34);
m.setElement(2, 0x56);
m.setElement(3, 0x78);
Message g = new Message(m);
Assert.assertEquals("standard format 2 byte", "T00000123412345678\r", g.toString());
}
use of jmri.jmrix.can.CanMessage 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();
}
Aggregations