Search in sources :

Example 26 with XNetMessage

use of jmri.jmrix.lenz.XNetMessage in project JMRI by JMRI.

the class Z21XNetSimulatorAdapterTest method testGenerateEmergencyStopAllReply.

@Test
public void testGenerateEmergencyStopAllReply() {
    Z21XNetSimulatorAdapter a = new Z21XNetSimulatorAdapter();
    Assert.assertEquals("CS Emergeny Stop All Reply", new XNetReply("81 00 81"), a.generateReply(new XNetMessage("80 80")));
}
Also used : XNetReply(jmri.jmrix.lenz.XNetReply) XNetMessage(jmri.jmrix.lenz.XNetMessage) Test(org.junit.Test)

Example 27 with XNetMessage

use of jmri.jmrix.lenz.XNetMessage in project JMRI by JMRI.

the class Z21XNetSimulatorAdapterTest method testGenerateEmergencyStopLocoReplyV1V2.

@Test
public void testGenerateEmergencyStopLocoReplyV1V2() {
    Z21XNetSimulatorAdapter a = new Z21XNetSimulatorAdapter();
    Assert.assertEquals("CS Emergeny Stop Specific Loco (XNetV1,V2)", new XNetReply("01 04 05"), a.generateReply(new XNetMessage("91 02 93")));
}
Also used : XNetReply(jmri.jmrix.lenz.XNetReply) XNetMessage(jmri.jmrix.lenz.XNetMessage) Test(org.junit.Test)

Example 28 with XNetMessage

use of jmri.jmrix.lenz.XNetMessage in project JMRI by JMRI.

the class Z21XNetSimulatorAdapterTest method testGenerateCSVersionReply.

@Test
public void testGenerateCSVersionReply() {
    Z21XNetSimulatorAdapter a = new Z21XNetSimulatorAdapter();
    Assert.assertEquals("CS Version Reply", new XNetReply("63 21 30 12 60"), a.generateReply(new XNetMessage("21 21 00")));
}
Also used : XNetReply(jmri.jmrix.lenz.XNetReply) XNetMessage(jmri.jmrix.lenz.XNetMessage) Test(org.junit.Test)

Example 29 with XNetMessage

use of jmri.jmrix.lenz.XNetMessage in project JMRI by JMRI.

the class LZ100InternalFrame method message.

// listen for responses from the LZ100
@Override
public synchronized void message(XNetReply l) {
    if (l.isOkMessage()) {
        /* this was an "OK" message
             We're only paying attention to it if we're 
             resetting the command station 
             */
        if (status.getText().equals(rb.getString("LZ100StatusSetMode"))) {
            status.setText(rb.getString("LZ100StatusOK"));
        }
        if (resetMode == OFFSENT) {
            XNetMessage msgon = XNetMessage.getFunctionGroup1OpsMsg(0, false, false, false, false, true);
            sendCount--;
            resetMode = ONSENT;
            tc.sendXNetMessage(msgon, this);
        } else if (resetMode == ONSENT) {
            XNetMessage msgoff = XNetMessage.getFunctionGroup1OpsMsg(0, false, false, false, false, false);
            if (sendCount >= 0) {
                resetMode = OFFSENT;
            } else {
                resetMode = IDLE;
                resetCSButton.setEnabled(true);
                status.setText(rb.getString("LZ100ResetFinished"));
            }
            tc.sendXNetMessage(msgoff, this);
        }
    } else if (l.getElement(0) == XNetConstants.CS_REQUEST_RESPONSE && l.getElement(1) == XNetConstants.CS_STATUS_RESPONSE) {
        int statusByte = l.getElement(2);
        if ((statusByte & 0x04) == 0x04) {
            isAutoMode.setSelected(true);
            isManualMode.setSelected(false);
            autoMode = true;
            status.setText(rb.getString("LZ100StatusOK"));
        } else {
            isAutoMode.setSelected(false);
            isManualMode.setSelected(true);
            autoMode = false;
            status.setText(rb.getString("LZ100StatusOK"));
        }
    }
}
Also used : XNetMessage(jmri.jmrix.lenz.XNetMessage)

Example 30 with XNetMessage

use of jmri.jmrix.lenz.XNetMessage in project JMRI by JMRI.

the class LI101Frame method readLI101Settings.

//Send Information request to LI101
void readLI101Settings() {
    /* First, we request setting an out of range address
         to get the current value. */
    XNetMessage msg = XNetMessage.getLIAddressRequestMsg(32);
    //Then send to the controller
    tc.sendXNetMessage(msg, this);
    /* Next, we request setting an out of range speed request
         to get the current value. */
    XNetMessage msg2 = XNetMessage.getLISpeedRequestMsg(6);
    //Then send to the controller
    tc.sendXNetMessage(msg2, this);
}
Also used : XNetMessage(jmri.jmrix.lenz.XNetMessage)

Aggregations

XNetMessage (jmri.jmrix.lenz.XNetMessage)55 XNetReply (jmri.jmrix.lenz.XNetReply)14 Test (org.junit.Test)14 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)2 IOException (java.io.IOException)1 XNetListenerScaffold (jmri.jmrix.lenz.XNetListenerScaffold)1 Z21Reply (jmri.jmrix.roco.z21.Z21Reply)1