|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--EDU.cmu.cs.coral.cye.JCyeMsg
JCyeMsg implements the message protocol used by the Cye robot. This class should NOT be used by a end-user of the JavaCye package.
Constructor Summary | |
protected |
JCyeMsg(byte d)
JCyeMsg constructor |
Method Summary | |
protected void |
Add(byte b)
Adds a byte to the message buffer. |
protected int |
CalcCRC(byte[] a,
int len)
Calculates the CRC value for a byte array. |
protected byte |
CombineBytes(byte b1,
byte b2)
Combine two four-bit values into a single byte. |
protected byte |
GetBufByte(int i)
Gets a particular buffer byte. |
protected int |
GetDestAddr()
Gets the message destination address. |
protected byte[] |
GetMsgBuf()
Returns the raw buffer data. |
protected int |
GetMsgID()
Gets the message ID number. |
protected int |
GetMsgLen()
Returns the message length. |
protected int |
GetRxMsgNum()
Gets the message RX number. |
protected int |
GetSrcAddr()
Gets the message source address. |
protected int |
GetTxMsgNum()
Gets the TX message number. |
protected void |
ParseReply()
Extract address, message number, and message type from a freshly-received JCyeMsg. |
protected void |
Print()
Pretty-prints a JCyeMsg object to System.out. |
protected void |
SetBufByte(int i,
byte b)
Sets a particular buffer byte to a specified value. |
protected void |
SetDestAddr(int Addr)
Sets the message destination address. |
protected void |
SetMsgID(int ID)
Sets the message ID number. |
protected void |
SetRxMsgNum(int Num)
Sets the message RX number. |
protected void |
SetSrcAddr(int Addr)
Sets the message source address. |
protected void |
SetTxMsgNum(int Num)
Sets the TX message number. |
protected byte[] |
SplitByte(byte b)
Split a byte into two four-bit values. |
protected JCyeMsg |
toTransmitArray()
Converts all of the ugly protocol information into a pretty byte array ready to be pushed through the serial port. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int MAX_MSG_LEN
public static final byte PC_SRC_ADDR
public static final byte CMD_SET_DEST
public static final byte CMD_SET_HEADING_DEST
public static final byte CMD_SET_TURN
public static final byte CMD_SET_MOTORS_PWM
public static final byte CMD_SET_MAXPWM
public static final byte CMD_SET_MAXSPEED
public static final byte CMD_SET_MOTORS_VELOCITY
public static final byte CMD_SET_HEADING_CORRECT_FACTOR
public static final byte CMD_SET_POSITIONVELOCITY_DEST
public static final byte CMD_STOP_MOTORS
public static final byte CMD_REQUEST_POSITION
public static final byte CMD_SET_HEADING
public static final byte CMD_SET_POSITION
public static final byte CMD_GO_STRAIGHT_VELOCITY
public static final byte CMD_SET_SENSITIVE_OBS
public static final byte CMD_SET_MOTION_CONTROL_CONSTANTS
public static final byte CMD_SET_HANDLE_LENGTH
public static final byte CMD_BUZZER_ON
public static final byte CMD_BUZZER_FREQUENCY
public static final byte CMD_SET_VELOCITY_DIRECTION
public static final byte CMD_REQUEST_STATE
public static final byte CMD_POWER_OFF
public static final byte CMD_POLL_REQUEST
public static final byte CMD_ISTART
public static final byte CMD_ASTART
public static final byte CMD_ACK_REQUEST
public static final byte REPLY_STATUS_UPDATE
public static final byte REPLY_OBSTACLE
public static final byte REPLY_CHARGE
public static final byte REPLY_SOFTWARE_REV
public static final byte REPLY_AT_HOME
public static final byte FLAG
public static final int FLAG_NUM
public static final byte ESC
public static final byte STX
public static final byte ETX
public static final byte ESC_STX
public static final byte ESC_ETX
Constructor Detail |
protected JCyeMsg(byte d)
d,
- the destination address.Method Detail |
protected void Print()
protected byte[] GetMsgBuf()
protected int GetMsgLen()
protected JCyeMsg toTransmitArray()
protected void Add(byte b)
b
- the byte to addprotected void SetBufByte(int i, byte b)
i
- the buffer indexb
- the byteprotected byte GetBufByte(int i)
i
- the buffer indexprotected void SetDestAddr(int Addr)
Addr
- the addressprotected int GetDestAddr()
protected void SetSrcAddr(int Addr)
Addr
- the addressprotected int GetSrcAddr()
protected void SetRxMsgNum(int Num)
Num
- the RX numberprotected int GetRxMsgNum()
protected void SetTxMsgNum(int Num)
Num
- the TX numberprotected int GetTxMsgNum()
protected void SetMsgID(int ID)
ID
- the numberprotected int GetMsgID()
protected int CalcCRC(byte[] a, int len)
a
- the byte arraylen
- the length of the arrayprotected void ParseReply()
protected byte[] SplitByte(byte b)
b
- the byte to splitprotected byte CombineBytes(byte b1, byte b2)
b1
- the first four-bit valueb2
- the second four-bit value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |