1 /* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef NFC_DATA_SHARE_IMPL_H 16 #define NFC_DATA_SHARE_IMPL_H 17 #include <singleton.h> 18 #include "datashare_helper.h" 19 #include "nfc_sdk_common.h" 20 #include "uri.h" 21 22 namespace OHOS { 23 namespace NFC { 24 const std::string NFC_DATA_COLUMN_KEYWORD = "KEYWORD"; 25 const std::string NFC_DATA_COLUMN_VALUE = "VALUE"; 26 27 class NfcDataShareImpl : public DelayedSingleton<NfcDataShareImpl> { 28 public: 29 DECLARE_INTERFACE_DESCRIPTOR(u"nfc.INfcState"); 30 NfcDataShareImpl(); 31 ~NfcDataShareImpl(); 32 33 KITS::ErrorCode GetValue(Uri &uri, const std::string &column, int32_t &value); 34 KITS::ErrorCode SetValue(Uri &uri, const std::string &column, int &value); 35 std::shared_ptr<DataShare::DataShareHelper> CreateDataShareHelper(); 36 37 private: 38 std::mutex mutex_ {}; 39 sptr<IRemoteObject> remoteObj_; 40 std::shared_ptr<DataShare::DataShareHelper> dataShareHelper_; 41 }; 42 43 class INfcState : public IRemoteBroker { 44 public: 45 DECLARE_INTERFACE_DESCRIPTOR(u"nfc.INfcState"); 46 }; 47 } // NFC 48 } // OHOS 49 #endif // NFC_DATA_SHARE_IMPL_H