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());
}
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());
}
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());
}
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);
}
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);
}
Aggregations