XBee-mbed library http://mbed.org/users/okini3939/notebook/xbee-mbed/

Dependents:   device_server_udp led_sender_post XBee_API_ex1 XBee_API_ex2 ... more

Embed: (wiki syntax)

« Back to documentation index

ZBTxRequest Class Reference

ZBTxRequest Class Reference

Represents a Series 2 TX packet that corresponds to Api Id: ZB_TX_REQUEST. More...

#include <XBee.h>

Inherits PayloadRequest.

Public Member Functions

 ZBTxRequest (XBeeAddress64 &addr64, uint8_t *payload, uint16_t payloadLength)
 Creates a unicast ZBTxRequest with the ACK option and DEFAULT_FRAME_ID.
 ZBTxRequest ()
 Creates a default instance of this class.
uint8_t * getPayload ()
 Returns the payload of the packet, if not null.
void setPayload (uint8_t *payloadPtr)
 Sets the payload array.
uint16_t getPayloadLength ()
 Returns the length of the payload array, as specified by the user.
void setPayloadLength (uint16_t payloadLength)
 Sets the length of the payload to include in the request.
void setFrameId (uint8_t frameId)
 Sets the frame id.
uint8_t getFrameId ()
 Returns the frame id.
uint8_t getApiId ()
 Returns the API id.

Protected Member Functions

virtual uint8_t getFrameData (uint16_t pos)
 Starting after the frame id (pos = 0) and up to but not including the checksum Note: Unlike Digi's definition of the frame data, this does not start with the API ID.
virtual uint16_t getFrameDataLength ()
 Returns the size of the api frame (not including frame id or api id or checksum).

Detailed Description

Represents a Series 2 TX packet that corresponds to Api Id: ZB_TX_REQUEST.

Be careful not to send a data array larger than the max packet size of your radio. This class does not perform any validation of packet size and there will be no indication if the packet is too large, other than you will not get a TX Status response. The datasheet says 72 bytes is the maximum for ZNet firmware and ZB Pro firmware provides the ATNP command to get the max supported payload size. This command is useful since the maximum payload size varies according to certain settings, such as encryption. ZB Pro firmware provides a PAYLOAD_TOO_LARGE that is returned if payload size exceeds the maximum.

Definition at line 866 of file XBee.h.


Constructor & Destructor Documentation

ZBTxRequest ( XBeeAddress64 addr64,
uint8_t *  payload,
uint16_t  payloadLength 
)

Creates a unicast ZBTxRequest with the ACK option and DEFAULT_FRAME_ID.

Definition at line 1047 of file XBee.cpp.

ZBTxRequest (  )

Creates a default instance of this class.

At a minimum you must specify a payload, payload length and a destination address before sending this request.

Definition at line 1036 of file XBee.cpp.


Member Function Documentation

uint8_t getApiId (  ) [inherited]

Returns the API id.

Definition at line 961 of file XBee.cpp.

uint8_t getFrameData ( uint16_t  pos ) [protected, virtual]

Starting after the frame id (pos = 0) and up to but not including the checksum Note: Unlike Digi's definition of the frame data, this does not start with the API ID.

The reason for this is the API ID and Frame ID are common to all requests, whereas my definition of frame data is only the API specific data.

Implements XBeeRequest.

Definition at line 1054 of file XBee.cpp.

uint16_t getFrameDataLength (  ) [protected, virtual]

Returns the size of the api frame (not including frame id or api id or checksum).

Implements XBeeRequest.

Definition at line 1084 of file XBee.cpp.

uint8_t getFrameId (  ) [inherited]

Returns the frame id.

Definition at line 957 of file XBee.cpp.

uint8_t * getPayload (  ) [inherited]

Returns the payload of the packet, if not null.

Definition at line 987 of file XBee.cpp.

uint16_t getPayloadLength (  ) [inherited]

Returns the length of the payload array, as specified by the user.

Definition at line 995 of file XBee.cpp.

void setFrameId ( uint8_t  frameId ) [inherited]

Sets the frame id.

Must be between 1 and 255 inclusive to get a TX status response.

Definition at line 953 of file XBee.cpp.

void setPayload ( uint8_t *  payloadPtr ) [inherited]

Sets the payload array.

Definition at line 991 of file XBee.cpp.

void setPayloadLength ( uint16_t  payloadLength ) [inherited]

Sets the length of the payload to include in the request.

For example if the payload array is 50 bytes and you only want the first 10 to be included in the packet, set the length to 10. Length must be <= to the array length.

Definition at line 999 of file XBee.cpp.