1bc2ed2b3Sopenharmony_ci/* 2bc2ed2b3Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 3bc2ed2b3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4bc2ed2b3Sopenharmony_ci * you may not use this file except in compliance with the License. 5bc2ed2b3Sopenharmony_ci * You may obtain a copy of the License at 6bc2ed2b3Sopenharmony_ci * 7bc2ed2b3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8bc2ed2b3Sopenharmony_ci * 9bc2ed2b3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10bc2ed2b3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11bc2ed2b3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12bc2ed2b3Sopenharmony_ci * See the License for the specific language governing permissions and 13bc2ed2b3Sopenharmony_ci * limitations under the License. 14bc2ed2b3Sopenharmony_ci */ 15bc2ed2b3Sopenharmony_ci#ifndef NFC_PREFERENCES_H 16bc2ed2b3Sopenharmony_ci#define NFC_PREFERENCES_H 17bc2ed2b3Sopenharmony_ci#include "preferences.h" 18bc2ed2b3Sopenharmony_ci#include "preferences_helper.h" 19bc2ed2b3Sopenharmony_ci 20bc2ed2b3Sopenharmony_cinamespace OHOS { 21bc2ed2b3Sopenharmony_cinamespace NFC { 22bc2ed2b3Sopenharmony_ciconst std::string PREF_KEY_STATE = "pref_key_nfc_state"; 23bc2ed2b3Sopenharmony_ciclass NfcPreferences { 24bc2ed2b3Sopenharmony_cipublic: 25bc2ed2b3Sopenharmony_ci NfcPreferences(); 26bc2ed2b3Sopenharmony_ci ~NfcPreferences(); 27bc2ed2b3Sopenharmony_ci static NfcPreferences& GetInstance(); 28bc2ed2b3Sopenharmony_ci 29bc2ed2b3Sopenharmony_ci void SetString(const std::string& key, const std::string& value); 30bc2ed2b3Sopenharmony_ci std::string GetString(const std::string& key); 31bc2ed2b3Sopenharmony_ci void SetInt(const std::string& key, const int value); 32bc2ed2b3Sopenharmony_ci int GetInt(const std::string& key); 33bc2ed2b3Sopenharmony_ci void Clear(); 34bc2ed2b3Sopenharmony_ci void Delete(const std::string& key); 35bc2ed2b3Sopenharmony_ci 36bc2ed2b3Sopenharmony_ci void UpdateNfcState(int newState); 37bc2ed2b3Sopenharmony_ci int GetNfcState(); 38bc2ed2b3Sopenharmony_ci 39bc2ed2b3Sopenharmony_ciprivate: 40bc2ed2b3Sopenharmony_ci std::shared_ptr<NativePreferences::Preferences> GetPreference(const std::string& fileName); 41bc2ed2b3Sopenharmony_ci int errCode_; 42bc2ed2b3Sopenharmony_ci std::string fileName_; 43bc2ed2b3Sopenharmony_ci}; 44bc2ed2b3Sopenharmony_ci} // NFC 45bc2ed2b3Sopenharmony_ci} // OHOS 46bc2ed2b3Sopenharmony_ci#endif // NFC_PREFERENCES_H