btif_config.h revision 9d52f88bfc07556cb01ab3055f5b1242c9b467aa
1/****************************************************************************** 2 * 3 * Copyright (C) 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 26typedef struct btif_config_section_iter_t btif_config_section_iter_t; 27 28bool btif_config_init(void); 29void btif_config_cleanup(void); 30 31bool btif_config_has_section(const char *section); 32bool btif_config_exist(const char *section, const char *key); 33bool btif_config_get_int(const char *section, const char *key, int *value); 34bool btif_config_set_int(const char *section, const char *key, int value); 35bool btif_config_get_str(const char *section, const char *key, char *value, int *length); 36bool btif_config_set_str(const char *section, const char *key, const char *value); 37bool btif_config_get_bin(const char *section, const char *key, uint8_t *value, size_t *length); 38bool btif_config_set_bin(const char *section, const char *key, const uint8_t *value, size_t length); 39bool btif_config_remove(const char *section, const char *key); 40 41size_t btif_config_get_bin_length(const char *section, const char *key); 42 43const btif_config_section_iter_t *btif_config_section_begin(void); 44const btif_config_section_iter_t *btif_config_section_end(void); 45const btif_config_section_iter_t *btif_config_section_next(const btif_config_section_iter_t *section); 46const char *btif_config_section_name(const btif_config_section_iter_t *section); 47 48void btif_config_save(void); 49void btif_config_flush(void); 50 51// TODO(zachoverflow): Eww...we need to move these out. These are peer specific, not config general. 52bool btif_get_address_type(const BD_ADDR bd_addr, int *p_addr_type); 53bool btif_get_device_type(const BD_ADDR bd_addr, int *p_device_type); 54 55