1 /****************************************************************************** 2 * 3 * Copyright 2014 Google, Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19 #pragma once 20 21 #include <stdbool.h> 22 #include <stddef.h> 23 24 #include "bt_types.h" 25 26 #include <list> 27 #include <string> 28 #include "osi/include/config.h" 29 #include "types/ble_address_with_type.h" 30 31 static const char BTIF_CONFIG_MODULE[] = "btif_config_module"; 32 33 static const std::string BT_CONFIG_KEY_SDP_DI_MANUFACTURER = 34 "SdpDiManufacturer"; 35 static const std::string BT_CONFIG_KEY_SDP_DI_MODEL = "SdpDiModel"; 36 static const std::string BT_CONFIG_KEY_SDP_DI_HW_VERSION = 37 "SdpDiHardwareVersion"; 38 static const std::string BT_CONFIG_KEY_SDP_DI_VENDOR_ID_SRC = 39 "SdpDiVendorIdSource"; 40 41 static const std::string BT_CONFIG_KEY_REMOTE_VER_MFCT = "Manufacturer"; 42 static const std::string BT_CONFIG_KEY_REMOTE_VER_VER = "LmpVer"; 43 static const std::string BT_CONFIG_KEY_REMOTE_VER_SUBVER = "LmpSubVer"; 44 45 bool btif_config_exist(const std::string& section, const std::string& key); 46 bool btif_config_get_int(const std::string& section, const std::string& key, 47 int* value); 48 bool btif_config_set_int(const std::string& section, const std::string& key, 49 int value); 50 bool btif_config_get_uint64(const std::string& section, const std::string& key, 51 uint64_t* value); 52 bool btif_config_set_uint64(const std::string& section, const std::string& key, 53 uint64_t value); 54 bool btif_config_get_str(const std::string& section, const std::string& key, 55 char* value, int* size_bytes); 56 bool btif_config_set_str(const std::string& section, const std::string& key, 57 const std::string& value); 58 bool btif_config_get_bin(const std::string& section, const std::string& key, 59 uint8_t* value, size_t* length); 60 bool btif_config_set_bin(const std::string& section, const std::string& key, 61 const uint8_t* value, size_t length); 62 bool btif_config_remove(const std::string& section, const std::string& key); 63 64 size_t btif_config_get_bin_length(const std::string& section, 65 const std::string& key); 66 67 std::vector<RawAddress> btif_config_get_paired_devices(); 68 69 void btif_config_save(void); 70 void btif_config_flush(void); 71 bool btif_config_clear(void); 72 73 // TODO(zachoverflow): Eww...we need to move these out. These are peer specific, 74 // not config general. 75 bool btif_get_address_type(const RawAddress& bd_addr, 76 tBLE_ADDR_TYPE* p_addr_type); 77 bool btif_get_device_type(const RawAddress& bd_addr, int* p_device_type); 78 79 void btif_debug_config_dump(int fd); 80