diff options
-rwxr-xr-x[-rw-r--r--] | Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs | 67 | ||||
-rwxr-xr-x[-rw-r--r--] | Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCardEmulationAdapter.cs | 6 | ||||
-rwxr-xr-x | Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManager.cs | 59 | ||||
-rwxr-xr-x[-rw-r--r--] | Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs | 4 | ||||
-rw-r--r-- | packaging/csapi-network-nfc.spec | 2 |
5 files changed, 93 insertions, 45 deletions
diff --git a/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs b/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs index a779aab..030d18a 100644..100755 --- a/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs +++ b/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs @@ -24,18 +24,35 @@ namespace Tizen.Network.Nfc /// </summary> public class NfcTagInformation { - internal NfcTagInformation() - { + private string _key; + private byte[] _informationValue; + internal NfcTagInformation(string key, byte[] informationValue) + { + _key = key; + _informationValue = informationValue; } + /// <summary> /// Key value. /// </summary> - public string Key; + public string Key + { + get + { + return _key; + } + } /// <summary> /// Information value. /// </summary> - public byte[] InformationValue; + public byte[] InformationValue + { + get + { + return _informationValue; + } + } } /// <summary> @@ -43,21 +60,49 @@ namespace Tizen.Network.Nfc /// </summary> 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; } + /// <summary> /// Secure Element Type value. /// </summary> - public NfcSecureElementType SeType; + public NfcSecureElementType SeType + { + get + { + return _seType; + } + } + /// <summary> - /// Aid value. + /// + /// The targeted Aid (Application Identifier) value. /// </summary> - public string Aid; + public string Aid + { + get + { + return _aid; + } + } + /// <summary> - /// Read-only value. + /// Read-only value. If this value is false, there are restrictions to the operation on this Aid. /// </summary> - public bool ReadOnly; + public bool ReadOnly + { + get + { + return _readOnly; + } + } } } diff --git a/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCardEmulationAdapter.cs b/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCardEmulationAdapter.cs index a9cef59..a1a0a5c 100644..100755 --- a/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCardEmulationAdapter.cs +++ b/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/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManager.cs b/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManager.cs index e0a82a2..85bc8df 100755 --- a/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManager.cs +++ b/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/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs b/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs index 87ec4c2..d1d5d65 100644..100755 --- a/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs +++ b/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); 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 |