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 16/** 17 * @addtogroup HdiNfc 18 * @{ 19 * 20 * @brief Provides unified APIs for nfc services to access nfc drivers. 21 * 22 * An nfc service can obtain an nfc driver object or agent and then call APIs provided by this object or agent to 23 * access nfc devices, thereby obtaining enabling or disabling an nfc controller, initializing an nfc core, 24 * writing NCI data to an nfc driver, starting configuration for RF discovery of nfc remote endpoints, 25 * sending nfc commands to an nfc driver for IO control. 26 * 27 * @version 1.0 28 */ 29 30package ohos.hdi.nfc.v1_0; 31 32import ohos.hdi.nfc.v1_0.NfcTypes; 33import ohos.hdi.nfc.v1_0.INfcCallback; 34 35/** 36 * @brief Declares the APIs provided by the nfc module for obtaining nfc controller operations, enabling or 37 * disabling an nfc controller, initializing an nfc core, writing NCI data to an nfc driver, starting 38 * configuration for RF discovery of nfc remote endpoints, sending nfc commands to an nfc driver for IO control. 39 * 40 * @since 3.2 41 * @version 1.0 42 */ 43 44interface INfcInterface { 45 /** 46 * @brief Enables the nfc controller and initialize the nfc core. 47 * 48 * @param callbackObj Indicates the callback to obtain the data and events that sent to nfc stack by the nfc chip. 49 * @return Returns <b>0</b> if the operation is succeed, otherwise marks the reason of failure. 50 * For details, see {@link NfcTypes}. 51 * 52 * @since 3.2 53 * @version 1.0 54 */ 55 Open([in] INfcCallback callbackObj, [out] enum NfcStatus status); 56 57 /** 58 * @brief Configures the nfc chip after initializing the nfc core. 59 * 60 * @param callbackObj Indicates the callback to obtain the data and events that sent to nfc stack by the nfc chip. 61 * @return Returns <b>0</b> if the operation is succeed, otherwise marks the reason of failure. 62 * For details, see {@link NfcTypes}. 63 * 64 * @since 3.2 65 * @version 1.0 66 */ 67 CoreInitialized([in] List<unsigned char> data, [out] enum NfcStatus status); 68 69 /** 70 * @brief Specifically configures the nfc chip before starting RF discovering. 71 * 72 * @return Returns <b>0</b> if the operation is succeed, otherwise marks the reason of failure. 73 * For details, see {@link NfcTypes}. 74 * 75 * @since 3.2 76 * @version 1.0 77 */ 78 Prediscover([out] enum NfcStatus status); 79 80 /** 81 * @brief Writes NCI data to the nfc core. 82 * 83 * @param data the NCI data sending to the nfc controller interface. 84 * @return Returns <b>0</b> if the operation is succeed, otherwise marks the reason of failure. 85 * For details, see {@link NfcTypes}. 86 * 87 * @since 3.2 88 * @version 1.0 89 */ 90 Write([in] List<unsigned char> data, [out] enum NfcStatus status); 91 92 /** 93 * @brief Sets the HDF to allow to send NCI data. 94 * 95 * @return Returns <b>0</b> if the operation is succeed, otherwise marks the reason of failure. 96 * For details, see {@link NfcTypes}. 97 * 98 * @since 3.2 99 * @version 1.0 100 */ 101 ControlGranted([out] enum NfcStatus status); 102 103 /** 104 * @brief Restarts the nfc controller according to each power cycle. 105 * 106 * @return Returns <b>0</b>if the operation is succeed, otherwise marks the reason of failure. 107 * For details, see {@link NfcTypes}. 108 * 109 * @since 3.2 110 * @version 1.0 111 */ 112 PowerCycle([out] enum NfcStatus status); 113 114 /** 115 * @brief Disables the nfc controller and releases the resource. 116 * 117 * @return Returns <b>0</b> if the operation is succeed, otherwise marks the reason of failure. 118 * For details, see {@link NfcTypes}. 119 * 120 * @since 3.2 121 * @version 1.0 122 */ 123 Close([out] enum NfcStatus status); 124 125 /** 126 * @brief Sends I/O control commands and data from the nfc stack to HDI. 127 * 128 * @param cmd Indicates the commands that defined in NfcCommand in {@link NfcTypes}. 129 * @param data Indicates the data that sent to HDI. 130 * @return Returns <b>0</b> if the operation is succeed, otherwise marks the reason of failure. 131 * For details, see {@link NfcTypes}. 132 * 133 * @since 3.2 134 * @version 1.0 135 */ 136 Ioctl([in] enum NfcCommand cmd, [in] List<unsigned char> data, [out] enum NfcStatus status); 137} 138