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 
18 #include <singleton.h>
19 #include "datashare_helper.h"
20 #include "nfc_sdk_common.h"
21 #include "uri.h"
22 
23 namespace OHOS {
24 namespace NFC {
25 
26 class NfcDataShareImpl : public DelayedSingleton<NfcDataShareImpl> {
27 public:
28     DECLARE_INTERFACE_DESCRIPTOR(u"nfc.INfcState");
29     NfcDataShareImpl();
30     ~NfcDataShareImpl();
31     KITS::ErrorCode RegisterDataObserver(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver);
32     KITS::ErrorCode UnregisterDataObserver(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver);
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     void Initialize();
39 
40     sptr<IRemoteObject> remoteObj_;
41     std::shared_ptr<DataShare::DataShareHelper> dataShareHelper_;
42 };
43 
44 class INfcState : public IRemoteBroker {
45 public:
46     DECLARE_INTERFACE_DESCRIPTOR(u"nfc.INfcState");
47 };
48 } // NFC
49 } // OHOS
50 #endif // NFC_DATA_SHARE_IMPL_H
51