00001 /*! \file WaspXBeeDM.h 00002 \brief Library for managing XBee DigiMesh and 900MHz modules 00003 00004 Copyright (C) 2009 Libelium Comunicaciones Distribuidas S.L. 00005 http://www.libelium.com 00006 00007 This program is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU Lesser General Public License as published by 00009 the Free Software Foundation, either version 2.1 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. 00019 00020 Version: 0.2 00021 00022 Design: David Gascón 00023 00024 Implementation: Alberto Bielsa 00025 00026 */ 00027 00028 /*! \def WaspXBeeDM_h 00029 \brief The library flag 00030 00031 */ 00032 #ifndef WaspXBeeDM_h 00033 #define WaspXBeeDM_h 00034 00035 /****************************************************************************** 00036 * Includes 00037 ******************************************************************************/ 00038 00039 #include <string.h> 00040 #include <stdint.h> 00041 #include <stdlib.h> 00042 #include "WConstants.h" 00043 #include "WaspXBee.h" 00044 #include "WaspUSB.h" 00045 #include "WaspXBeeCore.h" 00046 #include <inttypes.h> 00047 00048 #ifndef __WASPXBEECONSTANTS_H__ 00049 #include "WaspXBeeConstants.h" 00050 #endif 00051 00052 /****************************************************************************** 00053 * Class 00054 ******************************************************************************/ 00055 00056 //! WaspXBeeDM Class 00057 /*! 00058 WaspXBeeDM Class defines all the variables and functions used to manage XBee DigiMesh and 900MHz modules. It inherits from 'WaspXBeeCore' class the necessary functions, variables and definitions 00059 */ 00060 class WaspXBeeDM : public WaspXBeeCore 00061 { 00062 public: 00063 00064 //! class constructor 00065 /*! 00066 It does nothing 00067 \param void 00068 \return void 00069 */ 00070 WaspXBeeDM(){}; 00071 00072 //! It initializes the necessary variables 00073 /*! 00074 It initalizes all the necessary variables including its father's variables 00075 \param uint8_t protocol_used : specifies the protocol used in the XBee module (DIGIMESH or XBEE_900) 00076 \param uint8_t frequency : specifies the frequency used in the XBee module (FREQ2_4G or FREQ900M) 00077 \param uint8_t model_used : specifies the XBee model used (NORMAL or PRO) 00078 \return void 00079 */ 00080 void init(uint8_t protocol_used, uint8_t frequency, uint8_t model_used); 00081 00082 //! It gets the number of times the RF receiver detected a CRC or length error 00083 /*! 00084 It stores in global 'errorsRF' variable the number of times the RF receiver detected a CRC or length error 00085 \return '0' on success, '1' otherwise 00086 */ 00087 uint8_t getRFerrors(); 00088 00089 //! It gets the number of good frames with valid MAC headers that are received on the RF interface 00090 /*! 00091 It stores in global 'goodPackets' variable the number of good frames with valid MAC headers that are received on the RF interface 00092 \return '0' on success, '1' otherwise 00093 */ 00094 uint8_t getGoodPackets(); 00095 00096 //! It gets the DBM level of the designated channel 00097 /*! 00098 It stores in global 'channelRSSI' variable the number of retries 00099 \param uint8_t channel : the channel where to get the DBM level (depends on the XBee module) 00100 \return '0' on success, '1' otherwise 00101 */ 00102 uint8_t getChannelRSSI(uint8_t channel); 00103 00104 //! It gets the number of MAC frames that exhaust MAC retries without ever receiving a MAC acknowledgement message from the adjacent node 00105 /*! 00106 It stores in global 'transmisionErrors' variable the number of MAC frames that exhaust MAC retries without ever receiving a MAC acknowledgement message from the adjacent node 00107 \return '0' on success, '1' otherwise 00108 */ 00109 uint8_t getTransmisionErrors(); 00110 00111 //! It sets the maximum number of hops expected to be seen in a network route 00112 /*! 00113 \param uint8_t nhops : the maximum number of hops expected to be seen in a network route (range [1-0xFF]) 00114 \return '0' on success, '1' otherwise 00115 */ 00116 uint8_t setNetworkHops(uint8_t nhops); 00117 00118 //! It gets the maximum number of hops expected to be seen in a network route 00119 /*! 00120 It stores in global 'networkHops' variable the maximum number of hops expected to be seen in a network route receiving a MAC acknowledgement message from the adjacent node 00121 \return '0' on success, '1' otherwise 00122 */ 00123 uint8_t getNetworkHops(); 00124 00125 //! It sets the maximum random number of network delay slots before rebroadcasting a network packet 00126 /*! 00127 \param uint8_t dslots : the maximum random number of network delay slots before rebroadcasting a network packet (range [0-0x0A]) 00128 \return '0' on success, '1' otherwise 00129 */ 00130 uint8_t setNetworkDelaySlots(uint8_t dslots); 00131 00132 //! It gets the maximum random number of network delay slots before rebroadcasting a network packet 00133 /*! 00134 It stores in global 'netDelaySlots' variable the maximum random number of network delay slots before rebroadcasting a network packet 00135 \return '0' on success, '1' otherwise 00136 */ 00137 uint8_t getNetworkDelaySlots(); 00138 00139 //! It sets the maximum number of route discovery retries allowed to find a path to the destination node 00140 /*! 00141 \param uint8_t route : the maximum number of route discovery retries allowed to find a path to the destination node (range [0-0x0A]) 00142 \return '0' on success, '1' otherwise 00143 */ 00144 uint8_t setNetworkRouteRequests(uint8_t route); 00145 00146 //! It gets the maximum number of route discovery retries allowed to find a path to the destination node 00147 /*! 00148 It stores in global 'netRouteRequest' variable the maximum number of route discovery retries allowed to find a path to the destination node 00149 \return '0' on success, '1' otherwise 00150 */ 00151 uint8_t getNetworkRouteRequests(); 00152 00153 //! It sets the maximum number of network packet delivery attempts 00154 /*! 00155 \param uint8_t mesh : the maximum number of network packet delivery attempts (range [0-7]) 00156 \return '0' on success, '1' otherwise 00157 */ 00158 uint8_t setMeshNetworkRetries(uint8_t mesh); 00159 00160 //! It gets the maximum number of network packet delivery attempts 00161 /*! 00162 It stores in global 'meshNetRetries' variable the maximum number of network packet delivery attempts 00163 \return '0' on success, '1' otherwise 00164 */ 00165 uint8_t getMeshNetworkRetries(); 00166 00167 //! It gets module temperature in Celsius. Negatives temperatures can be returned 00168 /*! 00169 It stores in global 'temperature' variable module temperature in Celsius 00170 \return '0' on success, '1' otherwise 00171 */ 00172 uint8_t getTemperature(); 00173 00174 //! It gets the voltage on the Vcc pin 00175 /*! 00176 It stores in global 'supplyVoltage' variable the voltage on the Vcc pin 00177 \return '0' on success, '1' otherwise 00178 */ 00179 uint8_t getSupplyVoltage(); 00180 00181 //! It restores module parameters to compiled defaults 00182 /*! 00183 \return '0' on success, '1' otherwise 00184 */ 00185 uint8_t restoreCompiled(); 00186 00187 00188 //! Variable : the number of times the RF receiver detected a CRC or length error 00189 /*! 00190 */ 00191 uint8_t errorsRF[2]; 00192 00193 //! Variable : the number of good frames with valid MAC headers that are received on the RF interface 00194 /*! 00195 */ 00196 uint8_t goodPackets[2]; 00197 00198 //! Variable : the DBM level of the designated channel 00199 /*! 00200 */ 00201 uint8_t channelRSSI; 00202 00203 //! Variable : the number of MAC frames that exhaust MAC retries without ever receiving a MAC acknowledgement message from the adjacent node 00204 /*! 00205 */ 00206 uint8_t transmisionErrors[2]; 00207 00208 //! Variable : the maximum number of hops expected to be seen in a network route (range [1-0xFF]) 00209 /*! 00210 */ 00211 uint8_t networkHops; 00212 00213 //! Variable : the maximum random number of network delay slots before rebroadcasting a network packet (range [0-0x0A]) 00214 /*! 00215 */ 00216 uint8_t netDelaySlots; 00217 00218 //! Variable : the maximum number of route discovery retries allowed to find a path to the destination node (range [0-0x0A]) 00219 /*! 00220 */ 00221 uint8_t netRouteRequest; 00222 00223 //! Variable : the maximum number of network packet delivery attempts (range [0-7]) 00224 /*! 00225 */ 00226 uint8_t meshNetRetries; 00227 00228 //! Variable : module temperature in Celsius 00229 /*! 00230 */ 00231 uint8_t temperature[2]; 00232 00233 //! Variable : the voltage on the Vcc pin 00234 /*! 00235 */ 00236 uint8_t supplyVoltage[2]; 00237 }; 00238 00239 extern WaspXBeeDM xbeeDM; 00240 00241 #endif;
1.5.6