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