From: Jihoon Jung Date: Tue, 10 Jan 2017 07:02:22 +0000 (+0900) Subject: Version up : 1.0.3 to 1.0.4 X-Git-Tag: submit/trunk/20170823.075128~93^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9960b0cdec77376c3b28edcd44caace301769468;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Version up : 1.0.3 to 1.0.4 Signed-off-by: Jihoon Jung Change-Id: Ic7a2a54363f6928051479e6d2656e9a9e9cfc708 --- diff --git a/packaging/csapi-network-nfc.spec b/packaging/csapi-network-nfc.spec index 3c27369..a84e202 100644 --- a/packaging/csapi-network-nfc.spec +++ b/packaging/csapi-network-nfc.spec @@ -8,7 +8,7 @@ Name: csapi-network-nfc Summary: Tizen Nfc API for C# -Version: 1.0.3 +Version: 1.0.4 Release: 1 Group: Development/Libraries License: Apache-2.0 diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs old mode 100644 new mode 100755 index a779aab..030d18a --- a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs @@ -24,18 +24,35 @@ namespace Tizen.Network.Nfc /// public class NfcTagInformation { - internal NfcTagInformation() - { + private string _key; + private byte[] _informationValue; + internal NfcTagInformation(string key, byte[] informationValue) + { + _key = key; + _informationValue = informationValue; } + /// /// Key value. /// - public string Key; + public string Key + { + get + { + return _key; + } + } /// /// Information value. /// - public byte[] InformationValue; + public byte[] InformationValue + { + get + { + return _informationValue; + } + } } /// @@ -43,21 +60,49 @@ namespace Tizen.Network.Nfc /// public class NfcRegisteredAidInformation { - internal NfcRegisteredAidInformation() - { + private NfcSecureElementType _seType; + private string _aid; + private bool _readOnly; + internal NfcRegisteredAidInformation(NfcSecureElementType seType, string aid, bool readOnly) + { + _seType = seType; + _aid = aid; + _readOnly = readOnly; } + /// /// Secure Element Type value. /// - public NfcSecureElementType SeType; + public NfcSecureElementType SeType + { + get + { + return _seType; + } + } + /// - /// Aid value. + /// + /// The targeted Aid (Application Identifier) value. /// - public string Aid; + public string Aid + { + get + { + return _aid; + } + } + /// - /// Read-only value. + /// Read-only value. If this value is false, there are restrictions to the operation on this Aid. /// - public bool ReadOnly; + public bool ReadOnly + { + get + { + return _readOnly; + } + } } } diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCardEmulationAdapter.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCardEmulationAdapter.cs old mode 100644 new mode 100755 index a9cef59..a1a0a5c --- a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCardEmulationAdapter.cs +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCardEmulationAdapter.cs @@ -333,11 +333,7 @@ namespace Tizen.Network.Nfc { if (aid != IntPtr.Zero) { - NfcRegisteredAidInformation aidInfo = new NfcRegisteredAidInformation(); - - aidInfo.SeType = (NfcSecureElementType)type; - aidInfo.Aid = Marshal.PtrToStringAnsi(aid); - aidInfo.ReadOnly = readOnly; + NfcRegisteredAidInformation aidInfo = new NfcRegisteredAidInformation((NfcSecureElementType)type, Marshal.PtrToStringAnsi(aid), readOnly); infoList.Add(aidInfo); } diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManager.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManager.cs index e0a82a2..85bc8df 100755 --- a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManager.cs +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManager.cs @@ -38,16 +38,16 @@ namespace Tizen.Network.Nfc if (!isNfcSupported) { - return false; + throw new NotSupportedException(); } try { return NfcManagerImpl.Instance.IsSupported; } - catch (TypeInitializationException) + catch (TypeInitializationException e) { - return false; + throw e.InnerException; } } } @@ -63,16 +63,16 @@ namespace Tizen.Network.Nfc if (!isNfcSupported) { - return false; + throw new NotSupportedException(); } try { return NfcManagerImpl.Instance.IsActivated; } - catch (TypeInitializationException) + catch (TypeInitializationException e) { - return false; + throw e.InnerException; } } } @@ -89,16 +89,16 @@ namespace Tizen.Network.Nfc if (!isNfcSupported || !isTagSupported) { - return NfcTagFilterType.AllDisable; + throw new NotSupportedException(); } try { return NfcManagerImpl.Instance.TagFilterType; } - catch (TypeInitializationException) + catch (TypeInitializationException e) { - return NfcTagFilterType.AllDisable; + throw e.InnerException; } } set @@ -108,16 +108,16 @@ namespace Tizen.Network.Nfc if (!isNfcSupported || !isTagSupported) { - return; + throw new NotSupportedException(); } try { NfcManagerImpl.Instance.TagFilterType = value; } - catch (TypeInitializationException) + catch (TypeInitializationException e) { - return; + throw e.InnerException; } } } @@ -134,26 +134,35 @@ namespace Tizen.Network.Nfc if (!isNfcSupported || !isCeSupported) { - return NfcSecureElementType.Disable; + throw new NotSupportedException(); } try { return NfcManagerImpl.Instance.SecureElementType; } - catch (TypeInitializationException) + catch (TypeInitializationException e) { - return NfcSecureElementType.Disable; + throw e.InnerException; } } set { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + bool isCeSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.cardemulation", out isCeSupported); + + if (!isNfcSupported || !isCeSupported) + { + throw new NotSupportedException(); + } + try { NfcManagerImpl.Instance.SecureElementType = value; } - catch (TypeInitializationException) + catch (TypeInitializationException e) { + throw e.InnerException; } } } @@ -169,16 +178,16 @@ namespace Tizen.Network.Nfc if (!isNfcSupported) { - return false; + throw new NotSupportedException(); } try { return NfcManagerImpl.Instance.SystemHandlerEnabled; } - catch (TypeInitializationException) + catch (TypeInitializationException e) { - return false; + throw e.InnerException; } } set @@ -187,16 +196,16 @@ namespace Tizen.Network.Nfc if (!isNfcSupported) { - return; + throw new NotSupportedException(); } try { NfcManagerImpl.Instance.SystemHandlerEnabled = value; } - catch (TypeInitializationException) + catch (TypeInitializationException e) { - return; + throw e.InnerException; } } } @@ -212,16 +221,16 @@ namespace Tizen.Network.Nfc if (!isNfcSupported) { - return null; + throw new NotSupportedException(); } try { return NfcManagerImpl.Instance.CachedNdefMessage; } - catch (TypeInitializationException) + catch (TypeInitializationException e) { - return null; + throw e.InnerException; } } } diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs old mode 100644 new mode 100755 index 87ec4c2..d1d5d65 --- a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs @@ -138,10 +138,8 @@ namespace Tizen.Network.Nfc { if (key != IntPtr.Zero && infoValue != IntPtr.Zero) { - NfcTagInformation tagInfo = new NfcTagInformation(); + NfcTagInformation tagInfo = new NfcTagInformation(Marshal.PtrToStringAnsi(key), new byte[valueSize]); - tagInfo.Key = Marshal.PtrToStringAnsi(key); - tagInfo.InformationValue = new byte[valueSize]; Marshal.Copy(infoValue, tagInfo.InformationValue, 0, valueSize); infoList.Add(tagInfo);