using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using Tizen.System;
namespace Tizen.Network.Nfc
{
{
get
{
+ bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+
+ if (!isNfcSupported)
+ {
+ return false;
+ }
+
try
{
return NfcManagerImpl.Instance.IsSupported;
{
get
{
+ bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+
+ if (!isNfcSupported)
+ {
+ return false;
+ }
+
try
{
return NfcManagerImpl.Instance.IsActivated;
{
get
{
+ bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ bool isTagSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.tag", out isTagSupported);
+
+ if (!isNfcSupported || !isTagSupported)
+ {
+ return NfcTagFilterType.AllDisable;
+ }
+
try
{
return NfcManagerImpl.Instance.TagFilterType;
}
set
{
+ bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ bool isTagSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.tag", out isTagSupported);
+
+ if (!isNfcSupported || !isTagSupported)
+ {
+ return;
+ }
+
try
{
NfcManagerImpl.Instance.TagFilterType = value;
}
catch (TypeInitializationException)
{
+ return;
}
}
}
{
get
{
+ 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)
+ {
+ return NfcSecureElementType.Disable;
+ }
+
try
{
return NfcManagerImpl.Instance.SecureElementType;
{
get
{
+ bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+
+ if (!isNfcSupported)
+ {
+ return false;
+ }
+
try
{
return NfcManagerImpl.Instance.SystemHandlerEnabled;
}
set
{
+ bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+
+ if (!isNfcSupported)
+ {
+ return;
+ }
+
try
{
NfcManagerImpl.Instance.SystemHandlerEnabled = value;
}
catch (TypeInitializationException)
{
+ return;
}
}
}
{
get
{
+ bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+
+ if (!isNfcSupported)
+ {
+ return null;
+ }
+
try
{
return NfcManagerImpl.Instance.CachedNdefMessage;
/// </summary>
static public NfcTagAdapter GetTagAdapter()
{
+ bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ bool isTagSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.tag", out isTagSupported);
+
+ if (!isNfcSupported || !isTagSupported)
+ {
+ throw new NotSupportedException();
+ }
+
try
{
return NfcManagerImpl.Instance.TagAdapter;
/// </summary>
static public NfcP2pAdapter GetP2pAdapter()
{
+ bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ bool isP2pSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.p2p", out isP2pSupported);
+
+ if (!isNfcSupported || !isP2pSupported)
+ {
+ throw new NotSupportedException();
+ }
+
try
{
return NfcManagerImpl.Instance.P2pAdapter;
/// </summary>
static public NfcCardEmulationAdapter GetCardEmulationAdapter()
{
+ 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
{
return NfcManagerImpl.Instance.CardEmulationAdapter;
/// <returns>A task indicates whether the Activate method is done or not.</returns>
static public Task SetActivateAsync(bool activation)
{
+ bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+
+ if (!isNfcSupported)
+ {
+ throw new NotSupportedException();
+ }
+
try
{
return NfcManagerImpl.Instance.SetActivateAsync(activation);
{
add
{
+ bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+
+ if (!isNfcSupported)
+ {
+ throw new NotSupportedException();
+ }
+
try
{
NfcManagerImpl.Instance.ActivationChanged += value;
}
remove
{
+ bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+
+ if (!isNfcSupported)
+ {
+ throw new NotSupportedException();
+ }
+
try
{
NfcManagerImpl.Instance.ActivationChanged -= value;
{
add
{
+ bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+
+ if (!isNfcSupported)
+ {
+ throw new NotSupportedException();
+ }
+
try
{
NfcManagerImpl.Instance.NdefMessageDiscovered += value;
}
remove
{
+ bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+
+ if (!isNfcSupported)
+ {
+ throw new NotSupportedException();
+ }
+
try
{
NfcManagerImpl.Instance.NdefMessageDiscovered -= value;