1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef ANDROID_INCLUDE_BT_GATT_H 18 #define ANDROID_INCLUDE_BT_GATT_H 19 20 #include <stdint.h> 21 22 #include "ble_advertiser.h" 23 #include "ble_scanner.h" 24 #include "bt_gatt_client.h" 25 #include "bt_gatt_server.h" 26 #include "distance_measurement_interface.h" 27 28 __BEGIN_DECLS 29 30 /** BT-GATT callbacks */ 31 typedef struct { 32 /** Set to sizeof(btgatt_callbacks_t) */ 33 size_t size; 34 35 /** GATT Client callbacks */ 36 const btgatt_client_callbacks_t* client; 37 38 /** GATT Server callbacks */ 39 const btgatt_server_callbacks_t* server; 40 } btgatt_callbacks_t; 41 42 /** Represents the standard Bluetooth GATT interface. */ 43 typedef struct { 44 /** Set to sizeof(btgatt_interface_t) */ 45 size_t size; 46 47 /** 48 * Initializes the interface and provides callback routines 49 */ 50 bt_status_t (*init)(const btgatt_callbacks_t* callbacks); 51 52 /** Closes the interface */ 53 void (*cleanup)(void); 54 55 /** Pointer to the GATT client interface methods.*/ 56 const btgatt_client_interface_t* client; 57 58 /** Pointer to the GATT server interface methods.*/ 59 const btgatt_server_interface_t* server; 60 61 /** Pointer to the LE scanner interface methods.*/ 62 BleScannerInterface* scanner; 63 64 /** Pointer to the advertiser interface methods.*/ 65 BleAdvertiserInterface* advertiser; 66 67 /** Pointer to the distance measurement interface methods.*/ 68 DistanceMeasurementInterface* distance_measurement_manager; 69 } btgatt_interface_t; 70 71 __END_DECLS 72 73 #endif /* ANDROID_INCLUDE_BT_GATT_H */ 74