1 /* 2 * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef __BTC_CONFIG_H__ 8 #define __BTC_CONFIG_H__ 9 10 #include <stdbool.h> 11 #include <stddef.h> 12 13 #include "stack/bt_types.h" 14 15 typedef struct btc_config_section_iter_t btc_config_section_iter_t; 16 17 bool btc_config_init(void); 18 bool btc_config_shut_down(void); 19 bool btc_config_clean_up(void); 20 21 bool btc_config_has_section(const char *section); 22 bool btc_config_exist(const char *section, const char *key); 23 bool btc_config_get_int(const char *section, const char *key, int *value); 24 bool btc_config_set_int(const char *section, const char *key, int value); 25 bool btc_config_get_str(const char *section, const char *key, char *value, int *size_bytes); 26 bool btc_config_set_str(const char *section, const char *key, const char *value); 27 bool btc_config_get_bin(const char *section, const char *key, uint8_t *value, size_t *length); 28 bool btc_config_set_bin(const char *section, const char *key, const uint8_t *value, size_t length); 29 bool btc_config_remove(const char *section, const char *key); 30 bool btc_config_remove_section(const char *section); 31 32 size_t btc_config_get_bin_length(const char *section, const char *key); 33 34 const btc_config_section_iter_t *btc_config_section_begin(void); 35 const btc_config_section_iter_t *btc_config_section_end(void); 36 const btc_config_section_iter_t *btc_config_section_next(const btc_config_section_iter_t *section); 37 const char *btc_config_section_name(const btc_config_section_iter_t *section); 38 39 void btc_config_flush(void); 40 int btc_config_clear(void); 41 42 // TODO(zachoverflow): Eww...we need to move these out. These are peer specific, not config general. 43 bool btc_get_address_type(const BD_ADDR bd_addr, int *p_addr_type); 44 bool btc_compare_address_key_value(const char *section, const char *key_type, void *key_value, int key_length); 45 bool btc_get_device_type(const BD_ADDR bd_addr, int *p_device_type); 46 47 void btc_config_lock(void); 48 void btc_config_unlock(void); 49 50 #endif 51