General considerations
Waspmote libraries
Waspmote XBee files
WaspXBeeCore.h, WaspXBeeCore.cpp, WaspXBeeDM.h, WaspXBeeDM.cpp
It is mandatory to include the XBeeDM library when using this module. The following line must be introduced at the beginning of the code:
Constructor
To start using the Waspmote XBee DigiMesh library, an object from class 'WaspXBeeDM' must be created. This object, called xbeeDM
, is created inside the Waspmote XBee DigiMesh library and it is public to all libraries. It is used through the guide to show how Waspmote XBee DigiMesh library works.
When creating this constructor, some variables are defined with a value by default.
API functions
Through the guide there are many examples of using parameters. In these examples, API functions are called to execute the commands, storing in their related variables the parameter value in each case.
Example of use:
Related variables:
When returning from 'xbeeDM.getOwnMacLow' the related variable 'xbeeDM.sourceMacLow' will be filled with the appropriate values. Before calling the function, the related variable is created but it is empty.
There are three error flags that are filled when the function is executed:
error_AT: it stores if some error occurred during the execution of an AT command function
error_RX: it stores if some error occurred during the reception of a packet
error_TX: it stores if some error occurred during the transmission of a packet
All the functions return a flag to know if the function called was successful or not. Available values for this flag:
0: Success. The function was executed without errors and the variable was filled.
1: Error. The function was executed but an error occurred while executing.
2: Not executed. An error occurred before executing the function.
-1: Function not allowed in this module.
To store parameter changes after power cycles, it is needed to execute the writeValues()
function.
Example of use:
API extension
All the relevant and useful functions have been included in the Waspmote API, although any XBee command can be sent directly to the transceiver using the sendCommandAT()
function.
Example of use:
Related variables:
Send AT commands example: https://development.libelium.com/dm-12-send-at-command/
Waspmote reboot
When Waspmote is rebooted the application code will start again, creating all the variables and objects from the beginning.
Constants pre-defined
There are some constants pre-defined in a file called 'WaspXBeeCore.h'. These constants define some parameters like the maximum data size. The most important constants are explained next:
MAX_DATA
: (default value is 300) it defines the maximum available data size for a packet. This constant must be equal or bigger than the data is sent on each packet. This size shouldn't be bigger than 1500.MAX_PARSE
: (default value is 300) it defines the maximum data that is parsed in each call totreatData().
If more data are received, they will be stored in the UART buffer until the next call totreatData()
. However, if the UART buffer is full, the following data will be written on the buffer, so be careful with this matter.MAX_BROTHERS
: (default value is 5) it defines the maximum number of brothers that can be stored.
Last updated