示例#1
0
  @Override
  protected void sendFunctionGroup5() {
    // Functions F21 to F27
    int new_IB2_F21_F27 =
        ((getF27() ? LnConstants.RE_IB2_F27_MASK : 0)
            | (getF26() ? LnConstants.RE_IB2_F26_MASK : 0)
            | (getF25() ? LnConstants.RE_IB2_F25_MASK : 0)
            | (getF24() ? LnConstants.RE_IB2_F24_MASK : 0)
            | (getF23() ? LnConstants.RE_IB2_F23_MASK : 0)
            | (getF22() ? LnConstants.RE_IB2_F22_MASK : 0)
            | (getF21() ? LnConstants.RE_IB2_F21_MASK : 0));
    LocoNetMessage msg = new LocoNetMessage(6);
    msg.setOpCode(LnConstants.RE_OPC_IB2_SPECIAL);
    msg.setElement(1, LnConstants.RE_IB2_SPECIAL_FUNCS_TOKEN);
    msg.setElement(2, slot.getSlot());
    msg.setElement(3, LnConstants.RE_IB2_SPECIAL_F21_F27_TOKEN);
    msg.setElement(4, new_IB2_F21_F27);
    network.sendLocoNetMessage(msg);

    // Function F28 (and F20)
    // F12 is also controlled from this message though IB-II uses RE_OPC_IB2_F9_F12 OPS code for F12
    // - needed to avoid overridding F12 value
    int new_IB2_F20_F28 =
        ((getF12() ? LnConstants.RE_IB2_SPECIAL_F12_MASK : 0)
            | (getF20() ? LnConstants.RE_IB2_SPECIAL_F20_MASK : 0)
            | (getF28() ? LnConstants.RE_IB2_SPECIAL_F28_MASK : 0));
    LocoNetMessage msg2 = new LocoNetMessage(6);
    msg2.setOpCode(LnConstants.RE_OPC_IB2_SPECIAL);
    msg2.setElement(1, LnConstants.RE_IB2_SPECIAL_FUNCS_TOKEN);
    msg2.setElement(2, slot.getSlot());
    msg2.setElement(3, LnConstants.RE_IB2_SPECIAL_F20_F28_TOKEN);
    msg2.setElement(4, new_IB2_F20_F28);
    network.sendLocoNetMessage(msg2);
  }
示例#2
0
  @Override
  protected void sendFunctionGroup4() {
    // Special LocoNet message for Uhlenbrock (IB-I and IB-II) implementation
    // Functions F13 to F19
    int new_IB2_F13_F19 =
        ((getF19() ? LnConstants.RE_IB2_F19_MASK : 0)
            | (getF18() ? LnConstants.RE_IB2_F18_MASK : 0)
            | (getF17() ? LnConstants.RE_IB2_F17_MASK : 0)
            | (getF16() ? LnConstants.RE_IB2_F16_MASK : 0)
            | (getF15() ? LnConstants.RE_IB2_F15_MASK : 0)
            | (getF14() ? LnConstants.RE_IB2_F14_MASK : 0)
            | (getF13() ? LnConstants.RE_IB2_F13_MASK : 0));
    LocoNetMessage msg = new LocoNetMessage(6);
    msg.setOpCode(LnConstants.RE_OPC_IB2_SPECIAL);
    msg.setElement(1, LnConstants.RE_IB2_SPECIAL_FUNCS_TOKEN);
    msg.setElement(2, slot.getSlot());
    msg.setElement(3, LnConstants.RE_IB2_SPECIAL_F13_F19_TOKEN);
    msg.setElement(4, new_IB2_F13_F19);
    network.sendLocoNetMessage(msg);

    // Function F20 (and F28)
    // F12 is also controlled from this message though IB-II uses RE_OPC_IB2_F9_F12 OPS code for F12
    // - needed to avoid overridding F12 value
    int new_IB2_F20_F28 =
        ((getF12() ? LnConstants.RE_IB2_SPECIAL_F12_MASK : 0)
            | (getF20() ? LnConstants.RE_IB2_SPECIAL_F20_MASK : 0)
            | (getF28() ? LnConstants.RE_IB2_SPECIAL_F28_MASK : 0));
    LocoNetMessage msg2 = new LocoNetMessage(6);
    msg2.setOpCode(LnConstants.RE_OPC_IB2_SPECIAL);
    msg2.setElement(1, LnConstants.RE_IB2_SPECIAL_FUNCS_TOKEN);
    msg2.setElement(2, slot.getSlot());
    msg2.setElement(3, LnConstants.RE_IB2_SPECIAL_F20_F28_TOKEN);
    msg2.setElement(4, new_IB2_F20_F28);
    network.sendLocoNetMessage(msg2);
  }
  public void testLocoNetMessages() {
    // send messages for 21, 22
    // notify the Ln that somebody else changed it...
    LocoNetMessage m1 = new LocoNetMessage(4);
    m1.setOpCode(0xb1);
    m1.setElement(1, 0x14); // set CLOSED
    m1.setElement(2, 0x20);
    m1.setElement(3, 0x7b);
    lnis.sendTestMessage(m1);

    // notify the Ln that somebody else changed it...
    LocoNetMessage m2 = new LocoNetMessage(4);
    m2.setOpCode(0xb0);
    m2.setElement(1, 0x15); // set CLOSED
    m2.setElement(2, 0x20);
    m2.setElement(3, 0x7a);
    lnis.sendTestMessage(m2);

    // try to get turnouts to see if they exist
    Assert.assertTrue(null != l.getBySystemName("LT21"));
    Assert.assertTrue(null != l.getBySystemName("LT22"));

    // check the list
    List<String> testList = new ArrayList<String>(2);
    testList.add("LT21");
    testList.add("LT22");
    Assert.assertEquals("system name list", testList, l.getSystemNameList());
  }
示例#4
0
 protected void sendFunctionGroup3() {
   // Special LocoNet message for Uhlenbrock Intellibox-II implementation
   // Intellibox-I uses another implementation for these functions
   // Functions F9 to F12
   int new_IB2_F9_F12 =
       ((getF12() ? LnConstants.RE_IB2_F12_MASK : 0)
           | (getF11() ? LnConstants.RE_IB2_F11_MASK : 0)
           | (getF10() ? LnConstants.RE_IB2_F10_MASK : 0)
           | (getF9() ? LnConstants.RE_IB2_F9_MASK : 0));
   LocoNetMessage msg = new LocoNetMessage(4);
   msg.setOpCode(LnConstants.RE_OPC_IB2_F9_F12);
   msg.setElement(1, slot.getSlot());
   msg.setElement(2, new_IB2_F9_F12);
   network.sendLocoNetMessage(msg);
 }