Search in sources :

Example 36 with XNetInterfaceScaffold

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());
}
Also used : XNetInterfaceScaffold(jmri.jmrix.lenz.XNetInterfaceScaffold) XNetReply(jmri.jmrix.lenz.XNetReply)

Example 37 with XNetInterfaceScaffold

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());
}
Also used : XNetInterfaceScaffold(jmri.jmrix.lenz.XNetInterfaceScaffold) XNetReply(jmri.jmrix.lenz.XNetReply)

Example 38 with XNetInterfaceScaffold

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());
}
Also used : XNetInterfaceScaffold(jmri.jmrix.lenz.XNetInterfaceScaffold) XNetReply(jmri.jmrix.lenz.XNetReply)

Example 39 with XNetInterfaceScaffold

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());
}
Also used : XNetInterfaceScaffold(jmri.jmrix.lenz.XNetInterfaceScaffold) XNetReply(jmri.jmrix.lenz.XNetReply)

Example 40 with XNetInterfaceScaffold

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());
}
Also used : XNetInterfaceScaffold(jmri.jmrix.lenz.XNetInterfaceScaffold) Test(org.junit.Test)

Aggregations

XNetInterfaceScaffold (jmri.jmrix.lenz.XNetInterfaceScaffold)46 LenzCommandStation (jmri.jmrix.lenz.LenzCommandStation)26 XNetReply (jmri.jmrix.lenz.XNetReply)18 XNetSystemConnectionMemo (jmri.jmrix.lenz.XNetSystemConnectionMemo)13 Test (org.junit.Test)13 Before (org.junit.Before)10 XNetListenerScaffold (jmri.jmrix.lenz.XNetListenerScaffold)4 Turnout (jmri.Turnout)3 TurnoutManager (jmri.TurnoutManager)3 XNetThrottleTest (jmri.jmrix.lenz.XNetThrottleTest)2