jmri.jmrix.sprog
Class SprogMessage

Show UML class diagram
java.lang.Object
  extended by jmri.jmrix.AbstractMessage
      extended by jmri.jmrix.AbstractMRMessage
          extended by jmri.jmrix.sprog.SprogMessage
All Implemented Interfaces:
Message

public class SprogMessage
extends AbstractMRMessage

Encodes a message to an SPROG command station.

The SprogReply class handles the response from the command station.


Field Summary
static int CR
           
static int DLE
           
static int ER_FLASH
           
static int ETX
           
static int LF
           
(package private) static org.slf4j.Logger log
           
static int MAXSIZE
           
static int RD_VER
           
static int STX
           
static int WT_EEDATA
           
static int WT_FLASH
           
 
Fields inherited from class jmri.jmrix.AbstractMRMessage
LONG_TIMEOUT, SHORT_TIMEOUT
 
Fields inherited from class jmri.jmrix.AbstractMessage
_dataChars, _nDataChars
 
Constructor Summary
SprogMessage(byte[] packet)
          Creates a new SprogMessage containing a byte array to represent a packet to output
SprogMessage(int i)
           
SprogMessage(SprogMessage m)
           
SprogMessage(String s)
           
 
Method Summary
static SprogMessage getEnableMain()
           
static SprogMessage getEraseFlash(int addr, int rows)
           
static SprogMessage getExitProgMode()
           
 byte[] getFormattedMessage(SprogConstants.SprogState sprogState)
          Get formatted message for direct output to stream - this is the final format of the message as a byte array
static SprogMessage getKillMain()
           
static SprogMessage getPacketMessage(byte[] bytes)
          Get a message containing a DCC packet
static SprogMessage getProgMode()
           
static SprogMessage getReadBootVersion()
           
static SprogMessage getReadCV(int cv, int mode)
           
static SprogMessage getReadRegister(int reg)
           
static SprogMessage getReset()
           
static SprogMessage getStatus()
           
static SprogMessage getV4EndOfFile()
           
static SprogMessage getv4ExtAddr()
           
static SprogMessage getV4WriteFlash(int addr, int[] data, int type)
           
static SprogMessage getWriteCV(int cv, int val, int mode)
           
static SprogMessage getWriteEE(int addr, int[] data)
           
static SprogMessage getWriteFlash(int addr, int[] data, int blockLen)
           
static SprogMessage getWriteRegister(int reg, int val)
           
 boolean isEnableMain()
           
 boolean isKillMain()
           
 void setElement(int n, int v)
           
 String toString()
           
 
Methods inherited from class jmri.jmrix.AbstractMRMessage
addIntAsFourHex, addIntAsThree, addIntAsThreeHex, addIntAsTwoHex, getNeededMode, getOpCode, getOpCodeHex, getRetries, getTimeout, isBinary, replyExpected, setBinary, setNeededMode, setOpCode, setRetries, setTimeout
 
Methods inherited from class jmri.jmrix.AbstractMessage
getElement, getNumDataElements
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STX

public static final int STX
See Also:
Constant Field Values

DLE

public static final int DLE
See Also:
Constant Field Values

ETX

public static final int ETX
See Also:
Constant Field Values

CR

public static final int CR
See Also:
Constant Field Values

LF

public static final int LF
See Also:
Constant Field Values

RD_VER

public static final int RD_VER
See Also:
Constant Field Values

WT_FLASH

public static final int WT_FLASH
See Also:
Constant Field Values

ER_FLASH

public static final int ER_FLASH
See Also:
Constant Field Values

WT_EEDATA

public static final int WT_EEDATA
See Also:
Constant Field Values

MAXSIZE

public static final int MAXSIZE
See Also:
Constant Field Values

log

static org.slf4j.Logger log
Constructor Detail

SprogMessage

public SprogMessage(int i)

SprogMessage

public SprogMessage(byte[] packet)
Creates a new SprogMessage containing a byte array to represent a packet to output

Parameters:
packet - The contents of the packet

SprogMessage

public SprogMessage(String s)

SprogMessage

public SprogMessage(SprogMessage m)
Method Detail

setElement

public void setElement(int n,
                       int v)
Specified by:
setElement in interface Message
Overrides:
setElement in class AbstractMessage

toString

public String toString()
Specified by:
toString in interface Message
Overrides:
toString in class AbstractMRMessage

getFormattedMessage

public byte[] getFormattedMessage(SprogConstants.SprogState sprogState)
Get formatted message for direct output to stream - this is the final format of the message as a byte array

Parameters:
sprogState - a SprogState variable representing the current state of the Sprog
Returns:
the formatted message as a byte array

isKillMain

public boolean isKillMain()

isEnableMain

public boolean isEnableMain()

getEnableMain

public static SprogMessage getEnableMain()

getKillMain

public static SprogMessage getKillMain()

getProgMode

public static SprogMessage getProgMode()

getExitProgMode

public static SprogMessage getExitProgMode()

getStatus

public static SprogMessage getStatus()

getReadCV

public static SprogMessage getReadCV(int cv,
                                     int mode)

getWriteCV

public static SprogMessage getWriteCV(int cv,
                                      int val,
                                      int mode)

getReadRegister

public static SprogMessage getReadRegister(int reg)

getWriteRegister

public static SprogMessage getWriteRegister(int reg,
                                            int val)

getPacketMessage

public static SprogMessage getPacketMessage(byte[] bytes)
Get a message containing a DCC packet

Parameters:
bytes - byte[]
Returns:
SprogMessage

getReadBootVersion

public static SprogMessage getReadBootVersion()

getWriteFlash

public static SprogMessage getWriteFlash(int addr,
                                         int[] data,
                                         int blockLen)

getV4WriteFlash

public static SprogMessage getV4WriteFlash(int addr,
                                           int[] data,
                                           int type)

getV4EndOfFile

public static SprogMessage getV4EndOfFile()

getv4ExtAddr

public static SprogMessage getv4ExtAddr()

getEraseFlash

public static SprogMessage getEraseFlash(int addr,
                                         int rows)

getWriteEE

public static SprogMessage getWriteEE(int addr,
                                      int[] data)

getReset

public static SprogMessage getReset()


Copyright © 1997-2013 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads