Search in sources :

Example 96 with LocoNetMessage

use of jmri.jmrix.loconet.LocoNetMessage in project JMRI by JMRI.

the class LoaderEngineTest method testGetIntMessage.

public void testGetIntMessage() {
    LoaderEngine l = new LoaderEngine(null);
    LocoNetMessage m = l.getInitMessage();
    Assert.assertEquals("contents", "D3 01 00 00 00 2D", m.toString());
    Assert.assertEquals("checksum", true, m.checkParity());
}
Also used : LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage)

Example 97 with LocoNetMessage

use of jmri.jmrix.loconet.LocoNetMessage in project JMRI by JMRI.

the class LocoStatsFrameTest method testPR2Format.

@Test
public void testPR2Format() throws Exception {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    LocoStatsPanel p = getFrame("PR2 Stats Window", 300);
    p.requestUpdate();
    // initialize with a null traffic controller
    p.stats = new jmri.jmrix.loconet.locostats.LocoStatsFunc(null);
    p.stats.message(new LocoNetMessage(new int[] { LnConstants.OPC_PEER_XFER, 0x10, 0x22, 0x22, 0x01, 0x00, 1, 2, 0, 4, 0x00, 5, 6, 0, 0, 0 }));
    JFrame f = jmri.util.JmriJFrame.getFrame("PR2 Stats Window");
    Assert.assertTrue("found frame", f != null);
    f.dispose();
}
Also used : JmriJFrame(jmri.util.JmriJFrame) JFrame(javax.swing.JFrame) LocoStatsPanel(jmri.jmrix.loconet.locostats.swing.LocoStatsPanel) LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage) Test(org.junit.Test)

Example 98 with LocoNetMessage

use of jmri.jmrix.loconet.LocoNetMessage in project JMRI by JMRI.

the class LlnmonTest method testOpcPeerXfer10.

public void testOpcPeerXfer10() {
    LocoNetMessage l;
    l = new LocoNetMessage(new int[] { 0xe5, 0x0a, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f });
    assertEquals(" Slot test 1", "Throttle status TCNTRL=73 (unknown), Throttle ID=0x00 0x00 (0), SLA=0x00, SLB=0x00.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xe5, 0x0a, 0x40, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f });
    assertEquals(" Slot test 1", "Throttle status TCNTRL=40 (OK), Throttle ID=0x02 0x01 (257), SLA=0x00, SLB=0x00.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xe5, 0x0a, 0x7F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f });
    assertEquals(" Slot test 1", "Throttle status TCNTRL=7F (no key, immed, ignored), Throttle ID=0x00 0x01 (1), SLA=0x00, SLB=0x00.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xe5, 0x0a, 0x43, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f });
    assertEquals(" Slot test 1", "Throttle status TCNTRL=43 (+ key during msg), Throttle ID=0x02 0x00 (256), SLA=0x00, SLB=0x00.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xe5, 0x0a, 0x42, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x7f });
    assertEquals(" Slot test 1", "Throttle status TCNTRL=42 (- key during msg), Throttle ID=0x00 0x01 (1), SLA=0x30, SLB=0x00.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xe5, 0x0a, 0x41, 0x00, 0x02, 0x00, 0x00, 0x00, 0x40, 0x00, 0x7f });
    assertEquals(" Slot test 1", "Throttle status TCNTRL=41 (R/S key during msg, aborts), Throttle ID=0x02 0x00 (256), SLA=0x00, SLB=0x40.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xe5, 0x0a, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f });
    assertEquals(" Slot test 1", "Throttle status TCNTRL=4E (Throttle response to Semaphore Display Command), Throttle ID=0x00 0x00 (0), SLA=0x00, SLB=0x00.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xe5, 0x0a, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f });
    assertEquals(" Slot test 1", "Throttle status TCNTRL=45 (unknown), Throttle ID=0x00 0x00 (0), SLA=0x00, SLB=0x00.\n", f.displayMessage(l));
}
Also used : LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage)

Example 99 with LocoNetMessage

use of jmri.jmrix.loconet.LocoNetMessage in project JMRI by JMRI.

the class LlnmonTest method testBasicPM42Events.

public void testBasicPM42Events() {
    LocoNetMessage l;
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x65, 0x30, 0x19, 0x01 });
    assertEquals(" PM42 Events test 01", "PM4x (Board ID 102) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Shorted.\n\tSub-District 2 - Circuit-Breaker mode - Unshorted.\n\tSub-District 3 - Circuit-Breaker mode - Unshorted.\n\tSub-District 4 - Circuit-Breaker mode - Shorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x65, 0x30, 0x1B, 0x03 });
    assertEquals(" PM42 Events test 02", "PM4x (Board ID 102) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Shorted.\n\tSub-District 2 - Circuit-Breaker mode - Shorted.\n\tSub-District 3 - Circuit-Breaker mode - Unshorted.\n\tSub-District 4 - Circuit-Breaker mode - Shorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x65, 0x30, 0x1F, 0x07 });
    assertEquals(" PM42 Events test 03", "PM4x (Board ID 102) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Shorted.\n\tSub-District 2 - Circuit-Breaker mode - Shorted.\n\tSub-District 3 - Circuit-Breaker mode - Shorted.\n\tSub-District 4 - Circuit-Breaker mode - Shorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x64, 0x30, 0x18, 0x01 });
    assertEquals(" PM42 Events test 04", "PM4x (Board ID 101) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Unshorted.\n\tSub-District 2 - Circuit-Breaker mode - Unshorted.\n\tSub-District 3 - Circuit-Breaker mode - Unshorted.\n\tSub-District 4 - Circuit-Breaker mode - Shorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x64, 0x30, 0x1A, 0x03 });
    assertEquals(" PM42 Events test 05", "PM4x (Board ID 101) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Unshorted.\n\tSub-District 2 - Circuit-Breaker mode - Shorted.\n\tSub-District 3 - Circuit-Breaker mode - Unshorted.\n\tSub-District 4 - Circuit-Breaker mode - Shorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x65, 0x30, 0x16, 0x0E });
    assertEquals(" PM42 Events test 06", "PM4x (Board ID 102) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Unshorted.\n\tSub-District 2 - Circuit-Breaker mode - Shorted.\n\tSub-District 3 - Circuit-Breaker mode - Shorted.\n\tSub-District 4 - Circuit-Breaker mode - Unshorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x65, 0x30, 0x14, 0x0C });
    assertEquals(" PM42 Events test 07", "PM4x (Board ID 102) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Unshorted.\n\tSub-District 2 - Circuit-Breaker mode - Unshorted.\n\tSub-District 3 - Circuit-Breaker mode - Shorted.\n\tSub-District 4 - Circuit-Breaker mode - Unshorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x64, 0x30, 0x10, 0x09 });
    assertEquals(" PM42 Events test 08", "PM4x (Board ID 101) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Unshorted.\n\tSub-District 2 - Circuit-Breaker mode - Unshorted.\n\tSub-District 3 - Circuit-Breaker mode - Unshorted.\n\tSub-District 4 - Circuit-Breaker mode - Unshorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x65, 0x30, 0x10, 0x08 });
    assertEquals(" PM42 Events test 09", "PM4x (Board ID 102) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Unshorted.\n\tSub-District 2 - Circuit-Breaker mode - Unshorted.\n\tSub-District 3 - Circuit-Breaker mode - Unshorted.\n\tSub-District 4 - Circuit-Breaker mode - Unshorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x01, 0x38, 0x10, 0x64 });
    assertEquals(" PM42 Events test 09", "PM4x (Board ID 2) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Unshorted.\n\tSub-District 2 - Circuit-Breaker mode - Unshorted.\n\tSub-District 3 - Circuit-Breaker mode - Unshorted.\n\tSub-District 4 - Auto-Reversing mode - Normal.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x01, 0x38, 0x1F, 0x6B });
    assertEquals(" PM42 Events test 09", "PM4x (Board ID 2) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Shorted.\n\tSub-District 2 - Circuit-Breaker mode - Shorted.\n\tSub-District 3 - Circuit-Breaker mode - Shorted.\n\tSub-District 4 - Auto-Reversing mode - Reversed.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x01, 0x38, 0x18, 0x6C });
    assertEquals(" PM42 Events test 09", "PM4x (Board ID 2) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Unshorted.\n\tSub-District 2 - Circuit-Breaker mode - Unshorted.\n\tSub-District 3 - Circuit-Breaker mode - Unshorted.\n\tSub-District 4 - Auto-Reversing mode - Reversed.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x65, 0x11, 0x19, 0x01 });
    assertEquals(" PM42 Events test 01", "PM4x (Board ID 102) Power Status Report\n\tSub-District 1 - Auto-Reversing mode - Reversed.\n\tSub-District 2 - Circuit-Breaker mode - Unshorted.\n\tSub-District 3 - Circuit-Breaker mode - Unshorted.\n\tSub-District 4 - Circuit-Breaker mode - Shorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x65, 0x11, 0x18, 0x01 });
    assertEquals(" PM42 Events test 01", "PM4x (Board ID 102) Power Status Report\n\tSub-District 1 - Auto-Reversing mode - Normal.\n\tSub-District 2 - Circuit-Breaker mode - Unshorted.\n\tSub-District 3 - Circuit-Breaker mode - Unshorted.\n\tSub-District 4 - Circuit-Breaker mode - Shorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x65, 0x12, 0x12, 0x03 });
    assertEquals(" PM42 Events test 02", "PM4x (Board ID 102) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Unshorted.\n\tSub-District 2 - Auto-Reversing mode - Reversed.\n\tSub-District 3 - Circuit-Breaker mode - Unshorted.\n\tSub-District 4 - Circuit-Breaker mode - Unshorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x65, 0x12, 0x10, 0x07 });
    assertEquals(" PM42 Events test 03", "PM4x (Board ID 102) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Unshorted.\n\tSub-District 2 - Auto-Reversing mode - Normal.\n\tSub-District 3 - Circuit-Breaker mode - Unshorted.\n\tSub-District 4 - Circuit-Breaker mode - Unshorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x64, 0x14, 0x14, 0x01 });
    assertEquals(" PM42 Events test 04", "PM4x (Board ID 101) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Unshorted.\n\tSub-District 2 - Circuit-Breaker mode - Unshorted.\n\tSub-District 3 - Auto-Reversing mode - Reversed.\n\tSub-District 4 - Circuit-Breaker mode - Unshorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x64, 0x14, 0x10, 0x03 });
    assertEquals(" PM42 Events test 05", "PM4x (Board ID 101) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Unshorted.\n\tSub-District 2 - Circuit-Breaker mode - Unshorted.\n\tSub-District 3 - Auto-Reversing mode - Normal.\n\tSub-District 4 - Circuit-Breaker mode - Unshorted.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x65, 0x18, 0x18, 0x0E });
    assertEquals(" PM42 Events test 06", "PM4x (Board ID 102) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Unshorted.\n" + "\tSub-District 2 - Circuit-Breaker mode - Unshorted.\n\tSub-District 3 - Circuit-Breaker mode - Unshorted.\n\tSub-District 4 - Auto-Reversing mode - Reversed.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD0, 0x62, 0x65, 0x18, 0x10, 0x0C });
    assertEquals(" PM42 Events test 07", "PM4x (Board ID 102) Power Status Report\n\tSub-District 1 - Circuit-Breaker mode - Unshorted.\n" + "\tSub-District 2 - Circuit-Breaker mode - Unshorted.\n\tSub-District 3 - Circuit-Breaker mode - Unshorted.\n\tSub-District 4 - Auto-Reversing mode - Normal.\n", f.displayMessage(l));
}
Also used : LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage)

Example 100 with LocoNetMessage

use of jmri.jmrix.loconet.LocoNetMessage in project JMRI by JMRI.

the class LlnmonTest method testALM.

public void testALM() {
    LocoNetMessage l;
    l = new LocoNetMessage(new int[] { 0xEE, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
    assertEquals(" ALM task 1 test 1", "Write ALM msg 1 ATASK=0 (ID) BLKL=0 BLKH=0 LOGIC=0\n\tARG1L=0x00 ARG1H=0x00 ARG2L=0x00 ARG2H=0x00\n\tARG3L=0x00 ARG3H=0x00 ARG4L=0x00 ARG4H=0x00.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xEE, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 });
    assertEquals(" ALM task 2 test 1", "Write ALM msg 2 ATASK=0 (ID) BLKL=0 BLKH=0 LOGIC=0\n\tARG1L=0x00 ARG1H=0x00 ARG2L=0x00 ARG2H=0x00\n\tARG3L=0x00 ARG3H=0x00 ARG4L=0x00 ARG4H=0x00.\n", f.displayMessage(l));
}
Also used : LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage)

Aggregations

LocoNetMessage (jmri.jmrix.loconet.LocoNetMessage)103 Test (org.junit.Test)8 JFrame (javax.swing.JFrame)3 LocoNetInterfaceScaffold (jmri.jmrix.loconet.LocoNetInterfaceScaffold)3 LocoNetSystemConnectionMemo (jmri.jmrix.loconet.LocoNetSystemConnectionMemo)3 LocoStatsPanel (jmri.jmrix.loconet.locostats.swing.LocoStatsPanel)3 JmriJFrame (jmri.util.JmriJFrame)3 LocoNetSlot (jmri.jmrix.loconet.LocoNetSlot)2 SpjFile (jmri.jmrix.loconet.spjfile.SpjFile)2 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 StringTokenizer (java.util.StringTokenizer)1 LnPacketizer (jmri.jmrix.loconet.LnPacketizer)1 LnReporter (jmri.jmrix.loconet.LnReporter)1 LnTrafficController (jmri.jmrix.loconet.LnTrafficController)1 LnTurnout (jmri.jmrix.loconet.LnTurnout)1