WaspXBee802 Class Reference

WaspXBee802 Class. More...

#include <WaspXBee802.h>

Inheritance diagram for WaspXBee802:

Inheritance graph
[legend]
Collaboration diagram for WaspXBee802:

Collaboration graph
[legend]

Public Member Functions

 WaspXBee802 ()
 class constructor
void init (uint8_t protocol_used, uint8_t frequency, uint8_t model_used)
 It initializes the necessary variables.
uint8_t setRetries (uint8_t retry)
 It sets the maximum number of retries to execute in addition to the three retries defined in the 802.15.4 protocol.
uint8_t getRetries ()
 It gets the maximum number of retries to execute in addition to the three retries defined in the 802.15.4 protocol.
uint8_t setDelaySlots (uint8_t exponent)
 It sets the minimun value of the back-off exponent in CSMA/CA.
uint8_t getDelaySlots ()
 It gets the minimun value of the back-off exponent in CSMA/CA.
uint8_t setMacMode (uint8_t mac)
 It sets the MAC mode.
uint8_t getMacMode ()
 It gets the MAC mode.
uint8_t setEnergyThreshold (uint8_t threshold)
 It sets the CA threshold in the CCA process to detect energy on the channel.
uint8_t getEnergyThreshold ()
 It gets the Energy Threshold used in the CCA process.
uint8_t getCCAcounter ()
 It gets the number of times too much energy has been found on the channel.
uint8_t resetCCAcounter ()
 It resets the CCA counter.
uint8_t getACKcounter ()
 It gets the number of times there has been an ACK failure.
uint8_t resetACKcounter ()
 It resets the ACK counter.

Data Fields

uint8_t retries
 Variable : number of retries to execute in addition to the three retries defined in the 802.15.4 protocol (range [0-6]).
uint8_t delaySlots
 Variable : the minimun value of the back-off exponent in CSMA/CA (range [0-3]).
uint8_t macMode
 Variable : the MAC mode(range [0-3]).
uint8_t energyThreshold
 Variable : the CA threshold in the CCA process to detect energy on the channel (range [0x00-0x50]).
uint8_t counterCCA [2]
 Variable : the number of times too much energy has been found on the channel.
uint8_t counterACK [2]
 Variable : the number of times there has been an ACK failure.

Private Attributes

uint8_t counter
 Variable : internal counter.

Detailed Description

WaspXBee802 Class.

WaspXBee802 Class defines all the variables and functions used to manage XBee 802.15.4 modules. It inherits from 'WaspXBeeCore' class the necessary functions, variables and definitions

Definition at line 60 of file WaspXBee802.h.


Constructor & Destructor Documentation

WaspXBee802::WaspXBee802 (  )  [inline]

class constructor

It does nothing

Parameters:
void 
Returns:
void

Definition at line 70 of file WaspXBee802.h.

00070 {};


Member Function Documentation

void WaspXBee802::init ( uint8_t  protocol_used,
uint8_t  frequency,
uint8_t  model_used 
)

It initializes the necessary variables.

It initalizes all the necessary variables including its father's variables

Parameters:
uint8_t protocol_used : specifies the protocol used in the XBee module (XBEE_802_15_4 in this case)
uint8_t frequency : specifies the frequency used in the XBee module (FREQ2_4G in this case)
uint8_t model_used : specifies the XBee model used (NORMAL or PRO)
Returns:
void

Reimplemented from WaspXBeeCore.

Definition at line 29 of file WaspXBee802.cpp.

References WaspXBeeCore::add_type, AWAKE_TIME_802_15_4_H, AWAKE_TIME_802_15_4_L, WaspXBeeCore::awakeTime, WaspXBeeCore::clearCommand(), WaspXBeeCore::clearFinishArray(), counter, counterACK, counterCCA, WaspXBeeCore::data_length, delaySlots, WaspXBeeCore::discoveryOptions, ENCRYPT_MODE_802_15_4, WaspXBeeCore::encryptMode, energyThreshold, WaspXBeeCore::error_AT, WaspXBeeCore::error_RX, WaspXBeeCore::error_TX, WaspXBeeCore::finish, WaspXBeeCore::frag_length, WaspXBeeCore::frameNext, WaspXBeeCore::freq, WaspXBeeCore::indexNotModified, WaspXBeeCore::it, macMode, WaspXBeeCore::mode, WaspXBeeCore::model, WaspXBeeCore::nextIndex1, WaspXBeeCore::pendingPackets, WaspXBeeCore::pos, POWER_LEVEL_802_15_4, WaspXBeeCore::powerLevel, WaspXBeeCore::protocol, WaspXBeeCore::replacementPolicy, retries, SCAN_CHANNELS_802_15_4_H, SCAN_CHANNELS_802_15_4_L, SCAN_TIME_802_15_4, WaspXBeeCore::scanChannels, WaspXBeeCore::scanTime, SLEEP_OPTIONS_802_15_4, SLEEP_TIME_802_15_4_H, SLEEP_TIME_802_15_4_L, WaspXBeeCore::sleepOptions, WaspXBeeCore::sleepTime, WaspXBeeCore::start, WaspXBeeCore::TIME1, TIME_RSSI_802_15_4, WaspXBeeCore::timeRSSI, WaspXBeeCore::totalFragmentsReceived, and XBEE_OUT.

00030 {
00031         protocol=protocol_used;
00032         freq=frequency;
00033         model=model_used;
00034 
00035         totalFragmentsReceived=0;
00036         pendingPackets=0;
00037         pos=0;
00038         discoveryOptions=0x00;
00039         awakeTime[0]=AWAKE_TIME_802_15_4_H;
00040         awakeTime[1]=AWAKE_TIME_802_15_4_L;
00041         sleepTime[0]=SLEEP_TIME_802_15_4_H;
00042         sleepTime[1]=SLEEP_TIME_802_15_4_L;
00043         scanTime[0]=SCAN_TIME_802_15_4;
00044         scanChannels[0]=SCAN_CHANNELS_802_15_4_H;
00045         scanChannels[1]=SCAN_CHANNELS_802_15_4_L;
00046         encryptMode=ENCRYPT_MODE_802_15_4;
00047         powerLevel=POWER_LEVEL_802_15_4;
00048         timeRSSI=TIME_RSSI_802_15_4;
00049         sleepOptions=SLEEP_OPTIONS_802_15_4;
00050         retries=0;
00051         delaySlots=0;
00052         macMode=0;
00053         energyThreshold=0x2C;
00054         counterCCA[0]=0x00;
00055         counterCCA[1]=0x00;
00056         counterACK[0]=0x00;
00057         counterACK[1]=0x00;
00058 
00059         counter=0;
00060         data_length=0;
00061         it=0;
00062         start=0;
00063         finish=0;
00064         add_type=0;
00065         mode=0;
00066         frag_length=0;
00067         TIME1=0;
00068         nextIndex1=0;
00069         frameNext=0;
00070         replacementPolicy=XBEE_OUT;
00071         indexNotModified=1;
00072         error_AT=2;
00073         error_RX=2;
00074         error_TX=2;
00075         clearFinishArray();
00076         clearCommand();
00077 }

Here is the call graph for this function:

uint8_t WaspXBee802::setRetries ( uint8_t  retry  ) 

It sets the maximum number of retries to execute in addition to the three retries defined in the 802.15.4 protocol.

Parameters:
uint8_t retry : specifies the number of retries to set (range [0-6])
Returns:
'0' on success, '1' otherwise

Definition at line 91 of file WaspXBee802.cpp.

References WaspXBeeCore::error_AT, WaspXBeeCore::gen_checksum(), WaspXBeeCore::gen_data(), WaspXBeeCore::gen_send(), retries, and set_retries_802.

00092 {
00093     int8_t error=2;
00094      
00095     error_AT=2;
00096     gen_data(set_retries_802,retry);
00097     gen_checksum(set_retries_802);
00098     error=gen_send(set_retries_802);
00099     
00100 
00101     if(!error)
00102     {
00103         retries=retry;
00104     }
00105     return error;
00106 }

Here is the call graph for this function:

uint8_t WaspXBee802::getRetries (  ) 

It gets the maximum number of retries to execute in addition to the three retries defined in the 802.15.4 protocol.

It stores in global 'retries' variable the number of retries

Returns:
'0' on success, '1' otherwise

Definition at line 116 of file WaspXBee802.cpp.

References WaspXBeeCore::data, WaspXBeeCore::error_AT, WaspXBeeCore::gen_data(), WaspXBeeCore::gen_send(), get_retries_802, and retries.

00117 {
00118     int8_t error=2;
00119      
00120     error_AT=2;
00121     gen_data(get_retries_802);
00122     error=gen_send(get_retries_802);
00123     
00124 
00125     if(!error)
00126     {
00127         retries=data[0];
00128     }
00129     return error;
00130 }

Here is the call graph for this function:

uint8_t WaspXBee802::setDelaySlots ( uint8_t  exponent  ) 

It sets the minimun value of the back-off exponent in CSMA/CA.

Parameters:
uint8_t exponent : specifies the value of the back-off exponent in CSMA/CA (range [0-3])
Returns:
'0' on success, '1' otherwise

Definition at line 142 of file WaspXBee802.cpp.

References delaySlots, WaspXBeeCore::error_AT, WaspXBeeCore::gen_checksum(), WaspXBeeCore::gen_data(), WaspXBeeCore::gen_send(), and set_delay_slots_802.

00143 {
00144         int8_t error=2;
00145      
00146         error_AT=2;
00147         gen_data(set_delay_slots_802,exponent);
00148         gen_checksum(set_delay_slots_802);
00149         error=gen_send(set_delay_slots_802);
00150         
00151     if(!error)
00152     {
00153         delaySlots=exponent;
00154     }
00155     
00156     return error;
00157 }

Here is the call graph for this function:

uint8_t WaspXBee802::getDelaySlots (  ) 

It gets the minimun value of the back-off exponent in CSMA/CA.

It stores in global 'delaySlots' variable the minimun value of the back-off exponent in CSMA/CA

Returns:
'0' on success, '1' otherwise

Definition at line 167 of file WaspXBee802.cpp.

References WaspXBeeCore::data, delaySlots, WaspXBeeCore::error_AT, WaspXBeeCore::gen_data(), WaspXBeeCore::gen_send(), and get_delay_slots_802.

00168 {
00169     int8_t error=2;
00170      
00171     error_AT=2;
00172     gen_data(get_delay_slots_802);
00173     error=gen_send(get_delay_slots_802);
00174     
00175     if(!error)
00176     {
00177         delaySlots=data[0];
00178     }
00179     return error;
00180 }

Here is the call graph for this function:

uint8_t WaspXBee802::setMacMode ( uint8_t  mac  ) 

It sets the MAC mode.

Parameters:
uint8_t mac : specifies the MAC mode (range [0-3])
Returns:
'0' on success, '1' otherwise

Definition at line 192 of file WaspXBee802.cpp.

References WaspXBeeCore::error_AT, WaspXBeeCore::gen_checksum(), WaspXBeeCore::gen_data(), WaspXBeeCore::gen_send(), macMode, and set_mac_mode_802.

00193 {
00194     int8_t error=2;
00195      
00196     error_AT=2;
00197     gen_data(set_mac_mode_802,mac);
00198     gen_checksum(set_mac_mode_802);
00199     error=gen_send(set_mac_mode_802);
00200     
00201     if(!error)
00202     {
00203         macMode=mac;
00204     }
00205     return error;
00206 }

Here is the call graph for this function:

uint8_t WaspXBee802::getMacMode (  ) 

It gets the MAC mode.

It stores in global 'macMode' variable the MAC mode

Returns:
'0' on success, '1' otherwise

Definition at line 216 of file WaspXBee802.cpp.

References WaspXBeeCore::data, WaspXBeeCore::error_AT, WaspXBeeCore::gen_data(), WaspXBeeCore::gen_send(), get_mac_mode_802, and macMode.

00217 {
00218     int8_t error=2;
00219      
00220     error_AT=2;
00221     gen_data(get_mac_mode_802);
00222     error=gen_send(get_mac_mode_802);
00223     
00224     if(!error)
00225     {
00226         macMode=data[0];
00227     }
00228     return error;
00229 }

Here is the call graph for this function:

uint8_t WaspXBee802::setEnergyThreshold ( uint8_t  threshold  ) 

It sets the CA threshold in the CCA process to detect energy on the channel.

Parameters:
uint8_t threshold : specifies the CA threshold in the CCA process to detect energy on the channel (range [0x00-0x50])
Returns:
'0' on success, '1' otherwise

Definition at line 241 of file WaspXBee802.cpp.

References energyThreshold, WaspXBeeCore::error_AT, WaspXBeeCore::gen_checksum(), WaspXBeeCore::gen_data(), WaspXBeeCore::gen_send(), and set_energy_thres_802.

00242 {
00243     int8_t error=2;
00244      
00245     error_AT=2;
00246     gen_data(set_energy_thres_802,threshold);
00247     gen_checksum(set_energy_thres_802);
00248     error=gen_send(set_energy_thres_802);
00249     
00250     if(!error)
00251     {
00252         energyThreshold=threshold;
00253     }
00254     return error;
00255 }

Here is the call graph for this function:

uint8_t WaspXBee802::getEnergyThreshold (  ) 

It gets the Energy Threshold used in the CCA process.

It stores in global 'energyThreshold' variable the Energy Threshold used in the CCA process

Returns:
'0' on success, '1' otherwise

Definition at line 265 of file WaspXBee802.cpp.

References WaspXBeeCore::data, energyThreshold, WaspXBeeCore::error_AT, WaspXBeeCore::gen_data(), WaspXBeeCore::gen_send(), and get_energy_thres_802.

00266 {
00267     int8_t error=2;
00268      
00269     error_AT=2;
00270     gen_data(get_energy_thres_802);
00271     error=gen_send(get_energy_thres_802);
00272     
00273     if(!error)
00274     {
00275         energyThreshold=data[0];
00276     } 
00277     return error;
00278 }

Here is the call graph for this function:

uint8_t WaspXBee802::getCCAcounter (  ) 

It gets the number of times too much energy has been found on the channel.

It stores in global 'counterCCA' variable the number of times too much energy has been found on the channel

Returns:
'0' on success, '1' otherwise

Definition at line 288 of file WaspXBee802.cpp.

References counterCCA, WaspXBeeCore::data, delay(), WaspXBeeCore::error_AT, WaspXBeeCore::gen_data(), WaspXBeeCore::gen_send(), and get_CCA_802.

00289 {
00290     int8_t error=2;
00291      
00292     error_AT=2;
00293     gen_data(get_CCA_802);
00294     error=gen_send(get_CCA_802);
00295     
00296     if(!error)
00297     {
00298         counterCCA[0]=data[0];
00299         delay(20);
00300         counterCCA[1]=data[1];
00301         delay(20);   
00302     } 
00303     return error;
00304 }

Here is the call graph for this function:

uint8_t WaspXBee802::resetCCAcounter (  ) 

It resets the CCA counter.

Parameters:
void 
Returns:
'0' on success, '1' otherwise

Definition at line 314 of file WaspXBee802.cpp.

References counterCCA, WaspXBeeCore::error_AT, WaspXBeeCore::gen_data(), WaspXBeeCore::gen_send(), and reset_CCA_802.

00315 {
00316     int8_t error=2;
00317      
00318     error_AT=2;
00319     gen_data(reset_CCA_802);
00320     error=gen_send(reset_CCA_802);
00321     
00322     if(!error)
00323     {
00324         counterCCA[0]=0;
00325         counterCCA[1]=0;
00326     }
00327     return error;
00328 }

Here is the call graph for this function:

uint8_t WaspXBee802::getACKcounter (  ) 

It gets the number of times there has been an ACK failure.

It stores in global 'counterACK' variable the number of times there has been an ACK failure

Returns:
'0' on success, '1' otherwise

Definition at line 338 of file WaspXBee802.cpp.

References counterACK, WaspXBeeCore::data, delay(), WaspXBeeCore::error_AT, WaspXBeeCore::gen_data(), WaspXBeeCore::gen_send(), and get_ACK_802.

00339 {
00340     int8_t error=2;
00341      
00342     error_AT=2;
00343     gen_data(get_ACK_802);
00344     error=gen_send(get_ACK_802);
00345     
00346     if(!error)
00347     {
00348         counterACK[0]=data[0];
00349         delay(20);
00350         counterACK[1]=data[1];
00351         delay(20);   
00352     } 
00353     return error;
00354 }

Here is the call graph for this function:

uint8_t WaspXBee802::resetACKcounter (  ) 

It resets the ACK counter.

Parameters:
void 
Returns:
'0' on success, '1' otherwise

Definition at line 364 of file WaspXBee802.cpp.

References counterACK, WaspXBeeCore::error_AT, WaspXBeeCore::gen_data(), WaspXBeeCore::gen_send(), and reset_ACK_802.

00365 {
00366     int8_t error=2;
00367      
00368     error_AT=2;
00369     gen_data(reset_ACK_802);
00370     error=gen_send(reset_ACK_802);
00371     
00372     if(!error)
00373     {
00374         counterACK[0]=0;
00375         counterACK[1]=0;
00376     }
00377     return error;
00378 }

Here is the call graph for this function:


Field Documentation

Variable : number of retries to execute in addition to the three retries defined in the 802.15.4 protocol (range [0-6]).

Definition at line 170 of file WaspXBee802.h.

Referenced by getRetries(), init(), and setRetries().

Variable : the minimun value of the back-off exponent in CSMA/CA (range [0-3]).

Definition at line 175 of file WaspXBee802.h.

Referenced by getDelaySlots(), init(), and setDelaySlots().

Variable : the MAC mode(range [0-3]).

Definition at line 180 of file WaspXBee802.h.

Referenced by getMacMode(), init(), and setMacMode().

Variable : the CA threshold in the CCA process to detect energy on the channel (range [0x00-0x50]).

Definition at line 185 of file WaspXBee802.h.

Referenced by getEnergyThreshold(), init(), and setEnergyThreshold().

Variable : the number of times too much energy has been found on the channel.

Definition at line 190 of file WaspXBee802.h.

Referenced by getCCAcounter(), init(), and resetCCAcounter().

Variable : the number of times there has been an ACK failure.

Definition at line 195 of file WaspXBee802.h.

Referenced by getACKcounter(), init(), and resetACKcounter().

uint8_t WaspXBee802::counter [private]

Variable : internal counter.

Definition at line 202 of file WaspXBee802.h.

Referenced by init().


The documentation for this class was generated from the following files:

Generated on Tue Jul 20 09:31:04 2010 for WaspmoteAPI by  doxygen 1.5.6