1 /* 2 * Copyright 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <optional> 20 #include <string> 21 22 namespace bluetooth { 23 namespace os { 24 25 // Get |property| keyed system property from supported platform, return std::nullopt if the property does not exist 26 // or if the platform does not support system property 27 std::optional<std::string> GetSystemProperty(const std::string& property); 28 29 // Get |property| keyed system property as uint32_t from supported platform, return |default_value| if the property 30 // does not exist or if the platform does not support system property 31 uint32_t GetSystemPropertyUint32(const std::string& property, uint32_t default_value); 32 33 // Get |property| keyed system property as uint32_t from supported platform, return |default_value| 34 // if the property does not exist or if the platform does not support system property if property is 35 // found it will call stoul with |base| 36 uint32_t GetSystemPropertyUint32Base( 37 const std::string& property, uint32_t default_value, int base = 0); 38 39 // Get |property| keyed property as bool from supported platform, return 40 // |default_value| if the property does not exist or if the platform 41 // does not support system property 42 bool GetSystemPropertyBool(const std::string& property, bool default_value); 43 44 // Set |property| keyed system property to |value|, return true if the set was successful and false if the set failed 45 // Replace existing value if property already exists 46 bool SetSystemProperty(const std::string& property, const std::string& value); 47 48 // Clear system properties for host only 49 void ClearSystemPropertiesForHost(); 50 51 // Check if the vendor image is using root canal simulated Bluetooth stack 52 bool IsRootCanalEnabled(); 53 54 // Get Android Vendor Image release version in numeric value (e.g. Android R is 11), return 0 if not on Android or 55 // version not available 56 int GetAndroidVendorReleaseVersion(); 57 58 } // namespace os 59 } // namespace bluetooth