/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @addtogroup HdiNfc
* @{
*
* @brief Provides unified APIs for nfc services to access nfc drivers.
*
* An nfc service can obtain an nfc driver object or agent and then call APIs provided by this object or agent to
* access nfc devices, thereby obtaining enabling or disabling an nfc controller, initializing an nfc core,
* writing NCI data to an nfc driver, starting configuration for RF discovery of nfc remote endpoints,
* sending nfc commands to an nfc driver for IO control.
*
* @version 1.0
*/
package ohos.hdi.nfc.v1_0;
import ohos.hdi.nfc.v1_0.NfcTypes;
import ohos.hdi.nfc.v1_0.INfcCallback;
/**
* @brief Declares the APIs provided by the nfc module for obtaining nfc controller operations, enabling or
* disabling an nfc controller, initializing an nfc core, writing NCI data to an nfc driver, starting
* configuration for RF discovery of nfc remote endpoints, sending nfc commands to an nfc driver for IO control.
*
* @since 3.2
* @version 1.0
*/
interface INfcInterface {
/**
* @brief Enables the nfc controller and initialize the nfc core.
*
* @param callbackObj Indicates the callback to obtain the data and events that sent to nfc stack by the nfc chip.
* @return Returns 0 if the operation is succeed, otherwise marks the reason of failure.
* For details, see {@link NfcTypes}.
*
* @since 3.2
* @version 1.0
*/
Open([in] INfcCallback callbackObj, [out] enum NfcStatus status);
/**
* @brief Configures the nfc chip after initializing the nfc core.
*
* @param callbackObj Indicates the callback to obtain the data and events that sent to nfc stack by the nfc chip.
* @return Returns 0 if the operation is succeed, otherwise marks the reason of failure.
* For details, see {@link NfcTypes}.
*
* @since 3.2
* @version 1.0
*/
CoreInitialized([in] List data, [out] enum NfcStatus status);
/**
* @brief Specifically configures the nfc chip before starting RF discovering.
*
* @return Returns 0 if the operation is succeed, otherwise marks the reason of failure.
* For details, see {@link NfcTypes}.
*
* @since 3.2
* @version 1.0
*/
Prediscover([out] enum NfcStatus status);
/**
* @brief Writes NCI data to the nfc core.
*
* @param data the NCI data sending to the nfc controller interface.
* @return Returns 0 if the operation is succeed, otherwise marks the reason of failure.
* For details, see {@link NfcTypes}.
*
* @since 3.2
* @version 1.0
*/
Write([in] List data, [out] enum NfcStatus status);
/**
* @brief Sets the HDF to allow to send NCI data.
*
* @return Returns 0 if the operation is succeed, otherwise marks the reason of failure.
* For details, see {@link NfcTypes}.
*
* @since 3.2
* @version 1.0
*/
ControlGranted([out] enum NfcStatus status);
/**
* @brief Restarts the nfc controller according to each power cycle.
*
* @return Returns 0if the operation is succeed, otherwise marks the reason of failure.
* For details, see {@link NfcTypes}.
*
* @since 3.2
* @version 1.0
*/
PowerCycle([out] enum NfcStatus status);
/**
* @brief Disables the nfc controller and releases the resource.
*
* @return Returns 0 if the operation is succeed, otherwise marks the reason of failure.
* For details, see {@link NfcTypes}.
*
* @since 3.2
* @version 1.0
*/
Close([out] enum NfcStatus status);
/**
* @brief Sends I/O control commands and data from the nfc stack to HDI.
*
* @param cmd Indicates the commands that defined in NfcCommand in {@link NfcTypes}.
* @param data Indicates the data that sent to HDI.
* @return Returns 0 if the operation is succeed, otherwise marks the reason of failure.
* For details, see {@link NfcTypes}.
*
* @since 3.2
* @version 1.0
*/
Ioctl([in] enum NfcCommand cmd, [in] List data, [out] enum NfcStatus status);
}