Search in sources :

Example 26 with CanMessage

use of jmri.jmrix.can.CanMessage in project JMRI by JMRI.

the class CbusMessage method getBootTest.

/**
     * Microchip AN247 format message to check if a module is in boot mode
     */
public static CanMessage getBootTest(int header) {
    CanMessage m = new CanMessage(8, header);
    m.setExtended(true);
    m.setHeader(0x4);
    m.setElement(0, 0);
    m.setElement(1, 0);
    m.setElement(2, 0);
    m.setElement(3, 0);
    m.setElement(4, 0x0D);
    m.setElement(5, 4);
    m.setElement(6, 0);
    m.setElement(7, 0);
    setPri(m, 0xb);
    return m;
}
Also used : CanMessage(jmri.jmrix.can.CanMessage)

Example 27 with CanMessage

use of jmri.jmrix.can.CanMessage in project JMRI by JMRI.

the class CbusMessage method getBootCheck.

/**
     * Microchip AN247 format message to send the checksum for comparison
     */
public static CanMessage getBootCheck(int c, int header) {
    CanMessage m = new CanMessage(8, header);
    m.setExtended(true);
    m.setHeader(0x4);
    m.setElement(0, 0);
    m.setElement(1, 0);
    m.setElement(2, 0);
    m.setElement(3, 0);
    m.setElement(4, 0x0D);
    m.setElement(5, 3);
    m.setElement(6, (c / 256) & 0xff);
    m.setElement(7, c & 0xff);
    setPri(m, 0xb);
    return m;
}
Also used : CanMessage(jmri.jmrix.can.CanMessage)

Example 28 with CanMessage

use of jmri.jmrix.can.CanMessage in project JMRI by JMRI.

the class CbusMessage method getOpsModeWriteCV.

/**
     * CBUS Ops mode programmer commands
     */
public static CanMessage getOpsModeWriteCV(int mAddress, boolean mLongAddr, int cv, int val, int header) {
    CanMessage m = new CanMessage(7, header);
    int address = mAddress;
    m.setElement(0, CbusConstants.CBUS_WCVOA);
    if (mLongAddr) {
        address = address | 0xc000;
    }
    m.setElement(1, address / 256);
    m.setElement(2, address & 0xff);
    m.setElement(3, (cv / 256) & 0xff);
    m.setElement(4, cv & 0xff);
    m.setElement(5, CbusConstants.CBUS_OPS_BYTE);
    m.setElement(6, val);
    setPri(m, 0xb);
    return m;
}
Also used : CanMessage(jmri.jmrix.can.CanMessage)

Example 29 with CanMessage

use of jmri.jmrix.can.CanMessage in project JMRI by JMRI.

the class GridConnectMessageTest method testOne.

// :S123N12345678;
public void testOne() {
    CanMessage m = new CanMessage(0x123);
    m.setExtended(false);
    m.setRtr(false);
    m.setNumDataElements(4);
    m.setElement(0, 0x12);
    m.setElement(1, 0x34);
    m.setElement(2, 0x56);
    m.setElement(3, 0x78);
    GridConnectMessage g = new GridConnectMessage(m);
    Assert.assertEquals("standard format 2 byte", ":S123N12345678;", g.toString());
}
Also used : CanMessage(jmri.jmrix.can.CanMessage)

Example 30 with CanMessage

use of jmri.jmrix.can.CanMessage in project JMRI by JMRI.

the class GridConnectMessageTest method testTwo.

// :XF00DN;
public void testTwo() {
    CanMessage m = new CanMessage(0xF00D);
    m.setExtended(true);
    m.setRtr(false);
    m.setNumDataElements(0);
    GridConnectMessage g = new GridConnectMessage(m);
    Assert.assertEquals("standard format 2 byte", ":X0000F00DN;", g.toString());
}
Also used : CanMessage(jmri.jmrix.can.CanMessage)

Aggregations

CanMessage (jmri.jmrix.can.CanMessage)63 Test (org.junit.Test)4 CanReply (jmri.jmrix.can.CanReply)3 CanListener (jmri.jmrix.can.CanListener)2 CbusAddress (jmri.jmrix.can.cbus.CbusAddress)2 DccLocoAddress (jmri.DccLocoAddress)1 AbstractMRMessage (jmri.jmrix.AbstractMRMessage)1 CanSystemConnectionMemo (jmri.jmrix.can.CanSystemConnectionMemo)1 TestTrafficController (jmri.jmrix.can.TestTrafficController)1 TrafficControllerScaffold (jmri.jmrix.can.TrafficControllerScaffold)1 GridConnectMessage (jmri.jmrix.can.adapters.gridconnect.GridConnectMessage)1 GridConnectReply (jmri.jmrix.can.adapters.gridconnect.GridConnectReply)1 LoaderClient (org.openlcb.LoaderClient)1 OlcbInterface (org.openlcb.OlcbInterface)1 AliasMap (org.openlcb.can.AliasMap)1 CanInterface (org.openlcb.can.CanInterface)1 MessageBuilder (org.openlcb.can.MessageBuilder)1 Hub (org.openlcb.hub.Hub)1