Version up : 1.0.3 to 1.0.4
authorJihoon Jung <jh8801.jung@samsung.com>
Tue, 10 Jan 2017 07:02:22 +0000 (16:02 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Tue, 10 Jan 2017 07:06:25 +0000 (16:06 +0900)
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
Change-Id: Ic7a2a54363f6928051479e6d2656e9a9e9cfc708

packaging/csapi-network-nfc.spec
src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs [changed mode: 0644->0755]
src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCardEmulationAdapter.cs [changed mode: 0644->0755]
src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManager.cs
src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs [changed mode: 0644->0755]

index 3c27369..a84e202 100644 (file)
@@ -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
old mode 100644 (file)
new mode 100755 (executable)
index a779aab..030d18a
@@ -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;
+            }
+        }
     }
 }
old mode 100644 (file)
new mode 100755 (executable)
index a9cef59..a1a0a5c
@@ -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);
                 }
index e0a82a2..85bc8df 100755 (executable)
@@ -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;
                 }
             }
         }
old mode 100644 (file)
new mode 100755 (executable)
index 87ec4c2..d1d5d65
@@ -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);