Home | History | Annotate | Download | only in src

Lines Matching refs:config

43 #include "osi/include/config.h"
73 static void btif_config_remove_unpaired(config_t* config);
74 static void btif_config_remove_restricted(config_t* config);
124 static std::mutex config_lock; // protects operations on |config|.
125 static config_t* config;
137 config = btif_config_open(CONFIG_FILE_PATH);
139 if (!config) {
140 LOG_WARN(LOG_TAG, "%s unable to load config file: %s; using backup.",
142 config = btif_config_open(CONFIG_BACKUP_PATH);
146 if (!config) {
150 config = btif_config_transcode(CONFIG_LEGACY_FILE_PATH);
154 if (!config) {
156 "%s unable to transcode legacy file; creating empty config.",
158 config = config_new_empty();
164 config_set_string(config, INFO_SECTION, FILE_SOURCE, file_source.c_str());
166 if (!config) {
167 LOG_ERROR(LOG_TAG, "%s unable to allocate a config object.", __func__);
171 btif_config_remove_unpaired(config);
174 if (!is_restricted_mode()) btif_config_remove_restricted(config);
176 // Read or set config file creation timestamp
178 time_str = config_get_string(config, INFO_SECTION, FILE_TIMESTAMP, NULL);
186 config_set_string(config, INFO_SECTION, FILE_TIMESTAMP,
193 config_timer = alarm_new("btif.config");
205 config_free(config);
207 config = NULL;
213 config_t* config = config_new(filename);
214 if (!config) return NULL;
216 if (!config_has_section(config, "Adapter")) {
217 LOG_ERROR(LOG_TAG, "Config is missing adapter section");
218 config_free(config);
222 return config;
234 config_free(config);
236 config = NULL;
247 CHECK(config != NULL);
251 return config_has_section(config, section);
255 CHECK(config != NULL);
260 return config_has_key(config, section, key);
264 CHECK(config != NULL);
270 bool ret = config_has_key(config, section, key);
271 if (ret) *value = config_get_int(config, section, key, *value);
277 CHECK(config != NULL);
282 config_set_int(config, section, key, value);
289 CHECK(config != NULL);
297 const char* stored_value = config_get_string(config, section, key, NULL);
308 CHECK(config != NULL);
314 config_set_string(config, section, key, value);
320 CHECK(config != NULL);
327 const char* value_str = config_get_string(config, section, key, NULL);
344 CHECK(config != NULL);
349 const char* value_str = config_get_string(config, section, key, NULL);
360 CHECK(config != NULL);
375 config_set_string(config, section, key, str);
383 CHECK(config != NULL);
384 return (const btif_config_section_iter_t*)config_section_begin(config);
388 CHECK(config != NULL);
389 return (const btif_config_section_iter_t*)config_section_end(config);
394 CHECK(config != NULL);
402 CHECK(config != NULL);
408 CHECK(config != NULL);
413 return config_remove_key(config, section, key);
417 CHECK(config != NULL);
424 CHECK(config != NULL);
432 CHECK(config != NULL);
438 config_free(config);
440 config = config_new_empty();
441 if (config == NULL) return false;
443 bool ret = config_save(config, CONFIG_FILE_PATH);
457 CHECK(config != NULL);
462 config_t* config_paired = config_new_clone(config);
472 // The paired config used to carry information about
500 dprintf(fd, "\nBluetooth Config:\n");
502 dprintf(fd, " Config Source: ");
527 config_get_string(config, INFO_SECTION, FILE_SOURCE, "Original"));
530 static void btif_config_remove_restricted(config_t* config) {
531 CHECK(config != NULL);
533 const config_section_node_t* snode = config_section_begin(config);
534 while (snode != config_section_end(config)) {
537 config_has_key(config, section, "Restricted")) {
539 config_remove_section(config, section);