Loading system/btif/src/btif_config.cc +19 −0 Original line number Diff line number Diff line Loading @@ -451,6 +451,25 @@ bool btif_config_set_uint64(const std::string& section, const std::string& key, return true; } /******************************************************************************* * * Function btif_config_get_str * * Description Get the string value associated with a particular section * and key. * * section : The section name (i.e "Adapter") * key : The key name (i.e "Address") * value : A pointer to a buffer where we will store the value * size_bytes : The size of the buffer we have available to * write the value into. Will be updated upon * returning to contain the number of bytes * written. * * Returns True if a value was found, False otherwise. * ******************************************************************************/ bool btif_config_get_str(const std::string& section, const std::string& key, char* value, int* size_bytes) { if (bluetooth::shim::is_any_gd_enabled()) { Loading system/btif/src/btif_core.cc +6 −4 Original line number Diff line number Diff line Loading @@ -260,10 +260,12 @@ void btif_enable_bluetooth_evt() { std::string bdstr = local_bd_addr.ToString(); char val[PROPERTY_VALUE_MAX] = ""; int val_size = 0; if ((btif_config_get_str("Adapter", "Address", val, &val_size) == 0) || strcmp(bdstr.c_str(), val) == 0) { LOG_DEBUG("Storing the adapter address into the config file"); int val_size = PROPERTY_VALUE_MAX; if (!btif_config_get_str("Adapter", "Address", val, &val_size) || strcmp(bdstr.c_str(), val) != 0) { // We failed to get an address or the one in the config file does not match // the address given by the controller interface. Update the config cache LOG_DEBUG("%s: Storing '%s' into the config file", __func__, bdstr.c_str()); btif_config_set_str("Adapter", "Address", bdstr.c_str()); btif_config_save(); Loading Loading
system/btif/src/btif_config.cc +19 −0 Original line number Diff line number Diff line Loading @@ -451,6 +451,25 @@ bool btif_config_set_uint64(const std::string& section, const std::string& key, return true; } /******************************************************************************* * * Function btif_config_get_str * * Description Get the string value associated with a particular section * and key. * * section : The section name (i.e "Adapter") * key : The key name (i.e "Address") * value : A pointer to a buffer where we will store the value * size_bytes : The size of the buffer we have available to * write the value into. Will be updated upon * returning to contain the number of bytes * written. * * Returns True if a value was found, False otherwise. * ******************************************************************************/ bool btif_config_get_str(const std::string& section, const std::string& key, char* value, int* size_bytes) { if (bluetooth::shim::is_any_gd_enabled()) { Loading
system/btif/src/btif_core.cc +6 −4 Original line number Diff line number Diff line Loading @@ -260,10 +260,12 @@ void btif_enable_bluetooth_evt() { std::string bdstr = local_bd_addr.ToString(); char val[PROPERTY_VALUE_MAX] = ""; int val_size = 0; if ((btif_config_get_str("Adapter", "Address", val, &val_size) == 0) || strcmp(bdstr.c_str(), val) == 0) { LOG_DEBUG("Storing the adapter address into the config file"); int val_size = PROPERTY_VALUE_MAX; if (!btif_config_get_str("Adapter", "Address", val, &val_size) || strcmp(bdstr.c_str(), val) != 0) { // We failed to get an address or the one in the config file does not match // the address given by the controller interface. Update the config cache LOG_DEBUG("%s: Storing '%s' into the config file", __func__, bdstr.c_str()); btif_config_set_str("Adapter", "Address", bdstr.c_str()); btif_config_save(); Loading