use of jmri.jmrix.can.CanMessage in project JMRI by JMRI.
the class CbusMessage method getBootInitialise.
/**
* Microchip AN247 format message to initialise the bootloader and set the
* start address
*/
public static CanMessage getBootInitialise(int a, int header) {
CanMessage m = new CanMessage(8, header);
m.setExtended(true);
m.setHeader(0x4);
m.setElement(0, (a / 65536) & 0xFF);
m.setElement(1, (a / 256) & 0xFF);
m.setElement(2, a & 0xFF);
m.setElement(3, 0);
m.setElement(4, 0x0D);
m.setElement(5, 2);
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 getBootWriteData.
/**
* Microchip AN247 format message to write 8 bytes of data
*/
public static CanMessage getBootWriteData(int[] d, int header) {
CanMessage m = new CanMessage(8, header);
m.setExtended(true);
m.setHeader(0x5);
try {
m.setElement(0, d[0] & 0xff);
m.setElement(1, d[1] & 0xff);
m.setElement(2, d[2] & 0xff);
m.setElement(3, d[3] & 0xff);
m.setElement(4, d[4] & 0xff);
m.setElement(5, d[5] & 0xff);
m.setElement(6, d[6] & 0xff);
m.setElement(7, d[7] & 0xff);
} catch (Exception e) {
log.error("Exception in bootloader data" + e);
}
setPri(m, 0xb);
return m;
}
use of jmri.jmrix.can.CanMessage in project JMRI by JMRI.
the class CbusMessage method getRequestTrackOff.
public static CanMessage getRequestTrackOff(int header) {
CanMessage m = new CanMessage(1, header);
m.setElement(0, CbusConstants.CBUS_RTOF);
setPri(m, 0xb);
return m;
}
use of jmri.jmrix.can.CanMessage in project JMRI by JMRI.
the class CbusProgrammer method readCV.
@Override
public synchronized void readCV(int varnum, jmri.ProgListener p) throws jmri.ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("readCV " + varnum + " listens " + p);
}
useProgrammer(p);
programmerReadOperation = true;
progState = COMMANDSENT;
operationVariableNumber = varnum;
// start the error timer
startLongTimer();
// format and send the read message.
int[] frame = new int[] { 0x71, (nodenumber / 256) & 0xFF, nodenumber & 0xFF, operationVariableNumber & 0xFF };
CanMessage m = new CanMessage(frame, tc.getCanid());
tc.sendCanMessage(m, this);
}
use of jmri.jmrix.can.CanMessage in project JMRI by JMRI.
the class CbusProgrammer method writeCV.
// programming interface
@Override
public synchronized void writeCV(int varnum, int val, jmri.ProgListener p) throws jmri.ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("write " + varnum + " listens " + p);
}
useProgrammer(p);
programmerReadOperation = false;
// set state
// no reply to write
progState = NOTPROGRAMMING;
operationValue = val;
operationVariableNumber = varnum;
// format and send the write message.
int[] frame = new int[] { 0x96, (nodenumber / 256) & 0xFF, nodenumber & 0xFF, operationVariableNumber & 0xFF, operationValue & 0xFF };
CanMessage m = new CanMessage(frame, tc.getCanid());
tc.sendCanMessage(m, this);
// no reply, so don't want for reply
progState = NOTPROGRAMMING;
notifyProgListenerEnd(operationValue, jmri.ProgListener.OK);
}
Aggregations