ras.h
Go to the documentation of this file.
1 /**
2 *****************************************************************************************
3 *
4 * @file ras.h
5 *
6 * @brief Ranging Service API
7 *
8 *****************************************************************************************
9 * @attention
10 #####Copyright (c) 2024 GOODIX
11 All rigras reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 *****************************************************************************************
36 */
37
38 #ifndef __RAS_H__
39 #define __RAS_H__
40
41 #define RAS_CACHE_PROC_NUM (2) /**< Cache proc number. */
42
43 #include "gr_includes.h"
44 #include "custom_config.h"
45 #include "ble_prf_utils.h"
46 #include "ras_common.h"
47 #include <stdint.h>
48 #include <stdbool.h>
49
50 #ifdef __cplusplus
51 extern "C"
52 {
53 #endif /* __cplusplus */
54
55 /**
56 *****************************************************************************************
57 * @brief Initialize Ranging Service.
58 *
59 * @param[in] features: Ranging Service support features, bit mask @ref ras_fea_bit_mask_t.
60 *
61 * @return Result of service initialization.
62 *****************************************************************************************
63 */
64 sdk_err_t ras_service_init(uint32_t features);
65
66 /**
67 *****************************************************************************************
68 * @brief Handle for the connection event.
69 *
70 * @param[in] conn_idx: Connection index.
71 *
72 *****************************************************************************************
73 */
74 void ras_connect_handler(uint8_t conn_idx);
75
76 /**
77 *****************************************************************************************
78 * @brief Handle for the disconnection event.
79 *
80 * @param[in] conn_idx: Connection index.
81 *
82 *****************************************************************************************
83 */
84 void ras_disconnect_handler(uint8_t conn_idx);
85
86 /**
87 *****************************************************************************************
88 * @brief Handle for the mtu exchange event.
89 *
90 * @param[in] conn_idx: Connection index.
91 * @param[in] mtu: exchange mtu value.
92 *
93 *****************************************************************************************
94 */
95 void ras_mtu_exch_handler(uint8_t conn_idx, uint16_t mtu);
96
97 /**
98 *****************************************************************************************
99 * @brief Handle for receiving subevt data.
100 *
101 * @param[in] conn_idx: Connection index.
102 * @param[in] p_data: Pointer to the data buffer.
103 *
104 *****************************************************************************************
105 */
106 void ras_rcv_subevt_data_handler(uint8_t conn_idx, uint8_t *p_data);
107
108 /**
109 *****************************************************************************************
110 * @brief Set cache data information.
111 *
112 * @param[in] conn_idx: Connection index.
113 * @param[in] cfg_id: Procedure configure id.
114 * @param[in] proc_num: Procedure number need to cache.
115 * @param[in] subevt_num: Subevent number for per procedure.
116 *
117 *****************************************************************************************
118 */
119 void ras_set_cache_data_info(uint8_t conn_idx, uint8_t cfg_id, uint8_t proc_num, uint8_t subevt_num);
120
121 /**
122 *****************************************************************************************
123 * @brief Set cache data information.
124 *
125 * @param[in] conn_idx: Connection index.
126 * @param[in] cfg_id: Procedure configure id.
127 *
128 *****************************************************************************************
129 */
130 void ras_proc_disabled_handler(uint8_t conn_idx, uint8_t cfg_id);
131
132 void ras_write_subevt_data_free(void);
133
134
135 #ifdef __cplusplus
136 }
137 #endif /* __cplusplus */
138
139 #endif
140
ras_write_subevt_data_free
void ras_write_subevt_data_free(void)
ras_set_cache_data_info
void ras_set_cache_data_info(uint8_t conn_idx, uint8_t cfg_id, uint8_t proc_num, uint8_t subevt_num)
Set cache data information.
gr_includes.h
Include Files API.
ras_mtu_exch_handler
void ras_mtu_exch_handler(uint8_t conn_idx, uint16_t mtu)
Handle for the mtu exchange event.
ras_common.h
ras_disconnect_handler
void ras_disconnect_handler(uint8_t conn_idx)
Handle for the disconnection event.
ras_connect_handler
void ras_connect_handler(uint8_t conn_idx)
Handle for the connection event.
ras_rcv_subevt_data_handler
void ras_rcv_subevt_data_handler(uint8_t conn_idx, uint8_t *p_data)
Handle for receiving subevt data.
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:290
ble_prf_utils.h
Profile/Service Utilities API.
ras_proc_disabled_handler
void ras_proc_disabled_handler(uint8_t conn_idx, uint8_t cfg_id)
Set cache data information.
ras_service_init
sdk_err_t ras_service_init(uint32_t features)
Initialize Ranging Service.