1 #include "sys_prop.h" 2 #include <cutils/properties.h> 3 4 namespace bluetooth { 5 namespace common { 6 namespace sys_prop { 7 get(rust::Str property)8rust::String get(rust::Str property) { 9 auto name = std::string(property.data(), property.length()); 10 std::array<char, PROPERTY_VALUE_MAX> value_array{0}; 11 auto value_len = property_get(name.c_str(), value_array.data(), nullptr); 12 if (value_len <= 0) { 13 value_len = 0; 14 } 15 return rust::String(value_array.data(), value_len); 16 } 17 18 } // namespace sys_prop 19 } // namespace common 20 } // namespace bluetooth 21