static void _btc_storage_save(void) { const btc_config_section_iter_t *iter = btc_config_section_begin(); while (iter != btc_config_section_end()) { //store the next iter, if remove section, then will not loss the point const char *section = btc_config_section_name(iter); if (!string_is_bdaddr(section)) { iter = btc_config_section_next(iter); continue; } if (!btc_config_exist(section, BTC_BLE_STORAGE_DEV_TYPE_STR) && !btc_config_exist(section, BTC_BLE_STORAGE_ADDR_TYPE_STR) && !btc_config_exist(section, BTC_BLE_STORAGE_LINK_KEY_STR) && !btc_config_exist(section, BTC_BLE_STORAGE_LE_KEY_PENC_STR) && !btc_config_exist(section, BTC_BLE_STORAGE_LE_KEY_PID_STR) && !btc_config_exist(section, BTC_BLE_STORAGE_LE_KEY_PCSRK_STR) && !btc_config_exist(section, BTC_BLE_STORAGE_LE_KEY_LENC_STR) && !btc_config_exist(section, BTC_BLE_STORAGE_LE_KEY_LCSRK_STR)) { iter = btc_config_section_next(iter); btc_config_remove_section(section); continue; } iter = btc_config_section_next(iter); } btc_config_flush(); }
bool btc_config_clean_up(void) { btc_config_flush(); config_free(config); osi_mutex_free(&lock); config = NULL; return true; }
bool btc_config_shut_down(void) { btc_config_flush(); return true; }