Home | History | Annotate | Download | only in include
      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 
     26 static const char BTIF_CONFIG_MODULE[] = "btif_config_module";
     27 
     28 typedef struct btif_config_section_iter_t btif_config_section_iter_t;
     29 
     30 bool btif_config_has_section(const char *section);
     31 bool btif_config_exist(const char *section, const char *key);
     32 bool btif_config_get_int(const char *section, const char *key, int *value);
     33 bool btif_config_set_int(const char *section, const char *key, int value);
     34 bool btif_config_get_str(const char *section, const char *key, char *value, int *size_bytes);
     35 bool btif_config_set_str(const char *section, const char *key, const char *value);
     36 bool btif_config_get_bin(const char *section, const char *key, uint8_t *value, size_t *length);
     37 bool btif_config_set_bin(const char *section, const char *key, const uint8_t *value, size_t length);
     38 bool btif_config_remove(const char *section, const char *key);
     39 
     40 size_t btif_config_get_bin_length(const char *section, const char *key);
     41 
     42 const btif_config_section_iter_t *btif_config_section_begin(void);
     43 const btif_config_section_iter_t *btif_config_section_end(void);
     44 const btif_config_section_iter_t *btif_config_section_next(const btif_config_section_iter_t *section);
     45 const char *btif_config_section_name(const btif_config_section_iter_t *section);
     46 
     47 void btif_config_save(void);
     48 void btif_config_flush(void);
     49 int btif_config_clear(void);
     50 
     51 // TODO(zachoverflow): Eww...we need to move these out. These are peer specific, not config general.
     52 bool btif_get_address_type(const BD_ADDR bd_addr, int *p_addr_type);
     53 bool btif_get_device_type(const BD_ADDR bd_addr, int *p_device_type);
     54 
     55