Search in sources :

Example 11 with NceMessage

use of jmri.jmrix.nce.NceMessage in project JMRI by JMRI.

the class NceMacroBackup method readMacroMemory.

// Reads 16 bytes of NCE macro memory, and adjusts for second read 
private NceMessage readMacroMemory(int macroNum, boolean second) {
    // set flag for receive
    secondRead = second;
    int nceMacroAddr = (macroNum * MACRO_LNTH) + CS_MACRO_MEM;
    if (second) {
        // adjust for second memory read
        nceMacroAddr += REPLY_16;
    }
    // Expect 16 byte response
    replyLen = REPLY_16;
    waiting++;
    byte[] bl = NceBinaryCommand.accMemoryRead(nceMacroAddr);
    NceMessage m = NceMessage.createBinaryMessage(tc, bl, REPLY_16);
    return m;
}
Also used : NceMessage(jmri.jmrix.nce.NceMessage)

Example 12 with NceMessage

use of jmri.jmrix.nce.NceMessage in project JMRI by JMRI.

the class NceMacroEditPanel method writeSerialMemoryN.

// Write N bytes of NCE memory 
private void writeSerialMemoryN(int nceMacroAddr, byte[] x, int len) {
    // Expect 1 byte response
    replyLen = NceMessage.REPLY_1;
    waiting++;
    byte[] bl = NceBinaryCommand.accMemoryWriteN(nceMacroAddr, len);
    for (int i = 0; i < len; i++) {
        bl[3 + i] = x[i];
    }
    NceMessage m = NceMessage.createBinaryMessage(tc, bl, NceMessage.REPLY_1);
    tc.sendNceMessage(m, this);
}
Also used : NceMessage(jmri.jmrix.nce.NceMessage)

Example 13 with NceMessage

use of jmri.jmrix.nce.NceMessage in project JMRI by JMRI.

the class ClockMonPanel method issueReadTimeRequest.

@SuppressWarnings("unused")
private void issueReadTimeRequest() {
    if (!waitingForCmdRead) {
        byte[] cmd = jmri.jmrix.nce.NceBinaryCommand.accMemoryRead(CS_CLOCK_MEM_ADDR);
        NceMessage cmdNce = jmri.jmrix.nce.NceMessage.createBinaryMessage(tc, cmd, CS_CLOCK_MEM_SIZE);
        waiting++;
        waitingForCmdRead = true;
        tc.sendNceMessage(cmdNce, this);
    }
    updateTimeFromRead = true;
}
Also used : NceMessage(jmri.jmrix.nce.NceMessage)

Example 14 with NceMessage

use of jmri.jmrix.nce.NceMessage in project JMRI by JMRI.

the class ClockMonPanel method issueClockStart.

private void issueClockStart() {
    byte[] cmd = jmri.jmrix.nce.NceBinaryCommand.accStartClock();
    NceMessage cmdNce = jmri.jmrix.nce.NceMessage.createBinaryMessage(tc, cmd, CMD_CLOCK_SET_REPLY_SIZE);
    waiting++;
    waitingForCmdStart = true;
    tc.sendNceMessage(cmdNce, this);
}
Also used : NceMessage(jmri.jmrix.nce.NceMessage)

Example 15 with NceMessage

use of jmri.jmrix.nce.NceMessage in project JMRI by JMRI.

the class ClockMonPanel method issueReadStatusRequest.

@SuppressWarnings("unused")
private void issueReadStatusRequest() {
    if (!waitingForCmdRead) {
        byte[] cmd = jmri.jmrix.nce.NceBinaryCommand.accMemoryRead(CS_CLOCK_MEM_ADDR);
        NceMessage cmdNce = jmri.jmrix.nce.NceMessage.createBinaryMessage(tc, cmd, CS_CLOCK_MEM_SIZE);
        waiting++;
        waitingForCmdRead = true;
        tc.sendNceMessage(cmdNce, this);
    }
    updateStatusFromRead = true;
}
Also used : NceMessage(jmri.jmrix.nce.NceMessage)

Aggregations

NceMessage (jmri.jmrix.nce.NceMessage)46 IOException (java.io.IOException)3 BufferedReader (java.io.BufferedReader)2 File (java.io.File)2 FileNotFoundException (java.io.FileNotFoundException)2 FileReader (java.io.FileReader)2 JFileChooser (javax.swing.JFileChooser)2 JPanel (javax.swing.JPanel)2 NceReply (jmri.jmrix.nce.NceReply)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1