1bc2ed2b3Sopenharmony_ci/*
2bc2ed2b3Sopenharmony_ci * Copyright (C) 2023 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 I_NCI_NFCC_INTERFACE_H
16bc2ed2b3Sopenharmony_ci#define I_NCI_NFCC_INTERFACE_H
17bc2ed2b3Sopenharmony_ci#include <string>
18bc2ed2b3Sopenharmony_ci
19bc2ed2b3Sopenharmony_cinamespace OHOS {
20bc2ed2b3Sopenharmony_cinamespace NFC {
21bc2ed2b3Sopenharmony_cinamespace NCI {
22bc2ed2b3Sopenharmony_ciconst std::string FOREGROUND_APP_KEY = "foreground";
23bc2ed2b3Sopenharmony_ciconst std::string READERMODE_APP_KEY = "readermode";
24bc2ed2b3Sopenharmony_ciclass INciNfccInterface {
25bc2ed2b3Sopenharmony_cipublic:
26bc2ed2b3Sopenharmony_ci    virtual ~INciNfccInterface() = default;
27bc2ed2b3Sopenharmony_ci
28bc2ed2b3Sopenharmony_ci    /**
29bc2ed2b3Sopenharmony_ci     * @brief Initialize when turn on NFC
30bc2ed2b3Sopenharmony_ci     * @return True if success, otherwise false.
31bc2ed2b3Sopenharmony_ci     */
32bc2ed2b3Sopenharmony_ci    virtual bool Initialize() = 0;
33bc2ed2b3Sopenharmony_ci
34bc2ed2b3Sopenharmony_ci    /**
35bc2ed2b3Sopenharmony_ci     * @brief Deinitialize when turn off NFC
36bc2ed2b3Sopenharmony_ci     * @return True if success, otherwise false.
37bc2ed2b3Sopenharmony_ci     */
38bc2ed2b3Sopenharmony_ci    virtual bool Deinitialize() = 0;
39bc2ed2b3Sopenharmony_ci
40bc2ed2b3Sopenharmony_ci    /**
41bc2ed2b3Sopenharmony_ci     * @brief Start polling and listening
42bc2ed2b3Sopenharmony_ci     * @param techMask bitmask of the technologies
43bc2ed2b3Sopenharmony_ci     * @param enableReaderMode if enable tag polling
44bc2ed2b3Sopenharmony_ci     * @param enableHostRouting if enable host routing
45bc2ed2b3Sopenharmony_ci     * @param restart true if need restart, otherwise false.
46bc2ed2b3Sopenharmony_ci     */
47bc2ed2b3Sopenharmony_ci    virtual void EnableDiscovery(uint16_t techMask, bool enableReaderMode, bool enableHostRouting, bool restart) = 0;
48bc2ed2b3Sopenharmony_ci
49bc2ed2b3Sopenharmony_ci    /**
50bc2ed2b3Sopenharmony_ci     * @brief Stop polling and listening
51bc2ed2b3Sopenharmony_ci     */
52bc2ed2b3Sopenharmony_ci    virtual void DisableDiscovery() = 0;
53bc2ed2b3Sopenharmony_ci
54bc2ed2b3Sopenharmony_ci    /**
55bc2ed2b3Sopenharmony_ci     * @brief Set the screen statue to nfc controller.
56bc2ed2b3Sopenharmony_ci     * @param screenStateMask the bitmask of the screen state
57bc2ed2b3Sopenharmony_ci     * @return True if success, otherwise false.
58bc2ed2b3Sopenharmony_ci     */
59bc2ed2b3Sopenharmony_ci    virtual bool SetScreenStatus(uint8_t screenStateMask) = 0;
60bc2ed2b3Sopenharmony_ci
61bc2ed2b3Sopenharmony_ci    /**
62bc2ed2b3Sopenharmony_ci     * @brief Get Nci version supprted by nfc controller.
63bc2ed2b3Sopenharmony_ci     * @return 0x20 if it's NCI2.0, otherwise 0x10 if it's NCI1.0.
64bc2ed2b3Sopenharmony_ci     */
65bc2ed2b3Sopenharmony_ci    virtual int GetNciVersion() = 0;
66bc2ed2b3Sopenharmony_ci
67bc2ed2b3Sopenharmony_ci    /**
68bc2ed2b3Sopenharmony_ci     * @brief Abort the nfc controller if NCI timeout.
69bc2ed2b3Sopenharmony_ci     */
70bc2ed2b3Sopenharmony_ci    virtual void Abort() = 0;
71bc2ed2b3Sopenharmony_ci
72bc2ed2b3Sopenharmony_ci    /**
73bc2ed2b3Sopenharmony_ci     * @brief Do factory reset for nfc controller.
74bc2ed2b3Sopenharmony_ci     */
75bc2ed2b3Sopenharmony_ci    virtual void FactoryReset() = 0;
76bc2ed2b3Sopenharmony_ci
77bc2ed2b3Sopenharmony_ci    /**
78bc2ed2b3Sopenharmony_ci     * @brief Shutdown the device. Enable the nfc functionality if support power off case.
79bc2ed2b3Sopenharmony_ci     */
80bc2ed2b3Sopenharmony_ci    virtual void Shutdown() = 0;
81bc2ed2b3Sopenharmony_ci
82bc2ed2b3Sopenharmony_ci    /**
83bc2ed2b3Sopenharmony_ci     * @brief Send a custom message to vendor
84bc2ed2b3Sopenharmony_ci    */
85bc2ed2b3Sopenharmony_ci    virtual void NotifyMessageToVendor(const std::string& key, const std::string& value) = 0;
86bc2ed2b3Sopenharmony_ci};
87bc2ed2b3Sopenharmony_ci}  // namespace NCI
88bc2ed2b3Sopenharmony_ci}  // namespace NFC
89bc2ed2b3Sopenharmony_ci}  // namespace OHOS
90bc2ed2b3Sopenharmony_ci#endif  // I_NCI_NFCC_INTERFACE_H
91