Loading system/btif/include/btif_config.h +1 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ const char *btif_config_section_name(const btif_config_section_iter_t *section); void btif_config_save(void); void btif_config_flush(void); int btif_config_clear(void); // TODO(zachoverflow): Eww...we need to move these out. These are peer specific, not config general. bool btif_get_address_type(const BD_ADDR bd_addr, int *p_addr_type); Loading system/btif/src/bluetooth.c +8 −1 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ #include "osi/include/allocation_tracker.h" #include "osi/include/log.h" #include "stack_manager.h" #include "btif_config.h" /************************************************************************************ ** Constants & Macros Loading Loading @@ -416,6 +417,11 @@ static int set_os_callouts(bt_os_callouts_t *callouts) { return BT_STATUS_SUCCESS; } static int config_clear(void) { LOG_INFO("%s", __func__); return btif_config_clear(); } static const bt_interface_t bluetoothInterface = { sizeof(bluetoothInterface), init, Loading Loading @@ -449,7 +455,8 @@ static const bt_interface_t bluetoothInterface = { config_hci_snoop_log, set_os_callouts, read_energy_info, dump dump, config_clear }; const bt_interface_t* bluetooth__get_bluetooth_interface () Loading system/btif/src/btif_config.c +20 −0 Original line number Diff line number Diff line Loading @@ -360,6 +360,26 @@ void btif_config_flush(void) { pthread_mutex_unlock(&lock); } int btif_config_clear(void){ assert(config != NULL); assert(alarm_timer != NULL); alarm_cancel(alarm_timer); pthread_mutex_lock(&lock); config_free(config); config = config_new_empty(); if (config == NULL) { pthread_mutex_unlock(&lock); return false; } int ret = config_save(config, CONFIG_FILE_PATH); pthread_mutex_unlock(&lock); return ret; } static void timer_config_save(UNUSED_ATTR void *data) { assert(config != NULL); assert(alarm_timer != NULL); Loading Loading
system/btif/include/btif_config.h +1 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ const char *btif_config_section_name(const btif_config_section_iter_t *section); void btif_config_save(void); void btif_config_flush(void); int btif_config_clear(void); // TODO(zachoverflow): Eww...we need to move these out. These are peer specific, not config general. bool btif_get_address_type(const BD_ADDR bd_addr, int *p_addr_type); Loading
system/btif/src/bluetooth.c +8 −1 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ #include "osi/include/allocation_tracker.h" #include "osi/include/log.h" #include "stack_manager.h" #include "btif_config.h" /************************************************************************************ ** Constants & Macros Loading Loading @@ -416,6 +417,11 @@ static int set_os_callouts(bt_os_callouts_t *callouts) { return BT_STATUS_SUCCESS; } static int config_clear(void) { LOG_INFO("%s", __func__); return btif_config_clear(); } static const bt_interface_t bluetoothInterface = { sizeof(bluetoothInterface), init, Loading Loading @@ -449,7 +455,8 @@ static const bt_interface_t bluetoothInterface = { config_hci_snoop_log, set_os_callouts, read_energy_info, dump dump, config_clear }; const bt_interface_t* bluetooth__get_bluetooth_interface () Loading
system/btif/src/btif_config.c +20 −0 Original line number Diff line number Diff line Loading @@ -360,6 +360,26 @@ void btif_config_flush(void) { pthread_mutex_unlock(&lock); } int btif_config_clear(void){ assert(config != NULL); assert(alarm_timer != NULL); alarm_cancel(alarm_timer); pthread_mutex_lock(&lock); config_free(config); config = config_new_empty(); if (config == NULL) { pthread_mutex_unlock(&lock); return false; } int ret = config_save(config, CONFIG_FILE_PATH); pthread_mutex_unlock(&lock); return ret; } static void timer_config_save(UNUSED_ATTR void *data) { assert(config != NULL); assert(alarm_timer != NULL); Loading