Fork of my original MQTTGateway

Dependencies:   mbed-http

Embed: (wiki syntax)

« Back to documentation index

ApiFrame Class Reference

Class for XBee API frames. More...

#include <ApiFrame.h>

Inherited by AtCmdFrame, TxFrame802, TxFrameDM, and TxFrameZB.

Public Types

enum  ApiFrameType {
  TxReq64Bit = 0x00, TxReq16Bit = 0x01, AtCmd = 0x08, AtCmdQueuePV = 0x09,
  TxReqZBDM = 0x10, ExpAddrCmd = 0x11, RemoteCmdReq = 0x17, CreateSrcRoute = 0x21,
  RxPacket64Bit = 0x80, RxPacket16Bit = 0x81, Io64Bit = 0x82, Io16Bit = 0x83,
  AtCmdResp = 0x88, TxStatus = 0x89, AtModemStatus = 0x8A, TxStatusZBDM = 0x8B,
  RouteInfo = 0x8D, AggregateAddr = 0x8E, RxPacketAO0 = 0x90, RxPacketAO1 = 0x91,
  IoSampleRxZBDM = 0x92, SensorRxIndAO0 = 0x94, NodeIdentIndAO0 = 0x95, RemoteCmdResp = 0x97,
  OtaFwUpStatus = 0xA0, RouteRecInd = 0xA1, Many2OneRRInd = 0xA3, Invalid = ~0
}
 

List of API frames.

More...

Public Member Functions

 ApiFrame ()
 Default constructor.
 ApiFrame (uint16_t len)
 Constructor.
 ApiFrame (ApiFrameType type, const uint8_t *data, uint16_t len)
 Constructor.
 ~ApiFrame ()
 Destructor.
ApiFrameType get_frame_type () const
 get_frame_type gets the type of the frame
void dump () const
 dump dumps the information of this frame
void dump_if (ApiFrameType type)
 dump_if dumps the information of the frame if the frame type matches with the parameter.
void set_frame_type (ApiFrameType type)
 set_frame_type sets the type of the frame to type.
uint16_t get_data_len () const
 get_data_len gets the length of the frame data payload.
void set_data_len (uint16_t len)
 set_data_len sets the length of the frame data payload.
const uint8_t * get_data () const
 get_data returns a pointer to the frame data payload.
uint8_t get_data_at (uint16_t index) const
 get_data_at returns the byte at index offset.
void set_data (uint8_t data, uint16_t index)
 set_data sets data byte at the specified index or offset.
uint8_t get_frame_id () const
 get_frame_id returns the frame id of this frame.

Protected Member Functions

uint8_t get_next_frame_id ()
 get_next_frame_id - returns the next frame ID secuentially, skipping the value 0
void set_api_frame (ApiFrameType type, const uint8_t *data, uint16_t len)
 set_api_frame sets several members

Protected Attributes

ApiFrameType _type
 Type of this frame.
uint16_t _data_frame_len
 length of the payload, excluding the frame type
uint8_t * _data
 pointer to the frame data
bool _alloc_data
 True if the constructor allocates the data.
uint8_t _frame_id
 Frame ID of this frame.

Detailed Description

Class for XBee API frames.

Definition at line 19 of file ApiFrame.h.


Member Enumeration Documentation

List of API frames.

Note that not all frames are supported by all radios

Enumerator:
TxReq64Bit 

TxReq64Bit: Only for 802.15.4 modules.

TxReq16Bit 

TxReq16Bit: Only for 802.15.4 modules.

AtCmd 

AtCmd.

AtCmdQueuePV 

AtCmdQueuePV.

TxReqZBDM 

TxReqZBDM: Only for ZigBee and DigiMesh modules.

ExpAddrCmd 

ExpAddrCmd: Only for ZigBee modules and DigiMesh.

RemoteCmdReq 

RemoteCmdReq.

CreateSrcRoute 

CreateSrcRoute.

RxPacket64Bit 

RxPacket64Bit: Only for 802.15.4 modules.

RxPacket16Bit 

RxPacket16Bit: Only for 802.15.4 modules.

Io64Bit 

Io64Bit: Only for 802.15.4 modules.

Io16Bit 

Io16Bit.

AtCmdResp 

AtCmdResp.

TxStatus 

TxStatus.

AtModemStatus 

AtModemStatus.

TxStatusZBDM 

TxStatusZBDM: Only for ZigBee and DigiMesh modules.

RouteInfo 

RouteInfo: Only for DigiMesh modules.

AggregateAddr 

AggregateAddr: Only for DigiMesh modules.

RxPacketAO0 

RxPacketAO0: Only for ZigBee and DigiMesh modules.

RxPacketAO1 

RxPacketAO1: Only for ZigBee and DigiMesh modules.

IoSampleRxZBDM 

IoSampleRxZBDM: Only for ZigBee and DigiMesh modules.

SensorRxIndAO0 

SensorRxIndAO0: Only for ZigBee modules.

NodeIdentIndAO0 

NodeIdentIndAO0: Only for ZigBee and DigiMesh modules.

RemoteCmdResp 

RemoteCmdResp.

OtaFwUpStatus 

OtaFwUpStatus.

RouteRecInd 

RouteRecInd.

Many2OneRRInd 

Many2OneRRInd.

Invalid 

Invalid.

Definition at line 26 of file ApiFrame.h.


Constructor & Destructor Documentation

ApiFrame ( void   )

Default constructor.

Definition at line 21 of file ApiFrame.cpp.

ApiFrame ( uint16_t  len )

Constructor.

Parameters:
lenlength of the API frame (will allocate len bytes).

Definition at line 30 of file ApiFrame.cpp.

ApiFrame ( ApiFrameType  type,
const uint8_t *  data,
uint16_t  len 
)

Constructor.

Parameters:
typeframe type of this api frame.
datapointer to frame data payload.
lenlength of the payload.

Definition at line 49 of file ApiFrame.cpp.

~ApiFrame (  )

Destructor.

Definition at line 68 of file ApiFrame.cpp.


Member Function Documentation

void dump ( void   ) const

dump dumps the information of this frame

Definition at line 75 of file ApiFrame.cpp.

void dump_if ( ApiFrameType  type )

dump_if dumps the information of the frame if the frame type matches with the parameter.

Parameters:
typedump the frame info/data if the frame type matches with type.

Definition at line 85 of file ApiFrame.cpp.

const uint8_t * get_data (  ) const

get_data returns a pointer to the frame data payload.

Returns:
a pointer to the frame data payload.

Definition at line 113 of file ApiFrame.cpp.

uint8_t get_data_at ( uint16_t  index ) const

get_data_at returns the byte at index offset.

Parameters:
indexoffset of the byte we want to get.
Returns:
the byte at index offset.

Definition at line 118 of file ApiFrame.cpp.

uint16_t get_data_len (  ) const

get_data_len gets the length of the frame data payload.

Returns:
the length of the data payload.

Definition at line 103 of file ApiFrame.cpp.

uint8_t get_frame_id (  ) const

get_frame_id returns the frame id of this frame.

Returns:
the frame id of this frame.

Definition at line 129 of file ApiFrame.cpp.

ApiFrame::ApiFrameType get_frame_type (  ) const

get_frame_type gets the type of the frame

Returns:
the type of this frame.

Definition at line 93 of file ApiFrame.cpp.

uint8_t get_next_frame_id ( void   ) [protected]

get_next_frame_id - returns the next frame ID secuentially, skipping the value 0

Returns:
the next frame ID that should be assigned to a frame

Definition at line 39 of file ApiFrame.cpp.

void set_api_frame ( ApiFrameType  type,
const uint8_t *  data,
uint16_t  len 
) [protected]

set_api_frame sets several members

Parameters:
typeframe type of this api frame.
datapointer to frame data payload.
lenlength of the payload.

Definition at line 55 of file ApiFrame.cpp.

void set_data ( uint8_t  data,
uint16_t  index 
)

set_data sets data byte at the specified index or offset.

Parameters:
databyte that will be set at index position.
indexoffset of the byte we want to set.

Definition at line 123 of file ApiFrame.cpp.

void set_data_len ( uint16_t  len )

set_data_len sets the length of the frame data payload.

Parameters:
lenthe length of the data payload will be set on this frame.

Definition at line 108 of file ApiFrame.cpp.

void set_frame_type ( ApiFrameType  type )

set_frame_type sets the type of the frame to type.

Parameters:
typethe type we want to set on the frame.

Definition at line 98 of file ApiFrame.cpp.


Field Documentation

bool _alloc_data [protected]

True if the constructor allocates the data.

Needed to delete it on the destructor

Definition at line 157 of file ApiFrame.h.

uint8_t* _data [protected]

pointer to the frame data

Definition at line 154 of file ApiFrame.h.

uint16_t _data_frame_len [protected]

length of the payload, excluding the frame type

Definition at line 151 of file ApiFrame.h.

uint8_t _frame_id [protected]

Frame ID of this frame.

Definition at line 160 of file ApiFrame.h.

ApiFrameType _type [protected]

Type of this frame.

Definition at line 148 of file ApiFrame.h.