Search in sources :

Example 31 with LocoNetMessage

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

the class LoaderEngineTest method testGetEraseMessage.

public void testGetEraseMessage() {
    LoaderEngine l = new LoaderEngine(null);
    LocoNetMessage m = l.getEraseMessage();
    Assert.assertEquals("contents", "D3 02 01 7F 00 50", m.toString());
    Assert.assertEquals("checksum", true, m.checkParity());
}
Also used : LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage)

Example 32 with LocoNetMessage

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

the class LocoStatsFrameTest method testLocoBufferFormat.

@Test
public void testLocoBufferFormat() throws Exception {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    LocoStatsPanel p = getFrame("LocoBuffer Stats Window", 150);
    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, 0x50, 0x50, 0x01, 0x0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }));
    JFrame f = jmri.util.JmriJFrame.getFrame("LocoBuffer 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 33 with LocoNetMessage

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

the class LocoStatsFrameTest method testMS100Format.

@Test
public void testMS100Format() throws Exception {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    LocoStatsPanel p = getFrame("MS100 Stats Window", 450);
    p.requestUpdate();
    Assert.assertNotNull("p isn't supposed to be null", p);
    // 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, 0x20, 4, 0x00, 5, 6, 0, 0, 0 }));
    JFrame f = jmri.util.JmriJFrame.getFrame("MS100 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 34 with LocoNetMessage

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

the class LlnmonTest method testDuplexRadioScan.

public void testDuplexRadioScan() {
    LocoNetMessage l;
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x08, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C });
    assertEquals("Channel Scan test 1", "Query Duplex Channel 26 noise/activity.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x10, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14 });
    assertEquals("Channel Scan test 2", "Reported Duplex Channel 26 noise/activity level is 0/255.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x08, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D });
    assertEquals("Channel Scan test 3", "Query Duplex Channel 11 noise/activity.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x10, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05 });
    assertEquals("Channel Scan test 4", "Reported Duplex Channel 11 noise/activity level is 0/255.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A });
    assertEquals("Channel Scan test 5", "Query Duplex Channel 12 noise/activity.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x10, 0x00, 0x0C, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E });
    assertEquals("Channel Scan test 6", "Reported Duplex Channel 12 noise/activity level is 10/255.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x10, 0x00, 0x0C, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 });
    assertEquals("Channel Scan test 2", "Reported Duplex Channel 12 noise/activity level is 1/255.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x08, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B });
    assertEquals("Channel Scan test 2", "Query Duplex Channel 13 noise/activity.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x10, 0x00, 0x0D, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06 });
    assertEquals("Channel Scan test 2", "Reported Duplex Channel 13 noise/activity level is 5/255.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x10, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 });
    assertEquals("Channel Scan test 2", "Reported Duplex Channel 13 noise/activity level is 0/255.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x08, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18 });
    assertEquals("Channel Scan test 2", "Query Duplex Channel 14 noise/activity.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x10, 0x00, 0x0E, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26 });
    assertEquals("Channel Scan test 2", "Reported Duplex Channel 14 noise/activity level is 38/255.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x10, 0x00, 0x0E, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E });
    assertEquals("Channel Scan test 2", "Reported Duplex Channel 14 noise/activity level is 14/255.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x08, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19 });
    assertEquals("Channel Scan test 2", "Query Duplex Channel 15 noise/activity.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x10, 0x00, 0x0F, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16 });
    assertEquals("Channel Scan test 2", "Reported Duplex Channel 15 noise/activity level is 23/255.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x10, 0x00, 0x0F, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09 });
    assertEquals("Channel Scan test 2", "Reported Duplex Channel 15 noise/activity level is 8/255.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x10, 0x10, 0x00, 0x0F, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09 });
    assertEquals("Channel Scan test 2", "Reported Duplex Channel 15 noise/activity level is 8/255.\n", f.displayMessage(l));
}
Also used : LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage)

Example 35 with LocoNetMessage

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

the class LlnmonTest method testBasicConsistingMessages.

public void testBasicConsistingMessages() {
    LocoNetMessage l;
    l = new LocoNetMessage(new int[] { 0xB9, 0x0B, 0x05, 0x48 });
    assertEquals(" basic Consisting Test 01", "Consist loco in slot 11 to loco in slot 5.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xB8, 0x0E, 0x0D, 0x44 });
    assertEquals(" basic Consisting Test 02", "Remove loco in slot 14 from consist with loco in slot 13.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xB9, 0x0E, 0x0D, 0x45 });
    assertEquals(" basic Consisting Test 03", "Consist loco in slot 14 to loco in slot 13.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xB8, 0x23, 0x0F, 0x44 });
    assertEquals(" basic Consisting Test 04", "Remove loco in slot 35 from consist with loco in slot 15.\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