jmri.jmrix.can
Class CanReply

java.lang.Object
  extended by jmri.jmrix.AbstractMessage
      extended by jmri.jmrix.AbstractMRReply
          extended by jmri.jmrix.can.CanReply
All Implemented Interfaces:
CanFrame, CanMutableFrame, Message

public class CanReply
extends AbstractMRReply
implements CanMutableFrame

Base class for replies in a CANbus based message/reply protocol.

It is expected that any CAN based system will be based upon basic CANbus concepts such as ID (standard or extended), Normal and RTR frames and a data field.

"header" refers to the full 11 or 29 bit header; which mode is separately set via the "extended" parameter

CBUS uses a 2-bit "Pri" field and 7-bit "ID" ("CAN ID") field, with separate accessors.

Author:
Andrew Crosland Copyright (C) 2008, Bob Jacobsen Copyright (C) 2008, 2009, 2010

Field Summary
 
Fields inherited from class jmri.jmrix.AbstractMRReply
DEFAULTMAXSIZE
 
Fields inherited from class jmri.jmrix.AbstractMessage
_dataChars, _nDataChars
 
Constructor Summary
CanReply()
           
CanReply(CanReply m)
           
CanReply(int i)
           
CanReply(int[] d)
           
 
Method Summary
 boolean equals(Object a)
          Note that a CanMessage and a CanReply can be tested for equality
 int getElement(int n)
           
 int getHeader()
           
 int getNumDataElements()
           
 int hashCode()
          Hash on the header
 boolean isExtended()
           
 boolean isRtr()
           
 void setData(int[] d)
           
 void setElement(int n, int v)
           
 void setExtended(boolean b)
           
 void setHeader(int h)
           
 void setNumDataElements(int n)
           
 void setRtr(boolean b)
           
protected  int skipPrefix(int index)
           
 
Methods inherited from class jmri.jmrix.AbstractMRReply
flush, getOpCode, isBinary, isRetransmittableErrorMsg, isUnsolicited, match, maxSize, pollValue, setBinary, setOpCode, setUnsolicited, skipWhiteSpace, toString, value
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CanReply

public CanReply()

CanReply

public CanReply(int i)

CanReply

public CanReply(int[] d)

CanReply

public CanReply(CanReply m)
Method Detail

hashCode

public int hashCode()
Hash on the header

Overrides:
hashCode in class Object

equals

public boolean equals(Object a)
Note that a CanMessage and a CanReply can be tested for equality

Overrides:
equals in class Object

skipPrefix

protected int skipPrefix(int index)
Specified by:
skipPrefix in class AbstractMRReply

getNumDataElements

public int getNumDataElements()
Specified by:
getNumDataElements in interface CanFrame
Specified by:
getNumDataElements in interface Message
Overrides:
getNumDataElements in class AbstractMessage

setNumDataElements

public void setNumDataElements(int n)
Specified by:
setNumDataElements in interface CanMutableFrame

getElement

public int getElement(int n)
Specified by:
getElement in interface CanFrame
Specified by:
getElement in interface Message
Overrides:
getElement in class AbstractMessage

setElement

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

setData

public void setData(int[] d)

getHeader

public int getHeader()
Specified by:
getHeader in interface CanFrame

setHeader

public void setHeader(int h)
Specified by:
setHeader in interface CanMutableFrame

isExtended

public boolean isExtended()
Specified by:
isExtended in interface CanFrame

setExtended

public void setExtended(boolean b)
Specified by:
setExtended in interface CanMutableFrame

isRtr

public boolean isRtr()
Specified by:
isRtr in interface CanFrame

setRtr

public void setRtr(boolean b)
Specified by:
setRtr in interface CanMutableFrame


Copyright © 1997 - 2011 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