MT2523 API Reference  LinkIt SDK v4
bt_callback_manager.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __BT_CALLBACK_MANAGER_H__
36 #define __BT_CALLBACK_MANAGER_H__
37 
120 #include <stdbool.h>
121 #include <stdint.h>
122 #include <stdio.h>
123 #include "bt_type.h"
124 #if !defined(__MTK_BLE_ONLY_ENABLE__)
125 #include "bt_sdp.h"
126 #endif
127 
128 #ifdef __cplusplus
129 extern "C"
130 {
131 #endif /* __cplusplus */
132 
142 typedef enum {
144 #if !defined(__MTK_BLE_ONLY_ENABLE__)
148 #endif
156 #if !defined(__MTK_BLE_ONLY_ENABLE__)
159 #endif
162 
173 #define MODULE_MASK_OFFSET(value) (1<<((value) >> BT_MODULE_OFFSET))
174 #define MODULE_MASK_MM MODULE_MASK_OFFSET(BT_MODULE_MM)
175 #define MODULE_MASK_GAP MODULE_MASK_OFFSET(BT_MODULE_GAP)
176 #define MODULE_MASK_SYSTEM MODULE_MASK_OFFSET(BT_MODULE_SYSTEM)
177 #define MODULE_MASK_GATT MODULE_MASK_OFFSET(BT_MODULE_GATT)
178 #if !defined(__MTK_BLE_ONLY_ENABLE__)
179 #define MODULE_MASK_HFP MODULE_MASK_OFFSET(BT_MODULE_HFP)
180 #define MODULE_MASK_SPP MODULE_MASK_OFFSET(BT_MODULE_SPP)
181 #define MODULE_MASK_AVRCP MODULE_MASK_OFFSET(BT_MODULE_AVRCP)
182 #define MODULE_MASK_A2DP MODULE_MASK_OFFSET(BT_MODULE_A2DP)
183 #define MODULE_MASK_PBAPC MODULE_MASK_OFFSET(BT_MODULE_PBAPC)
184 #define MODULE_MASK_AWS MODULE_MASK_OFFSET(BT_MODULE_AWS)
185 #endif
186 
187 typedef uint32_t bt_callback_module_mask_t;
204 bt_status_t bt_callback_manager_register_callback(bt_callback_type_t type, bt_callback_module_mask_t module_mask, void *callback);
205 
213 bt_status_t bt_callback_manager_deregister_callback(bt_callback_type_t type, void *callback);
214 
215 #if !defined(__MTK_BLE_ONLY_ENABLE__)
216 
223 #endif
224 
225 #ifdef __cplusplus
226 }
227 #endif
228 
236 #endif /* __BT_CALLBACK_MANAGER_H__ */
237 
Must have one and only one callback registered for this callback type, if A2DP is required...
Definition: bt_callback_manager.h:158
bt_status_t bt_callback_manager_register_callback(bt_callback_type_t type, bt_callback_module_mask_t module_mask, void *callback)
This function registers a callback to the Bluetooth callback manager.
Cannot have more than one callback registered for this callback type.
Definition: bt_callback_manager.h:154
bt_status_t bt_callback_manager_deregister_callback(bt_callback_type_t type, void *callback)
This function unregister the callback from the Bluetooth callback manager.
Must have one and only one callback registered for this callback type.
Definition: bt_callback_manager.h:151
The prototype of the callback function for this callback type is defined as bt_app_event_callback().
Definition: bt_callback_manager.h:143
Cannot have more than one callback registered for this callback type.
Definition: bt_callback_manager.h:150
bt_callback_type_t
This structure defines the callback type to register.
Definition: bt_callback_manager.h:142
bt_status_t bt_callback_manager_add_sdp_customized_record(const bt_sdps_record_t *record)
This function adds a user record to the SDP.
Cannot have more than one callback registered for this callback type.
Definition: bt_callback_manager.h:146
Cannot have more than one callback registered for this callback type.
Definition: bt_callback_manager.h:147
Must have one and only one callback registered for this callback type.
Definition: bt_callback_manager.h:152
Cannot have more than one callback registered for this callback type.
Definition: bt_callback_manager.h:149
The maximum number of the callback types.
Definition: bt_callback_manager.h:160
int32_t bt_status_t
Define the status type, returned from the APIs, and defined as BT_STATUS_XXX.
Definition: bt_type.h:173
uint32_t bt_callback_module_mask_t
Type definition of a module mask.
Definition: bt_callback_manager.h:187
Defines the attribute list of the SDP record.
Definition: bt_sdp.h:718
Must have one and only one callback registered for this callback type.
Definition: bt_callback_manager.h:153
Must have one and only one callback registered for this callback type, if HFP is required.
Definition: bt_callback_manager.h:157
Cannot have more than one callback registered for this callback type.
Definition: bt_callback_manager.h:155
Must have one and only one callback registered for this callback type.
Definition: bt_callback_manager.h:145