TI BLE5-Stack API Documentation  2.02.04.00
rtls_ctrl_api.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  @file rtls_ctrl_api.h
4 
5  @brief This file contains the RTLS Control API's
6 
7  Group: WCS, BTS
8  $Target Device: DEVICES $
9 
10  ******************************************************************************
11  $License: BSD3 2018 $
12  ******************************************************************************
13  $Release Name: PACKAGE NAME $
14  $Release Date: PACKAGE RELEASE DATE $
15  *****************************************************************************/
16 
26 #ifndef RTLS_CTRL_API_H_
27 #define RTLS_CTRL_API_H_
28 
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #endif
33 
34 /*********************************************************************
35  * INCLUDES
36  */
37 #include <stdint.h>
38 
39 /*********************************************************************
40 * EXTERNAL FUNCTIONS
41 */
42 
43 extern void AssertHandler(uint8 assertCause, uint8 assertSubcause);
44 
45 /*********************************************************************
46  * CONSTANTS
47  */
48 
49 // Error codes passed through Assert Handler
50 #define RTLS_CTRL_ASSERT_CAUSE_OUT_OF_MEMORY 0x01
51 #define RTLS_CTRL_ASSERT_CAUSE_INVALID_PARAM 0x02
52 #define RTLS_CTRL_ASSERT_CAUSE_NULL_POINTER_EXCEPT 0x03
53 
54 // RTLS Control version
55 #define RTLS_CTRL_REV 0x2
56 
57 // RTLS Application Command Opcodes
58 #define RTLS_REQ_ENABLE_SYNC 0x01
59 #define RTLS_REQ_CONN 0x02
60 #define RTLS_REQ_SCAN 0x03
61 #define RTLS_REQ_SEND_DATA 0x04
62 #define RTLS_REQ_TERMINATE_LINK 0x05
63 #define RTLS_REQ_SET_AOA_PARAMS 0x06
64 #define RTLS_REQ_AOA_ENABLE 0x07
65 #define RTLS_REQ_UPDATE_CONN_INTERVAL 0x08
66 #define RTLS_REQ_GET_ACTIVE_CONN_INFO 0x09
67 #define RTLS_REQ_SET_CREATE_SYNC_PARAMS 0x0A
68 #define RTLS_REQ_CREATE_SYNC_CANCEL 0x0B
69 #define RTLS_REQ_TERMINATE_SYNC 0x0C
70 #define RTLS_REQ_PERIODIC_RECEIVE_ENABLE 0x0D
71 #define RTLS_REQ_ADD_DEVICE_ADV_LIST 0x0E
72 #define RTLS_REQ_REMOVE_DEVICE_ADV_LIST 0x0F
73 #define RTLS_REQ_READ_ADV_LIST_SIZE 0x10
74 #define RTLS_REQ_CLEAR_ADV_LIST 0x11
75 #define RTLS_REQ_CL_AOA_ENABLE 0x12
76 
77 #define RTLS_REQ_BLE_LOG_STRINGS_MAX 0x9
78 extern char *rtlsReq_BleLogStrings[];
79 
80 // BADDR Flash Address Offset in CCA (i.e. flash programmer BLE address)
81 #if !defined(CC26X2) && !defined(CC13X2) && !defined(CC13X2P)
82 #define BADDR_PAGE_OFFSET 0xFD0 // in CCFG (CCA); LSB..MSB
83 #else //Agama CC26X2 || CC13X2 || CC13X2P
84 #define BADDR_PAGE_OFFSET 0x1FD0 // in CCFG (CCA); LSB..MSB
85 #endif
86 // BADDR Address Offset in FCFG1 (i.e. permanent BLE address)
87 #define BDADDR_OFFSET 0x2E8 // in FCFG; LSB..MSB
88 #define CHIP_ID_SIZE 6
89 
90 #define BDADDR_VALID( bdAddr ) \
91  ( !( \
92  ((bdAddr)[0] == 0xFF) && \
93  ((bdAddr)[1] == 0xFF) && \
94  ((bdAddr)[2] == 0xFF) && \
95  ((bdAddr)[3] == 0xFF) && \
96  ((bdAddr)[4] == 0xFF) && \
97  ((bdAddr)[5] == 0xFF) \
98  ) \
99  )
100 
101 #define RTLS_FALSE 0
102 #define RTLS_TRUE 1
103 
104 // Connection Handle defines
105 #define RTLS_CONNHANDLE_ALL 0xFFFD // All connection handles
106 #define RTLS_CONNHANDLE_INVALID 0xFFFF // Invalid connection handle, used for no connection handle
107 
108 /*********************************************************************
109  * MACROS
110  */
111 
112 /*********************************************************************
113  * TYPEDEFS
114  */
115 
117 typedef void (*pfnRtlsAppCb)(uint8_t *cmd);
118 
120 typedef enum
121 {
122  RTLS_SUCCESS,
123  RTLS_FAIL,
124  RTLS_LINK_ESTAB_FAIL,
125  RTLS_LINK_TERMINATED,
126  RTLS_OUT_OF_MEMORY,
127  RTLS_CONFIG_NOT_SUPPORTED,
128  RTLS_ILLEGAL_CMD
129 } rtlsStatus_e;
130 
132 typedef enum
133 {
134  RTLS_CAP_NOT_INITIALIZED = 0x00000000,
135  RTLS_CAP_CM = 0x00000001,
136  RTLS_CAP_AOA_TX = 0x00000002,
137  RTLS_CAP_AOA_RX = 0x00000004,
138  RTLS_CAP_RESERVED1 = 0x00000008,
139  RTLS_CAP_CL_AOA = 0x00000010,
140  RTLS_CAP_RESERVED3 = 0x00000020,
141  RTLS_CAP_RTLS_RESPONDER = 0x00000040,
142  RTLS_CAP_RTLS_COORDINATOR = 0x00000080,
143  RTLS_CAP_RTLS_PASSIVE = 0x00000100,
144  RTLS_CAP_RTLS_CONNECTION_MONITOR = 0x00000200
146 
148 typedef struct
149 {
151  uint8_t identifier[CHIP_ID_SIZE];
152  uint16_t revNum;
153  uint8_t devId;
154  uint8_t maxNumConns;
157 
159 typedef struct
160 {
161  uint8_t reqOp;
162  uint8_t *pData;
163 } rtlsCtrlReq_t;
164 
166 typedef struct
167 {
168  uint16_t connHandle;
169  uint8_t cmdOp;
170  uint16_t payloadLen;
171  uint8_t pPayload[];
172 } rtlsPacket_t;
173 
175 typedef struct
176 {
177  uint16_t connHandle;
178  uint8_t enable;
180 
182 typedef struct
183 {
184  uint16_t connHandle;
185  uint16_t connInterval;
187 
189 typedef struct
190 {
191  uint16_t connHandle;
193 
195 typedef struct
196 {
197  uint16_t connHandle;
199 
200 /*********************************************************************
201  * API FUNCTIONS
202  */
203 
211 void RTLSCtrl_open(rtlsConfiguration_t *rtlsConfig);
212 
223 void RTLSCtrl_scanResultEvt(rtlsStatus_e status, uint8_t *scanResult, uint8_t size);
224 
233 void RTLSCtrl_connResultEvt(uint16_t connHandle, uint8_t status);
234 
243 void RTLSCtrl_connInfoEvt(uint8_t *connInfo, uint16_t connInfoLen);
244 
252 void RTLSCtrl_rtlsPacketEvt(uint8_t *pPkt);
253 
267 void RTLSCtrl_syncNotifyEvt(uint16_t connHandle, rtlsStatus_e status, uint32_t timeToNextEvent, int8_t rssi, uint8_t channel);
268 
278 void RTLSCtrl_dataSentEvt(uint16_t connHandle, uint8_t status);
279 
288 void RTLSCtrl_sendDebugEvt(uint8_t *debug_string, uint32_t debug_value);
289 
297 void RTLSCtrl_sendPeriodicListSize(uint8_t *pEvt);
298 
314 void RTLSCtrl_processSyncEstEvt(uint8_t opcode,
315  uint8_t status,
316  uint16_t syncHandle,
317  uint8_t advSid,
318  uint8_t advAddrType,
319  uint8_t advAddress[6],
320  uint8_t advPhy,
321  uint16_t periodicAdvInt,
322  uint8_t advClockAccuracy);
323 
332 void RTLSCtrl_processSyncLostEvt(uint8_t opcode,
333  uint16_t syncHandle);
334 
335 #ifdef RTLS_CTE
336 
352 void RTLSCtrl_aoaResultEvt(uint16_t handle, int8_t rssi, uint8_t channel, uint16_t numIqSamples, uint8_t sampleRate, uint8_t sampleSize, uint8_t sampleCtrl, uint8_t slotDuration, uint8_t numAnt, int8_t *pIQ);
353 
363 void RTLSCtrl_processClAoaEnableEvt(uint16_t opcode,
364  uint8_t status,
365  uint16_t syncHandle);
366 #endif /* RTLS_CTE*/
367 
376 
391 void RTLSCTRL_processPeriodicAdvReport( uint8_t opcode,
392  uint16_t syncHandle,
393  int8_t txPower,
394  int8_t rssi,
395  uint8_t cteType,
396  uint8_t dataStatus,
397  uint8_t dataLen,
398  uint8_t *pData);
399 
400 /*********************************************************************
401 *********************************************************************/
402 
403 
404 #ifdef __cplusplus
405 }
406 #endif
407 
408 #endif /* RTLS_CTRL_API_H_ */
409 
#define CHIP_ID_SIZE
Chip Identifier Size.
Definition: rtls_ctrl_api.h:88
void RTLSCtrl_processSyncLostEvt(uint8_t opcode, uint16_t syncHandle)
RTLS Configuration structure.
Definition: rtls_ctrl_api.h:148
uint8_t * pData
Pointer to request.
Definition: rtls_ctrl_api.h:162
void RTLSCtrl_dataSentEvt(uint16_t connHandle, uint8_t status)
RTLSCtrl_dataSentEvt.
rtlsCapabilities_e
Enumeration for RTLS Capabilities.
Definition: rtls_ctrl_api.h:132
uint8_t cmdOp
RTLS Application Command Opcode.
Definition: rtls_ctrl_api.h:169
void RTLSCtrl_scanResultEvt(rtlsStatus_e status, uint8_t *scanResult, uint8_t size)
RTLSCtrl_scanResultEvt.
void RTLSCtrl_sendDebugEvt(uint8_t *debug_string, uint32_t debug_value)
RTLSCtrl_sendDebugEvt.
void RTLSCtrl_connResultEvt(uint16_t connHandle, uint8_t status)
RTLSCtrl_connResultEvt.
void RTLSCtrl_rtlsPacketEvt(uint8_t *pPkt)
RTLSCtrl_rtlsPacketEvt.
void RTLSCtrl_connInfoEvt(uint8_t *connInfo, uint16_t connInfoLen)
RTLSCtrl_connInfoEvt.
void RTLSCtrl_processSyncEstEvt(uint8_t opcode, uint8_t status, uint16_t syncHandle, uint8_t advSid, uint8_t advAddrType, uint8_t advAddress[6], uint8_t advPhy, uint16_t periodicAdvInt, uint8_t advClockAccuracy)
RTLSCtrl_processSyncEstEvt.
void(* pfnRtlsAppCb)(uint8_t *cmd)
Application callback function.
Definition: rtls_ctrl_api.h:117
RTLS Enable Sync - This will tell the RTLS Application to start notifying RTLS Control about a specif...
Definition: rtls_ctrl_api.h:175
uint16_t payloadLen
Length.
Definition: rtls_ctrl_api.h:170
void RTLSCTRL_processPeriodicAdvReport(uint8_t opcode, uint16_t syncHandle, int8_t txPower, int8_t rssi, uint8_t cteType, uint8_t dataStatus, uint8_t dataLen, uint8_t *pData)
uint16_t revNum
Revision.
Definition: rtls_ctrl_api.h:152
void RTLSCtrl_sendPeriodicListSize(uint8_t *pEvt)
RTLSCtrl_sendPeriodicListSize.
rtlsCapabilities_e rtlsCapab
RTLS Capabilities.
Definition: rtls_ctrl_api.h:150
uint8_t reqOp
Request Opcode.
Definition: rtls_ctrl_api.h:161
uint16_t connHandle
Connection handle.
Definition: rtls_ctrl_api.h:184
void RTLSCtrl_open(rtlsConfiguration_t *rtlsConfig)
RTLSCtrl_open.
RTLS Packet - Generic structure that will be translated to a specific command.
Definition: rtls_ctrl_api.h:166
pfnRtlsAppCb rtlsAppCb
Application callback function.
Definition: rtls_ctrl_api.h:155
rtlsStatus_e
Enumeration for RTLS Status.
Definition: rtls_ctrl_api.h:120
RTLS Get Active Connection Info - get the connection information for a specific handle.
Definition: rtls_ctrl_api.h:195
void RTLSCtrl_processTerminateSyncEvt(void)
void RTLSCtrl_syncNotifyEvt(uint16_t connHandle, rtlsStatus_e status, uint32_t timeToNextEvent, int8_t rssi, uint8_t channel)
RTLSCtrl_syncNotifyEvt.
RTLS Control request.
Definition: rtls_ctrl_api.h:159
uint16_t connHandle
Connection handle.
Definition: rtls_ctrl_api.h:168
uint8_t maxNumConns
Maximum number of connections to support.
Definition: rtls_ctrl_api.h:154
RTLS update connection interval request.
Definition: rtls_ctrl_api.h:182
uint8_t devId
Device ID.
Definition: rtls_ctrl_api.h:153
uint16_t connInterval
Connection interval.
Definition: rtls_ctrl_api.h:185
© Copyright 1995-2022, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale