Home | History | Annotate | Download | only in include
      1 /******************************************************************************
      2  *
      3  *  Copyright (C) 2009-2012 Broadcom Corporation
      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 /*******************************************************************************
     20  *
     21  *  Filename:      btif_config.h
     22  *
     23  *  Description:   Bluetooth configuration Interface
     24  *
     25  *******************************************************************************/
     26 
     27 #ifndef BTIF_CONFIG_H
     28 #define BTIF_CONFIG_H
     29 
     30 #include "data_types.h"
     31 #include "bt_types.h"
     32 
     33 #ifdef __cplusplus
     34 #include <stdint.h>
     35 extern "C" {
     36 #endif
     37 
     38 /*******************************************************************************
     39 ** Constants & Macros
     40 ********************************************************************************/
     41 
     42 #define BTIF_CFG_TYPE_INVALID   0
     43 #define BTIF_CFG_TYPE_STR       1
     44 #define BTIF_CFG_TYPE_INT      (1 << 1)
     45 #define BTIF_CFG_TYPE_BIN      (1 << 2)
     46 #define BTIF_CFG_TYPE_VOLATILE (1 << 15)
     47 
     48 
     49 /*******************************************************************************
     50 **  Functions
     51 ********************************************************************************/
     52 
     53 int btif_config_init();
     54 
     55 int btif_config_exist(const char* section, const char* key, const char* name);
     56 int btif_config_get_int(const char* section, const char* key, const char* name, int* value);
     57 int btif_config_set_int(const char* section, const char* key, const char* name, int value);
     58 int btif_config_get_str(const char* section, const char* key, const char* name, char* value, int* bytes);
     59 int btif_config_set_str(const char* section, const char* key, const char* name, const char* value);
     60 
     61 int btif_config_get(const char* section, const char* key, const char* name, char* value, int* bytes, int* type);
     62 int btif_config_set(const char* section, const char* key, const char* name, const char*  value, int bytes, int type);
     63 
     64 int btif_config_remove(const char* section, const char* key, const char* name);
     65 int btif_config_filter_remove(const char* section, const char* filter[], int filter_count, int max_allowed);
     66 
     67 short btif_config_next_key(short current_key_pos, const char* section, char * key_name, int* key_name_bytes);
     68 short btif_config_next_value(short pos, const char* section, const char* key, char* value_name, int* value_name_bytes);
     69 
     70 typedef void (*btif_config_enum_callback)(void* user_data, const char* section, const char* key, const char* name,
     71                                           const char*  value, int bytes, int type);
     72 int btif_config_enum(btif_config_enum_callback cb, void* user_data);
     73 
     74 int btif_config_save();
     75 void btif_config_flush();
     76 
     77 BOOLEAN btif_get_address_type(const BD_ADDR bd_addr, int *p_addr_type);
     78 BOOLEAN btif_get_device_type(const BD_ADDR bd_addr, int *p_device_type);
     79 
     80 #ifdef __cplusplus
     81 }
     82 #endif
     83 
     84 #endif
     85