Home | History | Annotate | Download | only in hardware
      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 permissions;
     75 } btgatt_db_element_t;
     76 
     77 typedef struct {
     78   uint16_t feat_seln;
     79   uint16_t list_logic_type;
     80   uint8_t filt_logic_type;
     81   uint8_t rssi_high_thres;
     82   uint8_t rssi_low_thres;
     83   uint8_t dely_mode;
     84   uint16_t found_timeout;
     85   uint16_t lost_timeout;
     86   uint8_t found_timeout_cnt;
     87   uint16_t num_of_tracking_entries;
     88 } btgatt_filt_param_setup_t;
     89 
     90 // Advertising Packet Content Filter
     91 struct ApcfCommand {
     92   uint8_t type;
     93   RawAddress address;
     94   uint8_t addr_type;
     95   bluetooth::Uuid uuid;
     96   bluetooth::Uuid uuid_mask;
     97   std::vector<uint8_t> name;
     98   uint16_t company;
     99   uint16_t company_mask;
    100   std::vector<uint8_t> data;
    101   std::vector<uint8_t> data_mask;
    102 };
    103 
    104 #endif /* ANDROID_INCLUDE_BT_COMMON_TYPES_H */
    105