Search in sources :

Example 36 with CanMessage

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());
}
Also used : CanMessage(jmri.jmrix.can.CanMessage) CanMessage(jmri.jmrix.can.CanMessage)

Example 37 with CanMessage

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());
}
Also used : CanMessage(jmri.jmrix.can.CanMessage) CanMessage(jmri.jmrix.can.CanMessage)

Example 38 with CanMessage

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());
}
Also used : CanMessage(jmri.jmrix.can.CanMessage) CanMessage(jmri.jmrix.can.CanMessage)

Example 39 with CanMessage

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());
}
Also used : CanMessage(jmri.jmrix.can.CanMessage) CanMessage(jmri.jmrix.can.CanMessage)

Example 40 with CanMessage

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();
}
Also used : CanSystemConnectionMemo(jmri.jmrix.can.CanSystemConnectionMemo) CanReply(jmri.jmrix.can.CanReply) TrafficControllerScaffold(jmri.jmrix.can.TrafficControllerScaffold) CanMessage(jmri.jmrix.can.CanMessage) Test(org.junit.Test)

Aggregations

CanMessage (jmri.jmrix.can.CanMessage)63 Test (org.junit.Test)4 CanReply (jmri.jmrix.can.CanReply)3 CanListener (jmri.jmrix.can.CanListener)2 CbusAddress (jmri.jmrix.can.cbus.CbusAddress)2 DccLocoAddress (jmri.DccLocoAddress)1 AbstractMRMessage (jmri.jmrix.AbstractMRMessage)1 CanSystemConnectionMemo (jmri.jmrix.can.CanSystemConnectionMemo)1 TestTrafficController (jmri.jmrix.can.TestTrafficController)1 TrafficControllerScaffold (jmri.jmrix.can.TrafficControllerScaffold)1 GridConnectMessage (jmri.jmrix.can.adapters.gridconnect.GridConnectMessage)1 GridConnectReply (jmri.jmrix.can.adapters.gridconnect.GridConnectReply)1 LoaderClient (org.openlcb.LoaderClient)1 OlcbInterface (org.openlcb.OlcbInterface)1 AliasMap (org.openlcb.can.AliasMap)1 CanInterface (org.openlcb.can.CanInterface)1 MessageBuilder (org.openlcb.can.MessageBuilder)1 Hub (org.openlcb.hub.Hub)1