#include <WaspXBeeXSC.h>
Public Member Functions | |
| WaspXBeeXSC () | |
| class constructor | |
| void | init (uint8_t protocol_used, uint8_t frequency, uint8_t model_used) |
| It initializes the necessary variables. | |
| uint8_t | setCommandMode () |
| It sets the module into Command Mode. | |
| uint8_t | exitCommandMode () |
| It exits the module from Command Mode. | |
| uint8_t | setBaudRate (uint8_t brate) |
| It sets the Baud Rate used in the module. | |
| uint8_t | getBaudRate () |
| It gets the Baud Rate used in the module. | |
| uint8_t | setVendorID (uint8_t VID_H, uint8_t VID_L) |
| It sets the module Vendor ID. | |
| uint8_t | getVendorID () |
| It gets the module Vendor ID. | |
| uint8_t | getRSSI () |
| It gets the dBm level in the most recent packet. | |
| uint8_t | setDestAddress (uint8_t destAD_H, uint8_t destAD_L) |
| It sets the networking address of a module. | |
| uint8_t | getDestAddress () |
| It gets the networking address of a module. | |
| uint8_t | setReceiveErrorCount (uint8_t recerror_H, uint8_t recerror_L) |
| It sets the receive error count. | |
| uint8_t | getReceiveErrorCount () |
| It gets the receive error count. | |
| uint8_t | forceWakeUP () |
| It forces a Wake-up initializer to be sent on the next transmit. | |
| uint8_t | forceReset () |
| It resets the module through the UART. | |
| uint8_t | setReceiveGoodCount (uint8_t recgood_H, uint8_t recgood_L) |
| It sets the receive good count. | |
| uint8_t | getReceiveGoodCount () |
| It gets the receive good count. | |
| uint8_t | setHoppingChannel (uint8_t hchannel) |
| It sets the Hopping Channel used in the transmission. | |
| uint8_t | getHoppingChannel () |
| It gets the Hopping Channel used in the transmission. | |
| uint8_t | setTimeBeforeWakeUP (uint8_t timeHT_H, uint8_t timeHT_L) |
| It sets the time before send a Wake-up initializer. | |
| uint8_t | getTimeBeforeWakeUP () |
| It gets the time before send a Wake-up initializer. | |
| uint8_t | setTimeWakeUpInit (uint8_t timeLH) |
| It sets the amount of time the Wake-Up Init is sent. | |
| uint8_t | getTimeWakeUpInit () |
| It gets the amount of time the Wake-Up Init is sent. | |
| uint8_t | setAddressMask (uint8_t mask_H, uint8_t mask_L) |
| It sets the address mask. | |
| uint8_t | getAddressMask () |
| It gets the address mask. | |
| uint8_t | setPinWakeUP (uint8_t pin) |
| It sets the pin Wake-UP ON/OFF. | |
| uint8_t | getPinWakeUP () |
| It gets the pin Wake-UP ON/OFF. | |
| uint8_t | restoreDefaults () |
| It restores all configurable parameters to defaults values. | |
| uint8_t | setDelaySlots (uint8_t slot) |
| It sets the random delay slots. | |
| uint8_t | getDelaySlots () |
| It gets the random delay slots. | |
| uint8_t | setPacketTimeout (uint8_t pack_H, uint8_t pack_L) |
| It sets the packetization timeout. | |
| uint8_t | getPacketTimeout () |
| It gets the packetization timeout. | |
| uint8_t | setRSSItime (uint8_t rssiTime) |
| It sets the time the output pin is active with the RSSI value. | |
| uint8_t | getRSSItime () |
| It gets the time the output pin is active with the RSSI value. | |
| uint8_t | setRetries (uint8_t retry) |
| It sets the number of retries that can be sent for a given packet RF. | |
| uint8_t | getRetries () |
| It gets the number of retries that can be sent for a given packet RF. | |
| uint8_t | getRSSIvalue () |
| It gets the last received packet RSSI. | |
| uint8_t | setStopBits (uint8_t stop) |
| It sets the number of stop bits in the data packets. | |
| uint8_t | getStopBits () |
| It gets the number of stop bits in the data packets. | |
| uint8_t | getSourceMacHigh () |
| It gets the 32b Higher Source Mac. | |
| uint8_t | getSourceMacLow () |
| It gets the 32b Lower Source Mac. | |
| uint8_t | setSleepMode (uint8_t smode) |
| It sets the Sleep Mode. | |
| uint8_t | getSleepMode () |
| It gets the Sleep Mode. | |
| uint8_t | setAwakeTime (uint8_t awake_H, uint8_t awake_L) |
| It sets the amount of time the module is awake. | |
| uint8_t | getAwakeTime () |
| It gets the amount of time the module is awake. | |
| uint8_t | setTimeBeforeInit (uint8_t timeInit) |
| It sets the time before sending again the initializer. | |
| uint8_t | getTimeBeforeInit () |
| It gets the time before sending again the initializer. | |
| uint8_t | setTransmitErrorCount (uint8_t txerror_H, uint8_t txerror_L) |
| It sets the transmit error count. | |
| uint8_t | getTransmitErrorCount () |
| It gets the transmit error count. | |
| uint8_t | setTransmitLimit (uint8_t txlim_H, uint8_t txlim_L) |
| It sets the max number of bytes a module can send before waiting. | |
| uint8_t | getTransmitLimit () |
| It gets the max number of bytes a module can send before waiting. | |
| uint8_t | getSoftVersion () |
| It gets the Firmware version. | |
| uint8_t | writeValues () |
| It writes the parameters changed into non-volatil memory. | |
| uint8_t | sendData (struct packetXSC *packet) |
| It sends data to other modules. | |
| uint8_t | readData (struct packetXSC *packet) |
| It reads data from other modules. | |
| uint8_t | sendCommandAT (char *atcommand) |
| It is a transparent function. The user introduces an AT command within a string. | |
| uint8_t | ON () |
| It connects XBee, activating switch and opens the UART. | |
| uint8_t | sleep () |
| It sets the XBee to sleep, asserting PIN 9. | |
| uint8_t | wake () |
| It wakes up the XBee, de-asserting PIN 9. | |
Data Fields | |
| uint8_t | vendorID [2] |
| Variable : the module Vendor ID. | |
| uint8_t | baudRate |
| Variable : the Baud Rate used in the module. | |
| uint8_t | valueRSSI |
| Variable : the dBm level in the most recent packet. | |
| uint8_t | destAddress [2] |
| Variable : the networking address of a module. | |
| uint8_t | receiveErrorCount [2] |
| Variable : the receive error count. | |
| uint8_t | receiveGoodCount [2] |
| Variable : the receive good count. | |
| uint8_t | channel |
| Variable : the Hopping Channel used in the transmission. | |
| uint8_t | timeBeforeWakeUP [2] |
| Variable : the time before send a Wake-up initializer. | |
| uint8_t | timeWakeUpInit |
| Variable : the amount of time the Wake-Up Init is sent. | |
| uint8_t | addressMask [2] |
| Variable : the address mask. | |
| uint8_t | pinWakeUP |
| Variable : the pin Wake-UP ON/OFF. | |
| uint8_t | delaySlots |
| Variable : the random delay slots. | |
| uint8_t | packetTimeout [2] |
| Variable : the packetization timeout. | |
| uint8_t | timeRSSI |
| Variable : the time the output pin is active with the RSSI value. | |
| uint8_t | retries |
| Variable : the number of retries that can be sent for a given packet RF. | |
| uint8_t | RSSI |
| Variable : the last received packet RSSI. | |
| uint8_t | stopBits |
| Variable : the number of stop bits in the data packets. | |
| uint8_t | sourceMacHigh [2] |
| Variable : the 32b Higher Source Mac. | |
| uint8_t | sourceMacLow [2] |
| Variable : the 32b Lower Source Mac. | |
| uint8_t | sleepMode |
| Variable : the Sleep Mode. | |
| uint8_t | awakeTime [2] |
| Variable : the amount of time the module is awake. | |
| uint8_t | timeBeforeInit |
| Variable : the time before sending again the initializer. | |
| uint8_t | transmitErrorCount [2] |
| Variable : the transmit error count. | |
| uint8_t | transmitLimit [2] |
| Variable : the max number of bytes a module can send before waiting. | |
| uint8_t | firmwareVersion [2] |
| Variable : the Firmware version. | |
| uint8_t | commandAT [20] |
| Variable : the XBee answer to the command. | |
Private Member Functions | |
| uint8_t | converter (uint8_t conv1) |
| It generates a decimal number from an ASCII character which was a number. | |
| uint8_t | converter (uint8_t conv1, uint8_t conv2) |
| It generates a decimal number from two ASCII characters which were numbers. | |
| uint8_t | converter (uint8_t conv1, uint8_t conv2, uint8_t conv3) |
| It generates a decimal number from three ASCII characters which were numbers. | |
| void | clean () |
| It checks if the XBee module answer a 'OK' message. | |
| uint8_t | check () |
| It cleans the unwanted bytes returned by XBee module. | |
Private Attributes | |
| uint8_t | it |
| Variable : counter used in the library. | |
| uint8_t | protocol |
| Variable : protocol used (XBEE_XSC in this case). | |
| uint8_t | freq |
| Variable : frequency used (FREQ900M in this case). | |
| uint8_t | model |
| Variable : model used (PRO in this case). | |
WaspXBee Class defines all the variables and functions used for managing the XBee XSC modules
Definition at line 94 of file WaspXBeeXSC.h.
| WaspXBeeXSC::WaspXBeeXSC | ( | ) | [inline] |
class constructor
It does nothing
| void |
Definition at line 104 of file WaspXBeeXSC.h.
| void WaspXBeeXSC::init | ( | uint8_t | protocol_used, | |
| uint8_t | frequency, | |||
| uint8_t | model_used | |||
| ) |
It initializes the necessary variables.
| uint8_t | protocol_used : specifies the protocol used in the XBee module (XBEE_XSC in this case) | |
| uint8_t | frequency : specifies the frequency used in the XBee module (FREQ900M in this case) | |
| uint8_t | model_used : specifies the XBee model used (PRO) |
Definition at line 29 of file WaspXBeeXSC.cpp.
References freq, model, and protocol.
| uint8_t WaspXBeeXSC::setCommandMode | ( | ) |
It sets the module into Command Mode.
| void |
Definition at line 43 of file WaspXBeeXSC.cpp.
References clean(), delay(), WaspXBee::print(), and XBee.
Referenced by sendData().
00044 { 00045 uint8_t error=0; 00046 00047 delay(1500); 00048 XBee.print("+++"); 00049 delay(1000); 00050 clean(); 00051 error=0; 00052 return error; 00053 }


| uint8_t WaspXBeeXSC::exitCommandMode | ( | ) |
It exits the module from Command Mode.
| void |
Definition at line 62 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), WaspXBee::println(), and XBee.
Referenced by sendData().


| uint8_t WaspXBeeXSC::setBaudRate | ( | uint8_t | brate | ) |
It sets the Baud Rate used in the module.
| uint8_t | brate : the baud rate (range [0-5]) |
Definition at line 131 of file WaspXBeeXSC.cpp.
References baudRate, check(), clean(), DEC, delay(), WaspXBee::print(), WaspXBee::println(), and XBee.
00132 { 00133 clean(); 00134 XBee.print("atbd"); 00135 XBee.println(brate,DEC); 00136 delay(1000); 00137 if(!check()) 00138 { 00139 baudRate=brate; 00140 return 0; 00141 } 00142 return 1; 00143 }

| uint8_t WaspXBeeXSC::getBaudRate | ( | ) |
It gets the Baud Rate used in the module.
It stores in global 'baudRate' variable the Baud Rate used in the module
Definition at line 154 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), baudRate, clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), and XBee.
00155 { 00156 uint8_t ByteIN[10]; 00157 uint8_t error=1; 00158 uint8_t i=0; 00159 00160 clean(); 00161 XBee.println("atbd"); 00162 delay(1000); 00163 while(XBee.available() > 0) 00164 { 00165 ByteIN[i]=XBee.read(); 00166 i++; 00167 error=0; 00168 } 00169 baudRate=converter(ByteIN[0]); 00170 return error; 00171 }

| uint8_t WaspXBeeXSC::setVendorID | ( | uint8_t | VID_H, | |
| uint8_t | VID_L | |||
| ) |
It sets the module Vendor ID.
| uint8_t | VID_H : higher module Vendor ID byte (range [0x00-0x7F]) | |
| uint8_t | VID_L : lower module Vendor ID byte (range [0x00-0xFF]) |
Definition at line 78 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), HEX, WaspXBee::print(), WaspXBee::println(), vendorID, and XBee.
00079 { 00080 clean(); 00081 XBee.print("atid"); 00082 XBee.print(VID_H,HEX); 00083 XBee.println(VID_L,HEX); 00084 delay(1000); 00085 if(!check()) 00086 { 00087 vendorID[0]=VID_H; 00088 vendorID[1]=VID_L; 00089 return 0; 00090 } 00091 return 1; 00092 }

| uint8_t WaspXBeeXSC::getVendorID | ( | ) |
It gets the module Vendor ID.
It stores in global 'vendorID' variable the module Vendor ID
Definition at line 102 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), vendorID, and XBee.
00103 { 00104 uint8_t ByteIN[10]; 00105 uint8_t error=2; 00106 uint8_t i=0; 00107 00108 clean(); 00109 XBee.println("atid"); 00110 delay(1000); 00111 while(XBee.available() > 0) 00112 { 00113 ByteIN[i]=XBee.read(); 00114 i++; 00115 error=0; 00116 } 00117 vendorID[0]=converter(ByteIN[0],ByteIN[1]); 00118 vendorID[1]=converter(ByteIN[2],ByteIN[3]); 00119 return error; 00120 }

| uint8_t WaspXBeeXSC::getRSSI | ( | ) |
It gets the dBm level in the most recent packet.
It stores in global 'valueRSSI' variable the dBm level in the most recent packet
Definition at line 181 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), valueRSSI, and XBee.
00182 { 00183 uint8_t ByteIN[10]; 00184 uint8_t error=1; 00185 uint8_t i=0; 00186 00187 clean(); 00188 XBee.println("atdb"); 00189 delay(1000); 00190 while(XBee.available() > 0) 00191 { 00192 ByteIN[i]=XBee.read(); 00193 i++; 00194 error=0; 00195 } 00196 valueRSSI=converter(ByteIN[0],ByteIN[1]); 00197 return error; 00198 }

| uint8_t WaspXBeeXSC::setDestAddress | ( | uint8_t | destAD_H, | |
| uint8_t | destAD_L | |||
| ) |
It sets the networking address of a module.
| uint8_t | destAD_H : higher destination address byte (range [0x00-0xFF]) | |
| uint8_t | destAD_L : lower destination address byte (range [0x00-0xFF]) |
Definition at line 208 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), destAddress, HEX, WaspXBee::print(), WaspXBee::println(), and XBee.
00209 { 00210 clean(); 00211 XBee.print("atdt"); 00212 XBee.print(destAD_H,HEX); 00213 XBee.println(destAD_L,HEX); 00214 delay(1000); 00215 00216 if(!check()) 00217 { 00218 destAddress[0]=destAD_H; 00219 destAddress[1]=destAD_L; 00220 return 0; 00221 } 00222 return 1; 00223 }

| uint8_t WaspXBeeXSC::getDestAddress | ( | ) |
It gets the networking address of a module.
It stores in global 'destAddress' variable the networking address of a module
Definition at line 233 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), destAddress, WaspXBee::println(), WaspXBee::read(), and XBee.
00234 { 00235 uint8_t ByteIN[10]; 00236 uint8_t error=1; 00237 uint8_t i=0; 00238 00239 clean(); 00240 XBee.println("atdt"); 00241 delay(1000); 00242 while(XBee.available() > 0) 00243 { 00244 ByteIN[i]=XBee.read(); 00245 i++; 00246 error=0; 00247 } 00248 destAddress[0]=converter(ByteIN[0],ByteIN[1]); 00249 destAddress[1]=converter(ByteIN[2],ByteIN[3]); 00250 return error; 00251 }

| uint8_t WaspXBeeXSC::setReceiveErrorCount | ( | uint8_t | recerror_H, | |
| uint8_t | recerror_L | |||
| ) |
It sets the receive error count.
| uint8_t | recerror_H : higher receiver error count byte (range [0x00-0xFF]) | |
| uint8_t | recerror_L : lower receiver error count byte (range [0x00-0xFF]) |
Definition at line 261 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), HEX, WaspXBee::print(), WaspXBee::println(), receiveErrorCount, and XBee.
00262 { 00263 clean(); 00264 XBee.print("ater"); 00265 XBee.print(recerror_H,HEX); 00266 XBee.println(recerror_L,HEX); 00267 delay(1000); 00268 00269 if(!check()) 00270 { 00271 receiveErrorCount[0]=recerror_H; 00272 receiveErrorCount[1]=recerror_L; 00273 return 0; 00274 } 00275 return 1; 00276 }

| uint8_t WaspXBeeXSC::getReceiveErrorCount | ( | ) |
It gets the receive error count.
It stores in global 'receiveErrorCount' variable the receive error count
Definition at line 286 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), receiveErrorCount, and XBee.
00287 { 00288 uint8_t ByteIN[10]; 00289 uint8_t error=1; 00290 uint8_t i=0; 00291 00292 clean(); 00293 XBee.println("ater"); 00294 delay(1000); 00295 while(XBee.available() > 0) 00296 { 00297 ByteIN[i]=XBee.read(); 00298 i++; 00299 error=0; 00300 } 00301 receiveErrorCount[0]=converter(ByteIN[0],ByteIN[1]); 00302 receiveErrorCount[1]=converter(ByteIN[2],ByteIN[3]); 00303 return error; 00304 }

| uint8_t WaspXBeeXSC::forceWakeUP | ( | ) |
It forces a Wake-up initializer to be sent on the next transmit.
Definition at line 313 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), WaspXBee::println(), and XBee.

| uint8_t WaspXBeeXSC::forceReset | ( | ) |
It resets the module through the UART.
Definition at line 328 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), WaspXBee::println(), and XBee.

| uint8_t WaspXBeeXSC::setReceiveGoodCount | ( | uint8_t | recgood_H, | |
| uint8_t | recgood_L | |||
| ) |
It sets the receive good count.
| uint8_t | recgood_H : higher receive good count byte (range [0x00-0xFF]) | |
| uint8_t | recgood_L : lower receive good count byte (range [0x00-0xFF]) |
Definition at line 344 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), HEX, WaspXBee::print(), WaspXBee::println(), receiveGoodCount, and XBee.
00345 { 00346 clean(); 00347 XBee.print("atgd"); 00348 XBee.print(recgood_H,HEX); 00349 XBee.println(recgood_L,HEX); 00350 delay(1000); 00351 00352 if(!check()) 00353 { 00354 receiveGoodCount[0]=recgood_H; 00355 receiveGoodCount[1]=recgood_L; 00356 return 0; 00357 } 00358 return 1; 00359 }

| uint8_t WaspXBeeXSC::getReceiveGoodCount | ( | ) |
It gets the receive good count.
It stores in global 'receiveGoodCount' variable the receive good count
Definition at line 369 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), receiveGoodCount, and XBee.
00370 { 00371 uint8_t ByteIN[10]; 00372 uint8_t error=1; 00373 uint8_t i=0; 00374 00375 clean(); 00376 XBee.println("atgd"); 00377 delay(1000); 00378 while(XBee.available() > 0) 00379 { 00380 ByteIN[i]=XBee.read(); 00381 i++; 00382 error=0; 00383 } 00384 receiveGoodCount[0]=converter(ByteIN[0],ByteIN[1]); 00385 receiveGoodCount[1]=converter(ByteIN[2],ByteIN[3]); 00386 return error; 00387 }

| uint8_t WaspXBeeXSC::setHoppingChannel | ( | uint8_t | hchannel | ) |
It sets the Hopping Channel used in the transmission.
| uint8_t | hchannel : hopping channel used in the transmission (range [0-6]) |
Definition at line 397 of file WaspXBeeXSC.cpp.
References channel, check(), clean(), DEC, delay(), WaspXBee::print(), WaspXBee::println(), and XBee.
00398 { 00399 clean(); 00400 XBee.print("athp"); 00401 XBee.println(hchannel,DEC); 00402 delay(1000); 00403 00404 if(!check()) 00405 { 00406 channel=hchannel; 00407 return 0; 00408 } 00409 return 1; 00410 }

| uint8_t WaspXBeeXSC::getHoppingChannel | ( | ) |
It gets the Hopping Channel used in the transmission.
It stores in global 'channel' variable the Hopping Channel used in the transmission
Definition at line 420 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), channel, clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), and XBee.
00421 { 00422 uint8_t ByteIN[10]; 00423 uint8_t error=1; 00424 uint8_t i=0; 00425 00426 clean(); 00427 XBee.println("athp"); 00428 delay(1000); 00429 while(XBee.available() > 0) 00430 { 00431 ByteIN[i]=XBee.read(); 00432 i++; 00433 error=0; 00434 } 00435 channel=converter(ByteIN[0]); 00436 return error; 00437 }

| uint8_t WaspXBeeXSC::setTimeBeforeWakeUP | ( | uint8_t | timeHT_H, | |
| uint8_t | timeHT_L | |||
| ) |
It sets the time before send a Wake-up initializer.
| uint8_t | timeHT_H : higher timer byte (range [0x00-0xFF]) | |
| uint8_t | timeHT_L : lower timer byte (range [0x00-0xFF]) |
Definition at line 447 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), HEX, WaspXBee::print(), WaspXBee::println(), timeBeforeWakeUP, and XBee.
00448 { 00449 clean(); 00450 XBee.print("atht"); 00451 XBee.print(timeHT_H,HEX); 00452 XBee.println(timeHT_L,HEX); 00453 delay(1000); 00454 00455 if(!check()) 00456 { 00457 timeBeforeWakeUP[0]=timeHT_H; 00458 timeBeforeWakeUP[1]=timeHT_L; 00459 return 0; 00460 } 00461 return 1; 00462 }

| uint8_t WaspXBeeXSC::getTimeBeforeWakeUP | ( | ) |
It gets the time before send a Wake-up initializer.
It stores in global 'timeBeforeWakeUP' variable the time before sending a Wake-up initializer
Definition at line 472 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), timeBeforeWakeUP, and XBee.
00473 { 00474 uint8_t ByteIN[10]; 00475 uint8_t error=1; 00476 uint8_t i=0; 00477 00478 clean(); 00479 XBee.println("atht"); 00480 delay(1000); 00481 while(XBee.available() > 0) 00482 { 00483 ByteIN[i]=XBee.read(); 00484 i++; 00485 error=0; 00486 } 00487 timeBeforeWakeUP[0]=converter(ByteIN[0],ByteIN[1]); 00488 timeBeforeWakeUP[1]=converter(ByteIN[2],ByteIN[3]); 00489 return error; 00490 }

| uint8_t WaspXBeeXSC::setTimeWakeUpInit | ( | uint8_t | timeLH | ) |
It sets the amount of time the Wake-Up Init is sent.
| uint8_t | timeLH : the amount of time the Wake-Up Init is sent (range [0x00-0xFF]) |
Definition at line 500 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), HEX, WaspXBee::print(), WaspXBee::println(), timeWakeUpInit, and XBee.
00501 { 00502 clean(); 00503 XBee.print("atlh"); 00504 XBee.println(timeLH,HEX); 00505 delay(1000); 00506 00507 if(!check()) 00508 { 00509 timeWakeUpInit=timeLH; 00510 return 0; 00511 } 00512 return 1; 00513 }

| uint8_t WaspXBeeXSC::getTimeWakeUpInit | ( | ) |
It gets the amount of time the Wake-Up Init is sent.
It stores in global 'timeWakeUpInit' variable the time before send a Wake-up initializer
Definition at line 523 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), timeWakeUpInit, and XBee.
00524 { 00525 uint8_t ByteIN[10]; 00526 uint8_t error=1; 00527 uint8_t i=0; 00528 00529 clean(); 00530 XBee.println("atlh"); 00531 delay(1000); 00532 while(XBee.available() > 0) 00533 { 00534 ByteIN[i]=XBee.read(); 00535 i++; 00536 error=0; 00537 } 00538 timeWakeUpInit=converter(ByteIN[0],ByteIN[1]); 00539 return error; 00540 }

| uint8_t WaspXBeeXSC::setAddressMask | ( | uint8_t | mask_H, | |
| uint8_t | mask_L | |||
| ) |
It sets the address mask.
| uint8_t | mask_H : higher address mask byte (range [0x00-0xFF]) | |
| uint8_t | mask_L : lower address mask byte (range [0x00-0xFF]) |
Definition at line 550 of file WaspXBeeXSC.cpp.
References addressMask, check(), clean(), delay(), HEX, WaspXBee::print(), WaspXBee::println(), and XBee.
00551 { 00552 clean(); 00553 XBee.print("atmk"); 00554 XBee.print(mask_H,HEX); 00555 XBee.println(mask_L,HEX); 00556 delay(1000); 00557 00558 if(!check()) 00559 { 00560 addressMask[0]=mask_H; 00561 addressMask[1]=mask_L; 00562 return 0; 00563 } 00564 return 1; 00565 }

| uint8_t WaspXBeeXSC::getAddressMask | ( | ) |
It gets the address mask.
It stores in global 'addressMask' variable the address mask
Definition at line 575 of file WaspXBeeXSC.cpp.
References addressMask, WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), and XBee.
00576 { 00577 uint8_t ByteIN[10]; 00578 uint8_t error=1; 00579 uint8_t i=0; 00580 00581 clean(); 00582 XBee.println("atmk"); 00583 delay(1000); 00584 while(XBee.available() > 0) 00585 { 00586 ByteIN[i]=XBee.read(); 00587 i++; 00588 error=0; 00589 } 00590 addressMask[0]=converter(ByteIN[0],ByteIN[1]); 00591 addressMask[1]=converter(ByteIN[2],ByteIN[3]); 00592 return error; 00593 }

| uint8_t WaspXBeeXSC::setPinWakeUP | ( | uint8_t | pin | ) |
It sets the pin Wake-UP ON/OFF.
| uint8_t | pin : the pin to wake-up (range [0-1]) |
Definition at line 603 of file WaspXBeeXSC.cpp.
References check(), clean(), DEC, delay(), pinWakeUP, WaspXBee::print(), WaspXBee::println(), and XBee.
00604 { 00605 clean(); 00606 XBee.print("atpw"); 00607 XBee.println(pin,DEC); 00608 delay(1000); 00609 00610 if(!check()) 00611 { 00612 pinWakeUP=pin; 00613 return 0; 00614 } 00615 return 1; 00616 }

| uint8_t WaspXBeeXSC::getPinWakeUP | ( | ) |
It gets the pin Wake-UP ON/OFF.
It stores in global 'pin' variable the pin Wake-UP ON/OFF
Definition at line 626 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), pinWakeUP, WaspXBee::println(), WaspXBee::read(), and XBee.
00627 { 00628 uint8_t ByteIN[10]; 00629 uint8_t error=1; 00630 uint8_t i=0; 00631 00632 clean(); 00633 XBee.println("atpw"); 00634 delay(1000); 00635 while(XBee.available() > 0) 00636 { 00637 ByteIN[i]=XBee.read(); 00638 i++; 00639 error=0; 00640 } 00641 pinWakeUP=converter(ByteIN[0]); 00642 return error; 00643 }

| uint8_t WaspXBeeXSC::restoreDefaults | ( | ) |
It restores all configurable parameters to defaults values.
Definition at line 652 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), WaspXBee::println(), and XBee.

| uint8_t WaspXBeeXSC::setDelaySlots | ( | uint8_t | slot | ) |
It sets the random delay slots.
| uint8_t | slot : the random delay slots (range [0x00-0xFF]) |
Definition at line 668 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), delaySlots, HEX, WaspXBee::print(), WaspXBee::println(), and XBee.
00669 { 00670 clean(); 00671 XBee.print("atrn"); 00672 XBee.println(slot,HEX); 00673 delay(1000); 00674 00675 if(!check()) 00676 { 00677 delaySlots=slot; 00678 return 0; 00679 } 00680 return 1; 00681 }

| uint8_t WaspXBeeXSC::getDelaySlots | ( | ) |
It gets the random delay slots.
It stores in global 'delaySlots' variable the random delay slots
Definition at line 691 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), delaySlots, WaspXBee::println(), WaspXBee::read(), and XBee.
00692 { 00693 uint8_t ByteIN[10]; 00694 uint8_t error=1; 00695 uint8_t i=0; 00696 00697 clean(); 00698 XBee.println("atrn"); 00699 delay(1000); 00700 while(XBee.available() > 0) 00701 { 00702 ByteIN[i]=XBee.read(); 00703 i++; 00704 error=0; 00705 } 00706 delaySlots=converter(ByteIN[0],ByteIN[1]); 00707 return error; 00708 }

| uint8_t WaspXBeeXSC::setPacketTimeout | ( | uint8_t | pack_H, | |
| uint8_t | pack_L | |||
| ) |
It sets the packetization timeout.
| uint8_t | pack_H : higher timeout byte (range [0x00-0xFF]) | |
| uint8_t | pack_L : lower timeout byte (range [0x00-0xFF]) |
Definition at line 718 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), HEX, packetTimeout, WaspXBee::print(), WaspXBee::println(), and XBee.
00719 { 00720 clean(); 00721 XBee.print("atro"); 00722 XBee.print(pack_H,HEX); 00723 XBee.println(pack_L,HEX); 00724 delay(1000); 00725 00726 if(!check()) 00727 { 00728 packetTimeout[0]=pack_H; 00729 packetTimeout[1]=pack_L; 00730 return 0; 00731 } 00732 return 1; 00733 }

| uint8_t WaspXBeeXSC::getPacketTimeout | ( | ) |
It gets the packetization timeout.
It stores in global 'packetTimeout' variable the random delay slots
Definition at line 743 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), packetTimeout, WaspXBee::println(), WaspXBee::read(), and XBee.
00744 { 00745 uint8_t ByteIN[10]; 00746 uint8_t error=1; 00747 uint8_t i=0; 00748 00749 clean(); 00750 XBee.println("atro"); 00751 delay(1000); 00752 while(XBee.available() > 0) 00753 { 00754 ByteIN[i]=XBee.read(); 00755 i++; 00756 error=0; 00757 } 00758 packetTimeout[0]=converter(ByteIN[0],ByteIN[1]); 00759 packetTimeout[1]=converter(ByteIN[2],ByteIN[3]); 00760 return error; 00761 }

| uint8_t WaspXBeeXSC::setRSSItime | ( | uint8_t | rssiTime | ) |
It sets the time the output pin is active with the RSSI value.
| uint8_t | rssiTime : the time the output pin is active with the RSSI value (range [0x00-0x7F]) |
Definition at line 771 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), HEX, WaspXBee::print(), WaspXBee::println(), timeRSSI, and XBee.
00772 { 00773 clean(); 00774 XBee.print("atrp"); 00775 XBee.println(rssiTime,HEX); 00776 delay(1000); 00777 00778 if(!check()) 00779 { 00780 timeRSSI=rssiTime; 00781 return 0; 00782 } 00783 return 1; 00784 }

| uint8_t WaspXBeeXSC::getRSSItime | ( | ) |
It gets the time the output pin is active with the RSSI value.
It stores in global 'timeRSSI' variable the time the output pin is active with the RSSI value
Definition at line 794 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), timeRSSI, and XBee.
00795 { 00796 uint8_t ByteIN[10]; 00797 uint8_t error=1; 00798 uint8_t i=0; 00799 00800 clean(); 00801 XBee.println("atrp"); 00802 delay(1000); 00803 while(XBee.available() > 0) 00804 { 00805 ByteIN[i]=XBee.read(); 00806 i++; 00807 error=0; 00808 } 00809 timeRSSI=converter(ByteIN[0],ByteIN[1]); 00810 return error; 00811 }

| uint8_t WaspXBeeXSC::setRetries | ( | uint8_t | retry | ) |
It sets the number of retries that can be sent for a given packet RF.
| uint8_t | retry : the number of retries that can be sent for a given packet RF (range [0x00-0xFF]) |
Definition at line 821 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), HEX, WaspXBee::print(), WaspXBee::println(), retries, and XBee.
00822 { 00823 clean(); 00824 XBee.print("atrr"); 00825 XBee.println(retry,HEX); 00826 delay(1000); 00827 00828 if(!check()) 00829 { 00830 retries=retry; 00831 return 0; 00832 } 00833 return 1; 00834 }

| uint8_t WaspXBeeXSC::getRetries | ( | ) |
It gets the number of retries that can be sent for a given packet RF.
It stores in global 'retries' variable the number of retries that can be sent for a given packet RF
Definition at line 844 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), retries, and XBee.
00845 { 00846 uint8_t ByteIN[10]; 00847 uint8_t error=1; 00848 uint8_t i=0; 00849 00850 clean(); 00851 XBee.println("atrr"); 00852 delay(1000); 00853 while(XBee.available() > 0) 00854 { 00855 ByteIN[i]=XBee.read(); 00856 i++; 00857 error=0; 00858 } 00859 retries=converter(ByteIN[0],ByteIN[1]); 00860 return error; 00861 }

| uint8_t WaspXBeeXSC::getRSSIvalue | ( | ) |
It gets the last received packet RSSI.
It stores in global 'RSSI' variable the last received packet RSSI
Definition at line 871 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), RSSI, and XBee.
00872 { 00873 uint8_t ByteIN[10]; 00874 uint8_t error=1; 00875 uint8_t i=0; 00876 00877 clean(); 00878 XBee.println("atrs"); 00879 delay(1000); 00880 while(XBee.available() > 0) 00881 { 00882 ByteIN[i]=XBee.read(); 00883 i++; 00884 error=0; 00885 } 00886 RSSI=converter(ByteIN[0],ByteIN[1]); 00887 return error; 00888 }

| uint8_t WaspXBeeXSC::setStopBits | ( | uint8_t | stop | ) |
It sets the number of stop bits in the data packets.
| uint8_t | stop : the number of stop bits in the data packets (range [0-1]) |
Definition at line 898 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), HEX, WaspXBee::print(), WaspXBee::println(), stopBits, and XBee.
00899 { 00900 clean(); 00901 XBee.print("atsb"); 00902 XBee.println(stop,HEX); 00903 delay(1000); 00904 00905 if(!check()) 00906 { 00907 stopBits=stop; 00908 return 0; 00909 } 00910 return 1; 00911 }

| uint8_t WaspXBeeXSC::getStopBits | ( | ) |
It gets the number of stop bits in the data packets.
It stores in global 'stopBits' variable the number of stop bits in the data packets
Definition at line 921 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), stopBits, and XBee.
00922 { 00923 uint8_t ByteIN[10]; 00924 uint8_t error=1; 00925 uint8_t i=0; 00926 00927 clean(); 00928 XBee.println("atsb"); 00929 delay(1000); 00930 while(XBee.available() > 0) 00931 { 00932 ByteIN[i]=XBee.read(); 00933 i++; 00934 error=0; 00935 } 00936 stopBits=converter(ByteIN[0],ByteIN[1]); 00937 return error; 00938 }

| uint8_t WaspXBeeXSC::getSourceMacHigh | ( | ) |
It gets the 32b Higher Source Mac.
It stores in global 'sourceMacHigh' variable the 32b Higher Source Mac
Definition at line 948 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), it, WaspXBee::println(), WaspXBee::read(), sourceMacHigh, and XBee.
Referenced by sendData().
00949 { 00950 uint8_t ByteIN[10]; 00951 uint8_t error=1; 00952 uint8_t i=0; 00953 00954 clean(); 00955 XBee.println("atsh"); 00956 delay(1000); 00957 while(XBee.available() > 0) 00958 { 00959 ByteIN[i]=XBee.read(); 00960 i++; 00961 error=0; 00962 } 00963 if(i<5) 00964 { 00965 ByteIN[3]=ByteIN[2]; 00966 ByteIN[2]=ByteIN[1]; 00967 ByteIN[1]=ByteIN[0]; 00968 ByteIN[0]=0; 00969 } 00970 it=0; 00971 i=0; 00972 while(i<4) 00973 { 00974 sourceMacHigh[it]=converter(ByteIN[i],ByteIN[i+1]); 00975 i++; 00976 i++; 00977 it++; 00978 } 00979 return error; 00980 }


| uint8_t WaspXBeeXSC::getSourceMacLow | ( | ) |
It gets the 32b Lower Source Mac.
It stores in global 'sourceMacLow' variable the 32b Lower Source Mac
Definition at line 990 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), it, WaspXBee::println(), WaspXBee::read(), sourceMacLow, and XBee.
Referenced by sendData().
00991 { 00992 uint8_t ByteIN[10]; 00993 uint8_t error=1; 00994 uint8_t i=0; 00995 00996 clean(); 00997 XBee.println("atsl"); 00998 delay(1000); 00999 while(XBee.available() > 0) 01000 { 01001 ByteIN[i]=XBee.read(); 01002 i++; 01003 error=0; 01004 } 01005 if(i<5) 01006 { 01007 ByteIN[3]=ByteIN[2]; 01008 ByteIN[2]=ByteIN[1]; 01009 ByteIN[1]=ByteIN[0]; 01010 ByteIN[0]=0; 01011 } 01012 i=0; 01013 it=0; 01014 while(i<4) 01015 { 01016 sourceMacLow[it]=converter(ByteIN[i],ByteIN[i+1]); 01017 i++; 01018 i++; 01019 it++; 01020 } 01021 return error; 01022 }


| uint8_t WaspXBeeXSC::setSleepMode | ( | uint8_t | smode | ) |
It sets the Sleep Mode.
| uint8_t | smode : the Sleep Mode (range [0-8]) |
Definition at line 1032 of file WaspXBeeXSC.cpp.
References check(), clean(), DEC, delay(), WaspXBee::print(), WaspXBee::println(), sleepMode, and XBee.
01033 { 01034 clean(); 01035 XBee.print("atsm"); 01036 XBee.println(smode,DEC); 01037 delay(1000); 01038 01039 if(!check()) 01040 { 01041 sleepMode=smode; 01042 return 0; 01043 } 01044 return 1; 01045 }

| uint8_t WaspXBeeXSC::getSleepMode | ( | ) |
It gets the Sleep Mode.
It stores in global 'sleepMode' variable the Sleep Mode
Definition at line 1055 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), sleepMode, and XBee.
01056 { 01057 uint8_t ByteIN[10]; 01058 uint8_t error=1; 01059 uint8_t i=0; 01060 01061 clean(); 01062 XBee.println("atsm"); 01063 delay(1000); 01064 while(XBee.available() > 0) 01065 { 01066 ByteIN[i]=XBee.read(); 01067 i++; 01068 error=0; 01069 } 01070 sleepMode=converter(ByteIN[0]); 01071 return error; 01072 }

| uint8_t WaspXBeeXSC::setAwakeTime | ( | uint8_t | awake_H, | |
| uint8_t | awake_L | |||
| ) |
It sets the amount of time the module is awake.
| uint8_t | awake_H : higher awake time byte (range [0x00-0xFF]) | |
| uint8_t | awake_L : lower awake time byte (range [0x10-0xFF]) |
Definition at line 1083 of file WaspXBeeXSC.cpp.
References awakeTime, check(), clean(), delay(), HEX, WaspXBee::print(), WaspXBee::println(), and XBee.
01084 { 01085 clean(); 01086 XBee.print("atst"); 01087 XBee.print(awake_H,HEX); 01088 XBee.println(awake_L,HEX); 01089 delay(1000); 01090 01091 if(!check()) 01092 { 01093 awakeTime[0]=awake_H; 01094 awakeTime[1]=awake_L; 01095 return 0; 01096 } 01097 return 1; 01098 }

| uint8_t WaspXBeeXSC::getAwakeTime | ( | ) |
It gets the amount of time the module is awake.
It stores in global 'awakeTime' variable the amount of time the module is awake
Definition at line 1109 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), awakeTime, clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), and XBee.
01110 { 01111 uint8_t ByteIN[10]; 01112 uint8_t error=1; 01113 uint8_t i=0; 01114 01115 clean(); 01116 XBee.println("atst"); 01117 delay(1000); 01118 while(XBee.available() > 0) 01119 { 01120 ByteIN[i]=XBee.read(); 01121 i++; 01122 error=0; 01123 } 01124 awakeTime[0]=converter(ByteIN[0],ByteIN[1]); 01125 awakeTime[1]=converter(ByteIN[2],ByteIN[3]); 01126 return error; 01127 }

| uint8_t WaspXBeeXSC::setTimeBeforeInit | ( | uint8_t | timeInit | ) |
It sets the time before sending again the initializer.
| uint8_t | timeInit : the time before sending again the initializer (range [0x00-0xFF]) |
Definition at line 1137 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), HEX, WaspXBee::print(), WaspXBee::println(), timeBeforeInit, and XBee.
01138 { 01139 clean(); 01140 XBee.print("atsy"); 01141 XBee.println(timeInit,HEX); 01142 delay(1000); 01143 01144 if(!check()) 01145 { 01146 timeBeforeInit=timeInit; 01147 return 0; 01148 } 01149 return 1; 01150 }

| uint8_t WaspXBeeXSC::getTimeBeforeInit | ( | ) |
It gets the time before sending again the initializer.
It stores in global 'timeBeforeInit' variable the time before sending again the initializer
Definition at line 1160 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), timeBeforeInit, and XBee.
01161 { 01162 uint8_t ByteIN[10]; 01163 uint8_t error=1; 01164 uint8_t i=0; 01165 01166 clean(); 01167 XBee.println("atsy"); 01168 delay(1000); 01169 while(XBee.available() > 0) 01170 { 01171 ByteIN[i]=XBee.read(); 01172 i++; 01173 error=0; 01174 } 01175 timeBeforeInit=converter(ByteIN[0],ByteIN[1]); 01176 return error; 01177 }

| uint8_t WaspXBeeXSC::setTransmitErrorCount | ( | uint8_t | txerror_H, | |
| uint8_t | txerror_L | |||
| ) |
It sets the transmit error count.
| uint8_t | txerror_H : higher transmit error count byte (range [0x00-0xFF]) | |
| uint8_t | txerror_L : lower transmit error count byte (range [0x00-0xFF]) |
Definition at line 1187 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), HEX, WaspXBee::print(), WaspXBee::println(), transmitErrorCount, and XBee.
01188 { 01189 clean(); 01190 XBee.print("attr"); 01191 XBee.print(txerror_H,HEX); 01192 XBee.println(txerror_L,HEX); 01193 delay(1000); 01194 01195 if(!check()) 01196 { 01197 transmitErrorCount[0]=txerror_H; 01198 transmitErrorCount[1]=txerror_L; 01199 return 0; 01200 } 01201 return 1; 01202 }

| uint8_t WaspXBeeXSC::getTransmitErrorCount | ( | ) |
It gets the transmit error count.
It stores in global 'transmitErrorCount' variable the transmit error count
Definition at line 1212 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), transmitErrorCount, and XBee.
01213 { 01214 uint8_t ByteIN[10]; 01215 uint8_t error=1; 01216 uint8_t i=0; 01217 01218 clean(); 01219 XBee.println("attr"); 01220 delay(1000); 01221 while(XBee.available() > 0) 01222 { 01223 ByteIN[i]=XBee.read(); 01224 i++; 01225 error=0; 01226 } 01227 transmitErrorCount[0]=converter(ByteIN[0],ByteIN[1]); 01228 transmitErrorCount[1]=converter(ByteIN[2],ByteIN[3]); 01229 return error; 01230 }

| uint8_t WaspXBeeXSC::setTransmitLimit | ( | uint8_t | txlim_H, | |
| uint8_t | txlim_L | |||
| ) |
It sets the max number of bytes a module can send before waiting.
| uint8_t | txlim_H : higher transmit limit byte (range [0x00-0xFF]) | |
| uint8_t | txlim_L : lower transmit limit byte (range [0x00-0xFF]) |
Definition at line 1240 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), HEX, WaspXBee::print(), WaspXBee::println(), transmitLimit, and XBee.
01241 { 01242 clean(); 01243 XBee.print("attt"); 01244 XBee.print(txlim_H,HEX); 01245 XBee.println(txlim_L,HEX); 01246 delay(1000); 01247 01248 if(!check()) 01249 { 01250 transmitLimit[0]=txlim_H; 01251 transmitLimit[1]=txlim_L; 01252 return 0; 01253 } 01254 return 1; 01255 }

| uint8_t WaspXBeeXSC::getTransmitLimit | ( | ) |
It gets the max number of bytes a module can send before waiting.
It stores in global 'transmitLimit' variable the max number of bytes a module can send before waiting
Definition at line 1265 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), WaspXBee::println(), WaspXBee::read(), transmitLimit, and XBee.
01266 { 01267 uint8_t ByteIN[10]; 01268 uint8_t error=1; 01269 uint8_t i=0; 01270 01271 clean(); 01272 XBee.println("attt"); 01273 delay(1000); 01274 while(XBee.available() > 0) 01275 { 01276 ByteIN[i]=XBee.read(); 01277 i++; 01278 error=0; 01279 } 01280 transmitLimit[0]=converter(ByteIN[0],ByteIN[1]); 01281 transmitLimit[1]=converter(ByteIN[2],ByteIN[3]); 01282 return error; 01283 }

| uint8_t WaspXBeeXSC::getSoftVersion | ( | ) |
It gets the Firmware version.
It stores in global 'firmwareVersion' variable the Firmware version
Definition at line 1293 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), clean(), converter(), delay(), firmwareVersion, WaspXBee::println(), WaspXBee::read(), and XBee.
01294 { 01295 uint8_t ByteIN[10]; 01296 uint8_t error=1; 01297 uint8_t i=0; 01298 01299 clean(); 01300 XBee.println("atvr"); 01301 delay(1000); 01302 while(XBee.available() > 0) 01303 { 01304 ByteIN[i]=XBee.read(); 01305 i++; 01306 error=0; 01307 } 01308 firmwareVersion[0]=converter(ByteIN[0],ByteIN[1]); 01309 firmwareVersion[1]=converter(ByteIN[2],ByteIN[3]); 01310 return error; 01311 }

| uint8_t WaspXBeeXSC::writeValues | ( | ) |
It writes the parameters changed into non-volatil memory.
Definition at line 1320 of file WaspXBeeXSC.cpp.
References check(), clean(), delay(), WaspXBee::println(), and XBee.
01321 { 01322 uint8_t ByteIN[10]; 01323 uint8_t error=1; 01324 uint8_t i=0; 01325 01326 clean(); 01327 XBee.println("atwr"); 01328 delay(1000); 01329 return check(); 01330 }

| uint8_t WaspXBeeXSC::sendData | ( | struct packetXSC * | packet | ) |
It sends data to other modules.
It sends over the air its own MAC, data length and the data, so the receiver can identify the sender and store the data
| struct | packetXSC* packet : a structure where the data to send is stored |
Definition at line 1339 of file WaspXBeeXSC.cpp.
References BYTE, packetXSC::data, packetXSC::data_length, DEC, exitCommandMode(), getSourceMacHigh(), getSourceMacLow(), HEX, it, WaspXBee::print(), setCommandMode(), sourceMacHigh, packetXSC::sourceMacHigh, sourceMacLow, packetXSC::sourceMacLow, and XBee.
01340 { 01341 uint8_t error=2; 01342 01343 error=setCommandMode(); 01344 error=getSourceMacHigh(); 01345 error=getSourceMacLow(); 01346 error=exitCommandMode(); 01347 packet->sourceMacHigh[0]=sourceMacHigh[0]; 01348 packet->sourceMacHigh[1]=sourceMacHigh[1]; 01349 packet->sourceMacLow[0]=sourceMacLow[0]; 01350 packet->sourceMacLow[1]=sourceMacLow[1]; 01351 01352 // Enviamos los datos 01353 XBee.print(packet->sourceMacHigh[0],HEX); 01354 XBee.print(packet->sourceMacHigh[1],HEX); 01355 XBee.print(packet->sourceMacLow[0],HEX); 01356 XBee.print(packet->sourceMacLow[1],HEX); 01357 XBee.print("-"); 01358 XBee.print(packet->data_length,DEC); 01359 XBee.print("-"); 01360 for(it=0;it<packet->data_length;it++) 01361 { 01362 XBee.print(packet->data[it],BYTE); 01363 } 01364 error=0; 01365 return error; 01366 }

| uint8_t WaspXBeeXSC::readData | ( | struct packetXSC * | packet | ) |
It reads data from other modules.
It stores the sender MAC and data into the 'packet' structure
| struct | packetXSC* packet : a structure where the received data and node information is stored |
Definition at line 1375 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), converter(), packetXSC::data, packetXSC::data_length, WaspUtils::dec2hex(), WaspXBee::flush(), it, millis(), WaspXBee::read(), packetXSC::sourceMacHigh, packetXSC::sourceMacLow, Utils, and XBee.
01376 { 01377 uint8_t error=2; 01378 uint8_t end=0; 01379 uint16_t interval=2000; 01380 long previous=millis(); 01381 uint8_t counter3=0; 01382 uint8_t trama=0; 01383 uint8_t length=0; 01384 uint8_t dataIN[110]; 01385 01386 for(int i=0;i<110;i++) dataIN[i]=0; 01387 previous=millis(); 01388 while(end==0) 01389 { 01390 if(XBee.available()>0) 01391 { 01392 previous=millis(); 01393 dataIN[counter3]=XBee.read(); 01394 counter3++; 01395 } 01396 01397 if( (millis()-previous) > interval ) 01398 { 01399 end=1; 01400 XBee.flush(); 01401 } 01402 01403 } 01404 end=0; 01405 if(dataIN[0]==10) end=1; 01406 if( dataIN[8+end]!='-' ) return 1; 01407 packet->sourceMacHigh[0]=converter(dataIN[0+end],dataIN[1+end]); 01408 packet->sourceMacHigh[1]=converter(dataIN[2+end],dataIN[3+end]); 01409 packet->sourceMacLow[0]=converter(dataIN[4+end],dataIN[5+end]); 01410 packet->sourceMacLow[1]=converter(dataIN[6+end],dataIN[7+end]); 01411 it=9; 01412 while(dataIN[it]!='-') 01413 { 01414 length++; 01415 it++; 01416 } 01417 switch(length) 01418 { 01419 case 1: packet->data_length=converter(dataIN[9]); 01420 break; 01421 case 2: packet->data_length=converter(dataIN[9],dataIN[10]); 01422 break; 01423 case 3: packet->data_length=converter(dataIN[9],dataIN[10],dataIN[11]); 01424 break; 01425 } 01426 packet->data_length=Utils.dec2hex(packet->data_length); 01427 it=0; 01428 for(it=0;it<packet->data_length;it++) 01429 { 01430 packet->data[it]=char(dataIN[it+10+length]); 01431 } 01432 return 0; 01433 }

| uint8_t WaspXBeeXSC::sendCommandAT | ( | char * | atcommand | ) |
It is a transparent function. The user introduces an AT command within a string.
It stores in the global 'commandAT' variable the XBee answer to the command
| char | *atcommand : the AT command to send to the XBee module |
Definition at line 1445 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), BYTE, clean(), commandAT, delay(), WaspXBee::print(), WaspXBee::println(), WaspXBee::read(), and XBee.
01446 { 01447 uint8_t error=1; 01448 uint8_t i=0; 01449 01450 clean(); 01451 XBee.print("at"); 01452 while( *atcommand!='#' ) 01453 { 01454 XBee.print(*atcommand++,BYTE); 01455 } 01456 XBee.println(""); 01457 delay(1000); 01458 while(XBee.available() > 0) 01459 { 01460 commandAT[i]=XBee.read(); 01461 i++; 01462 error=0; 01463 } 01464 return error; 01465 }

| uint8_t WaspXBeeXSC::ON | ( | void | ) |
It connects XBee, activating switch and opens the UART.
Definition at line 1475 of file WaspXBeeXSC.cpp.
References WaspXBee::begin(), clean(), delay(), WaspXBee::setMode(), XBee, and XBEE_ON.
01476 { 01477 uint8_t error=2; 01478 XBee.begin(); 01479 XBee.setMode(XBEE_ON); 01480 delay(50); 01481 clean(); 01482 error=0; 01483 return error; 01484 }

| uint8_t WaspXBeeXSC::sleep | ( | ) |
It sets the XBee to sleep, asserting PIN 9.
Definition at line 1494 of file WaspXBeeXSC.cpp.
References WaspXBee::close(), digitalWrite(), HIGH, OUTPUT, pinMode(), XBee, and XBEE_SLEEP.
01495 { 01496 uint8_t error=2; 01497 pinMode(XBEE_SLEEP, OUTPUT); 01498 digitalWrite(XBEE_SLEEP,HIGH); 01499 XBee.close(); 01500 error=0; 01501 return error; 01502 }

| uint8_t WaspXBeeXSC::wake | ( | ) |
It wakes up the XBee, de-asserting PIN 9.
Definition at line 1512 of file WaspXBeeXSC.cpp.
References WaspXBee::begin(), clean(), delay(), digitalWrite(), LOW, OUTPUT, pinMode(), XBee, and XBEE_SLEEP.
01513 { 01514 uint8_t error=2; 01515 pinMode(XBEE_SLEEP, OUTPUT); 01516 digitalWrite(XBEE_SLEEP,LOW); 01517 XBee.begin(); 01518 delay(50); 01519 clean(); 01520 error=0; 01521 return error; 01522 }

| uint8_t WaspXBeeXSC::converter | ( | uint8_t | conv1 | ) | [private] |
It generates a decimal number from an ASCII character which was a number.
| uint8_t | conv1 : the ASCII number to convert |
Definition at line 1529 of file WaspXBeeXSC.cpp.
Referenced by getAddressMask(), getAwakeTime(), getBaudRate(), getDelaySlots(), getDestAddress(), getHoppingChannel(), getPacketTimeout(), getPinWakeUP(), getReceiveErrorCount(), getReceiveGoodCount(), getRetries(), getRSSI(), getRSSItime(), getRSSIvalue(), getSleepMode(), getSoftVersion(), getSourceMacHigh(), getSourceMacLow(), getStopBits(), getTimeBeforeInit(), getTimeBeforeWakeUP(), getTimeWakeUpInit(), getTransmitErrorCount(), getTransmitLimit(), getVendorID(), and readData().
01530 { 01531 uint8_t aux=0; 01532 uint8_t resul=0; 01533 01534 switch(conv1) 01535 { 01536 case 48: aux=0; 01537 break; 01538 case 49: aux=1; 01539 break; 01540 case 50: aux=2; 01541 break; 01542 case 51: aux=3; 01543 break; 01544 case 52: aux=4; 01545 break; 01546 case 53: aux=5; 01547 break; 01548 case 54: aux=6; 01549 break; 01550 case 55: aux=7; 01551 break; 01552 case 56: aux=8; 01553 break; 01554 case 57: aux=9; 01555 break; 01556 } 01557 resul=aux; 01558 return resul; 01559 }

| uint8_t WaspXBeeXSC::converter | ( | uint8_t | conv1, | |
| uint8_t | conv2 | |||
| ) | [private] |
It generates a decimal number from two ASCII characters which were numbers.
| uint8_t | conv1 : the ASCII number first digit to convert | |
| uint8_t | conv2 : the ASCII number second digit to convert |
Definition at line 1566 of file WaspXBeeXSC.cpp.
01567 { 01568 uint8_t aux=0; 01569 uint8_t aux2=0; 01570 uint8_t resul=0; 01571 01572 switch(conv1) 01573 { 01574 case 48: aux=0; 01575 break; 01576 case 49: aux=1; 01577 break; 01578 case 50: aux=2; 01579 break; 01580 case 51: aux=3; 01581 break; 01582 case 52: aux=4; 01583 break; 01584 case 53: aux=5; 01585 break; 01586 case 54: aux=6; 01587 break; 01588 case 55: aux=7; 01589 break; 01590 case 56: aux=8; 01591 break; 01592 case 57: aux=9; 01593 break; 01594 case 65: aux=10; 01595 break; 01596 case 66: aux=11; 01597 break; 01598 case 67: aux=12; 01599 break; 01600 case 68: aux=13; 01601 break; 01602 case 69: aux=14; 01603 break; 01604 case 70: aux=15; 01605 break; 01606 } 01607 switch(conv2) 01608 { 01609 case 48: aux2=0; 01610 break; 01611 case 49: aux2=1; 01612 break; 01613 case 50: aux2=2; 01614 break; 01615 case 51: aux2=3; 01616 break; 01617 case 52: aux2=4; 01618 break; 01619 case 53: aux2=5; 01620 break; 01621 case 54: aux2=6; 01622 break; 01623 case 55: aux2=7; 01624 break; 01625 case 56: aux2=8; 01626 break; 01627 case 57: aux2=9; 01628 break; 01629 case 65: aux2=10; 01630 break; 01631 case 66: aux2=11; 01632 break; 01633 case 67: aux2=12; 01634 break; 01635 case 68: aux2=13; 01636 break; 01637 case 69: aux2=14; 01638 break; 01639 case 70: aux2=15; 01640 break; 01641 default: aux2=100; 01642 break; 01643 } 01644 if(aux2==100) // Only one character but we have treated two, so We have to fix it 01645 { 01646 resul=aux; 01647 } 01648 else 01649 { 01650 resul=(aux*16)+aux2; 01651 } 01652 return resul; 01653 }
| uint8_t WaspXBeeXSC::converter | ( | uint8_t | conv1, | |
| uint8_t | conv2, | |||
| uint8_t | conv3 | |||
| ) | [private] |
It generates a decimal number from three ASCII characters which were numbers.
| uint8_t | conv1 : the ASCII number first digit to convert | |
| uint8_t | conv2 : the ASCII number second digit to convert | |
| uint8_t | conv3 : the ASCII number third digit to convert |
Definition at line 1659 of file WaspXBeeXSC.cpp.
01660 { 01661 uint8_t aux=0; 01662 uint8_t aux2=0; 01663 uint8_t aux3=0; 01664 uint8_t resul=0; 01665 01666 switch(conv1) 01667 { 01668 case 48: aux=0; 01669 break; 01670 case 49: aux=1; 01671 break; 01672 case 50: aux=2; 01673 break; 01674 case 51: aux=3; 01675 break; 01676 case 52: aux=4; 01677 break; 01678 case 53: aux=5; 01679 break; 01680 case 54: aux=6; 01681 break; 01682 case 55: aux=7; 01683 break; 01684 case 56: aux=8; 01685 break; 01686 case 57: aux=9; 01687 break; 01688 } 01689 switch(conv2) 01690 { 01691 case 48: aux2=0; 01692 break; 01693 case 49: aux2=1; 01694 break; 01695 case 50: aux2=2; 01696 break; 01697 case 51: aux2=3; 01698 break; 01699 case 52: aux2=4; 01700 break; 01701 case 53: aux2=5; 01702 break; 01703 case 54: aux2=6; 01704 break; 01705 case 55: aux2=7; 01706 break; 01707 case 56: aux2=8; 01708 break; 01709 case 57: aux2=9; 01710 break; 01711 } 01712 switch(conv3) 01713 { 01714 case 48: aux3=0; 01715 break; 01716 case 49: aux3=1; 01717 break; 01718 case 50: aux3=2; 01719 break; 01720 case 51: aux3=3; 01721 break; 01722 case 52: aux3=4; 01723 break; 01724 case 53: aux3=5; 01725 break; 01726 case 54: aux3=6; 01727 break; 01728 case 55: aux3=7; 01729 break; 01730 case 56: aux3=8; 01731 break; 01732 case 57: aux3=9; 01733 break; 01734 } 01735 resul=aux3*100+aux2*10+aux; 01736 return resul; 01737 }
| void WaspXBeeXSC::clean | ( | ) | [private] |
It checks if the XBee module answer a 'OK' message.
Definition at line 1739 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), WaspXBee::read(), and XBee.
Referenced by exitCommandMode(), forceReset(), forceWakeUP(), getAddressMask(), getAwakeTime(), getBaudRate(), getDelaySlots(), getDestAddress(), getHoppingChannel(), getPacketTimeout(), getPinWakeUP(), getReceiveErrorCount(), getReceiveGoodCount(), getRetries(), getRSSI(), getRSSItime(), getRSSIvalue(), getSleepMode(), getSoftVersion(), getSourceMacHigh(), getSourceMacLow(), getStopBits(), getTimeBeforeInit(), getTimeBeforeWakeUP(), getTimeWakeUpInit(), getTransmitErrorCount(), getTransmitLimit(), getVendorID(), ON(), restoreDefaults(), sendCommandAT(), setAddressMask(), setAwakeTime(), setBaudRate(), setCommandMode(), setDelaySlots(), setDestAddress(), setHoppingChannel(), setPacketTimeout(), setPinWakeUP(), setReceiveErrorCount(), setReceiveGoodCount(), setRetries(), setRSSItime(), setSleepMode(), setStopBits(), setTimeBeforeInit(), setTimeBeforeWakeUP(), setTimeWakeUpInit(), setTransmitErrorCount(), setTransmitLimit(), setVendorID(), wake(), and writeValues().
01740 { 01741 uint8_t ByteIN=0; 01742 01743 while(XBee.available() > 0) 01744 { 01745 ByteIN = XBee.read(); 01746 } 01747 }


| uint8_t WaspXBeeXSC::check | ( | void | ) | [private] |
It cleans the unwanted bytes returned by XBee module.
Definition at line 1749 of file WaspXBeeXSC.cpp.
References WaspXBee::available(), WaspXBee::flush(), millis(), WaspXBee::read(), and XBee.
Referenced by exitCommandMode(), forceReset(), forceWakeUP(), restoreDefaults(), setAddressMask(), setAwakeTime(), setBaudRate(), setDelaySlots(), setDestAddress(), setHoppingChannel(), setPacketTimeout(), setPinWakeUP(), setReceiveErrorCount(), setReceiveGoodCount(), setRetries(), setRSSItime(), setSleepMode(), setStopBits(), setTimeBeforeInit(), setTimeBeforeWakeUP(), setTimeWakeUpInit(), setTransmitErrorCount(), setTransmitLimit(), setVendorID(), and writeValues().
01750 { 01751 uint8_t ByteIN[10]; 01752 uint8_t error=0; 01753 uint8_t i=0; 01754 uint8_t counter=0; 01755 long previous=0; 01756 uint8_t end=0; 01757 long interval=1000; 01758 01759 previous=millis(); 01760 while(end==0) 01761 { 01762 if(XBee.available()>0) 01763 { 01764 ByteIN[i]=XBee.read(); 01765 i++; 01766 previous=millis(); 01767 } 01768 if( (millis()-previous) > interval ) 01769 { 01770 end=1; 01771 XBee.flush(); 01772 } 01773 } 01774 counter=i; 01775 i=0; 01776 while(counter>i) 01777 { 01778 if(ByteIN[i]=='O') 01779 { 01780 if(ByteIN[i+1]=='K') 01781 { 01782 return 0; 01783 } 01784 } 01785 i++; 01786 } 01787 return 1; 01788 }


| uint8_t WaspXBeeXSC::vendorID[2] |
Variable : the module Vendor ID.
Definition at line 523 of file WaspXBeeXSC.h.
Referenced by getVendorID(), and setVendorID().
| uint8_t WaspXBeeXSC::baudRate |
Variable : the Baud Rate used in the module.
Definition at line 528 of file WaspXBeeXSC.h.
Referenced by getBaudRate(), and setBaudRate().
| uint8_t WaspXBeeXSC::valueRSSI |
Variable : the dBm level in the most recent packet.
Definition at line 533 of file WaspXBeeXSC.h.
Referenced by getRSSI().
| uint8_t WaspXBeeXSC::destAddress[2] |
Variable : the networking address of a module.
Definition at line 538 of file WaspXBeeXSC.h.
Referenced by getDestAddress(), and setDestAddress().
| uint8_t WaspXBeeXSC::receiveErrorCount[2] |
Variable : the receive error count.
Definition at line 543 of file WaspXBeeXSC.h.
Referenced by getReceiveErrorCount(), and setReceiveErrorCount().
| uint8_t WaspXBeeXSC::receiveGoodCount[2] |
Variable : the receive good count.
Definition at line 548 of file WaspXBeeXSC.h.
Referenced by getReceiveGoodCount(), and setReceiveGoodCount().
| uint8_t WaspXBeeXSC::channel |
Variable : the Hopping Channel used in the transmission.
Definition at line 553 of file WaspXBeeXSC.h.
Referenced by getHoppingChannel(), and setHoppingChannel().
| uint8_t WaspXBeeXSC::timeBeforeWakeUP[2] |
Variable : the time before send a Wake-up initializer.
Definition at line 558 of file WaspXBeeXSC.h.
Referenced by getTimeBeforeWakeUP(), and setTimeBeforeWakeUP().
| uint8_t WaspXBeeXSC::timeWakeUpInit |
Variable : the amount of time the Wake-Up Init is sent.
Definition at line 563 of file WaspXBeeXSC.h.
Referenced by getTimeWakeUpInit(), and setTimeWakeUpInit().
| uint8_t WaspXBeeXSC::addressMask[2] |
Variable : the address mask.
Definition at line 568 of file WaspXBeeXSC.h.
Referenced by getAddressMask(), and setAddressMask().
| uint8_t WaspXBeeXSC::pinWakeUP |
Variable : the pin Wake-UP ON/OFF.
Definition at line 573 of file WaspXBeeXSC.h.
Referenced by getPinWakeUP(), and setPinWakeUP().
| uint8_t WaspXBeeXSC::delaySlots |
Variable : the random delay slots.
Definition at line 578 of file WaspXBeeXSC.h.
Referenced by getDelaySlots(), and setDelaySlots().
| uint8_t WaspXBeeXSC::packetTimeout[2] |
Variable : the packetization timeout.
Definition at line 583 of file WaspXBeeXSC.h.
Referenced by getPacketTimeout(), and setPacketTimeout().
| uint8_t WaspXBeeXSC::timeRSSI |
Variable : the time the output pin is active with the RSSI value.
Definition at line 588 of file WaspXBeeXSC.h.
Referenced by getRSSItime(), and setRSSItime().
| uint8_t WaspXBeeXSC::retries |
Variable : the number of retries that can be sent for a given packet RF.
Definition at line 593 of file WaspXBeeXSC.h.
Referenced by getRetries(), and setRetries().
| uint8_t WaspXBeeXSC::RSSI |
Variable : the last received packet RSSI.
Definition at line 598 of file WaspXBeeXSC.h.
Referenced by getRSSIvalue().
| uint8_t WaspXBeeXSC::stopBits |
Variable : the number of stop bits in the data packets.
Definition at line 603 of file WaspXBeeXSC.h.
Referenced by getStopBits(), and setStopBits().
| uint8_t WaspXBeeXSC::sourceMacHigh[2] |
Variable : the 32b Higher Source Mac.
Definition at line 608 of file WaspXBeeXSC.h.
Referenced by getSourceMacHigh(), and sendData().
| uint8_t WaspXBeeXSC::sourceMacLow[2] |
Variable : the 32b Lower Source Mac.
Definition at line 613 of file WaspXBeeXSC.h.
Referenced by getSourceMacLow(), and sendData().
| uint8_t WaspXBeeXSC::sleepMode |
Variable : the Sleep Mode.
Definition at line 618 of file WaspXBeeXSC.h.
Referenced by getSleepMode(), and setSleepMode().
| uint8_t WaspXBeeXSC::awakeTime[2] |
Variable : the amount of time the module is awake.
Definition at line 623 of file WaspXBeeXSC.h.
Referenced by getAwakeTime(), and setAwakeTime().
| uint8_t WaspXBeeXSC::timeBeforeInit |
Variable : the time before sending again the initializer.
Definition at line 628 of file WaspXBeeXSC.h.
Referenced by getTimeBeforeInit(), and setTimeBeforeInit().
| uint8_t WaspXBeeXSC::transmitErrorCount[2] |
Variable : the transmit error count.
Definition at line 633 of file WaspXBeeXSC.h.
Referenced by getTransmitErrorCount(), and setTransmitErrorCount().
| uint8_t WaspXBeeXSC::transmitLimit[2] |
Variable : the max number of bytes a module can send before waiting.
Definition at line 638 of file WaspXBeeXSC.h.
Referenced by getTransmitLimit(), and setTransmitLimit().
| uint8_t WaspXBeeXSC::firmwareVersion[2] |
Variable : the Firmware version.
Definition at line 643 of file WaspXBeeXSC.h.
Referenced by getSoftVersion().
| uint8_t WaspXBeeXSC::commandAT[20] |
Variable : the XBee answer to the command.
Definition at line 648 of file WaspXBeeXSC.h.
Referenced by sendCommandAT().
uint8_t WaspXBeeXSC::it [private] |
Variable : counter used in the library.
Definition at line 692 of file WaspXBeeXSC.h.
Referenced by getSourceMacHigh(), getSourceMacLow(), readData(), and sendData().
uint8_t WaspXBeeXSC::protocol [private] |
Variable : protocol used (XBEE_XSC in this case).
Definition at line 697 of file WaspXBeeXSC.h.
Referenced by init().
uint8_t WaspXBeeXSC::freq [private] |
Variable : frequency used (FREQ900M in this case).
Definition at line 702 of file WaspXBeeXSC.h.
Referenced by init().
uint8_t WaspXBeeXSC::model [private] |
Variable : model used (PRO in this case).
Definition at line 707 of file WaspXBeeXSC.h.
Referenced by init().
1.5.6