1/* 2 * Copyright (c) 2025 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@!sts_inject(""" 17static { loadLibrary("nfc_fwk_taihe_controller.z"); } 18""") 19 20@!namespace("@ohos.nfc.controller", "nfcController") 21 22enum NfcState: i32 { 23 STATE_OFF = 1, 24 STATE_TURNING_ON = 2, 25 STATE_ON = 3, 26 STATE_TURNING_OFF = 4 27} 28 29function isNfcAvailable(): bool; // deprecated since API 9, use canIUse("SystemCapability.Communication.NFC.Core") instead 30 31@on_off("nfcStateChange") 32function onNfcStateChange(callback: (data: NfcState) => void): void; 33@on_off("nfcStateChange") 34function offNfcStateChange(callback: Optional<(data: NfcState) => void>): void; 35 36function openNfc(): bool; // deprecated since API 9, use enableNfc() instead 37function enableNfc(): void; 38 39function closeNfc(): bool; // deprecated since API 9, use disableNfc() instead 40function disableNfc(): void; 41 42function isNfcOpen(): bool; 43function getNfcState(): NfcState; 44