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 41 /** LE scanner callbacks */ 42 const btgatt_scanner_callbacks_t* scanner; 43 } btgatt_callbacks_t; 44 45 /** Represents the standard Bluetooth GATT interface. */ 46 typedef struct { 47 /** Set to sizeof(btgatt_interface_t) */ 48 size_t size; 49 50 /** 51 * Initializes the interface and provides callback routines 52 */ 53 bt_status_t (*init)(const btgatt_callbacks_t* callbacks); 54 55 /** Closes the interface */ 56 void (*cleanup)(void); 57 58 /** Pointer to the GATT client interface methods.*/ 59 const btgatt_client_interface_t* client; 60 61 /** Pointer to the GATT server interface methods.*/ 62 const btgatt_server_interface_t* server; 63 64 /** Pointer to the LE scanner interface methods.*/ 65 BleScannerInterface* scanner; 66 67 /** Pointer to the advertiser interface methods.*/ 68 BleAdvertiserInterface* advertiser; 69 70 /** Pointer to the distance measurement interface methods.*/ 71 DistanceMeasurementInterface* distance_measurement_manager; 72 } btgatt_interface_t; 73 74 __END_DECLS 75 76 #endif /* ANDROID_INCLUDE_BT_GATT_H */ 77