Search in sources :

Example 11 with XNetMessage

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

the class Z21XPressNetTunnel method loadChars.

/**
     * Get characters from the input source, and file a message.
     * <P>
     * Returns only when the message is complete.
     * <P>
     * Only used in the Receive thread.
     *
     * @returns filled message
     * @throws IOException when presented by the input source.
     */
private XNetMessage loadChars() throws java.io.IOException {
    int i;
    byte char1;
    char1 = readByteProtected(inpipe);
    // opCode+Nbytes+ECC
    int len = (char1 & 0x0f) + 2;
    // 3 payload bytes, but really only has two.
    if ((char1 & 0xff) == Z21Constants.LAN_X_GET_TURNOUT_INFO) {
        len = 4;
    }
    XNetMessage msg = new XNetMessage(len);
    msg.setElement(0, char1 & 0xFF);
    for (i = 1; i < len; i++) {
        char1 = readByteProtected(inpipe);
        msg.setElement(i, char1 & 0xFF);
    }
    return msg;
}
Also used : XNetMessage(jmri.jmrix.lenz.XNetMessage)

Example 12 with XNetMessage

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

the class Z21XNetThrottle method sendStatusInformationRequest.

// sendStatusInformation sends a request to get the speed,direction
// and function status from the command station
@Override
protected synchronized void sendStatusInformationRequest() {
    /* Send the request for status */
    XNetMessage msg = Z21XNetMessage.getZ21LocomotiveInfoRequestMsg(this.address);
    // Since we repeat this ourselves, don't ask the 
    msg.setRetries(1);
    // traffic controller to do this for us.
    // now, we queue the message for sending to the command station
    queueMessage(msg, THROTTLESTATSENT);
    return;
}
Also used : XNetMessage(jmri.jmrix.lenz.XNetMessage)

Example 13 with XNetMessage

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

the class Z21XNetThrottle method sendFunctionGroup4.

/**
     * Send the XpressNet message to set the state of functions F13, F14, F15,
     * F16, F17, F18, F19, F20
     */
@Override
protected void sendFunctionGroup4() {
    // because of the way the z21 wants to see the functions, we
    // send all the functions when there is a change in the group.
    XNetMessage msg = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 13, f13);
    // now, queue the message for sending to the command station
    queueMessage(msg, THROTTLEFUNCSENT);
    XNetMessage msg1 = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 14, f14);
    // now, queue the message for sending to the command station
    queueMessage(msg1, THROTTLEFUNCSENT);
    XNetMessage msg2 = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 15, f15);
    // now, queue the message for sending to the command station
    queueMessage(msg2, THROTTLEFUNCSENT);
    XNetMessage msg3 = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 16, f16);
    // now, queue the message for sending to the command station
    queueMessage(msg3, THROTTLEFUNCSENT);
    XNetMessage msg4 = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 17, f17);
    // now, queue the message for sending to the command station
    queueMessage(msg4, THROTTLEFUNCSENT);
    XNetMessage msg5 = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 18, f18);
    // now, queue the message for sending to the command station
    queueMessage(msg5, THROTTLEFUNCSENT);
    XNetMessage msg6 = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 19, f19);
    // now, queue the message for sending to the command station
    queueMessage(msg6, THROTTLEFUNCSENT);
    XNetMessage msg7 = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 20, f20);
    // now, queue the message for sending to the command station
    queueMessage(msg7, THROTTLEFUNCSENT);
}
Also used : XNetMessage(jmri.jmrix.lenz.XNetMessage)

Example 14 with XNetMessage

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

the class Z21XNetThrottle method sendFunctionGroup1.

/**
     * Send the XpressNet messages to set the state of locomotive direction and
     * functions F0, F1, F2, F3, F4
     */
@Override
protected void sendFunctionGroup1() {
    // because of the way the z21 wants to see the functions, we
    // send all the functions when there is a change in the group.
    XNetMessage msg = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 0, f0);
    // now, queue the message for sending to the command station
    queueMessage(msg, THROTTLEFUNCSENT);
    XNetMessage msg1 = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 1, f1);
    // now, queue the message for sending to the command station
    queueMessage(msg1, THROTTLEFUNCSENT);
    XNetMessage msg2 = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 2, f2);
    // now, queue the message for sending to the command station
    queueMessage(msg2, THROTTLEFUNCSENT);
    XNetMessage msg3 = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 3, f3);
    // now, queue the message for sending to the command station
    queueMessage(msg3, THROTTLEFUNCSENT);
    XNetMessage msg4 = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 4, f4);
    // now, queue the message for sending to the command station
    queueMessage(msg4, THROTTLEFUNCSENT);
}
Also used : XNetMessage(jmri.jmrix.lenz.XNetMessage)

Example 15 with XNetMessage

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

the class Z21XNetThrottle method sendFunctionGroup2.

/**
     * Send the XpressNet message to set the state of functions F5, F6, F7, F8
     */
@Override
protected void sendFunctionGroup2() {
    // because of the way the z21 wants to see the functions, we
    // send all the functions when there is a change in the group.
    XNetMessage msg = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 5, f5);
    // now, queue the message for sending to the command station
    queueMessage(msg, THROTTLEFUNCSENT);
    XNetMessage msg1 = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 6, f6);
    // now, queue the message for sending to the command station
    queueMessage(msg1, THROTTLEFUNCSENT);
    XNetMessage msg2 = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 7, f7);
    // now, queue the message for sending to the command station
    queueMessage(msg2, THROTTLEFUNCSENT);
    XNetMessage msg3 = Z21XNetMessage.getZ21LocomotiveFunctionOperationMsg(this.getDccAddress(), 8, f8);
    // now, queue the message for sending to the command station
    queueMessage(msg3, THROTTLEFUNCSENT);
}
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