/// <summary> /// Unregisters a previously registered AID for the specified category. /// </summary> /// <since_tizen> 3 </since_tizen> /// <param name="seType">The type of the secure element.</param> /// <param name="category">Enumeration value of the category.</param> /// <param name="aid">The application ID specified in the ISO/IEC 7816-4.</param> /// <privilege>http://tizen.org/privilege/nfc.cardemulation</privilege> /// <exception cref="NotSupportedException">Thrown when the NFC is not supported.</exception> /// <exception cref="ArgumentException">Thrown when the method fails due to an invalid parameter.</exception> /// <exception cref="InvalidOperationException">Thrown when the method fails due to an invalid operation.</exception> public void UnregisterAid(NfcSecureElementType seType, NfcCardEmulationCategoryType category, string aid) { int ret = Interop.Nfc.CardEmulation.UnregisterAid((int)seType, (int)category, aid); if (ret != (int)NfcError.None) { Log.Error(Globals.LogTag, "Failed to unregister aid, Error - " + (NfcError)ret); NfcErrorFactory.ThrowNfcException(ret); } }
/// <summary> /// Gets the state, whether an application to call this API is currently the activated handler for the category. /// </summary> /// <since_tizen> 3 </since_tizen> /// <returns>'True' when application is currently the activated handler, otherwise 'False'.</returns> /// <param name="seType">The type of the secure element.</param> /// <param name="category">Enumeration value of the category.</param> /// <privilege>http://tizen.org/privilege/nfc.cardemulation</privilege> /// <exception cref="NotSupportedException">Thrown when the NFC is not supported.</exception> /// <exception cref="ArgumentException">Thrown when the method fails due to an invalid parameter.</exception> /// <exception cref="InvalidOperationException">Thrown when the method fails due to an invalid operation.</exception> public bool IsActivatedHandlerForCategory(NfcSecureElementType seType, NfcCardEmulationCategoryType category) { bool isActivatedHandle = false; int ret = Interop.Nfc.CardEmulation.IsActivatedHandlerForCategory((int)seType, (int)category, out isActivatedHandle); if (ret != (int)NfcError.None) { Log.Error(Globals.LogTag, "Failed to check activated handle for category, Error - " + (NfcError)ret); NfcErrorFactory.ThrowNfcException(ret); } return(isActivatedHandle); }
private void RegisterSecureElementTransactionEvent(NfcSecureElementType seType) { _secureElementTransactionEventCallback = (int type, IntPtr aid, int aidSize, IntPtr param, int paramSize, IntPtr userData) => { NfcSecureElementType _secureElementType = (NfcSecureElementType)type; byte[] _aid = NfcConvertUtil.IntLengthIntPtrToByteArray(aid, aidSize); byte[] _param = NfcConvertUtil.IntLengthIntPtrToByteArray(param, paramSize); SecureElementTranscationEventArgs e = new SecureElementTranscationEventArgs(_secureElementType, _aid, _param); _secureElementTransactionEvent.SafeInvoke(null, e); }; int ret = Interop.Nfc.SetSecureElementTransactionEventCallback((int)seType, _secureElementTransactionEventCallback, IntPtr.Zero); if (ret != (int)NfcError.None) { Log.Error(Globals.LogTag, "Failed to set secure element transaction event callback, Error - " + (NfcError)ret); } }
/// <summary> /// Retrieves all registered AIDs. /// </summary> /// <since_tizen> 3 </since_tizen> /// <returns>The list of NfcRegisteredAidInformation objects.</returns> /// <param name="seType">The type of the secure element.</param> /// <param name="category">Enumeration value of the category.</param> /// <privilege>http://tizen.org/privilege/nfc.cardemulation</privilege> /// <exception cref="NotSupportedException">Thrown when the NFC is not supported.</exception> /// <exception cref="ArgumentException">Thrown when the method fails due to an invalid parameter.</exception> /// <exception cref="InvalidOperationException">Thrown when the method fails due to an invalid operation.</exception> public IEnumerable <NfcRegisteredAidInformation> GetRegisteredAidInformation(NfcSecureElementType seType, NfcCardEmulationCategoryType category) { List <NfcRegisteredAidInformation> infoList = new List <NfcRegisteredAidInformation>(); Interop.Nfc.SecureElementRegisteredAidCallback callback = (int type, IntPtr aid, bool readOnly, IntPtr userData) => { if (aid != IntPtr.Zero) { NfcRegisteredAidInformation aidInfo = new NfcRegisteredAidInformation((NfcSecureElementType)type, Marshal.PtrToStringAnsi(aid), readOnly); infoList.Add(aidInfo); } }; int ret = Interop.Nfc.CardEmulation.ForeachRegisterdAids((int)seType, (int)category, callback, IntPtr.Zero); if (ret != (int)NfcError.None) { Log.Error(Globals.LogTag, "Failed to get all registerd aid informations, Error - " + (NfcError)ret); NfcErrorFactory.ThrowNfcException(ret); } return(infoList); }
internal NfcRegisteredAidInformation(NfcSecureElementType seType, string aid, bool readOnly) { _seType = seType; _aid = aid; _readOnly = readOnly; }
internal SecureElementTranscationEventArgs(NfcSecureElementType secureElementType, byte[] aid, byte[] param) { _secureElementType = secureElementType; _aid = aid; _param = param; }
private void UnregisterSecureElementTransactionEvent(NfcSecureElementType seType) { Interop.Nfc.UnsetSecureElementTransactionEventCallback((int)seType); }