use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.
the class EliteXNetProgrammerTest method testWriteRegisterSequence.
public void testWriteRegisterSequence() throws JmriException {
// infrastructure objects
XNetInterfaceScaffold t = new XNetInterfaceScaffold(new HornbyEliteCommandStation());
EliteXNetListenerScaffold l = new EliteXNetListenerScaffold();
EliteXNetProgrammer p = new EliteXNetProgrammer(t);
// set register mode
p.setMode(DefaultProgrammerManager.REGISTERMODE);
// and do the write
p.writeCV(29, 12, l);
// check "prog mode" message sent
Assert.assertEquals("read message sent", 2, t.outbound.size());
Assert.assertEquals("write message contents", "23 12 05 0C 38", t.outbound.elementAt(0).toString());
// send reply
XNetReply mr1 = new XNetReply();
mr1.setElement(0, 0x61);
mr1.setElement(1, 0x02);
mr1.setElement(2, 0x63);
t.sendTestMessage(mr1);
Assert.assertEquals("enquire message sent", 2, t.outbound.size());
Assert.assertEquals("enquire message contents", "21 10 31", t.outbound.elementAt(1).toString());
}
use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.
the class EliteXNetProgrammerTest method testReadCvSequenceString.
public void testReadCvSequenceString() throws JmriException {
// infrastructure objects
XNetInterfaceScaffold t = new XNetInterfaceScaffold(new HornbyEliteCommandStation());
EliteXNetListenerScaffold l = new EliteXNetListenerScaffold();
EliteXNetProgrammer p = new EliteXNetProgrammer(t);
// and do the read
p.readCV("10", l);
// check "prog mode" message sent
Assert.assertEquals("mode message sent", 2, t.outbound.size());
Assert.assertEquals("read message contents", "22 15 0A 3D", t.outbound.elementAt(0).toString());
// send reply
XNetReply mr1 = new XNetReply();
mr1.setElement(0, 0x61);
mr1.setElement(1, 0x02);
mr1.setElement(2, 0x63);
t.sendTestMessage(mr1);
Assert.assertEquals("enquire message sent", 2, t.outbound.size());
Assert.assertEquals("enquire message contents", "21 10 31", t.outbound.elementAt(1).toString());
}
use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.
the class EliteXNetProgrammerTest method testWriteCvSequence.
public void testWriteCvSequence() throws JmriException {
// infrastructure objects
XNetInterfaceScaffold t = new XNetInterfaceScaffold(new HornbyEliteCommandStation());
EliteXNetListenerScaffold l = new EliteXNetListenerScaffold();
EliteXNetProgrammer p = new EliteXNetProgrammer(t);
// and do the write
p.writeCV(10, 20, l);
// check "prog mode" message sent
Assert.assertEquals("mode message sent", 2, t.outbound.size());
Assert.assertEquals("write message contents", "23 16 0A 14 2B", t.outbound.elementAt(0).toString());
// send reply
XNetReply mr1 = new XNetReply();
mr1.setElement(0, 0x61);
mr1.setElement(1, 0x02);
mr1.setElement(2, 0x63);
t.sendTestMessage(mr1);
Assert.assertEquals("enquire message sent", 2, t.outbound.size());
Assert.assertEquals("enquire message contents", "21 10 31", t.outbound.elementAt(1).toString());
}
use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.
the class EliteXNetProgrammerTest method testReadCvSequence.
public void testReadCvSequence() throws JmriException {
// infrastructure objects
XNetInterfaceScaffold t = new XNetInterfaceScaffold(new HornbyEliteCommandStation());
EliteXNetListenerScaffold l = new EliteXNetListenerScaffold();
EliteXNetProgrammer p = new EliteXNetProgrammer(t);
// and do the read
p.readCV(10, l);
// check "prog mode" message sent
Assert.assertEquals("mode message sent", 2, t.outbound.size());
Assert.assertEquals("read message contents", "22 15 0A 3D", t.outbound.elementAt(0).toString());
// send reply
XNetReply mr1 = new XNetReply();
mr1.setElement(0, 0x61);
mr1.setElement(1, 0x02);
mr1.setElement(2, 0x63);
t.sendTestMessage(mr1);
Assert.assertEquals("enquire message sent", 2, t.outbound.size());
Assert.assertEquals("enquire message contents", "21 10 31", t.outbound.elementAt(1).toString());
}
use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.
the class EliteXNetSystemConnectionMemoTest method testCtor.
@Test
public void testCtor() {
// infrastructure objects
XNetInterfaceScaffold tc = new XNetInterfaceScaffold(new HornbyEliteCommandStation());
EliteXNetSystemConnectionMemo t = new EliteXNetSystemConnectionMemo(tc);
Assert.assertNotNull(t);
Assert.assertNotNull(t.getXNetTrafficController());
// While we are constructing the memo, we should also set the
// SystemMemo parameter in the traffic controller.
Assert.assertNotNull(tc.getSystemConnectionMemo());
}
Aggregations