API  2.2
TSmarT Software Library
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions

Functions

int8_t TSMART_XBEE_DM_Init (tsmart_xbee_dm_t *TSMART_XBEE_DM, tsmart_xbee_dm_config_t *TSMART_XBEE_DM_config)
 Initialize the XBee module. More...
 
int8_t TSMART_XBEE_DM_InitStruct (tsmart_xbee_dm_config_device_t *TSMART_XBEE_DM_config_device)
 Init Struct function. More...
 
int8_t TSMART_XBEE_DM_Config (tsmart_xbee_dm_t *TSMART_XBEE_DM, tsmart_xbee_dm_config_device_t *TSMART_XBEE_DM_config_device)
 Configuration for XBEE Digimesh device. More...
 
int8_t TSMART_XBEE_DM_AtCommandMode (tsmart_xbee_dm_t *TSMART_XBEE_DM, tsmart_xbee_dm_flag_t TSMART_XBEE_DM_flag)
 Enters/exits from the AT command mode in Transparent operation. More...
 
int32_t TSMART_XBEE_DM_Send (tsmart_xbee_dm_t *TSMART_XBEE_DM, uint8_t *TSMART_XBEE_DM_buf, uint32_t TSMART_XBEE_DM_nbytes, portTickType TSMART_XBEE_DM_xticks)
 Sends data from the XBee module. More...
 
int32_t TSMART_XBEE_DM_Receive (tsmart_xbee_dm_t *TSMART_XBEE_DM, uint8_t *TSMART_XBEE_DM_buf, uint32_t TSMART_XBEE_DM_nbytes, portTickType TSMART_XBEE_DM_xticks)
 Receives data from the XBee module. More...
 
int8_t TSMART_XBEE_DM_TransparentMode (tsmart_xbee_dm_t *TSMART_XBEE_DM, tsmart_xbee_dm_flag_t TSMART_XBEE_DM_flag)
 Enters/Exits transparent mode to receive data. More...
 
int8_t TSMART_XBEE_DM_ReceiveApiFrame (tsmart_xbee_dm_t *TSMART_XBEE_DM, tsmart_xbee_dm_data_received_t *TSMART_XBEE_DM_data, portTickType TSMART_XBEE_DM_xticks)
 Receives a digimesh frame in API mode. More...
 
int8_t TSMART_XBEE_DM_SendApiFrame (tsmart_xbee_dm_t *TSMART_XBEE_DM, tsmart_xbee_dm_data_to_send_t *TSMART_XBEE_DM_data, portTickType TSMART_XBEE_DM_xticks)
 Sends a digimesh frame in API mode. More...
 
int8_t TSMART_XBEE_DM_PowerSignalReceived (tsmart_xbee_dm_t *TSMART_XBEE_DM)
 Reports the RF power signal (RSSI) of last received packet in -dbm example: 0x60 = -96dbm. More...
 
int8_t TSMART_XBEE_DM_DiscoverNetworks (tsmart_xbee_dm_t *TSMART_XBEE_DM, uint8_t TSMART_XBEE_DM_max_nodes, tsmart_xbee_dm_discovered_node_t *TSMART_XBEE_DM_discovered_node, uint8_t TSMART_XBEE_DM_Timeout)
 Discovers networks. More...
 
int8_t TSMART_XBEE_DM_HwSleep (tsmart_xbee_dm_t *TSMART_XBEE_DM, tsmart_xbee_dm_flag_t TSMART_XBEE_DM_flag)
 Hardware Sleep. More...
 
int8_t TSMART_XBEE_DM_CheckOnSleep (tsmart_xbee_dm_t *TSMART_XBEE_DM)
 On_sleep pin State. More...
 
int8_t TSMART_XBEE_DM_ReadSatus (tsmart_xbee_dm_t *TSMART_XBEE_DM, portTickType TSMART_XBEE_DM_timeout)
 Read one status message. More...
 
uint32_t TSMART_XBEE_DM_ReadLowAddress (tsmart_xbee_dm_t *TSMART_XBEE_DM)
 Reads the low XBee address. More...
 
uint32_t TSMART_XBEE_DM_ReadHighAddress (tsmart_xbee_dm_t *TSMART_XBEE_DM)
 Reads the high XBee address. More...
 
uint32_t TSMART_XBEE_DM_FirmwareVersion (tsmart_xbee_dm_t *TSMART_XBEE_DM)
 Reads the Firmware version of the local XBee address. More...
 
int8_t TSMART_XBEE_DM_SendRemoteCommand (tsmart_xbee_dm_t *TSMART_XBEE_DM, uint32_t TSMART_XBEE_DM_high_addr, uint32_t TSMART_XBEE_DM_low_addr, uint8_t *TSMART_XBEE_DM_cmd, uint8_t *TSMART_XBEE_DM_cmd_parameter, uint8_t TSMART_XBEE_DM_cmd_parameter_size, uint8_t *TSMART_XBEE_DM_response_buffer)
 Sends a remote Xbee command. More...
 
void TSMART_XBEE_DM_HwReset (tsmart_xbee_dm_t *TSMART_XBEE_DM)
 Hardware Reset. More...
 

Detailed Description

Function Documentation

int8_t TSMART_XBEE_DM_AtCommandMode ( tsmart_xbee_dm_t TSMART_XBEE_DM,
tsmart_xbee_dm_flag_t  TSMART_XBEE_DM_flag 
)

Enters/exits from the AT command mode in Transparent operation.

Parameters
TSMART_XBEE_DMXBee structure handler.
TSMART_XBEE_DM_flagLabel to enter/exit the AT command mode.
Returns
  • TSMART_PASS - OK
  • TSMART_XBEE_DM_FAULT_CODE_1 - Fails trying to enter AT command mode
  • TSMART_XBEE_DM_FAULT_CODE_2 - Fails trying to exit from AT command mode
  • TSMART_XBEE_DM_FAULT_CODE_3 - Fails trying to change the receiving mode
Examples:
cumulocity_nfc_wifi_xbee.c, and xv_nfc_wifi_xbee.c.
int8_t TSMART_XBEE_DM_CheckOnSleep ( tsmart_xbee_dm_t TSMART_XBEE_DM)

On_sleep pin State.

Provides to know the state of On_sleep pin: asserted or de-asserted.

Attention
This function only works with following modes:
  • TSMART_XBEE_DM_ACYCLIC
  • TSMART_XBEE_DM_SCYCLIC

Parameters
TSMART_XBEE_DMXBee DM structure handler.
Returns
  • 0 - De-asserted
  • 1 - Asserted
int8_t TSMART_XBEE_DM_Config ( tsmart_xbee_dm_t TSMART_XBEE_DM,
tsmart_xbee_dm_config_device_t TSMART_XBEE_DM_config_device 
)

Configuration for XBEE Digimesh device.

This function configures XBEE Digimesh device with user's values.

Parameters
TSMART_XBEE_DMXBee Digimesh structure handler.
TSMART_XBEE_DM_config_deviceXBee Digimesh configuration structure.
Returns
  • TSMART_PASS - OK
  • TSMART_XBEE_DM_FAULT_CODE_1 - Configuration error: Fails enter in command mode
  • TSMART_XBEE_DM_FAULT_CODE_2 - Configuration error: Fails changing API mode
  • TSMART_XBEE_DM_FAULT_CODE_3 - Configuration error: Fails applying changes
  • TSMART_XBEE_DM_FAULT_CODE_4 - Configuration error: Fails checking API mode
  • TSMART_XBEE_DM_FAULT_CODE_5 - Configuration error: Fails exit from command mode
  • TSMART_XBEE_DM_FAULT_CODE_6 - Configuration error: Fails changing kind of Device parameter
  • TSMART_XBEE_DM_FAULT_CODE_7 - Configuration error: Fails changing channel
  • TSMART_XBEE_DM_FAULT_CODE_8 - Configuration error: Fails changing PAN ID
  • TSMART_XBEE_DM_FAULT_CODE_9 - Configuration error: Fails changing baud rate
  • TSMART_XBEE_DM_FAULT_CODE_10 - Configuration error: Fails changing flow control RTS
  • TSMART_XBEE_DM_FAULT_CODE_11 - Configuration error: Fails changing flow control CTS
  • TSMART_XBEE_DM_FAULT_CODE_12 - Configuration error: Fails changing power level
  • TSMART_XBEE_DM_FAULT_CODE_13 - Configuration error: Fails changing AES encryption
  • TSMART_XBEE_DM_FAULT_CODE_14 - Configuration error: Fails changing AES key encryption
  • TSMART_XBEE_DM_FAULT_CODE_15 - Configuration error: Fails Low destination address
  • TSMART_XBEE_DM_FAULT_CODE_16 - Configuration error: Fails High destination address
  • TSMART_XBEE_DM_FAULT_CODE_17 - Configuration error: Fails changing MAC retries parameter for broadcast transmissions
  • TSMART_XBEE_DM_FAULT_CODE_18 - Configuration error: Fails changing MAC retries parameter for unicast transmissions
  • TSMART_XBEE_DM_FAULT_CODE_19 - Configuration error: Fails changing Mesh Network Retries parameter
  • TSMART_XBEE_DM_FAULT_CODE_20 - Configuration error: Fails changing sleep parameter
  • TSMART_XBEE_DM_FAULT_CODE_21 - Configuration error: Fails changing sleep_option parameter
  • TSMART_XBEE_DM_FAULT_CODE_22 - Configuration error: Fails changing sleep period parameter
  • TSMART_XBEE_DM_FAULT_CODE_23 - Configuration error: Fails changing wake time parameter
  • TSMART_XBEE_DM_FAULT_CODE_24 - Configuration error: Fails changing wake host parameter
  • TSMART_XBEE_DM_FAULT_CODE_25 - Configuration error: Fails changing number of hops parameter
  • TSMART_XBEE_DM_FAULT_CODE_26 - Configuration error: Fails changing network delay slot parameter
  • TSMART_XBEE_DM_FAULT_CODE_27 - Configuration error: Fails broadcast radius mode
Examples:
cumulocity_nfc_wifi_xbee.c, digimesh_receiver.c, digimesh_sender.c, and xv_nfc_wifi_xbee.c.
int8_t TSMART_XBEE_DM_DiscoverNetworks ( tsmart_xbee_dm_t TSMART_XBEE_DM,
uint8_t  TSMART_XBEE_DM_max_nodes,
tsmart_xbee_dm_discovered_node_t TSMART_XBEE_DM_discovered_node,
uint8_t  TSMART_XBEE_DM_Timeout 
)

Discovers networks.

Discovers and reports all RF modules found in the same channel and PAN ID, same network.

The user determines the number of nodes to find by creating an array of discovered_node_t and indicating a maximum size.

The structure tsmart_xbee_dm_discovered_node_t contains information about one node.

Attention
This function shall be used in a task of higher priority than the reception task. If this information's ignore, not all nodes of your network will be discovered.
Parameters
TSMART_XBEE_DMXBee DM structure handler.
TSMART_XBEE_DM_max_nodesMaximum nodes to look for. Maximum 255 nodes.
TSMART_XBEE_DM_discovered_nodeArray of discovered_node_t (with at least TSMART_XBEE_DM_max_nodes elements, (MAX 255 nodes)).
TSMART_XBEE_DM_TimeoutThe amount of time a node will spend discovering other nodes.Range: 0x20-0x2EE0 (x100 ms).
Returns
  • Number of nodes discovered.
  • TSMART_XBEE_DM_FAULT_CODE_1 - Fails setting timeout.
  • TSMART_XBEE_DM_FAULT_CODE_2 - Unknown answer.
uint32_t TSMART_XBEE_DM_FirmwareVersion ( tsmart_xbee_dm_t TSMART_XBEE_DM)

Reads the Firmware version of the local XBee address.

Parameters
TSMART_XBEE_DMXBee DM structure handler.
Returns
  • Firmware Version
  • TSMART_FAIL - Failure
void TSMART_XBEE_DM_HwReset ( tsmart_xbee_dm_t TSMART_XBEE_DM)

Hardware Reset.

Resets the XBee device using a dedicate HW line.

Attention
This function only works with following modes:
  • TSMART_XBEE_DM_PIN
  • TSMART_XBEE_DM_ACYCLIC_pin

Parameters
TSMART_XBEE_DMXBee DM structure handler.
int8_t TSMART_XBEE_DM_HwSleep ( tsmart_xbee_dm_t TSMART_XBEE_DM,
tsmart_xbee_dm_flag_t  TSMART_XBEE_DM_flag 
)

Hardware Sleep.

Provides to enter/exit to sleep mode using a dedicated line, RQ Pin.

Attention
This function only works with following modes:
  • TSMART_XBEE_DM_PIN
  • TSMART_XBEE_DM_ACYCLIC_pin

Parameters
TSMART_XBEE_DMXBee DM structure handler.
TSMART_XBEE_DM_flagFlag to enter/exit sleep mode.
Returns
  • TSMART_PASS - OK
Examples:
cumulocity_nfc_wifi_xbee.c, digimesh_receiver.c, digimesh_sender.c, and xv_nfc_wifi_xbee.c.
int8_t TSMART_XBEE_DM_Init ( tsmart_xbee_dm_t TSMART_XBEE_DM,
tsmart_xbee_dm_config_t TSMART_XBEE_DM_config 
)

Initialize the XBee module.

This functions initializes the hardware configuration of the selected XBee and the associated OS mechanisms.

Attention
This function creates one task to receive, reception task. This task should set with a high priority in the user application (14 is advisable) and has a own stack. Its target is to pick packets up quickly avoiding lose packets and parsing them. In addition this function creates several queues to manage the information received properly. This task can be change its operation mode, API to transparent or command mode and transparent or command to API mode. Check the specific TSmarT functions to make this change of operation:
Parameters
TSMART_XBEE_DMXBee Digimes structure handler.
TSMART_XBEE_DM_configIndicates the Baud rate for the microcontroller's UART, enables/disables flow control.
Returns
  • TSMART_PASS - OK
  • TSMART_FAIL - Failure
Examples:
cumulocity_nfc_wifi_xbee.c, digimesh_receiver.c, digimesh_sender.c, and xv_nfc_wifi_xbee.c.
int8_t TSMART_XBEE_DM_InitStruct ( tsmart_xbee_dm_config_device_t TSMART_XBEE_DM_config_device)

Init Struct function.

This function shall be called before configure the XBee Digimesh module to make sure having a good configuration for Xbee module. Check default values in tsmart_xbee_dm_config_device_t definition.

Parameters
TSMART_XBEE_DM_config_deviceConfiguration device structure. It shall be empty.
Returns
  • TSMART_PASS - OK
Examples:
cumulocity_nfc_wifi_xbee.c, digimesh_receiver.c, digimesh_sender.c, and xv_nfc_wifi_xbee.c.
int8_t TSMART_XBEE_DM_PowerSignalReceived ( tsmart_xbee_dm_t TSMART_XBEE_DM)

Reports the RF power signal (RSSI) of last received packet in -dbm example: 0x60 = -96dbm.

Parameters
TSMART_XBEE_DMXBee DM structure handler.
Returns
  • Power signal (-X dBm)
  • TSMART_FAIL - Failure
uint32_t TSMART_XBEE_DM_ReadHighAddress ( tsmart_xbee_dm_t TSMART_XBEE_DM)

Reads the high XBee address.

Parameters
TSMART_XBEE_DMXBee DM structure handler.
Returns
  • High XBee address
  • TSMART_FAIL - Failure
uint32_t TSMART_XBEE_DM_ReadLowAddress ( tsmart_xbee_dm_t TSMART_XBEE_DM)

Reads the low XBee address.

Parameters
TSMART_XBEE_DMXBee DM structure handler.
Returns
  • Low XBee address
  • TSMART_FAIL - Failure
int8_t TSMART_XBEE_DM_ReadSatus ( tsmart_xbee_dm_t TSMART_XBEE_DM,
portTickType  TSMART_XBEE_DM_timeout 
)

Read one status message.

This function remains blocked until expires a selected timeout or until one status message is received. The messages will be queued in the proper buffer until it's full (it can store 5 messages). Users should empty the buffer executing this function to avoid lose new messages.

Parameters
TSMART_XBEE_DMXBee DM structure handler.
TSMART_XBEE_DM_timeoutMaximum waiting timeout.
Returns
  • 0x00 - Hardware reset
  • 0x01 - Watchdog timer reset
  • 0x0B - Network Woke Up
  • 0x0C - Network Went To Sleep
  • TSMART_FAIL - Failure
int32_t TSMART_XBEE_DM_Receive ( tsmart_xbee_dm_t TSMART_XBEE_DM,
uint8_t *  TSMART_XBEE_DM_buf,
uint32_t  TSMART_XBEE_DM_nbytes,
portTickType  TSMART_XBEE_DM_xticks 
)

Receives data from the XBee module.

This function can be used to receive AT response command in command mode or to receive data in transparent mode.

Parameters
TSMART_XBEE_DMXBee digimesh structure handler.
TSMART_XBEE_DM_bufData buffer to store data.
TSMART_XBEE_DM_nbytesNumber of bytes to receive.
TSMART_XBEE_DM_xticksMaximum waiting timeout.
Returns
  • Bytes received
Examples:
cumulocity_nfc_wifi_xbee.c, and xv_nfc_wifi_xbee.c.
int8_t TSMART_XBEE_DM_ReceiveApiFrame ( tsmart_xbee_dm_t TSMART_XBEE_DM,
tsmart_xbee_dm_data_received_t TSMART_XBEE_DM_data,
portTickType  TSMART_XBEE_DM_xticks 
)

Receives a digimesh frame in API mode.

Parameters
TSMART_XBEE_DMXBee DM structure handler.
TSMART_XBEE_DM_dataData structure to store data.
TSMART_XBEE_DM_xticksMaximum waiting timeout.
Returns
nBytes sent
Examples:
digimesh_receiver.c.
int32_t TSMART_XBEE_DM_Send ( tsmart_xbee_dm_t TSMART_XBEE_DM,
uint8_t *  TSMART_XBEE_DM_buf,
uint32_t  TSMART_XBEE_DM_nbytes,
portTickType  TSMART_XBEE_DM_xticks 
)

Sends data from the XBee module.

This function can be used to send AT command in command mode or to send data in transparent mode.

Parameters
TSMART_XBEE_DMXBee digimesh structure handler.
TSMART_XBEE_DM_bufData buffer to send.
TSMART_XBEE_DM_nbytesBytes to send
TSMART_XBEE_DM_xticksMaximum waiting timeout.
Returns
  • Bytes sent
Examples:
cumulocity_nfc_wifi_xbee.c, and xv_nfc_wifi_xbee.c.
int8_t TSMART_XBEE_DM_SendApiFrame ( tsmart_xbee_dm_t TSMART_XBEE_DM,
tsmart_xbee_dm_data_to_send_t TSMART_XBEE_DM_data,
portTickType  TSMART_XBEE_DM_xticks 
)

Sends a digimesh frame in API mode.

This function can be waiting for ACK setting the ID frame different than 0. Waiting ACK can delay the sent but ensures it.

Parameters
TSMART_XBEE_DMXBee DM structure handler.
TSMART_XBEE_DM_dataData buffer to send.
TSMART_XBEE_DM_xticksMaximum waiting timeout.
Returns
  • 0x00 - Success
  • 0x01 - MAC ACK Failure
  • 0x15 - Invalid destination endpoint
  • 0x21 - Network ACK Failure
  • 0x25 - Route Not Found
  • TSMART_FAIL - Failure
Examples:
digimesh_sender.c.
int8_t TSMART_XBEE_DM_SendRemoteCommand ( tsmart_xbee_dm_t TSMART_XBEE_DM,
uint32_t  TSMART_XBEE_DM_high_addr,
uint32_t  TSMART_XBEE_DM_low_addr,
uint8_t *  TSMART_XBEE_DM_cmd,
uint8_t *  TSMART_XBEE_DM_cmd_parameter,
uint8_t  TSMART_XBEE_DM_cmd_parameter_size,
uint8_t *  TSMART_XBEE_DM_response_buffer 
)

Sends a remote Xbee command.

Parameters
TSMART_XBEE_DMXBee DM structure handler.
TSMART_XBEE_DM_high_addrHigh destination address.
TSMART_XBEE_DM_low_addrLow destination address.
TSMART_XBEE_DM_cmdCommand to send.
TSMART_XBEE_DM_cmd_parameterCommand parameter to send.
TSMART_XBEE_DM_cmd_parameter_sizeCommand parameter size.
TSMART_XBEE_DM_response_bufferCommand response buffer(output parameter).
Returns
  • Response size.
  • TSMART_FAIL - Failure
int8_t TSMART_XBEE_DM_TransparentMode ( tsmart_xbee_dm_t TSMART_XBEE_DM,
tsmart_xbee_dm_flag_t  TSMART_XBEE_DM_flag 
)

Enters/Exits transparent mode to receive data.

This function changes the API internal operation mode to transparent internal operation mode only for receiving data form another device.

Parameters
TSMART_XBEE_DMXBee DM structure handler.
TSMART_XBEE_DM_flagLabel to enter/exit the transparent internal mode.
Returns
  • TSMART_PASS - OK
  • TSMART_XBEE_DM_FAULT_CODE_1 - Fails applying changes.
  • TSMART_XBEE_DM_FAULT_CODE_2 - Impossible enter to command mode.
  • TSMART_XBEE_DM_FAULT_CODE_3 - Impossible exit form command mode.
Examples:
cumulocity_nfc_wifi_xbee.c, and xv_nfc_wifi_xbee.c.