Search in sources :

Example 1 with ProgDebugger

use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.

the class AddressedHighCvProgrammerFacadeTest method testWriteReadDirectHighCV.

public void testWriteReadDirectHighCV() throws jmri.ProgrammerException, InterruptedException {
    ProgDebugger dp = new ProgDebugger();
    dp.setTestReadLimit(1024);
    dp.setTestWriteLimit(1024);
    Programmer p = new AddressedHighCvProgrammerFacade(dp, "256", "253", "254", "255", "100");
    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 H not written", !dp.hasBeenWritten(253));
    Assert.assertTrue("index L not written", !dp.hasBeenWritten(254));
    Assert.assertTrue("index val not written", !dp.hasBeenWritten(255));
    p.readCV("258", l);
    waitReply();
    Assert.assertEquals("read back", 12, readValue);
}
Also used : Programmer(jmri.Programmer) ProgDebugger(jmri.progdebugger.ProgDebugger) ProgListener(jmri.ProgListener)

Example 2 with ProgDebugger

use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.

the class AddressedHighCvProgrammerFacadeTest method testWriteReadDirect.

public void testWriteReadDirect() throws jmri.ProgrammerException, InterruptedException {
    ProgDebugger dp = new ProgDebugger();
    dp.setTestReadLimit(256);
    dp.setTestWriteLimit(256);
    Programmer p = new AddressedHighCvProgrammerFacade(dp, "256", "253", "254", "255", "100");
    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("4", 12, l);
    waitReply();
    Assert.assertEquals("target written", 12, dp.getCvVal(4));
    Assert.assertTrue("index H not written", !dp.hasBeenWritten(253));
    Assert.assertTrue("index L not written", !dp.hasBeenWritten(254));
    Assert.assertTrue("index val not written", !dp.hasBeenWritten(255));
    p.readCV(4, l);
    waitReply();
    Assert.assertEquals("read back", 12, readValue);
}
Also used : Programmer(jmri.Programmer) ProgDebugger(jmri.progdebugger.ProgDebugger) ProgListener(jmri.ProgListener)

Example 3 with ProgDebugger

use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.

the class ResettingOffsetHighCvProgrammerFacadeTest method testWriteReadDirect.

public void testWriteReadDirect() throws jmri.ProgrammerException, InterruptedException {
    ProgDebugger dp = new ProgDebugger();
    dp.setTestReadLimit(256);
    dp.setTestWriteLimit(256);
    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("4", 12, l);
    waitReply();
    Assert.assertEquals("target written", 12, dp.getCvVal(4));
    Assert.assertTrue("index not written", !dp.hasBeenWritten(7));
    p.readCV(4, l);
    waitReply();
    Assert.assertEquals("read back", 12, readValue);
}
Also used : Programmer(jmri.Programmer) ProgDebugger(jmri.progdebugger.ProgDebugger) ProgListener(jmri.ProgListener)

Example 4 with ProgDebugger

use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.

the class ResettingOffsetHighCvProgrammerFacadeTest method testWriteReadIndexed.

public void testWriteReadIndexed() throws jmri.ProgrammerException, InterruptedException {
    ProgDebugger dp = new ProgDebugger();
    dp.setTestReadLimit(256);
    dp.setTestWriteLimit(256);
    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.assertTrue("target not written", !dp.hasBeenWritten(258));
    // wrote 220, then wrote back
    Assert.assertEquals("index written", 0, dp.getCvVal(7));
    Assert.assertEquals("value written", 12, dp.getCvVal(58));
    Assert.assertEquals("did 3 operations", 3, dp.nOperations);
}
Also used : Programmer(jmri.Programmer) ProgDebugger(jmri.progdebugger.ProgDebugger) ProgListener(jmri.ProgListener)

Example 5 with ProgDebugger

use of jmri.progdebugger.ProgDebugger 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)

Aggregations

ProgDebugger (jmri.progdebugger.ProgDebugger)40 Programmer (jmri.Programmer)33 ProgListener (jmri.ProgListener)27 JLabel (javax.swing.JLabel)4 Element (org.jdom2.Element)4 DocType (org.jdom2.DocType)2 Document (org.jdom2.Document)2 DefaultProgrammerManager (jmri.managers.DefaultProgrammerManager)1 Before (org.junit.Before)1