Search in sources :

Example 6 with ProgListener

use of jmri.ProgListener in project JMRI by JMRI.

the class ResettingOffsetHighCvProgrammerFacadeTest method testWriteReadDirectHighCV.

public void testWriteReadDirectHighCV() throws jmri.ProgrammerException, InterruptedException {
    ProgDebugger dp = new ProgDebugger();
    dp.setTestReadLimit(1024);
    dp.setTestWriteLimit(1024);
    Programmer p = new ResettingOffsetHighCvProgrammerFacade(dp, "256", "7", "10", "100", "200");
    ProgListener l = new ProgListener() {

        @Override
        public void programmingOpReply(int value, int status) {
            log.debug("callback value=" + value + " status=" + status);
            replied = true;
            readValue = value;
        }
    };
    p.writeCV("258", 12, l);
    waitReply();
    Assert.assertEquals("target written", 12, dp.getCvVal(258));
    Assert.assertTrue("index not written", !dp.hasBeenWritten(7));
    p.readCV("258", l);
    waitReply();
    Assert.assertEquals("read back", 12, readValue);
}
Also used : Programmer(jmri.Programmer) ProgDebugger(jmri.progdebugger.ProgDebugger) ProgListener(jmri.ProgListener)

Example 7 with ProgListener

use of jmri.ProgListener in project JMRI by JMRI.

the class SlotManagerTest method testWriteCVPaged.

public void testWriteCVPaged() throws jmri.ProgrammerException {
    int CV1 = 12;
    int val2 = 34;
    ProgListener p3 = null;
    slotmanager.setMode(DefaultProgrammerManager.PAGEMODE);
    slotmanager.writeCV(CV1, val2, p3);
    Assert.assertEquals("write message", "EF 0E 7C 63 00 00 00 00 00 0B 22 7F 7F 00", lnis.outbound.elementAt(lnis.outbound.size() - 1).toString());
}
Also used : ProgListener(jmri.ProgListener)

Example 8 with ProgListener

use of jmri.ProgListener in project JMRI by JMRI.

the class SlotManagerTest method testWriteCVOpsShortAddr.

public void testWriteCVOpsShortAddr() throws jmri.ProgrammerException {
    int CV1 = 12;
    int val2 = 34;
    ProgListener p3 = null;
    slotmanager.writeCVOpsMode(CV1, val2, p3, 22, false);
    Assert.assertEquals("write message", "EF 0E 7C 67 00 00 16 00 00 0B 22 7F 7F 00", lnis.outbound.elementAt(lnis.outbound.size() - 1).toString());
}
Also used : ProgListener(jmri.ProgListener)

Example 9 with ProgListener

use of jmri.ProgListener in project JMRI by JMRI.

the class SlotManagerTest method testReadCVOpsModeShort.

public void testReadCVOpsModeShort() throws jmri.ProgrammerException {
    int CV1 = 12;
    ProgListener p2 = null;
    slotmanager.readCVOpsMode(CV1, p2, 22, false);
    Assert.assertEquals("read message", "EF 0E 7C 2F 00 00 16 00 00 0B 00 7F 7F 00", lnis.outbound.elementAt(lnis.outbound.size() - 1).toString());
}
Also used : ProgListener(jmri.ProgListener)

Example 10 with ProgListener

use of jmri.ProgListener in project JMRI by JMRI.

the class SlotManagerTest method testReadCVRegister.

public void testReadCVRegister() throws jmri.ProgrammerException {
    int CV1 = 2;
    ProgListener p2 = null;
    slotmanager.setMode(DefaultProgrammerManager.REGISTERMODE);
    slotmanager.readCV(CV1, p2);
    Assert.assertEquals("read message", "EF 0E 7C 13 00 00 00 00 00 01 00 7F 7F 00", lnis.outbound.elementAt(lnis.outbound.size() - 1).toString());
}
Also used : ProgListener(jmri.ProgListener)

Aggregations

ProgListener (jmri.ProgListener)53 Programmer (jmri.Programmer)27 ProgDebugger (jmri.progdebugger.ProgDebugger)27 ProgrammerException (jmri.ProgrammerException)3