Fork of my original MQTTGateway

Dependencies:   mbed-http

Embed: (wiki syntax)

« Back to documentation index

AtCmdFrame Class Reference

Class for the AT command api frames. More...

#include <AtCmdFrame.h>

Inherits ApiFrame.

Public Types

enum  AtCmdResp {
  AtCmdRespOk = 0, AtCmdRespError = 1, AtCmdRespInvalidCmd = 2, AtCmdRespInvalidParam = 3,
  AtCmdRespTxFailure = 4, AtCmdRespLenMismatch = 0xfd, AtCmdRespInvalidAddr = 0xfe, AtCmdRespTimeout = 0xff
}
 

AtCmdResp.

More...
enum  ModemStatus {
  HwReset = 0, WdReset = 1, JoinedNW = 2, Disassociated = 3,
  SyncLost = 4, CoordRealign = 5, CoordStarted = 6, NwSecKeyUpdated = 7,
  NwWokeUp = 0x0B, NwToSleep = 0x0C, VccExceeded = 0x0D, ModConfChangeJoinInProg = 0x11
}
 

ModemStatus.

More...
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

 AtCmdFrame (const char *const cmd, const uint32_t cmd_param)
 Class constructor.
 AtCmdFrame (const char *const cmd, const uint8_t *cmd_param=NULL, uint16_t param_len=0)
 Class constructor.
 AtCmdFrame (uint64_t remote, const char *const cmd, uint32_t cmd_param)
 Class constructor.
 AtCmdFrame (uint64_t remote, const char *const cmd, const uint8_t *cmd_param=NULL, uint16_t param_len=0)
 Class constructor.
 AtCmdFrame (uint16_t remote, const char *const cmd, uint32_t cmd_param)
 Class constructor.
 AtCmdFrame (uint16_t remote, const char *const cmd, const uint8_t *cmd_param=NULL, uint16_t param_len=0)
 Class constructor.
 AtCmdFrame (uint64_t remote64, uint16_t remote16, const char *const cmd, uint32_t cmd_param)
 Class constructor.
 AtCmdFrame (uint64_t remote64, uint16_t remote16, const char *const cmd, const uint8_t *cmd_param=NULL, uint16_t param_len=0)
 Class constructor.
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

void build_at_cmd_frame (const char *cmd, const uint8_t *cmd_params, uint8_t payload_len, bool reverse=true)
 build_at_cmd_frame method used by the constructors to create the at command frame
void build_at_cmd_remote_frame (uint64_t remote64, uint16_t remote16, const char *const cmd, const uint8_t *const cmd_params, uint8_t payload_len, bool reverse=true)
 build_at_cmd_remote_frame method used by the constructors to create the at command frame
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 the AT command api frames.

Derived from ApiFrame

Definition at line 42 of file AtCmdFrame.h.


Member Enumeration Documentation

enum ApiFrameType [inherited]

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.

enum AtCmdResp

AtCmdResp.

Enumerator:
AtCmdRespOk 

Ok.

AtCmdRespError 

Error.

AtCmdRespInvalidCmd 

Invalid Command.

AtCmdRespInvalidParam 

Invalid Parameter.

AtCmdRespTxFailure 

Tx Failure.

AtCmdRespLenMismatch 

Length Mismatch (Error generated by the library)

AtCmdRespInvalidAddr 

Invalid Address (Error generated by the library)

AtCmdRespTimeout 

Timeout (Error generated by the library)

Reimplemented from ApiFrame.

Definition at line 49 of file AtCmdFrame.h.

ModemStatus.

Enumerator:
HwReset 

Hardware reset.

WdReset 

Watchdog timer reset.

JoinedNW 

Joined network (routers and end devices)

Disassociated 

Disassociated.

SyncLost 

Synchronization Lost.

CoordRealign 

Coordinator realignment.

CoordStarted 

Coordinator started.

NwSecKeyUpdated 

Network security key was updated.

NwWokeUp 

NwWokeUp.

NwToSleep 

NwToSleep.

VccExceeded 

VccExceeded: PRO S2B only?

ModConfChangeJoinInProg 

Modem configuration changed while join in progress.

Definition at line 63 of file AtCmdFrame.h.


Constructor & Destructor Documentation

AtCmdFrame ( const char *const   cmd,
const uint32_t  cmd_param 
)

Class constructor.

Parameters:
cmdat command of the frame
cmd_paramcommand parameter
param_lenlength of the command param

Definition at line 38 of file AtCmdFrame.cpp.

AtCmdFrame ( const char *const   cmd,
const uint8_t *  cmd_param = NULL,
uint16_t  param_len = 0 
)

Class constructor.

Parameters:
cmdat command of the frame
cmd_parampointer to command parameter
param_lenlength of the command param

Definition at line 56 of file AtCmdFrame.cpp.

AtCmdFrame ( uint64_t  remote,
const char *const   cmd,
uint32_t  cmd_param 
)

Class constructor.

Parameters:
remote64 bit address of the remote device where we want to run the command
cmdat command of the frame
cmd_paramcommand parameter

Definition at line 64 of file AtCmdFrame.cpp.

AtCmdFrame ( uint64_t  remote,
const char *const   cmd,
const uint8_t *  cmd_param = NULL,
uint16_t  param_len = 0 
)

Class constructor.

Parameters:
remote64 bit address of the remote device where we want to run the command
cmdat command of the frame
cmd_parampointer to command parameter
param_lenlength of the command param

Definition at line 72 of file AtCmdFrame.cpp.

AtCmdFrame ( uint16_t  remote,
const char *const   cmd,
uint32_t  cmd_param 
)

Class constructor.

Parameters:
remote16 bit address of the remote device where we want to run the command
cmdat command of the frame
cmd_paramcommand parameter

Definition at line 80 of file AtCmdFrame.cpp.

AtCmdFrame ( uint16_t  remote,
const char *const   cmd,
const uint8_t *  cmd_param = NULL,
uint16_t  param_len = 0 
)

Class constructor.

Parameters:
remote16 bit address of the remote device where we want to run the command
cmdat command of the frame
cmd_parampointer to command parameter
param_lenlength of the command param

Definition at line 88 of file AtCmdFrame.cpp.

AtCmdFrame ( uint64_t  remote64,
uint16_t  remote16,
const char *const   cmd,
uint32_t  cmd_param 
)

Class constructor.

Parameters:
remote64 bit address of the remote device where we want to run the command
remote16 bit address of the remote device where we want to run the command
cmdat command of the frame
cmd_paramcommand parameter

Definition at line 96 of file AtCmdFrame.cpp.

AtCmdFrame ( uint64_t  remote64,
uint16_t  remote16,
const char *const   cmd,
const uint8_t *  cmd_param = NULL,
uint16_t  param_len = 0 
)

Class constructor.

Parameters:
remote64 bit address of the remote device where we want to run the command
remote16 bit address of the remote device where we want to run the command
cmdat command of the frame
cmd_parampointer to command parameter
param_lenlength of the command param

Definition at line 104 of file AtCmdFrame.cpp.


Member Function Documentation

void build_at_cmd_frame ( const char *  cmd,
const uint8_t *  cmd_params,
uint8_t  payload_len,
bool  reverse = true 
) [protected]

build_at_cmd_frame method used by the constructors to create the at command frame

Parameters:
cmdat command of the frame
cmd_paramspointer to command parameter
param_lenlength of the command param

Definition at line 20 of file AtCmdFrame.cpp.

void build_at_cmd_remote_frame ( uint64_t  remote64,
uint16_t  remote16,
const char *const   cmd,
const uint8_t *const   cmd_params,
uint8_t  payload_len,
bool  reverse = true 
) [protected]

build_at_cmd_remote_frame method used by the constructors to create the at command frame

Parameters:
remote6464 bit address of the remote device where we want to run the command
remote1616 bit address of the remote device where we want to run the command
cmdat command of the frame
cmd_paramspointer to command parameter
param_lenlength of the command param

Definition at line 122 of file AtCmdFrame.cpp.

void dump ( void   ) const [inherited]

dump dumps the information of this frame

Definition at line 75 of file ApiFrame.cpp.

void dump_if ( ApiFrameType  type ) [inherited]

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 [inherited]

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 [inherited]

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 [inherited]

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 [inherited]

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 [inherited]

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, inherited]

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, inherited]

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 
) [inherited]

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 ) [inherited]

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 ) [inherited]

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, inherited]

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, inherited]

pointer to the frame data

Definition at line 154 of file ApiFrame.h.

uint16_t _data_frame_len [protected, inherited]

length of the payload, excluding the frame type

Definition at line 151 of file ApiFrame.h.

uint8_t _frame_id [protected, inherited]

Frame ID of this frame.

Definition at line 160 of file ApiFrame.h.

ApiFrameType _type [protected, inherited]

Type of this frame.

Definition at line 148 of file ApiFrame.h.