btif_config.h revision 5738f83aeb59361a0a2eda2460113f6dc9194271
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#ifdef __cplusplus
31#include <stdint.h>
32extern "C" {
33#endif
34
35/*******************************************************************************
36** Constants & Macros
37********************************************************************************/
38
39#define BTIF_CFG_TYPE_INVALID   0
40#define BTIF_CFG_TYPE_STR       1
41#define BTIF_CFG_TYPE_INT      (1 << 1)
42#define BTIF_CFG_TYPE_BIN      (1 << 2)
43#define BTIF_CFG_TYPE_VOLATILE (1 << 15)
44
45
46/*******************************************************************************
47**  Functions
48********************************************************************************/
49
50int btif_config_init();
51
52int btif_config_exist(const char* section, const char* key, const char* name);
53int btif_config_get_int(const char* section, const char* key, const char* name, int* value);
54int btif_config_set_int(const char* section, const char* key, const char* name, int value);
55int btif_config_get_str(const char* section, const char* key, const char* name, char* value, int* bytes);
56int btif_config_set_str(const char* section, const char* key, const char* name, const char* value);
57
58int btif_config_get(const char* section, const char* key, const char* name, char* value, int* bytes, int* type);
59int btif_config_set(const char* section, const char* key, const char* name, const char*  value, int bytes, int type);
60
61int btif_config_remove(const char* section, const char* key, const char* name);
62
63short btif_config_next_key(short current_key_pos, const char* section, char * key_name, int* key_name_bytes);
64short btif_config_next_value(short pos, const char* section, const char* key, char* value_name, int* value_name_bytes);
65
66typedef void (*btif_config_enum_callback)(void* user_data, const char* section, const char* key, const char* name,
67                                          const char*  value, int bytes, int type);
68int btif_config_enum(btif_config_enum_callback cb, void* user_data);
69
70int btif_config_save();
71void btif_config_flush();
72
73#ifdef __cplusplus
74}
75#endif
76
77#endif
78