15738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/****************************************************************************** 25738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * 3b95c4ef4ac9e86953050a7ae6b3b4260df935713Sharvil Nanavati * Copyright (C) 2014 Google, Inc. 45738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * 55738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); 65738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * you may not use this file except in compliance with the License. 75738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * You may obtain a copy of the License at: 85738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * 95738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * http://www.apache.org/licenses/LICENSE-2.0 105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * 115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * Unless required by applicable law or agreed to in writing, software 125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS, 135738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 145738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * See the License for the specific language governing permissions and 155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * limitations under the License. 165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * 175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ******************************************************************************/ 185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 19b95c4ef4ac9e86953050a7ae6b3b4260df935713Sharvil Nanavati#pragma once 205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 21b95c4ef4ac9e86953050a7ae6b3b4260df935713Sharvil Nanavati#include <stdbool.h> 22b95c4ef4ac9e86953050a7ae6b3b4260df935713Sharvil Nanavati#include <stddef.h> 235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2486f97eda524568f2d264186844450db5e56dac36Matthew Xie#include "bt_types.h" 2586f97eda524568f2d264186844450db5e56dac36Matthew Xie 2606ef205ebcb0d3f0fe2b88ddcea73e646981940eSharvil Nanavatistatic const char BTIF_CONFIG_MODULE[] = "btif_config_module"; 275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2806ef205ebcb0d3f0fe2b88ddcea73e646981940eSharvil Nanavatitypedef struct btif_config_section_iter_t btif_config_section_iter_t; 295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 309d52f88bfc07556cb01ab3055f5b1242c9b467aaSharvil Nanavatibool btif_config_has_section(const char *section); 319d52f88bfc07556cb01ab3055f5b1242c9b467aaSharvil Nanavatibool btif_config_exist(const char *section, const char *key); 329d52f88bfc07556cb01ab3055f5b1242c9b467aaSharvil Nanavatibool btif_config_get_int(const char *section, const char *key, int *value); 339d52f88bfc07556cb01ab3055f5b1242c9b467aaSharvil Nanavatibool btif_config_set_int(const char *section, const char *key, int value); 34ce0bab413c2c1a0a5e9f4a82a6b2833685333bceSharvil Nanavatibool btif_config_get_str(const char *section, const char *key, char *value, int *size_bytes); 359d52f88bfc07556cb01ab3055f5b1242c9b467aaSharvil Nanavatibool btif_config_set_str(const char *section, const char *key, const char *value); 369d52f88bfc07556cb01ab3055f5b1242c9b467aaSharvil Nanavatibool btif_config_get_bin(const char *section, const char *key, uint8_t *value, size_t *length); 379d52f88bfc07556cb01ab3055f5b1242c9b467aaSharvil Nanavatibool btif_config_set_bin(const char *section, const char *key, const uint8_t *value, size_t length); 389d52f88bfc07556cb01ab3055f5b1242c9b467aaSharvil Nanavatibool btif_config_remove(const char *section, const char *key); 399d52f88bfc07556cb01ab3055f5b1242c9b467aaSharvil Nanavati 409d52f88bfc07556cb01ab3055f5b1242c9b467aaSharvil Nanavatisize_t btif_config_get_bin_length(const char *section, const char *key); 415738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 42b95c4ef4ac9e86953050a7ae6b3b4260df935713Sharvil Nanavaticonst btif_config_section_iter_t *btif_config_section_begin(void); 43b95c4ef4ac9e86953050a7ae6b3b4260df935713Sharvil Nanavaticonst btif_config_section_iter_t *btif_config_section_end(void); 44b95c4ef4ac9e86953050a7ae6b3b4260df935713Sharvil Nanavaticonst btif_config_section_iter_t *btif_config_section_next(const btif_config_section_iter_t *section); 45b95c4ef4ac9e86953050a7ae6b3b4260df935713Sharvil Nanavaticonst char *btif_config_section_name(const btif_config_section_iter_t *section); 465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 47b95c4ef4ac9e86953050a7ae6b3b4260df935713Sharvil Nanavativoid btif_config_save(void); 48b95c4ef4ac9e86953050a7ae6b3b4260df935713Sharvil Nanavativoid btif_config_flush(void); 49aa3be1a696b9ae1142fe9f358ad5f97e99da7892Ajay Panickerint btif_config_clear(void); 5086f97eda524568f2d264186844450db5e56dac36Matthew Xie 51b95c4ef4ac9e86953050a7ae6b3b4260df935713Sharvil Nanavati// TODO(zachoverflow): Eww...we need to move these out. These are peer specific, not config general. 52b95c4ef4ac9e86953050a7ae6b3b4260df935713Sharvil Nanavatibool btif_get_address_type(const BD_ADDR bd_addr, int *p_addr_type); 53b95c4ef4ac9e86953050a7ae6b3b4260df935713Sharvil Nanavatibool btif_get_device_type(const BD_ADDR bd_addr, int *p_device_type); 545738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 55