Search in sources :

Example 11 with ProgListener

use of jmri.ProgListener in project JMRI by JMRI.

the class SlotManagerTest method testWriteCVDirect.

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

Example 12 with ProgListener

use of jmri.ProgListener in project JMRI by JMRI.

the class SlotManagerTest method testWriteCVRegister.

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

Example 13 with ProgListener

use of jmri.ProgListener in project JMRI by JMRI.

the class SlotManagerTest method testReadCVPagedString.

// Test names ending with "String" are for the new writeCV(String, ...) 
// etc methods.  If you remove the older writeCV(int, ...) tests, 
// you can rename these. Note that not all (int,...) tests may have a 
// String(String, ...) test defined, in which case you should create those.
public void testReadCVPagedString() throws jmri.ProgrammerException {
    String CV1 = "12";
    ProgListener p2 = null;
    slotmanager.setMode(DefaultProgrammerManager.PAGEMODE);
    slotmanager.readCV(CV1, p2);
    Assert.assertEquals("read message", "EF 0E 7C 23 00 00 00 00 00 0B 00 7F 7F 00", lnis.outbound.elementAt(lnis.outbound.size() - 1).toString());
}
Also used : ProgListener(jmri.ProgListener)

Example 14 with ProgListener

use of jmri.ProgListener in project JMRI by JMRI.

the class DebugProgrammerTest method testWriteRead.

public void testWriteRead() throws jmri.ProgrammerException, InterruptedException {
    Programmer p = new ProgDebugger();
    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();
    log.debug("readValue is " + readValue);
    p.readCV(4, l);
    waitReply();
    log.debug("readValue is " + readValue);
    Assert.assertEquals("read back", 12, readValue);
}
Also used : Programmer(jmri.Programmer) ProgListener(jmri.ProgListener)

Example 15 with ProgListener

use of jmri.ProgListener in project JMRI by JMRI.

the class DebugProgrammerTest method testWriteReadString.

// Test names ending with "String" are for the new writeCV(String, ...) 
// etc methods.  If you remove the older writeCV(int, ...) tests, 
// you can rename these. Note that not all (int,...) tests may have a 
// String(String, ...) test defined, in which case you should create those.
public void testWriteReadString() throws jmri.ProgrammerException, InterruptedException {
    Programmer p = new ProgDebugger();
    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();
    log.debug("readValue is " + readValue);
    p.readCV("4", l);
    waitReply();
    log.debug("readValue is " + readValue);
    Assert.assertEquals("read back", 12, readValue);
}
Also used : Programmer(jmri.Programmer) ProgListener(jmri.ProgListener)

Aggregations

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