Search in sources :

Example 1 with LnTurnout

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

the class LlnmonTest method testSwichMessages.

public void testSwichMessages() {
    LocoNetMessage l;
    l = new LocoNetMessage(new int[] { 0xBD, 0x00, 0x00, 0x00 });
    assertEquals("Switch test 1", "Requesting Switch at LT1 () to Thrown (Off (open)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x00, 0x20, 0x00 });
    assertEquals("Switch test 2", "Requesting Switch at LT1 () to Closed (Off (open)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x00, 0x10, 0x00 });
    assertEquals("Switch test 3", "Requesting Switch at LT1 () to Thrown (On (sink)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x00, 0x30, 0x00 });
    assertEquals("Switch test 4", "Requesting Switch at LT1 () to Closed (On (sink)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x01, 0x30, 0x00 });
    assertEquals("Switch test 5", "Requesting Switch at LT2 () to Closed (On (sink)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x02, 0x30, 0x00 });
    assertEquals("Switch test 6", "Requesting Switch at LT3 () to Closed (On (sink)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x04, 0x30, 0x00 });
    assertEquals("Switch test 7", "Requesting Switch at LT5 () to Closed (On (sink)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x08, 0x30, 0x00 });
    assertEquals("Switch test 8", "Requesting Switch at LT9 () to Closed (On (sink)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x10, 0x30, 0x00 });
    assertEquals("Switch test 9", "Requesting Switch at LT17 () to Closed (On (sink)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x20, 0x30, 0x00 });
    assertEquals("Switch test 10", "Requesting Switch at LT33 () to Closed (On (sink)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x40, 0x30, 0x00 });
    assertEquals("Switch test 11", "Requesting Switch at LT65 () to Closed (On (sink)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x00, 0x31, 0x00 });
    assertEquals("Switch test 12", "Requesting Switch at LT129 () to Closed (On (sink)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x00, 0x32, 0x00 });
    assertEquals("Switch test 13", "Requesting Switch at LT257 () to Closed (On (sink)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x00, 0x34, 0x00 });
    assertEquals("Switch test 14", "Requesting Switch at LT513 () to Closed (On (sink)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x00, 0x38, 0x00 });
    assertEquals("Switch test 15", "Requesting Switch at LT1025 () to Closed (On (sink)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x00, 0x10, 0x00 });
    assertEquals("Switch test 16", "Requesting Switch at LT1 () to Thrown (On (sink)), with acknowledgment.\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x00, 0x00, 0x00 });
    assertEquals("Switch test 17", "Request status of switch LT1 ().\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x01, 0x00, 0x00 });
    assertEquals("Switch test 18", "Request status of switch LT2 ().\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x02, 0x00, 0x00 });
    assertEquals("Switch test 19", "Request status of switch LT3 ().\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x04, 0x00, 0x00 });
    assertEquals("Switch test 20", "Request status of switch LT5 ().\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x08, 0x00, 0x00 });
    assertEquals("Switch test 21", "Request status of switch LT9 ().\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x10, 0x00, 0x00 });
    assertEquals("Switch test 22", "Request status of switch LT17 ().\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x20, 0x00, 0x00 });
    assertEquals("Switch test 23", "Request status of switch LT33 ().\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x40, 0x00, 0x00 });
    assertEquals("Switch test 24", "Request status of switch LT65 ().\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x00, 0x01, 0x00 });
    assertEquals("Switch test 25", "Request status of switch LT129 ().\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x00, 0x02, 0x00 });
    assertEquals("Switch test 26", "Request status of switch LT257 ().\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x00, 0x04, 0x00 });
    assertEquals("Switch test 27", "Request status of switch LT513 ().\n", f.displayMessage(l));
    LnTurnout t = (LnTurnout) lntm.provideTurnout("LT513");
    l = new LocoNetMessage(new int[] { 0xBC, 0x00, 0x04, 0x00 });
    assertEquals("Switch test 27", "Request status of switch LT513 ().\n", f.displayMessage(l));
    t.setUserName("This User Name");
    l = new LocoNetMessage(new int[] { 0xBC, 0x00, 0x04, 0x00 });
    assertEquals("Switch test 27", "Request status of switch LT513 (This User Name).\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x00, 0x08, 0x00 });
    assertEquals("Switch test 28", "Request status of switch LT1025 ().\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x00, 0x40, 0x02 });
    assertEquals("Switch test 29", "Unable to parse LocoNet message.\ncontents: BD 00 40 02\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x00, 0x10, 0x53 });
    assertEquals("Switch test 30", "Unable to parse LocoNet message.\ncontents: BC 00 10 53\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x00, 0x20, 0x63 });
    assertEquals("Switch test 31", "Unable to parse LocoNet message.\ncontents: BC 00 20 63\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBC, 0x00, 0x40, 0x33 });
    assertEquals("Switch test 32", "Unable to parse LocoNet message.\ncontents: BC 00 40 33\n", f.displayMessage(l));
    l = new LocoNetMessage(new int[] { 0xBD, 0x00, 0x40, 0x00 });
    assertEquals("Switch test 33", "Unable to parse LocoNet message.\ncontents: BD 00 40 00\n", f.displayMessage(l));
}
Also used : LnTurnout(jmri.jmrix.loconet.LnTurnout) LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage)

Aggregations

LnTurnout (jmri.jmrix.loconet.LnTurnout)1 LocoNetMessage (jmri.jmrix.loconet.LocoNetMessage)1