|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.rapplogic.xbee.api.XBee
public class XBee
This is an API for communicating with Digi XBee 802.15.4 and ZigBee radios via the serial port
| Constructor Summary | |
|---|---|
XBee()
|
|
XBee(XBeeConfiguration conf)
|
|
| Method Summary | |
|---|---|
void |
addPacketListener(PacketListener packetListener)
|
void |
clearResponseQueue()
Removes all packets off of the response queue |
void |
close()
Shuts down RXTX and packet parser thread |
int |
getCurrentFrameId()
|
int |
getNextFrameId()
This is useful for obtaining a frame id when composing your XBeeRequest. |
XBeeResponse |
getResponse()
Same as getResponse(int) but does not timeout. |
XBeeResponse |
getResponse(int timeout)
This method returns an XBeeResponse from the queue, if available, or waits up to "timeout" milliseconds for a response. |
void |
initProviderConnection(XBeeConnection connection)
Allows a protocol specific implementation of XBeeConnection to be used instead of the default RXTX connection. |
boolean |
isConnected()
Indicates if serial port connection has been established. |
void |
open(java.lang.String port,
int baudRate)
If XBeeConnection.startUpChecks is set to true (default), this method will check if the AP parameter is set correctly and attempt to update if AP=1. |
void |
removePacketListener(PacketListener packetListener)
|
void |
sendAsynchronous(XBeeRequest request)
Sends an XBeeRequest though the XBee interface in an asynchronous manner, such that it will return immediately, without waiting for a response. |
AtCommandResponse |
sendAtCommand(AtCommand command)
Deprecated. Use this.sendSynchronous(command, timeout); |
void |
sendPacket(int[] packet)
This exists solely for the XMPP project. |
void |
sendPacket(XBeePacket packet)
It's possible for packets to get interspersed if multiple threads send simultaneously. |
void |
sendRequest(XBeeRequest request)
|
XBeeResponse |
sendSynchronous(XBeeRequest request)
Uses sendSynchronous timeout defined in XBeeConfiguration (default is 5000ms) |
XBeeResponse |
sendSynchronous(XBeeRequest xbeeRequest,
int timeout)
Synchronous method for sending an XBeeRequest and obtaining the corresponding response (response that has same frame id). |
void |
updateFrameId(int val)
Updates the frame id. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XBee()
public XBee(XBeeConfiguration conf)
| Method Detail |
|---|
public void open(java.lang.String port,
int baudRate)
throws XBeeException
open in interface IXBeeXBeeException
public void initProviderConnection(XBeeConnection connection)
throws XBeeException
XBeeExceptionpublic void addPacketListener(PacketListener packetListener)
addPacketListener in interface IXBeepublic void removePacketListener(PacketListener packetListener)
removePacketListener in interface IXBee
public void sendRequest(XBeeRequest request)
throws java.io.IOException
java.io.IOException
public void sendPacket(XBeePacket packet)
throws java.io.IOException
sendPacket in interface IXBeepacket -
java.io.IOException
public void sendPacket(int[] packet)
throws java.io.IOException
sendPacket in interface IXBeepacket -
java.lang.RuntimeException - when serial device is disconnected
java.io.IOException
public void sendAsynchronous(XBeeRequest request)
throws XBeeException
sendAsynchronous in interface IXBeerequest -
XBeeException
public AtCommandResponse sendAtCommand(AtCommand command)
throws XBeeException
command -
XBeeException
public XBeeResponse sendSynchronous(XBeeRequest xbeeRequest,
int timeout)
throws XBeeTimeoutException,
XBeeException
sendSynchronous in interface IXBeexbeeRequest -
XBeeException
XBeeTimeoutException - thrown if no matching response is identified
public XBeeResponse sendSynchronous(XBeeRequest request)
throws XBeeTimeoutException,
XBeeException
XBeeTimeoutException
XBeeException
public XBeeResponse getResponse()
throws XBeeException
getResponse in interface IXBeeXBeeException
public XBeeResponse getResponse(int timeout)
throws XBeeException,
XBeeTimeoutException
getResponse in interface IXBeetimeout - milliseconds to wait for a response. A value of zero disables the timeout
XBeeException
XBeeTimeoutException - if timeout occurs before a response is receivedpublic void close()
close in interface IXBeepublic boolean isConnected()
isConnected in interface IXBeepublic int getCurrentFrameId()
getCurrentFrameId in interface IXBeepublic int getNextFrameId()
getNextFrameId in interface IXBeepublic void updateFrameId(int val)
updateFrameId in interface IXBeeval - Jan 24, 2009public void clearResponseQueue()
clearResponseQueue in interface IXBee
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||