API  2.2
TSmarT Software Library
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
tsmart_xbee_868.h
1 
12 #ifndef TSMART_XBEE_868_H_
13 #define TSMART_XBEE_868_H_
14 
15 
16 #include "ts_xbee_if.h"
17 
18 
30 #define PR_TSMART_XBEE_868_MAX_API_PAYLOAD 237
31 #define PR_TSMART_XBEE_868_MAX_SECURITY_KEY 16
33 #define TSMART_XBEE_868_FAULT_CODE_1 -1
34 #define TSMART_XBEE_868_FAULT_CODE_2 -2
35 #define TSMART_XBEE_868_FAULT_CODE_3 -3
36 #define TSMART_XBEE_868_FAULT_CODE_4 -4
37 #define TSMART_XBEE_868_FAULT_CODE_5 -5
38 #define TSMART_XBEE_868_FAULT_CODE_6 -6
39 #define TSMART_XBEE_868_FAULT_CODE_7 -7
40 #define TSMART_XBEE_868_FAULT_CODE_8 -8
41 #define TSMART_XBEE_868_FAULT_CODE_9 -9
42 #define TSMART_XBEE_868_FAULT_CODE_10 -10
43 #define TSMART_XBEE_868_FAULT_CODE_11 -11
44 #define TSMART_XBEE_868_FAULT_CODE_12 -12
45 #define TSMART_XBEE_868_FAULT_CODE_13 -13
46 #define TSMART_XBEE_868_FAULT_CODE_14 -14
47 #define TSMART_XBEE_868_FAULT_CODE_15 -15
48 #define TSMART_XBEE_868_FAULT_CODE_16 -16
62 typedef enum{
63  TSMART_XBEE_868_FC_NONE = USART_HardwareFlowControl_None,
64  TSMART_XBEE_868_FC_RTS = USART_HardwareFlowControl_RTS,
65  TSMART_XBEE_868_FC_CTS = USART_HardwareFlowControl_CTS,
66  TSMART_XBEE_868_FC_RTS_CTS = USART_HardwareFlowControl_RTS_CTS
68 
69 
73 typedef struct{
74  uint32_t high_addr_source;
75  uint32_t low_addr_source;
76  uint8_t receive_options;
79  uint8_t data[PR_TSMART_XBEE_868_MAX_API_PAYLOAD];
81 
82 
86 typedef struct{
87  uint8_t frame_id;
88  uint32_t high_addr_dest;
89  uint32_t low_addr_dest;
90  uint8_t broadcast_radius;
91  uint8_t transmit_options;
95  uint8_t payload[PR_TSMART_XBEE_868_MAX_API_PAYLOAD];
96  uint32_t payload_size;
98 
99 
103 typedef enum{
107 
108 
112 typedef enum {
116 
117 
121 typedef struct{
126  uint8_t power_level;
128  uint8_t mac_retries;
140  uint16_t vid;
147  uint8_t security_key[PR_TSMART_XBEE_868_MAX_SECURITY_KEY];
150  uint32_t dest_addr_high;
151  uint32_t dest_addr_low;
154 
155 
159 typedef struct {
160  uint32_t baud_rate;
175  uint8_t priority;
180 
181 
191 typedef struct {
192  ts_xbee_if_t *xbee_if;
193  uint8_t *rx_buf;
194  uint32_t rx_buf_sz;
198  uint8_t n_packet_lost;
199  uint8_t api_enable;
200  xQueueHandle data_queue;
201  xQueueHandle command_queue;
202  xQueueHandle status_queue;
203  xQueueHandle mode_queue;
204  xSemaphoreHandle bitmap_protection;
205  xTaskHandle reception_task;
224 int8_t TSMART_XBEE_868_Init(tsmart_xbee_868_t *TSMART_XBEE_868, tsmart_xbee_868_config_t *TSMART_XBEE_868_config);
225 void TSMART_XBEE_868_InitStruct(tsmart_xbee_868_config_device_t *TSMART_XBEE_868_config_device);
226 int8_t TSMART_XBEE_868_Config(tsmart_xbee_868_t *TSMART_XBEE_868, tsmart_xbee_868_config_device_t *TSMART_XBEE_868_config_device);
227 int8_t TSMART_XBEE_868_TransparentMode(tsmart_xbee_868_t *TSMART_XBEE_868, tsmart_xbee_868_flag_t TSMART_XBEE_868_flag);
228 int8_t TSMART_XBEE_868_AtCommandMode(tsmart_xbee_868_t *TSMART_XBEE_868, tsmart_xbee_868_flag_t TSMART_XBEE_868_flag);
229 int32_t TSMART_XBEE_868_Send(tsmart_xbee_868_t *TSMART_XBEE_868, uint8_t *TSMART_XBEE_868_buf, uint32_t TSMART_XBEE_868_nbytes, portTickType TSMART_XBEE_868_xticks);
230 int32_t TSMART_XBEE_868_Receive(tsmart_xbee_868_t *TSMART_XBEE_868, uint8_t *TSMART_XBEE_868_buf, uint32_t TSMART_XBEE_868_nbytes, portTickType TSMART_XBEE_868_xticks);
231 int16_t TSMART_XBEE_868_ReceiveApiFrame(tsmart_xbee_868_t *TSMART_XBEE_868, tsmart_xbee_868_data_received_t *TSMART_XBEE_868_data, portTickType TSMART_XBEE_868_xticks);
232 int8_t TSMART_XBEE_868_SendApiFrame(tsmart_xbee_868_t *TSMART_XBEE_868, tsmart_xbee_868_data_to_send_t *TSMART_XBEE_868_data, portTickType TSMART_XBEE_868_xticks);
234 int8_t TSMART_XBEE_868_ReadSatus(tsmart_xbee_868_t *TSMART_XBEE_868, portTickType TSMART_XBEE_868_timeout);
235 int32_t TSMART_XBEE_868_ReadLowAddress(tsmart_xbee_868_t *TSMART_XBEE_868);
236 int32_t TSMART_XBEE_868_ReadHighAddress(tsmart_xbee_868_t *TSMART_XBEE_868);
237 int8_t TSMART_XBEE_868_ChangePowerLevel(tsmart_xbee_868_t *TSMART_XBEE_868, uint8_t TSMART_XBEE_868_power_level);
238 
250 //#endif
251 
252 #endif /* TSMART_XBEE_868_H_ */
xQueueHandle data_queue
Definition: tsmart_xbee_868.h:200
xQueueHandle command_queue
Definition: tsmart_xbee_868.h:201
tsmart_xbee_868_fc_t flow_control
Definition: tsmart_xbee_868.h:138
uint16_t vid
Definition: tsmart_xbee_868.h:140
int32_t TSMART_XBEE_868_Receive(tsmart_xbee_868_t *TSMART_XBEE_868, uint8_t *TSMART_XBEE_868_buf, uint32_t TSMART_XBEE_868_nbytes, portTickType TSMART_XBEE_868_xticks)
Receives data from the XBee module.
Definition: tsmart_xbee_868.c:563
uint8_t broadcast_radius
Definition: tsmart_xbee_868.h:90
uint32_t low_addr_dest
Definition: tsmart_xbee_868.h:89
uint8_t frame_id
Definition: tsmart_xbee_868.h:87
ts_xbee_if_t * xbee_if
Definition: tsmart_xbee_868.h:192
XBee 868 configuration structure.
Definition: tsmart_xbee_868.h:159
int8_t TSMART_XBEE_868_PowerSignalReceived(tsmart_xbee_868_t *TSMART_XBEE_868)
Reports the received signal strength (RSSI) of last received packet.
Definition: tsmart_xbee_868.c:953
Definition: tsmart_xbee_868.h:65
Definition: tsmart_xbee_868.h:105
uint32_t high_addr_source
Definition: tsmart_xbee_868.h:74
int8_t TSMART_XBEE_868_Config(tsmart_xbee_868_t *TSMART_XBEE_868, tsmart_xbee_868_config_device_t *TSMART_XBEE_868_config_device)
Configures a XBEE 868 Device.
Definition: tsmart_xbee_868.c:1270
Definition: tsmart_xbee_868.h:66
uint8_t priority
Definition: tsmart_xbee_868.h:175
void TSMART_XBEE_868_InitStruct(tsmart_xbee_868_config_device_t *TSMART_XBEE_868_config_device)
Initializes tsmart_xbee_868_config_device_t structure.
Definition: tsmart_xbee_868.c:1151
int8_t TSMART_XBEE_868_ChangePowerLevel(tsmart_xbee_868_t *TSMART_XBEE_868, uint8_t TSMART_XBEE_868_power_level)
Changes transmitter RF power.
Definition: tsmart_xbee_868.c:1108
uint8_t * rx_buf
Definition: tsmart_xbee_868.h:193
uint8_t transmit_options
Definition: tsmart_xbee_868.h:91
int8_t TSMART_XBEE_868_ReadSatus(tsmart_xbee_868_t *TSMART_XBEE_868, portTickType TSMART_XBEE_868_timeout)
Read one status message.
Definition: tsmart_xbee_868.c:1001
Data structure to receive.
Definition: tsmart_xbee_868.h:73
Definition: tsmart_xbee_868.h:104
uint32_t low_addr_source
Definition: tsmart_xbee_868.h:75
Data to send structure.
Definition: tsmart_xbee_868.h:86
tsmart_xbee_868_fc_t
Flow control labels.
Definition: tsmart_xbee_868.h:62
uint8_t power_level
Definition: tsmart_xbee_868.h:126
uint32_t high_addr_dest
Definition: tsmart_xbee_868.h:88
xQueueHandle mode_queue
Definition: tsmart_xbee_868.h:203
xTaskHandle reception_task
Definition: tsmart_xbee_868.h:205
uint8_t receive_options
Definition: tsmart_xbee_868.h:76
uint8_t multiple_transmissions
Definition: tsmart_xbee_868.h:122
tsmart_xbee_868_fc_t flow_control
Definition: tsmart_xbee_868.h:168
int32_t TSMART_XBEE_868_Send(tsmart_xbee_868_t *TSMART_XBEE_868, uint8_t *TSMART_XBEE_868_buf, uint32_t TSMART_XBEE_868_nbytes, portTickType TSMART_XBEE_868_xticks)
Sends data to remote XBee module.
Definition: tsmart_xbee_868.c:546
tsmart_xbee_868_flag_t api_mode
Definition: tsmart_xbee_868.h:134
tsmart_xbee_868_flag_t security
Definition: tsmart_xbee_868.h:143
uint8_t api_enable
Definition: tsmart_xbee_868.h:199
int32_t TSMART_XBEE_868_ReadHighAddress(tsmart_xbee_868_t *TSMART_XBEE_868)
Reads the high part of the local XBee address.
Definition: tsmart_xbee_868.c:1066
xQueueHandle status_queue
Definition: tsmart_xbee_868.h:202
XBee 868 handler structure.
Definition: tsmart_xbee_868.h:191
int32_t TSMART_XBEE_868_ReadLowAddress(tsmart_xbee_868_t *TSMART_XBEE_868)
Reads the low part of the local XBee address.
Definition: tsmart_xbee_868.c:1026
int8_t TSMART_XBEE_868_AtCommandMode(tsmart_xbee_868_t *TSMART_XBEE_868, tsmart_xbee_868_flag_t TSMART_XBEE_868_flag)
Enters or exits from the AT command mode.
Definition: tsmart_xbee_868.c:861
tsmart_xbee_868_flag_t
Standard label for XBEE 868 device.
Definition: tsmart_xbee_868.h:112
uint32_t rx_buf_sz
Definition: tsmart_xbee_868.h:194
int8_t TSMART_XBEE_868_Init(tsmart_xbee_868_t *TSMART_XBEE_868, tsmart_xbee_868_config_t *TSMART_XBEE_868_config)
Initialize the XBee module.
Definition: tsmart_xbee_868.c:656
tsmart_xbee_868_report_t packet_lost
Definition: tsmart_xbee_868.h:195
Definition: tsmart_xbee_868.h:63
uint8_t mac_retries
Definition: tsmart_xbee_868.h:128
int8_t TSMART_XBEE_868_TransparentMode(tsmart_xbee_868_t *TSMART_XBEE_868, tsmart_xbee_868_flag_t TSMART_XBEE_868_flag)
Enters/Exits from transparent mode to receive or send data.
Definition: tsmart_xbee_868.c:913
Definition: tsmart_xbee_868.h:114
int8_t TSMART_XBEE_868_SendApiFrame(tsmart_xbee_868_t *TSMART_XBEE_868, tsmart_xbee_868_data_to_send_t *TSMART_XBEE_868_data, portTickType TSMART_XBEE_868_xticks)
Sends a frame using API mode.
Definition: tsmart_xbee_868.c:729
uint32_t dest_addr_high
Definition: tsmart_xbee_868.h:150
Definition: tsmart_xbee_868.h:113
Definition: tsmart_xbee_868.h:64
XBee 868 device configuration structure.
Definition: tsmart_xbee_868.h:121
uint32_t dest_addr_low
Definition: tsmart_xbee_868.h:151
uint32_t baud_rate
Definition: tsmart_xbee_868.h:160
int16_t TSMART_XBEE_868_ReceiveApiFrame(tsmart_xbee_868_t *TSMART_XBEE_868, tsmart_xbee_868_data_received_t *TSMART_XBEE_868_data, portTickType TSMART_XBEE_868_xticks)
Receives a frame using API mode.
Definition: tsmart_xbee_868.c:782
uint8_t n_packet_lost
Definition: tsmart_xbee_868.h:198
tsmart_xbee_868_report_t
Label to report about loss packets.
Definition: tsmart_xbee_868.h:103
uint32_t payload_size
Definition: tsmart_xbee_868.h:96
tsmart_xbee_868_t tsmart_xbee_868
Definition: tsmart_xbee_868.c:69
xSemaphoreHandle bitmap_protection
Definition: tsmart_xbee_868.h:204