TI BLE5-Stack API Documentation  9.14.00
connection_monitor.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  @file connection_monitor.h
4 
5  @brief This file contains interfaces for the Host Connection Monitor.
6 
7  Group: WCS, BTS
8  $Target Device: DEVICES $
9 
10  ******************************************************************************
11  $License: TI_TEXT 2025 $
12  ******************************************************************************
13  $Release Name: PACKAGE NAME $
14  $Release Date: PACKAGE RELEASE DATE $
15  *****************************************************************************/
16 
17 #ifndef CONNECTION_MONITOR_H
18 #define CONNECTION_MONITOR_H
19 
20 /*******************************************************************************
21  * INCLUDES
22  */
23 #include "ti/ble/stack_util/connection_monitor_types.h"
25 
26 /*******************************************************************************
27  * MACROS
28  */
29 
30 /*******************************************************************************
31  * CONSTANTS
32  */
33 
34 /*******************************************************************************
35  * TYPEDEFS
36  */
37 
38 /*******************************************************************************
39  * LOCAL VARIABLES
40  */
41 
42 /*******************************************************************************
43  * GLOBAL VARIABLES
44  */
45 
46 /*******************************************************************************
47  * FUNCTIONS
48  */
49 
50 /************************************
51  * Connecetion Monitor Serving APIs *
52  ************************************/
53 /* How to use the Connection Monitor Serving APIs:
54  * 1. Register the callback functions using CMS_RegisterCBs
55  * 2. Initialize the connection data parameters using CMS_InitConnDataParams
56  * 3. Get the connection data size using CMS_GetConnDataSize
57  * 4. Get the connection data using CMS_GetConnData
58  * 5. Send the event to the upper layer which will forward it to the CM node
59  */
60 /*******************************************************************************
61  * @fn CMS_RegisterCBs
62  *
63  * @brief Register the application callback function at the Host for the CMS
64  *
65  * @param pCBs - pointer to the callback functions
66  *
67  * @return CM_SUCCESS, CM_INVALID_PARAMS, CM_UNSUPPORTED @ref cmErrorCodes_e
68  *
69  * @note When the callback is called it is called from the context of the BLE stack
70  * The application must release the context as fast as it can
71  */
72 cmErrorCodes_e CMS_RegisterCBs(const cmsCBs_t *pCBs);
73 
74 /*******************************************************************************
75  * @fn CMS_GetConnDataSize
76  *
77  * @brief Request the controller data size and returns the sum of
78  * the controller and host data size which should be allocated by the application
79  *
80  * @return The connection data size
81  */
82 uint8_t CMS_GetConnDataSize(void);
83 
84 /*******************************************************************************
85  * @fn CMS_InitConnDataParams
86  *
87  * @brief Initialize the given parameter structure with default values
88  *
89  * @param pParams - Pointer to the parameters structure
90  *
91  * @return CM_SUCCESS, CM_UNSUPPORTED @ref cmErrorCodes_e
92  *
93  */
94 cmErrorCodes_e CMS_InitConnDataParams(cmsConnDataParams_t *pParams);
95 
96 /*******************************************************************************
97  * @fn CMS_GetConnData
98  *
99  * @brief Get the connection data which will be monitored.
100  *
101  * @param connHandle - the connection handle
102  * @param pData - pointer to the data buffer
103  *
104  * @return CM_SUCCESS, CM_INCORRECT_MODE, CM_NOT_CONNECTED,
105  * CM_NO_RESOURCE, CM_UNSUPPORTED @ref cmErrorCodes_e
106  */
107 cmErrorCodes_e CMS_GetConnData(uint16_t connHandle, cmsConnDataParams_t *pParams);
108 
109 
110 /************************************
111  * Connection Monitor APIs *
112  ************************************/
113 /* How to use the Connection Monitor APIs:
114  * 1. Register the callback functions using CM_RegisterCBs
115  * 2. Initialize the start monitor parameters using CM_InitStartMonitorParams
116  * 3. Start monitoring a connection using CM_StartMonitor with the data received
117  * from the CM Serving node
118  * 4. Stop monitoring a connection using CM_StopMonitor
119  * 5. Update the monitored connection using data from CM Serving node using CM_UpdateConn
120  */
121 
122 /*******************************************************************************
123  * @fn CM_RegisterCBs
124  *
125  * @brief Register the application callback function at the Host
126  *
127  * @param pCBs - pointer to the callback functions
128  *
129  * @return CM_SUCCESS, CM_INVALID_PARAMS, CM_UNSUPPORTED @ref cmErrorCodes_e
130  *
131  * @note When the callback is called it is called from the context of the BLE stack
132  * The application must release the context as fast as it can
133  */
134 cmErrorCodes_e CM_RegisterCBs(const cmCBs_t *pCBs);
135 
136 /*******************************************************************************
137  * @fn CM_InitStartMonitorParams
138  *
139  * @brief Initialize the given parameter structure with default values
140  *
141  * @param pParams - Pointer to the parameters structure
142  *
143  * @return CM_SUCCESS, CM_UNSUPPORTED @ref cmErrorCodes_e
144  */
145 cmErrorCodes_e CM_InitStartMonitorParams(cmStartMonitorParams_t *pParams);
146 
147 /*******************************************************************************
148  * @fn CM_StartMonitor
149  *
150  * @brief Starts the connection monitoring process with the connection data given.
151  *
152  * @param pParams - Pointer to the monitor parameters
153  *
154  * @return CM_SUCCESS, CM_NOT_CONNECTED, CM_ALREADY_REQUESTED,
155  * CM_INVALID_PARAMS, CM_NO_RESOURCE,
156  * CM_CONNECTION_LIMIT_EXCEEDED, CM_UNSUPPORTED @ref cmErrorCodes_e
157  *
158  * @output This function will send a @ref CM_TRACKING_START_EVT event to the registered
159  * callback @ref pfnCmConnStatusEvtCB in case of a success monitoring start, otherwise it will send a
160  * @ref CM_TRACKING_STOP_EVT event after the end of the trying to sync up to
161  * maxSyncAttempts in the @ref cmStartMonitorParams_t.
162  *
163  * @note If the return code is CM_SUCCESS if there any running advertise, it will be disabled,
164  * and an event of @ref GAP_EVT_ADV_END_AFTER_DISABLE
165  *
166  * @note After a success monitoring start, the application should expect
167  * @ref cmReportEvt_t event with the RSSI by calling @ref pfnCmReportEvtCB.
168  */
169 cmErrorCodes_e CM_StartMonitor(cmStartMonitorParams_t *pParams);
170 
171 /*******************************************************************************
172  * @fn CM_StopMonitor
173  *
174  * @brief Stops the connection monitoring process.
175  *
176  * @param connHandle - the connection handle
177  *
178  * @return CM_SUCCESS, CM_NOT_CONNECTED, CM_UNSUPPORTED @ref cmErrorCodes_e
179  *
180  * @output This function will send a @ref CM_TRACKING_STOP_EVT event to the registered
181  * callback @ref pfnCmConnStatusEvtCB.
182  */
183 cmErrorCodes_e CM_StopMonitor(uint16_t connHandle);
184 
185 /*******************************************************************************
186  * @fn CM_UpdateConn
187  *
188  * @brief This function used to update monitored connection given by the CMS
189  * with the given connection data
190  *
191  * @param pConnUpdateEvt - pointer to the update event
192  *
193  * @return CM_SUCCESS, CM_NOT_CONNECTED, CM_ALREADY_REQUESTED,
194  * CM_INVALID_PARAMS,CM_UNSUPPORTED,CM_FAILURE @ref cmErrorCodes_e
195  *
196  * @output This function will adjust the monitored connection with the update event.
197  * If the update event can't be applied with return code @ref CM_FAILURE,
198  * it will terminate the monitored connection with @ref CM_TRACKING_STOP_EVT and
199  * reason @ref CM_BAD_UPDATE_EVENT
200  */
201 cmErrorCodes_e CM_UpdateConn(cmConnUpdateEvt_t *pConnUpdateEvt);
202 
203 #endif /* CONNECTION_MONITOR_H */
cmErrorCodes_e CM_UpdateConn(cmConnUpdateEvt_t *pConnUpdateEvt)
cmErrorCodes_e CM_StartMonitor(cmStartMonitorParams_t *pParams)
cmErrorCodes_e CMS_InitConnDataParams(cmsConnDataParams_t *pParams)
cmErrorCodes_e CMS_GetConnData(uint16_t connHandle, cmsConnDataParams_t *pParams)
cmErrorCodes_e CM_RegisterCBs(const cmCBs_t *pCBs)
uint8_t CMS_GetConnDataSize(void)
cmErrorCodes_e CM_StopMonitor(uint16_t connHandle)
ICall layer interface.
cmErrorCodes_e CMS_RegisterCBs(const cmsCBs_t *pCBs)
cmErrorCodes_e CM_InitStartMonitorParams(cmStartMonitorParams_t *pParams)
© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale