Search in sources :

Example 21 with CanMessage

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;
}
Also used : CanMessage(jmri.jmrix.can.CanMessage)

Example 22 with CanMessage

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;
}
Also used : CanMessage(jmri.jmrix.can.CanMessage)

Example 23 with CanMessage

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;
}
Also used : CanMessage(jmri.jmrix.can.CanMessage)

Example 24 with CanMessage

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);
}
Also used : CanMessage(jmri.jmrix.can.CanMessage)

Example 25 with CanMessage

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