|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.rapplogic.xbee.api.PacketParser
public class PacketParser
Reads a packet from the input stream, verifies checksum and creates an XBeeResponse object
Notes: Escaped bytes increase packet length but packet stated length only indicates un-escaped bytes. Stated length includes all bytes after Length bytes, not including the checksum
Constructor Summary | |
---|---|
PacketParser(IIntInputStream in)
|
|
PacketParser(java.io.InputStream in)
|
Method Summary | |
---|---|
ApiId |
getApiId()
|
int |
getBytesRead()
Does not include any escape bytes |
int |
getChecksum()
|
int |
getFrameDataBytesRead()
Returns number of bytes remaining, relative to the stated packet length (not including checksum). |
int |
getIntApiId()
|
XBeePacketLength |
getLength()
|
int |
getRemainingBytes()
Number of bytes remaining to be read, including the checksum |
boolean |
isDone()
|
XBeeAddress16 |
parseAddress16()
|
XBeeAddress64 |
parseAddress64()
|
XBeeResponse |
parsePacket()
This method is guaranteed (unless I screwed up) to return an instance of XBeeResponse and should never throw an exception If an exception occurs, it will be packaged and returned as an ErrorResponse. |
int |
read()
This method reads bytes from the underlying input stream and performs the following tasks: 1. |
int |
read(java.lang.String context)
Same as read() but logs the context of the byte being read. |
int[] |
readRemainingBytes()
Reads all remaining bytes except for checksum |
void |
setBytesRead(int bytesRead)
|
void |
setDone(boolean done)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PacketParser(java.io.InputStream in)
public PacketParser(IIntInputStream in)
Method Detail |
---|
public XBeeResponse parsePacket()
public int read(java.lang.String context) throws java.io.IOException
read
in interface IPacketParser
read
in interface IIntInputStream
java.io.IOException
public int read() throws java.io.IOException
read
in interface IIntInputStream
java.io.IOException
public int[] readRemainingBytes() throws java.io.IOException
readRemainingBytes
in interface IPacketParser
java.io.IOException
public XBeeAddress64 parseAddress64() throws java.io.IOException
parseAddress64
in interface IPacketParser
java.io.IOException
public XBeeAddress16 parseAddress16() throws java.io.IOException
parseAddress16
in interface IPacketParser
java.io.IOException
public int getFrameDataBytesRead()
getFrameDataBytesRead
in interface IPacketParser
public int getRemainingBytes()
getRemainingBytes
in interface IPacketParser
public int getBytesRead()
getBytesRead
in interface IPacketParser
public void setBytesRead(int bytesRead)
public boolean isDone()
public void setDone(boolean done)
public int getChecksum()
public XBeePacketLength getLength()
getLength
in interface IPacketParser
public ApiId getApiId()
getApiId
in interface IPacketParser
public int getIntApiId()
getIntApiId
in interface IPacketParser
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |