• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.h"
27 
28 #include <bluetooth/uuid.h>
29 #include <vector>
30 
31 typedef struct {
32   uint8_t client_if;
33   uint8_t filt_index;
34   uint8_t advertiser_state;
35   uint8_t advertiser_info_present;
36   uint8_t addr_type;
37   uint8_t tx_power;
38   int8_t rssi_value;
39   uint16_t time_stamp;
40   RawAddress bd_addr;
41   uint8_t adv_pkt_len;
42   uint8_t* p_adv_pkt_data;
43   uint8_t scan_rsp_len;
44   uint8_t* p_scan_rsp_data;
45 } btgatt_track_adv_info_t;
46 
47 typedef enum {
48   BTGATT_DB_PRIMARY_SERVICE,
49   BTGATT_DB_SECONDARY_SERVICE,
50   BTGATT_DB_INCLUDED_SERVICE,
51   BTGATT_DB_CHARACTERISTIC,
52   BTGATT_DB_DESCRIPTOR,
53 } bt_gatt_db_attribute_type_t;
54 
55 typedef struct {
56   uint16_t id;
57   bluetooth::Uuid uuid;
58   bt_gatt_db_attribute_type_t type;
59   uint16_t attribute_handle;
60 
61   /*
62    * If |type| is |BTGATT_DB_PRIMARY_SERVICE|, or
63    * |BTGATT_DB_SECONDARY_SERVICE|, this contains the start and end attribute
64    * handles.
65    */
66   uint16_t start_handle;
67   uint16_t end_handle;
68 
69   /*
70    * If |type| is |BTGATT_DB_CHARACTERISTIC|, this contains the properties of
71    * the characteristic.
72    */
73   uint8_t properties;
74   uint16_t extended_properties;
75 
76   uint16_t permissions;
77 } btgatt_db_element_t;
78 
79 typedef struct {
80   uint16_t feat_seln;
81   uint16_t list_logic_type;
82   uint8_t filt_logic_type;
83   uint8_t rssi_high_thres;
84   uint8_t rssi_low_thres;
85   uint8_t dely_mode;
86   uint16_t found_timeout;
87   uint16_t lost_timeout;
88   uint8_t found_timeout_cnt;
89   uint16_t num_of_tracking_entries;
90 } btgatt_filt_param_setup_t;
91 
92 // Advertising Packet Content Filter
93 struct ApcfCommand {
94   uint8_t type;
95   RawAddress address;
96   uint8_t addr_type;
97   bluetooth::Uuid uuid;
98   bluetooth::Uuid uuid_mask;
99   std::vector<uint8_t> name;
100   uint16_t company;
101   uint16_t company_mask;
102   std::vector<uint8_t> data;
103   std::vector<uint8_t> data_mask;
104   std::array<uint8_t, 16> irk;  // 128 bit/16 octet IRK
105 };
106 
107 #endif /* ANDROID_INCLUDE_BT_COMMON_TYPES_H */
108