1 /******************************************************************************
3 * Copyright (C) 2009-2013 Broadcom Corporation
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 ******************************************************************************/
19 /*******************************************************************************
21 * Filename: btif_gatt.c
23 * Description: GATT Profile Bluetooth Interface
25 *******************************************************************************/
27 #define LOG_TAG "bt_btif_gatt"
30 #include <hardware/bluetooth.h>
31 #include <hardware/bt_gatt.h>
36 #include "btif_common.h"
37 #include "btif_util.h"
39 #if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
42 #include "bta_gatt_api.h"
43 #include "btif_gatt.h"
44 #include "btif_gatt_util.h"
45 #include "btif_storage.h"
47 const btgatt_callbacks_t *bt_gatt_callbacks = NULL;
49 extern btgatt_client_interface_t btgattClientInterface;
50 extern btgatt_server_interface_t btgattServerInterface;
52 /*******************************************************************************
54 ** Function btif_gatt_init
56 ** Description Initializes the GATT interface
58 ** Returns bt_status_t
60 *******************************************************************************/
61 static bt_status_t btif_gatt_init( const btgatt_callbacks_t* callbacks )
63 bt_gatt_callbacks = callbacks;
65 return BT_STATUS_SUCCESS;
68 /*******************************************************************************
70 ** Function btif_gatt_cleanup
72 ** Description Closes the GATT interface
76 *******************************************************************************/
77 static void btif_gatt_cleanup( void )
79 if (bt_gatt_callbacks)
80 bt_gatt_callbacks = NULL;
86 static const btgatt_interface_t btgattInterface = {
87 sizeof(btgattInterface),
92 &btgattClientInterface,
93 &btgattServerInterface,
96 /*******************************************************************************
98 ** Function btif_gatt_get_interface
100 ** Description Get the gatt callback interface
102 ** Returns btgatt_interface_t
104 *******************************************************************************/
105 const btgatt_interface_t *btif_gatt_get_interface()
107 return &btgattInterface;