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);
#include "osi/include/allocation_tracker.h"
#include "osi/include/log.h"
#include "stack_manager.h"
+#include "btif_config.h"
/************************************************************************************
** Constants & Macros
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,
config_hci_snoop_log,
set_os_callouts,
read_energy_info,
- dump
+ dump,
+ config_clear
};
const bt_interface_t* bluetooth__get_bluetooth_interface ()
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);