Search in sources :

Example 26 with LocoNetMessage

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

the class LlnmonTest method testBasicSensorReportMessages.

public void testBasicSensorReportMessages() {
    LocoNetMessage l;
    l = new LocoNetMessage(new int[] { 0xB2, 0x20, 0x41, 0x2C });
    assertEquals(" basic Sensor Report Test 01", "Sensor LS321 () is Low.  (BDL16 # 21, DS1; DS54/DS64 # 41, AuxA/A1).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xB2, 0x20, 0x61, 0x0C });
    assertEquals(" basic Sensor Report Test 02", "Sensor LS322 () is Low.  (BDL16 # 21, DS2; DS54/DS64 # 41, SwiA/S1).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xB2, 0x23, 0x41, 0x2C });
    assertEquals(" basic Sensor Report Test 03", "Sensor LS327 () is Low.  (BDL16 # 21, DS7; DS54/DS64 # 41, AuxD/A4).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xB2, 0x23, 0x61, 0x0C });
    assertEquals(" basic Sensor Report Test 04", "Sensor LS328 () is Low.  (BDL16 # 21, DS8; DS54/DS64 # 41, SwiD/S4).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xB2, 0x00, 0x10, 0x0C });
    assertEquals(" basic Sensor Report Test 05", "Sensor LS1 () is High.  (BDL16 # 1, DS1; DS54/DS64/SE8c # 1, AuxA/A1/DS01).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xB2, 0x00, 0x20, 0x0C });
    assertEquals(" basic Sensor Report Test 06", "Sensor LS2 () is Low.  (BDL16 # 1, DS2; DS54/DS64/SE8c # 1, SwiA/S1/DS02).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xB2, 0x00, 0x00, 0x0C });
    assertEquals(" basic Sensor Report Test 07", "Sensor LS1 () is Low.  (BDL16 # 1, DS1; DS54/DS64/SE8c # 1, AuxA/A1/DS01).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xB2, 0x00, 0x70, 0x0C });
    assertEquals(" basic Sensor Report Test 08", "Sensor LS2 () is High.  (BDL16 # 1, DS2; DS54/DS64/SE8c # 1, SwiA/S1/DS02).\n", f.displayMessage(l));
}
Also used : LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage)

Example 27 with LocoNetMessage

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

the class LnPr2PowerManagerTest method hearOff.

@Override
protected void hearOff() {
    LocoNetMessage m = new LocoNetMessage(16);
    m.setOpCode(LnConstants.OPC_PEER_XFER);
    m.setElement(1, 0x10);
    m.setElement(2, 0x22);
    m.setElement(3, 0x22);
    m.setElement(4, 0x01);
    m.setElement(5, 0x00);
    m.setElement(6, 0x00);
    m.setElement(7, 0x00);
    m.setElement(8, 0x00);
    m.setElement(9, 0x00);
    m.setElement(10, 0x00);
    m.setElement(11, 0x00);
    m.setElement(12, 0x00);
    m.setElement(13, 0x00);
    m.setElement(14, 0x00);
    controller.sendTestMessage(m);
}
Also used : LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage)

Example 28 with LocoNetMessage

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

the class LlnmonTest method testThrottleMessages.

public void testThrottleMessages() {
    LocoNetMessage l;
    l = new LocoNetMessage(new int[] { 0xE5, 0x10, 0x7f, 0x00, 0x00, 0x0, 1, 2, 0, 0, 0x70, 0, 0, 0, 0, 0x00 });
    assertEquals("Throttle message 1", "Throttle Semaphore Symbol Control: " + "Loco 130, Semaphore body unlit, " + "Vertical arm unlit, Diagonal arm unlit, Horizontal arm unlit; " + "Any lit arms are non-blinking.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x10, 0x7f, 0x00, 0x00, 0x0, 1, 2, 0x10, 0, 0x70, 0, 0, 0, 0, 0x00 });
    assertEquals("Throttle message 2", "Throttle Semaphore Symbol Control: " + "Loco 130, Semaphore body lit, " + "Vertical arm unlit, Diagonal arm unlit, Horizontal arm unlit; " + "Any lit arms are non-blinking.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x10, 0x7f, 0x00, 0x00, 0x0, 3, 4, 0x01, 0, 0x70, 0, 0, 0, 0, 0x00 });
    assertEquals("Throttle message 3", "Throttle Semaphore Symbol Control: " + "Loco 388, Semaphore body unlit, " + "Vertical arm unlit, Diagonal arm unlit, Horizontal arm unlit; " + "Any lit arms are blinking.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x10, 0x7f, 0x00, 0x00, 0x0, 3, 4, 0x02, 0, 0x70, 0, 0, 0, 0, 0x00 });
    assertEquals("Throttle message 3", "Throttle Semaphore Symbol Control: " + "Loco 388, Semaphore body unlit, " + "Vertical arm unlit, Diagonal arm unlit, Horizontal arm lit; " + "Any lit arms are non-blinking.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x10, 0x7f, 0x00, 0x00, 0x0, 3, 4, 0x04, 0, 0x70, 0, 0, 0, 0, 0x00 });
    assertEquals("Throttle message 3", "Throttle Semaphore Symbol Control: " + "Loco 388, Semaphore body unlit, " + "Vertical arm unlit, Diagonal arm lit, Horizontal arm unlit; " + "Any lit arms are non-blinking.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x10, 0x7f, 0x00, 0x00, 0x0, 3, 4, 0x08, 0, 0x70, 0, 0, 0, 0, 0x00 });
    assertEquals("Throttle message 3", "Throttle Semaphore Symbol Control: " + "Loco 388, Semaphore body unlit, " + "Vertical arm lit, Diagonal arm unlit, Horizontal arm unlit; " + "Any lit arms are non-blinking.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xe5, 0x10, 0x7f, 0x00, 0x00, 0, 0x31, 0x41, 0x51, 0x61, 0, 0x32, 0x33, 0x34, 0x35, 0 });
    assertEquals("Throttle message 3", "Send Throttle Text Message to all throttles with message 1AQa2345.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xe5, 0x10, 0x7f, 0x00, 0x01, 0, 0x21, 0x22, 0x23, 0x24, 0, 0x25, 0x26, 0x27, 0x28, 0 });
    assertEquals("Throttle message 3", "Send Throttle Text Message to Throttle 128 with message !\"#$%&'(.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x10, 0x7e, 0x00, 0x00, 0x0, 1, 2, 0, 0, 0x70, 0, 0, 0, 0, 0x00 });
    assertEquals("Throttle message 1", "Unable to parse LocoNet message.\ncontents: E5 10 7E 00 00 00 01 02 00 00 70 00 00 00 00 00\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x10, 0x7f, 0x05, 0x00, 0x0, 0x30, 0x30, 0x30, 0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0x00 });
    assertEquals("Throttle message 1", "Send Throttle Text Message to Throttle 5 with message 00000000.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x10, 0x7f, 0x00, 0x22, 0x0, 0x31, 0x32, 0x30, 0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0x00 });
    assertEquals("Throttle message 1", "Send Throttle Text Message to Throttle 4352 with message 12000000.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x10, 0x7f, 0x00, 0x00, 0x10, 1, 2, 0, 0, 0x70, 0, 0, 0, 0, 0x00 });
    assertEquals("Throttle message 1", "Throttle Semaphore Symbol Control: Loco 130, Semaphore body unlit, Vertical arm unlit, Diagonal arm unlit, Horizontal arm unlit; Any lit arms are non-blinking.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x10, 0x7f, 0x00, 0x00, 0x0, 0x41, 0x42, 0x41, 0x41, 0x60, 0x50, 0x50, 0x50, 0x50, 0x00 });
    assertEquals("Throttle message 1", "Send Throttle Text Message to all throttles with message ABAAPPPP.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x10, 0x7f, 0x00, 0x00, 0x0, 0x41, 0x42, 0x41, 0x41, 0x20, 0x50, 0x50, 0x50, 0x50, 0x00 });
    assertEquals("Throttle message 1", "Send Throttle Text Message to all throttles with message ABAAPPPP.\n", f.displayMessage(l));
}
Also used : LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage)

Example 29 with LocoNetMessage

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

the class LlnmonTest method testTetherlessQueryAndReplies.

public void testTetherlessQueryAndReplies() {
    LocoNetMessage l;
    l = new LocoNetMessage(new int[] { 0xDF, 0x00, 0x00, 0x00, 0x00, 0x20 });
    assertEquals(" Tetherless Query/Reply test 01", "Query Tetherless Receivers.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x03, 0x10, 0x00, 0x45, 0x4E, 0x4C, 0x32, 0x00, 0x30, 0x31, 0x31, 0x20, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x62 });
    assertEquals(" Tetherless Query/Reply test 02", "Reported Duplex Group Name=\"ENL2011 \", Password=00000000, Channel=26, ID=0.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD7, 0x12, 0x00, 0x0F, 0x20, 0x15 });
    assertEquals(" Tetherless Query/Reply test 03", "UR92 Responding with LocoNet ID 7, duplex enabled.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD7, 0x1F, 0x00, 0x06, 0x00, 0x30 });
    assertEquals(" Tetherless Query/Reply test 04", "UR91 Responding with LocoNet ID 6.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD7, 0x1F, 0x00, 0x00, 0x00, 0x30 });
    assertEquals(" Tetherless Query/Reply test 05", "UR91 Responding with LocoNet ID 0.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x02, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04 });
    assertEquals(" Tetherless Query/Reply test 06", "Query Duplex Channel.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x02, 0x10, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06 });
    assertEquals(" Tetherless Query/Reply test 07", "Reported Duplex Channel is 26.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 });
    assertEquals(" Tetherless Query/Reply test 08", "Query Duplex Password.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xE5, 0x14, 0x07, 0x10, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19 });
    assertEquals(" Tetherless Query/Reply test 09", "Reported Duplex Password is 0000.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xDF, 0x40, 0x1F, 0x05, 0x00, 0x00 });
    assertEquals(" Tetherless Query/Reply test 10", "Set LocoNet ID to 5.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xDF, 0x30, 0x01, 0x05, 0x00, 0x00 });
    assertEquals(" Tetherless Query/Reply test 11", "Unable to parse LocoNet message.\ncontents: DF 30 01 05 00 00\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD7, 0x17, 0x00, 0x00, 0x00, 0x3F });
    assertEquals(" Tetherless Query/Reply test 12", "UR90 Responding with LocoNet ID 0.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD7, 0x17, 0x00, 0x01, 0x00, 0x3F });
    assertEquals(" Tetherless Query/Reply test 13", "UR90 Responding with LocoNet ID 1.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD7, 0x17, 0x00, 0x02, 0x00, 0x3F });
    assertEquals(" Tetherless Query/Reply test 14", "UR90 Responding with LocoNet ID 2.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD7, 0x17, 0x00, 0x03, 0x00, 0x3F });
    assertEquals(" Tetherless Query/Reply test 15", "UR90 Responding with LocoNet ID 3.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD7, 0x17, 0x00, 0x04, 0x00, 0x3F });
    assertEquals(" Tetherless Query/Reply test 16", "UR90 Responding with LocoNet ID 4.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD7, 0x17, 0x00, 0x05, 0x00, 0x3F });
    assertEquals(" Tetherless Query/Reply test 17", "UR90 Responding with LocoNet ID 5.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD7, 0x17, 0x00, 0x06, 0x00, 0x3F });
    assertEquals(" Tetherless Query/Reply test 18", "UR90 Responding with LocoNet ID 6.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xD7, 0x17, 0x00, 0x07, 0x00, 0x3F });
    assertEquals(" Tetherless Query/Reply test 19", "UR90 Responding with LocoNet ID 7.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xDF, 0x40, 0x00, 0x00, 0x00, 0x60 });
    assertEquals(" Tetherless Query/Reply test 20", "Unable to parse LocoNet message.\ncontents: DF 40 00 00 00 60\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xDF, 0x01, 0x00, 0x00, 0x00, 0x60 });
    assertEquals(" Tetherless Query/Reply test 20", "Unable to parse LocoNet message.\ncontents: DF 01 00 00 00 60\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xDF, 0x01, 0x01, 0x00, 0x00, 0x60 });
    assertEquals(" Tetherless Query/Reply test 20", "Unable to parse LocoNet message.\ncontents: DF 01 01 00 00 60\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xDF, 0x01, 0x08, 0x00, 0x00, 0x60 });
    assertEquals(" Tetherless Query/Reply test 20", "Unable to parse LocoNet message.\ncontents: DF 01 08 00 00 60\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xDF, 0x01, 0x29, 0x00, 0x00, 0x60 });
    assertEquals(" Tetherless Query/Reply test 20", "Unable to parse LocoNet message.\ncontents: DF 01 29 00 00 60\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xDF, 0x01, 0x00, 0x01, 0x00, 0x60 });
    assertEquals(" Tetherless Query/Reply test 20", "Unable to parse LocoNet message.\ncontents: DF 01 00 01 00 60\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xDF, 0x01, 0x00, 0x40, 0x00, 0x60 });
    assertEquals(" Tetherless Query/Reply test 20", "Unable to parse LocoNet message.\ncontents: DF 01 00 40 00 60\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xDF, 0x01, 0x00, 0x00, 0x08, 0x60 });
    assertEquals(" Tetherless Query/Reply test 20", "Unable to parse LocoNet message.\ncontents: DF 01 00 00 08 60\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xDF, 0x01, 0x00, 0x00, 0x7f, 0x60 });
    assertEquals(" Tetherless Query/Reply test 20", "Unable to parse LocoNet message.\ncontents: DF 01 00 00 7F 60\n", f.displayMessage(l));
}
Also used : LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage)

Example 30 with LocoNetMessage

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

the class LlnmonTest method testConvertToMixed.

public void testConvertToMixed() {
    LocoNetMessage l;
    l = new LocoNetMessage(new int[] { 0xbf, 0x00, 0x01, 0x7f });
    assertEquals("convert To Mixed 1", "Request slot for loco address 1.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x7d, 0x01, 0x7f });
    assertEquals("convert To Mixed 2", "Request slot for loco address 1(short).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x7F, 0x01, 0x7f });
    assertEquals("convert To Mixed 3", "Request slot for loco address 1.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x00, 99, 0x7f });
    assertEquals("convert To Mixed 4", "Request slot for loco address 99.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x7d, 99, 0x7f });
    assertEquals("convert To Mixed 5", "Request slot for loco address 99(short).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x7f, 99, 0x7f });
    assertEquals("convert To Mixed 6", "Request slot for loco address 99.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x00, 100, 0x7f });
    assertEquals("convert To Mixed 7", "Request slot for loco address 100 (a0).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x7d, 100, 0x7f });
    assertEquals("convert To Mixed 8", "Request slot for loco address 100(short) (a0).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x7f, 109, 0x7f });
    assertEquals("convert To Mixed 9", "Request slot for loco address 109 (a9).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x00, 111, 0x7f });
    assertEquals("convert To Mixed 10", "Request slot for loco address 111 (b1).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x7d, 111, 0x7f });
    assertEquals("convert To Mixed 11", "Request slot for loco address 111(short) (b1).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x7f, 114, 0x7f });
    assertEquals("convert To Mixed 12", "Request slot for loco address 114 (b4).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x00, 122, 0x7f });
    assertEquals("convert To Mixed 13", "Request slot for loco address 122 (c2).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x7d, 122, 0x7f });
    assertEquals("convert To Mixed 14", "Request slot for loco address 122(short) (c2).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x7f, 123, 0x7f });
    assertEquals("convert To Mixed 15", "Request slot for loco address 123 (c3).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x01, 14, 0x7f });
    assertEquals("convert To Mixed 16", "Request slot for loco address 142.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xbf, 0x7b, 1, 0x7f });
    assertEquals("convert To Mixed 17", "Request slot for loco address 15745.\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