Loading system/gd/os/system_properties.h +6 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,12 @@ std::optional<std::string> GetSystemProperty(const std::string& property); // does not exist or if the platform does not support system property uint32_t GetSystemPropertyUint32(const std::string& property, uint32_t default_value); // Get |property| keyed system property as uint32_t from supported platform, return |default_value| // if the property does not exist or if the platform does not support system property if property is // found it will call stoul with |base| uint32_t GetSystemPropertyUint32Base( const std::string& property, uint32_t default_value, int base = 0); // Get |property| keyed property as bool from supported platform, return // |default_value| if the property does not exist or if the platform // does not support system property Loading system/gd/os/system_properties_common.cc +6 −1 Original line number Diff line number Diff line Loading @@ -23,9 +23,14 @@ namespace bluetooth { namespace os { uint32_t GetSystemPropertyUint32(const std::string& property, uint32_t default_value) { return GetSystemPropertyUint32Base(property, default_value, 10); } uint32_t GetSystemPropertyUint32Base( const std::string& property, uint32_t default_value, int base) { std::optional<std::string> result = GetSystemProperty(property); if (result.has_value()) { return static_cast<uint32_t>(std::stoul(*result)); return static_cast<uint32_t>(std::stoul(*result, nullptr, base)); } return default_value; } Loading system/stack/l2cap/l2c_api.cc +3 −3 Original line number Diff line number Diff line Loading @@ -35,11 +35,11 @@ #include "device/include/controller.h" // TODO Remove #include "gd/common/init_flags.h" #include "gd/hal/snoop_logger.h" #include "gd/os/system_properties.h" #include "hci/include/btsnoop.h" #include "main/shim/shim.h" #include "osi/include/allocator.h" #include "osi/include/log.h" #include "osi/include/properties.h" #include "stack/btm/btm_sec.h" #include "stack/include/bt_hdr.h" #include "stack/include/btu.h" // do_in_main_thread Loading Loading @@ -73,14 +73,14 @@ uint16_t L2CA_Register2(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, uint16_t L2CA_LeCreditDefault() { static const uint16_t sL2CAP_LE_CREDIT_DEFAULT = (uint16_t)osi_property_get_int32( bluetooth::os::GetSystemPropertyUint32Base( "bluetooth.l2cap.le.credit_default.value", 0xffff); return sL2CAP_LE_CREDIT_DEFAULT; } uint16_t L2CA_LeCreditThreshold() { static const uint16_t sL2CAP_LE_CREDIT_THRESHOLD = (uint16_t)osi_property_get_int32( bluetooth::os::GetSystemPropertyUint32Base( "bluetooth.l2cap.le.credit_threshold.value", 0x0040); return sL2CAP_LE_CREDIT_THRESHOLD; } Loading Loading
system/gd/os/system_properties.h +6 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,12 @@ std::optional<std::string> GetSystemProperty(const std::string& property); // does not exist or if the platform does not support system property uint32_t GetSystemPropertyUint32(const std::string& property, uint32_t default_value); // Get |property| keyed system property as uint32_t from supported platform, return |default_value| // if the property does not exist or if the platform does not support system property if property is // found it will call stoul with |base| uint32_t GetSystemPropertyUint32Base( const std::string& property, uint32_t default_value, int base = 0); // Get |property| keyed property as bool from supported platform, return // |default_value| if the property does not exist or if the platform // does not support system property Loading
system/gd/os/system_properties_common.cc +6 −1 Original line number Diff line number Diff line Loading @@ -23,9 +23,14 @@ namespace bluetooth { namespace os { uint32_t GetSystemPropertyUint32(const std::string& property, uint32_t default_value) { return GetSystemPropertyUint32Base(property, default_value, 10); } uint32_t GetSystemPropertyUint32Base( const std::string& property, uint32_t default_value, int base) { std::optional<std::string> result = GetSystemProperty(property); if (result.has_value()) { return static_cast<uint32_t>(std::stoul(*result)); return static_cast<uint32_t>(std::stoul(*result, nullptr, base)); } return default_value; } Loading
system/stack/l2cap/l2c_api.cc +3 −3 Original line number Diff line number Diff line Loading @@ -35,11 +35,11 @@ #include "device/include/controller.h" // TODO Remove #include "gd/common/init_flags.h" #include "gd/hal/snoop_logger.h" #include "gd/os/system_properties.h" #include "hci/include/btsnoop.h" #include "main/shim/shim.h" #include "osi/include/allocator.h" #include "osi/include/log.h" #include "osi/include/properties.h" #include "stack/btm/btm_sec.h" #include "stack/include/bt_hdr.h" #include "stack/include/btu.h" // do_in_main_thread Loading Loading @@ -73,14 +73,14 @@ uint16_t L2CA_Register2(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, uint16_t L2CA_LeCreditDefault() { static const uint16_t sL2CAP_LE_CREDIT_DEFAULT = (uint16_t)osi_property_get_int32( bluetooth::os::GetSystemPropertyUint32Base( "bluetooth.l2cap.le.credit_default.value", 0xffff); return sL2CAP_LE_CREDIT_DEFAULT; } uint16_t L2CA_LeCreditThreshold() { static const uint16_t sL2CAP_LE_CREDIT_THRESHOLD = (uint16_t)osi_property_get_int32( bluetooth::os::GetSystemPropertyUint32Base( "bluetooth.l2cap.le.credit_threshold.value", 0x0040); return sL2CAP_LE_CREDIT_THRESHOLD; } Loading