summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJihoon Jung <jh8801.jung@samsung.com>2017-01-10 07:02:22 (GMT)
committerJihoon Jung <jh8801.jung@samsung.com>2017-01-10 07:06:25 (GMT)
commit10b49945e0e4530a4996f6cb643ed1d7eee0a677 (patch)
tree58d2df3a202a32c271a12d295e3e9666bc4fb8be
parenta60df37c1de1a7e20f28810a345997cc172a4af0 (diff)
downloadnfc-submit/tizen/20170110.074653.zip
nfc-submit/tizen/20170110.074653.tar.gz
nfc-submit/tizen/20170110.074653.tar.bz2
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com> Change-Id: Ic7a2a54363f6928051479e6d2656e9a9e9cfc708
-rwxr-xr-x[-rw-r--r--]Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs67
-rwxr-xr-x[-rw-r--r--]Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCardEmulationAdapter.cs6
-rwxr-xr-xTizen.Network.Nfc/Tizen.Network.Nfc/NfcManager.cs59
-rwxr-xr-x[-rw-r--r--]Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs4
-rw-r--r--packaging/csapi-network-nfc.spec2
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