161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ConnectivityKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport { AsyncCallback } from './@ohos.base'; 2261847f8eSopenharmony_ciimport { ElementName } from './bundleManager/ElementName'; 2361847f8eSopenharmony_ciimport type { AbilityInfo } from './bundleManager/AbilityInfo'; 2461847f8eSopenharmony_ci 2561847f8eSopenharmony_ci/** 2661847f8eSopenharmony_ci * Provides methods to operate or manage NFC card emulation. 2761847f8eSopenharmony_ci * 2861847f8eSopenharmony_ci * @namespace cardEmulation 2961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 3061847f8eSopenharmony_ci * @since 6 3161847f8eSopenharmony_ci */ 3261847f8eSopenharmony_ci/** 3361847f8eSopenharmony_ci * Provides methods to operate or manage NFC card emulation. 3461847f8eSopenharmony_ci * 3561847f8eSopenharmony_ci * @namespace cardEmulation 3661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 3761847f8eSopenharmony_ci * @atomicservice 3861847f8eSopenharmony_ci * @since 12 3961847f8eSopenharmony_ci */ 4061847f8eSopenharmony_cideclare namespace cardEmulation { 4161847f8eSopenharmony_ci /** 4261847f8eSopenharmony_ci * Defines the capability type. 4361847f8eSopenharmony_ci * 4461847f8eSopenharmony_ci * @enum { number } 4561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 4661847f8eSopenharmony_ci * @since 6 4761847f8eSopenharmony_ci * @deprecated since 9 4861847f8eSopenharmony_ci * @useinstead ohos.nfc.cardEmulation/cardEmulation#hasHceCapability 4961847f8eSopenharmony_ci */ 5061847f8eSopenharmony_ci enum FeatureType { 5161847f8eSopenharmony_ci /** 5261847f8eSopenharmony_ci * This constant is used to check whether HCE card emulation is supported. 5361847f8eSopenharmony_ci * 5461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 5561847f8eSopenharmony_ci * @since 6 5661847f8eSopenharmony_ci * @deprecated since 9 5761847f8eSopenharmony_ci */ 5861847f8eSopenharmony_ci HCE = 0, 5961847f8eSopenharmony_ci 6061847f8eSopenharmony_ci /** 6161847f8eSopenharmony_ci * This constant is used to check whether SIM card emulation is supported. 6261847f8eSopenharmony_ci * 6361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 6461847f8eSopenharmony_ci * @since 6 6561847f8eSopenharmony_ci * @deprecated since 9 6661847f8eSopenharmony_ci */ 6761847f8eSopenharmony_ci UICC = 1, 6861847f8eSopenharmony_ci 6961847f8eSopenharmony_ci /** 7061847f8eSopenharmony_ci * This constant is used to check whether eSE card emulation is supported. 7161847f8eSopenharmony_ci * 7261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 7361847f8eSopenharmony_ci * @since 6 7461847f8eSopenharmony_ci * @deprecated since 9 7561847f8eSopenharmony_ci */ 7661847f8eSopenharmony_ci ESE = 2 7761847f8eSopenharmony_ci } 7861847f8eSopenharmony_ci 7961847f8eSopenharmony_ci /** 8061847f8eSopenharmony_ci * Define the card emulation type, payment or other. 8161847f8eSopenharmony_ci * 8261847f8eSopenharmony_ci * @enum { string } 8361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 8461847f8eSopenharmony_ci * @since 9 8561847f8eSopenharmony_ci */ 8661847f8eSopenharmony_ci /** 8761847f8eSopenharmony_ci * Define the card emulation type, payment or other. 8861847f8eSopenharmony_ci * 8961847f8eSopenharmony_ci * @enum { string } 9061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 9161847f8eSopenharmony_ci * @atomicservice 9261847f8eSopenharmony_ci * @since 12 9361847f8eSopenharmony_ci */ 9461847f8eSopenharmony_ci enum CardType { 9561847f8eSopenharmony_ci /** 9661847f8eSopenharmony_ci * Payment type of card emulation 9761847f8eSopenharmony_ci * 9861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 9961847f8eSopenharmony_ci * @since 9 10061847f8eSopenharmony_ci */ 10161847f8eSopenharmony_ci /** 10261847f8eSopenharmony_ci * Payment type of card emulation 10361847f8eSopenharmony_ci * 10461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 10561847f8eSopenharmony_ci * @atomicservice 10661847f8eSopenharmony_ci * @since 12 10761847f8eSopenharmony_ci */ 10861847f8eSopenharmony_ci PAYMENT = 'payment', 10961847f8eSopenharmony_ci 11061847f8eSopenharmony_ci /** 11161847f8eSopenharmony_ci * Other type of card emulation 11261847f8eSopenharmony_ci * 11361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 11461847f8eSopenharmony_ci * @since 9 11561847f8eSopenharmony_ci */ 11661847f8eSopenharmony_ci /** 11761847f8eSopenharmony_ci * Other type of card emulation 11861847f8eSopenharmony_ci * 11961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 12061847f8eSopenharmony_ci * @atomicservice 12161847f8eSopenharmony_ci * @since 12 12261847f8eSopenharmony_ci */ 12361847f8eSopenharmony_ci OTHER = 'other' 12461847f8eSopenharmony_ci } 12561847f8eSopenharmony_ci 12661847f8eSopenharmony_ci /** 12761847f8eSopenharmony_ci * Checks whether a specified type of card emulation is supported. 12861847f8eSopenharmony_ci * <p>This method is used to check Whether the host or secure element supports card emulation. 12961847f8eSopenharmony_ci * 13061847f8eSopenharmony_ci * @param { number } feature Indicates the card emulation type, {@code HCE}, {@code UICC}, or {@code ESE}. 13161847f8eSopenharmony_ci * @returns { boolean } Returns true if the specified type of card emulation is supported; returns false otherwise. 13261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 13361847f8eSopenharmony_ci * @since 6 13461847f8eSopenharmony_ci * @deprecated since 9 13561847f8eSopenharmony_ci * @useinstead ohos.nfc.cardEmulation/cardEmulation#hasHceCapability 13661847f8eSopenharmony_ci */ 13761847f8eSopenharmony_ci function isSupported(feature: number): boolean; 13861847f8eSopenharmony_ci 13961847f8eSopenharmony_ci /** 14061847f8eSopenharmony_ci * Checks whether Host Card Emulation(HCE) capability is supported. 14161847f8eSopenharmony_ci * 14261847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 14361847f8eSopenharmony_ci * @returns { boolean } Returns true if HCE is supported, otherwise false. 14461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 14561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 14661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 14761847f8eSopenharmony_ci * @since 9 14861847f8eSopenharmony_ci */ 14961847f8eSopenharmony_ci /** 15061847f8eSopenharmony_ci * Checks whether Host Card Emulation(HCE) capability is supported. 15161847f8eSopenharmony_ci * 15261847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 15361847f8eSopenharmony_ci * @returns { boolean } Returns true if HCE is supported, otherwise false. 15461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 15561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 15661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 15761847f8eSopenharmony_ci * @atomicservice 15861847f8eSopenharmony_ci * @since 12 15961847f8eSopenharmony_ci */ 16061847f8eSopenharmony_ci function hasHceCapability(): boolean; 16161847f8eSopenharmony_ci 16261847f8eSopenharmony_ci /** 16361847f8eSopenharmony_ci * Checks whether a service is default for given type. 16461847f8eSopenharmony_ci * 16561847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 16661847f8eSopenharmony_ci * @param { ElementName } elementName - The element name of the service ability 16761847f8eSopenharmony_ci * @param { CardType } type - The type to query, payment or other. 16861847f8eSopenharmony_ci * @returns { boolean } Returns true if the service is default, otherwise false. 16961847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 17061847f8eSopenharmony_ci * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 17161847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 17261847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 17361847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 17461847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 17561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 17661847f8eSopenharmony_ci * @since 9 17761847f8eSopenharmony_ci */ 17861847f8eSopenharmony_ci /** 17961847f8eSopenharmony_ci * Checks whether a service is default for given type. 18061847f8eSopenharmony_ci * 18161847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 18261847f8eSopenharmony_ci * @param { ElementName } elementName - The element name of the service ability 18361847f8eSopenharmony_ci * @param { CardType } type - The type to query, payment or other. 18461847f8eSopenharmony_ci * @returns { boolean } Returns true if the service is default, otherwise false. 18561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 18661847f8eSopenharmony_ci * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 18761847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 18861847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 18961847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 19061847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 19161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 19261847f8eSopenharmony_ci * @atomicservice 19361847f8eSopenharmony_ci * @since 12 19461847f8eSopenharmony_ci */ 19561847f8eSopenharmony_ci function isDefaultService(elementName: ElementName, type: CardType): boolean; 19661847f8eSopenharmony_ci 19761847f8eSopenharmony_ci /** 19861847f8eSopenharmony_ci * Gets all payment services. 19961847f8eSopenharmony_ci * 20061847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 20161847f8eSopenharmony_ci * @returns { AbilityInfo[] } Returns all payment services. 20261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 20361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 20461847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 20561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 20661847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 20761847f8eSopenharmony_ci * @since 11 20861847f8eSopenharmony_ci */ 20961847f8eSopenharmony_ci function getPaymentServices(): AbilityInfo[]; 21061847f8eSopenharmony_ci 21161847f8eSopenharmony_ci /** 21261847f8eSopenharmony_ci * A class for NFC host application. 21361847f8eSopenharmony_ci * <p>The NFC host application use this class, then Nfc service can access the application 21461847f8eSopenharmony_ci * installation information and connect to services of the application. 21561847f8eSopenharmony_ci * 21661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 21761847f8eSopenharmony_ci * @since 8 21861847f8eSopenharmony_ci */ 21961847f8eSopenharmony_ci /** 22061847f8eSopenharmony_ci * A class for NFC host application. 22161847f8eSopenharmony_ci * <p>The NFC host application use this class, then Nfc service can access the application 22261847f8eSopenharmony_ci * installation information and connect to services of the application. 22361847f8eSopenharmony_ci * 22461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 22561847f8eSopenharmony_ci * @atomicservice 22661847f8eSopenharmony_ci * @since 12 22761847f8eSopenharmony_ci */ 22861847f8eSopenharmony_ci export class HceService { 22961847f8eSopenharmony_ci /** 23061847f8eSopenharmony_ci * start HCE 23161847f8eSopenharmony_ci * 23261847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 23361847f8eSopenharmony_ci * @param { string[] } aidList - The aid list to be registered by this service 23461847f8eSopenharmony_ci * @returns { boolean } Returns true if HCE is enabled or has been enabled; returns false otherwise. 23561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 23661847f8eSopenharmony_ci * @since 8 23761847f8eSopenharmony_ci * @deprecated since 9 23861847f8eSopenharmony_ci * @useinstead ohos.nfc.cardEmulation/cardEmulation.HceService#start 23961847f8eSopenharmony_ci */ 24061847f8eSopenharmony_ci startHCE(aidList: string[]): boolean; 24161847f8eSopenharmony_ci 24261847f8eSopenharmony_ci /** 24361847f8eSopenharmony_ci * Starts the HCE, register more aids and allows this application to be preferred while in foreground. 24461847f8eSopenharmony_ci * 24561847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 24661847f8eSopenharmony_ci * @param { ElementName } elementName - The element name of the service ability 24761847f8eSopenharmony_ci * @param { string[] } aidList - The aid list to be registered by this service, allowed to be empty. 24861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 24961847f8eSopenharmony_ci * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 25061847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 25161847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 25261847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 25361847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 25461847f8eSopenharmony_ci * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. 25561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 25661847f8eSopenharmony_ci * @since 9 25761847f8eSopenharmony_ci */ 25861847f8eSopenharmony_ci /** 25961847f8eSopenharmony_ci * Starts the HCE, register more aids and allows this application to be preferred while in foreground. 26061847f8eSopenharmony_ci * 26161847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 26261847f8eSopenharmony_ci * @param { ElementName } elementName - The element name of the service ability 26361847f8eSopenharmony_ci * @param { string[] } aidList - The aid list to be registered by this service, allowed to be empty. 26461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 26561847f8eSopenharmony_ci * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 26661847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 26761847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 26861847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 26961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 27061847f8eSopenharmony_ci * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. 27161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 27261847f8eSopenharmony_ci * @atomicservice 27361847f8eSopenharmony_ci * @since 12 27461847f8eSopenharmony_ci */ 27561847f8eSopenharmony_ci start(elementName: ElementName, aidList: string[]): void; 27661847f8eSopenharmony_ci 27761847f8eSopenharmony_ci /** 27861847f8eSopenharmony_ci * stop HCE 27961847f8eSopenharmony_ci * 28061847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 28161847f8eSopenharmony_ci * @returns { boolean } Returns true if HCE is disabled or has been disabled; returns false otherwise. 28261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 28361847f8eSopenharmony_ci * @since 8 28461847f8eSopenharmony_ci * @deprecated since 9 28561847f8eSopenharmony_ci * @useinstead ohos.nfc.cardEmulation/cardEmulation.HceService#stop 28661847f8eSopenharmony_ci */ 28761847f8eSopenharmony_ci stopHCE(): boolean; 28861847f8eSopenharmony_ci 28961847f8eSopenharmony_ci /** 29061847f8eSopenharmony_ci * Stops the HCE, and unset the preferred service while in foreground. 29161847f8eSopenharmony_ci * 29261847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 29361847f8eSopenharmony_ci * @param { ElementName } elementName - The element name of the service ability 29461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 29561847f8eSopenharmony_ci * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 29661847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 29761847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 29861847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 29961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 30061847f8eSopenharmony_ci * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. 30161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 30261847f8eSopenharmony_ci * @since 9 30361847f8eSopenharmony_ci */ 30461847f8eSopenharmony_ci /** 30561847f8eSopenharmony_ci * Stops the HCE, and unset the preferred service while in foreground. 30661847f8eSopenharmony_ci * 30761847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 30861847f8eSopenharmony_ci * @param { ElementName } elementName - The element name of the service ability 30961847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 31061847f8eSopenharmony_ci * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 31161847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 31261847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 31361847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 31461847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 31561847f8eSopenharmony_ci * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. 31661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 31761847f8eSopenharmony_ci * @atomicservice 31861847f8eSopenharmony_ci * @since 12 31961847f8eSopenharmony_ci */ 32061847f8eSopenharmony_ci stop(elementName: ElementName): void; 32161847f8eSopenharmony_ci 32261847f8eSopenharmony_ci /** 32361847f8eSopenharmony_ci * register HCE event to receive the APDU data. 32461847f8eSopenharmony_ci * 32561847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 32661847f8eSopenharmony_ci * @param { 'hceCmd' } type The type to register. 32761847f8eSopenharmony_ci * @param { AsyncCallback<number[]> } callback Callback used to listen to HCE data that local device received. 32861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 32961847f8eSopenharmony_ci * @since 8 33061847f8eSopenharmony_ci */ 33161847f8eSopenharmony_ci /** 33261847f8eSopenharmony_ci * register HCE event to receive the APDU data. 33361847f8eSopenharmony_ci * 33461847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 33561847f8eSopenharmony_ci * @param { 'hceCmd' } type The type to register. 33661847f8eSopenharmony_ci * @param { AsyncCallback<number[]> } callback Callback used to listen to HCE data that local device received. 33761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 33861847f8eSopenharmony_ci * @atomicservice 33961847f8eSopenharmony_ci * @since 12 34061847f8eSopenharmony_ci */ 34161847f8eSopenharmony_ci on(type: 'hceCmd', callback: AsyncCallback<number[]>): void; 34261847f8eSopenharmony_ci 34361847f8eSopenharmony_ci /** 34461847f8eSopenharmony_ci * Sends a response APDU to the remote device. 34561847f8eSopenharmony_ci * <p>This method is used by a host application when swiping card. 34661847f8eSopenharmony_ci * 34761847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 34861847f8eSopenharmony_ci * @param { number[] } responseApdu Indicates the response, which is a byte array. 34961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 35061847f8eSopenharmony_ci * @since 8 35161847f8eSopenharmony_ci * @deprecated since 9 35261847f8eSopenharmony_ci * @useinstead ohos.nfc.cardEmulation/cardEmulation.HceService#transmit 35361847f8eSopenharmony_ci */ 35461847f8eSopenharmony_ci sendResponse(responseApdu: number[]): void; 35561847f8eSopenharmony_ci 35661847f8eSopenharmony_ci /** 35761847f8eSopenharmony_ci * Sends a response APDU to the remote device. 35861847f8eSopenharmony_ci * 35961847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 36061847f8eSopenharmony_ci * @param { number[] } response Indicates the response to send, which is a byte array. 36161847f8eSopenharmony_ci * @returns { Promise<void> } The void 36261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 36361847f8eSopenharmony_ci * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 36461847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 36561847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 36661847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 36761847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 36861847f8eSopenharmony_ci * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. 36961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 37061847f8eSopenharmony_ci * @since 9 37161847f8eSopenharmony_ci */ 37261847f8eSopenharmony_ci /** 37361847f8eSopenharmony_ci * Sends a response APDU to the remote device. 37461847f8eSopenharmony_ci * 37561847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 37661847f8eSopenharmony_ci * @param { number[] } response Indicates the response to send, which is a byte array. 37761847f8eSopenharmony_ci * @returns { Promise<void> } The void 37861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 37961847f8eSopenharmony_ci * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 38061847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 38161847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 38261847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 38361847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 38461847f8eSopenharmony_ci * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. 38561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 38661847f8eSopenharmony_ci * @atomicservice 38761847f8eSopenharmony_ci * @since 12 38861847f8eSopenharmony_ci */ 38961847f8eSopenharmony_ci transmit(response: number[]): Promise<void>; 39061847f8eSopenharmony_ci 39161847f8eSopenharmony_ci /** 39261847f8eSopenharmony_ci * Sends a response APDU to the remote device. 39361847f8eSopenharmony_ci * 39461847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 39561847f8eSopenharmony_ci * @param { number[] } response Indicates the response to send, which is a byte array. 39661847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback The callback 39761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 39861847f8eSopenharmony_ci * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 39961847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 40061847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 40161847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 40261847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 40361847f8eSopenharmony_ci * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. 40461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 40561847f8eSopenharmony_ci * @since 9 40661847f8eSopenharmony_ci */ 40761847f8eSopenharmony_ci /** 40861847f8eSopenharmony_ci * Sends a response APDU to the remote device. 40961847f8eSopenharmony_ci * 41061847f8eSopenharmony_ci * @permission ohos.permission.NFC_CARD_EMULATION 41161847f8eSopenharmony_ci * @param { number[] } response Indicates the response to send, which is a byte array. 41261847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback The callback 41361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 41461847f8eSopenharmony_ci * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 41561847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 41661847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 41761847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 41861847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 41961847f8eSopenharmony_ci * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. 42061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NFC.CardEmulation 42161847f8eSopenharmony_ci * @atomicservice 42261847f8eSopenharmony_ci * @since 12 42361847f8eSopenharmony_ci */ 42461847f8eSopenharmony_ci transmit(response: number[], callback: AsyncCallback<void>): void; 42561847f8eSopenharmony_ci } 42661847f8eSopenharmony_ci} 42761847f8eSopenharmony_ciexport default cardEmulation; 428