Search in sources :

Example 6 with NceMessage

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

the class NceShowCabPanel method readCabMemory16.

// Reads 16 bytes of NCE cab memory 
private void readCabMemory16(int cabNum, int offset) {
    int nceCabAddr = getNceCabAddr(cabNum, offset);
    // Expect 16 byte response
    replyLen = NceMessage.REPLY_16;
    waiting++;
    byte[] bl = NceBinaryCommand.accMemoryRead(nceCabAddr);
    NceMessage m = NceMessage.createBinaryMessage(tc, bl, NceMessage.REPLY_16);
    tc.sendNceMessage(m, this);
}
Also used : NceMessage(jmri.jmrix.nce.NceMessage)

Example 7 with NceMessage

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

the class ClockMonPanel method issueReadOnlyRequest.

private void issueReadOnlyRequest() {
    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);
    //   log.debug("issueReadOnlyRequest at " + internalClock.getTime());
    }
}
Also used : NceMessage(jmri.jmrix.nce.NceMessage)

Example 8 with NceMessage

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

the class ClockMonPanel method issueClock1224.

private void issueClock1224(boolean mode) {
    byte[] cmd = jmri.jmrix.nce.NceBinaryCommand.accSetClock1224(mode);
    NceMessage cmdNce = jmri.jmrix.nce.NceMessage.createBinaryMessage(tc, cmd, CMD_CLOCK_SET_REPLY_SIZE);
    waiting++;
    waitingForCmd1224 = true;
    tc.sendNceMessage(cmdNce, this);
}
Also used : NceMessage(jmri.jmrix.nce.NceMessage)

Example 9 with NceMessage

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

the class NcePacketGenPanelTest method testPacketCreate.

public void testPacketCreate() {
    NcePacketGenPanel t = new NcePacketGenPanel();
    NceMessage m = t.createPacket("12 34 AB 3 19 6 B B1");
    Assert.assertEquals("length", 8, m.getNumDataElements());
    Assert.assertEquals("0th byte", 0x12, m.getElement(0) & 0xFF);
    Assert.assertEquals("1st byte", 0x34, m.getElement(1) & 0xFF);
    Assert.assertEquals("2nd byte", 0xAB, m.getElement(2) & 0xFF);
    Assert.assertEquals("3rd byte", 0x03, m.getElement(3) & 0xFF);
    Assert.assertEquals("4th byte", 0x19, m.getElement(4) & 0xFF);
    Assert.assertEquals("5th byte", 0x06, m.getElement(5) & 0xFF);
    Assert.assertEquals("6th byte", 0x0B, m.getElement(6) & 0xFF);
    Assert.assertEquals("7th byte", 0xB1, m.getElement(7) & 0xFF);
}
Also used : NceMessage(jmri.jmrix.nce.NceMessage)

Example 10 with NceMessage

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

the class NceMacroBackup method getNceMacro.

// Read 20 bytes of NCE CS memory
private void getNceMacro(int mN) {
    NceMessage m = readMacroMemory(mN, false);
    tc.sendNceMessage(m, this);
    // wait for read to complete, flag determines if 1st or 2nd read
    if (!readWait()) {
        return;
    }
    NceMessage m2 = readMacroMemory(mN, true);
    tc.sendNceMessage(m2, this);
    readWait();
}
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