Search in sources :

Example 21 with Programmer

use of jmri.Programmer in project JMRI by JMRI.

the class OffsetHighCvProgrammerFacadeTest method testCvLimit.

public void testCvLimit() {
    ProgDebugger dp = new ProgDebugger();
    dp.setTestReadLimit(256);
    dp.setTestWriteLimit(256);
    Programmer p = new OffsetHighCvProgrammerFacade(dp, "256", "7", "10", "100");
    Assert.assertTrue("CV limit read OK", p.getCanRead("1024"));
    Assert.assertTrue("CV limit write OK", p.getCanWrite("1024"));
    Assert.assertTrue("CV limit read fail", !p.getCanRead("1025"));
    Assert.assertTrue("CV limit write fail", !p.getCanWrite("1025"));
}
Also used : Programmer(jmri.Programmer) ProgDebugger(jmri.progdebugger.ProgDebugger)

Example 22 with Programmer

use of jmri.Programmer in project JMRI by JMRI.

the class OffsetHighCvProgrammerFacadeTest method testWriteReadDirect.

public void testWriteReadDirect() throws jmri.ProgrammerException, InterruptedException {
    ProgDebugger dp = new ProgDebugger();
    dp.setTestReadLimit(256);
    dp.setTestWriteLimit(256);
    Programmer p = new OffsetHighCvProgrammerFacade(dp, "256", "7", "10", "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 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 23 with Programmer

use of jmri.Programmer in project JMRI by JMRI.

the class MultiIndexProgrammerFacadeTest method testWriteReadDoubleIndexedCvList.

public void testWriteReadDoubleIndexedCvList() throws jmri.ProgrammerException, InterruptedException {
    ProgDebugger dp = new ProgDebugger();
    Programmer p = new MultiIndexProgrammerFacade(dp, "81", "82", false, false);
    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("45.46.123", 12, l);
    waitReply();
    Assert.assertEquals("index 1 written", 45, dp.getCvVal(81));
    Assert.assertEquals("index 2 written", 46, dp.getCvVal(82));
    Assert.assertEquals("value written", 12, dp.getCvVal(123));
    dp.clearHasBeenWritten(81);
    dp.clearHasBeenWritten(82);
    p.readCV("45.46.123", l);
    waitReply();
    Assert.assertEquals("read back", 12, readValue);
    Assert.assertEquals("index 1 written", 45, dp.getCvVal(81));
    Assert.assertEquals("index 2 written", 46, dp.getCvVal(82));
    dp.clearHasBeenWritten(81);
    dp.clearHasBeenWritten(82);
    p.readCV("45.46.123", l);
    waitReply();
    Assert.assertEquals("read back", 12, readValue);
    Assert.assertEquals("index 1 written", 45, dp.getCvVal(81));
    Assert.assertEquals("index 2 written", 46, dp.getCvVal(82));
    dp.clearHasBeenWritten(81);
    dp.clearHasBeenWritten(82);
    p.readCV("45.46.123", l);
    waitReply();
    Assert.assertEquals("read back", 12, readValue);
    Assert.assertEquals("index 1 written", 45, dp.getCvVal(81));
    Assert.assertEquals("index 2 written", 46, dp.getCvVal(82));
}
Also used : Programmer(jmri.Programmer) ProgDebugger(jmri.progdebugger.ProgDebugger) ProgListener(jmri.ProgListener)

Example 24 with Programmer

use of jmri.Programmer in project JMRI by JMRI.

the class MultiIndexProgrammerFacadeTest method testWriteReadSingleIndexedCvLast.

public void testWriteReadSingleIndexedCvLast() throws jmri.ProgrammerException, InterruptedException {
    ProgDebugger dp = new ProgDebugger();
    Programmer p = new MultiIndexProgrammerFacade(dp, "81", "82", false, false);
    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("45.123", 12, l);
    waitReply();
    Assert.assertEquals("index 1 written", 45, dp.getCvVal(81));
    Assert.assertTrue("index 2 not written", !dp.hasBeenWritten(82));
    Assert.assertEquals("value written", 12, dp.getCvVal(123));
    dp.clearHasBeenWritten(81);
    dp.clearHasBeenWritten(82);
    p.readCV("45.123", l);
    waitReply();
    Assert.assertEquals("read back", 12, readValue);
    Assert.assertEquals("index 1 written", 45, dp.getCvVal(81));
    Assert.assertTrue("index 2 not written", !dp.hasBeenWritten(82));
    Assert.assertEquals("index written", 45, dp.getCvVal(81));
}
Also used : Programmer(jmri.Programmer) ProgDebugger(jmri.progdebugger.ProgDebugger) ProgListener(jmri.ProgListener)

Example 25 with Programmer

use of jmri.Programmer in project JMRI by JMRI.

the class TwoIndexTcsProgrammerFacadeTest method testWriteReadDirect.

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

Aggregations

Programmer (jmri.Programmer)63 ProgDebugger (jmri.progdebugger.ProgDebugger)33 ProgListener (jmri.ProgListener)27 JFrame (javax.swing.JFrame)4 JPanel (javax.swing.JPanel)3 ProgrammerException (jmri.ProgrammerException)3 IdentifyLoco (jmri.jmrit.roster.IdentifyLoco)3 PaneOpsProgFrame (jmri.jmrit.symbolicprog.tabbedframe.PaneOpsProgFrame)3 BoxLayout (javax.swing.BoxLayout)2 JLabel (javax.swing.JLabel)2 JMenuBar (javax.swing.JMenuBar)2 AddressedProgrammerManager (jmri.AddressedProgrammerManager)2 GlobalProgrammerManager (jmri.GlobalProgrammerManager)2 DecoderFile (jmri.jmrit.decoderdefn.DecoderFile)2 IdentifyDecoder (jmri.jmrit.decoderdefn.IdentifyDecoder)2 ProgModeSelector (jmri.jmrit.progsupport.ProgModeSelector)2 RosterEntry (jmri.jmrit.roster.RosterEntry)2 CvTableModel (jmri.jmrit.symbolicprog.CvTableModel)2 IndexedCvTableModel (jmri.jmrit.symbolicprog.IndexedCvTableModel)2 KnownLocoSelPane (jmri.jmrit.symbolicprog.KnownLocoSelPane)2