1 /* 2 * Copyright 2019 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 <list> 20 #include <optional> 21 #include <string> 22 #include <vector> 23 24 namespace bluetooth { 25 namespace shim { 26 27 class BtifConfigInterface { 28 public: 29 ~BtifConfigInterface() = default; 30 static bool HasSection(const std::string& section); 31 static bool HasProperty(const std::string& section, 32 const std::string& property); 33 static bool GetInt(const std::string& section, const std::string& key, 34 int* value); 35 static bool SetInt(const std::string& section, const std::string& key, 36 int value); 37 static bool GetUint64(const std::string& section, const std::string& key, 38 uint64_t* value); 39 static bool SetUint64(const std::string& section, const std::string& key, 40 uint64_t value); 41 static bool GetStr(const std::string& section, const std::string& key, 42 char* value, int* size_bytes); 43 static std::optional<std::string> GetStr(const std::string& section, 44 const std::string& key); 45 static bool SetStr(const std::string& section, const std::string& key, 46 const std::string& value); 47 static bool GetBin(const std::string& section, const std::string& key, 48 uint8_t* value, size_t* length); 49 static size_t GetBinLength(const std::string& section, 50 const std::string& key); 51 static bool SetBin(const std::string& section, const std::string& key, 52 const uint8_t* value, size_t length); 53 static bool RemoveProperty(const std::string& section, 54 const std::string& key); 55 static std::vector<std::string> GetPersistentDevices(); 56 static void Save(); 57 static void Flush(); 58 static void Clear(); 59 }; 60 61 } // namespace shim 62 } // namespace bluetooth 63