• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 I_NFC_SERVICE_H
16 #define I_NFC_SERVICE_H
17 
18 #include "infcc_host.h"
19 #include "tag_dispatcher.h"
20 
21 namespace OHOS {
22 namespace NFC {
23 enum class NfcCommonEvent {
24     // tags found
25     MSG_TAG_FOUND = 0,
26     MSG_TAG_DEBOUNCE,
27 
28     // screen changed
29     MSG_SCREEN_CHANGED,
30 
31     // package updated
32     MSG_PACKAGE_UPDATED,
33 
34     // card emulation
35     MSG_ROUTE_AID,
36 };
37 
38 enum class ScreenState {
39     SCREEN_STATE_UNKNOWN = 0x00,
40     SCREEN_STATE_OFF_UNLOCKED = 0x01,
41     SCREEN_STATE_OFF_LOCKED = 0x02,
42     SCREEN_STATE_ON_LOCKED = 0x04,
43     SCREEN_STATE_ON_UNLOCKED = 0x08,
44     // Polling mask
45     SCREEN_POLLING_TAG_MASK = 0x10,
46     SCREEN_POLLING_READER_MASK = 0x40
47 };
48 
49 class INfcService {
50 public:
~INfcService()51     virtual ~INfcService() {}
52 
53     virtual bool IsNfcEnabled() = 0;
54     virtual int GetNfcState() = 0;
55     virtual int GetScreenState() = 0;
56     virtual int GetNciVersion() = 0;
57     virtual std::weak_ptr<NFC::NCI::INfccHost> GetNfccHost() = 0;
58     virtual std::weak_ptr<TAG::TagDispatcher> GetTagDispatcher() = 0;
59     virtual OHOS::sptr<IRemoteObject> GetTagServiceIface() = 0;
60     virtual void ExecuteStartPollingLoop() = 0;
61 
62 private:
63 };
64 }  // namespace NFC
65 }  // namespace OHOS
66 #endif  // I_NFC_SERVICE_H
67