1 /* 2 * Copyright (C) 2015 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 /****************************************************************************** 18 * 19 * This file contains constants and definitions that can be used commonly 20 * between JNI and stack layer 21 * 22 ******************************************************************************/ 23 #ifndef ANDROID_INCLUDE_BT_COMMON_TYPES_H 24 #define ANDROID_INCLUDE_BT_COMMON_TYPES_H 25 26 #include <bluetooth/uuid.h> 27 #include <raw_address.h> 28 29 #include <vector> 30 31 #include "bluetooth.h" 32 33 typedef struct { 34 uint8_t client_if; 35 uint8_t filt_index; 36 uint8_t advertiser_state; 37 uint8_t advertiser_info_present; 38 uint8_t addr_type; 39 uint8_t tx_power; 40 int8_t rssi_value; 41 uint16_t time_stamp; 42 RawAddress bd_addr; 43 uint8_t adv_pkt_len; 44 uint8_t* p_adv_pkt_data; 45 uint8_t scan_rsp_len; 46 uint8_t* p_scan_rsp_data; 47 } btgatt_track_adv_info_t; 48 49 typedef enum { 50 BTGATT_DB_PRIMARY_SERVICE, 51 BTGATT_DB_SECONDARY_SERVICE, 52 BTGATT_DB_INCLUDED_SERVICE, 53 BTGATT_DB_CHARACTERISTIC, 54 BTGATT_DB_DESCRIPTOR, 55 } bt_gatt_db_attribute_type_t; 56 57 typedef struct { 58 uint16_t id; 59 bluetooth::Uuid uuid; 60 bt_gatt_db_attribute_type_t type; 61 uint16_t attribute_handle; 62 63 /* 64 * If |type| is |BTGATT_DB_PRIMARY_SERVICE|, or 65 * |BTGATT_DB_SECONDARY_SERVICE|, this contains the start and end attribute 66 * handles. 67 */ 68 uint16_t start_handle; 69 uint16_t end_handle; 70 71 /* 72 * If |type| is |BTGATT_DB_CHARACTERISTIC|, this contains the properties of 73 * the characteristic. 74 */ 75 uint8_t properties; 76 uint16_t extended_properties; 77 78 uint16_t permissions; 79 } btgatt_db_element_t; 80 81 typedef struct { 82 uint16_t feat_seln; 83 uint16_t list_logic_type; 84 uint8_t filt_logic_type; 85 uint8_t rssi_high_thres; 86 uint8_t rssi_low_thres; 87 uint8_t dely_mode; 88 uint16_t found_timeout; 89 uint16_t lost_timeout; 90 uint8_t found_timeout_cnt; 91 uint16_t num_of_tracking_entries; 92 } btgatt_filt_param_setup_t; 93 94 // Advertising Packet Content Filter 95 struct ApcfCommand { 96 uint8_t type; 97 RawAddress address; 98 uint8_t addr_type; 99 bluetooth::Uuid uuid; 100 bluetooth::Uuid uuid_mask; 101 std::vector<uint8_t> name; 102 uint16_t company; 103 uint16_t company_mask; 104 uint8_t org_id; 105 uint8_t tds_flags; 106 uint8_t tds_flags_mask; 107 uint8_t meta_data_type; 108 std::vector<uint8_t> meta_data; 109 uint8_t ad_type; 110 std::vector<uint8_t> data; 111 std::vector<uint8_t> data_mask; 112 std::array<uint8_t, 16> irk; // 128 bit/16 octet IRK 113 }; 114 115 // MSFT scan filter pattern 116 struct MsftAdvMonitorPattern { 117 uint8_t ad_type; 118 uint8_t start_byte; 119 std::vector<uint8_t> pattern; 120 }; 121 122 // LE Scan filter defined by MSFT extension. 123 struct MsftAdvMonitor { 124 uint8_t rssi_threshold_high; 125 uint8_t rssi_threshold_low; 126 uint8_t rssi_threshold_low_time_interval; 127 uint8_t rssi_sampling_period; 128 std::vector<MsftAdvMonitorPattern> patterns; 129 }; 130 131 #endif /* ANDROID_INCLUDE_BT_COMMON_TYPES_H */ 132