using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Collections;
-using System.Threading;
using Tizen.Applications;
namespace Tizen.Network.Connection
public HandleHolder()
{
_tid = Thread.CurrentThread.ManagedThreadId;
+
Log.Info(Globals.LogTag, "PInvoke connection_create for Thread " + _tid);
int ret = Interop.Connection.Create(_tid, out Handle);
Log.Info(Globals.LogTag, "Handle: " + Handle);
{
if (_ConnectionTypeChanged == null)
{
- try
- {
- ConnectionTypeChangedStart();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on adding ConnectionTypeChanged\n" + e.ToString());
- return;
- }
+ ConnectionTypeChangedStart();
}
_ConnectionTypeChanged += value;
}, null);
_ConnectionTypeChanged -= value;
if (_ConnectionTypeChanged == null)
{
- try
- {
- ConnectionTypeChangedStop();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on removing ConnectionTypeChanged\n" + e.ToString());
- }
+ ConnectionTypeChangedStop();
}
}, null);
}
{
if (_EthernetCableStateChanged == null)
{
- try
- {
- EthernetCableStateChangedStart();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on adding EthernetCableStateChanged\n" + e.ToString());
- return;
- }
+ EthernetCableStateChangedStart();
}
_EthernetCableStateChanged += value;
}, null);
_EthernetCableStateChanged -= value;
if (_EthernetCableStateChanged == null)
{
- try
- {
- EthernetCableStateChangedStop();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on removing EthernetCableStateChanged\n" + e.ToString());
- }
+ EthernetCableStateChangedStop();
}
}, null);
}
{
if (_IPAddressChanged == null)
{
- try
- {
- IPAddressChangedStart();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on adding IPAddressChanged\n" + e.ToString());
- return;
- }
+ IPAddressChangedStart();
}
_IPAddressChanged += value;
}, null);
_IPAddressChanged -= value;
if (_IPAddressChanged == null)
{
- try
- {
- IPAddressChangedStop();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on removing IPAddressChanged\n" + e.ToString());
- }
+ IPAddressChangedStop();
}
}, null);
}
{
if (_ProxyAddressChanged == null)
{
- try
- {
- ProxyAddressChangedStart();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on adding ProxyAddressChanged\n" + e.ToString());
- return;
- }
+ ProxyAddressChangedStart();
}
_ProxyAddressChanged += value;
}, null);
_ProxyAddressChanged -= value;
if (_ProxyAddressChanged == null)
{
- try
- {
- ProxyAddressChangedStop();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on removing ProxyAddressChanged\n" + e.ToString());
- }
+ ProxyAddressChangedStop();
}
}, null);
}
context.Post((x) =>
{
Log.Info(Globals.LogTag, "Interop.Connection.SetDefaultCellularServiceProfileAsync " + profile.Name);
- try
- {
- int ret = Interop.Connection.SetDefaultCellularServiceProfileAsync(GetHandle(), (int)type, profile.ProfileHandle, Callback, (IntPtr)0);
-
- if ((ConnectionError)ret != ConnectionError.None)
- {
- Log.Error(Globals.LogTag, "It failed to set default cellular profile, " + (ConnectionError)ret);
- ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony");
- ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero || profile.ProfileHandle == IntPtr.Zero), "Connection or Profile Handle may have been disposed or released");
- ConnectionErrorFactory.ThrowConnectionException(ret);
- }
- } catch (Exception e)
+ int ret = Interop.Connection.SetDefaultCellularServiceProfileAsync(GetHandle(), (int)type, profile.ProfileHandle, Callback, (IntPtr)0);
+ if ((ConnectionError)ret != ConnectionError.None)
{
- Log.Error(Globals.LogTag, "Exception on SetDefaultCellularServiceProfileAsync\n" + e.ToString());
- task.SetException(e);
+ Log.Error(Globals.LogTag, "It failed to set default cellular profile, " + (ConnectionError)ret);
+ ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony");
+ ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero || profile.ProfileHandle == IntPtr.Zero), "Connection or Profile Handle may have been disposed or released");
+ ConnectionErrorFactory.ThrowConnectionException(ret);
}
}, null);
context.Post((x) =>
{
Log.Info(Globals.LogTag, "Interop.Connection.OpenProfile " + profile.Name);
- try
- {
- int ret = Interop.Connection.OpenProfile(GetHandle(), profile.ProfileHandle, Callback, IntPtr.Zero);
- if ((ConnectionError)ret != ConnectionError.None)
- {
- Log.Error(Globals.LogTag, "It failed to connect profile, " + (ConnectionError)ret);
- ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth");
- ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero || profile.ProfileHandle == IntPtr.Zero), "Connection or Profile Handle may have been disposed or released");
- ConnectionErrorFactory.ThrowConnectionException(ret);
- }
- }
- catch (Exception e)
+ int ret = Interop.Connection.OpenProfile(GetHandle(), profile.ProfileHandle, Callback, IntPtr.Zero);
+ if ((ConnectionError)ret != ConnectionError.None)
{
- Log.Error(Globals.LogTag, "Exception on OpenProfile\n" + e.ToString());
- task.SetException(e);
+ Log.Error(Globals.LogTag, "It failed to connect profile, " + (ConnectionError)ret);
+ ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth");
+ ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero || profile.ProfileHandle == IntPtr.Zero), "Connection or Profile Handle may have been disposed or released");
+ ConnectionErrorFactory.ThrowConnectionException(ret);
}
}, null);
context.Post((x) =>
{
Log.Info(Globals.LogTag, "Interop.Connection.CloseProfile " + profile.Name);
- try
- {
- int ret = Interop.Connection.CloseProfile(GetHandle(), profile.ProfileHandle, Callback, IntPtr.Zero);
- if ((ConnectionError)ret != ConnectionError.None)
- {
- Log.Error(Globals.LogTag, "It failed to disconnect profile, " + (ConnectionError)ret);
- ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth");
- ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.set)");
- ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero || profile.ProfileHandle == IntPtr.Zero), "Connection or Profile Handle may have been disposed or released");
- ConnectionErrorFactory.ThrowConnectionException(ret);
- }
- }
- catch (Exception e)
+ int ret = Interop.Connection.CloseProfile(GetHandle(), profile.ProfileHandle, Callback, IntPtr.Zero);
+ if ((ConnectionError)ret != ConnectionError.None)
{
- Log.Error(Globals.LogTag, "Exception on CloseProfile\n" + e.ToString());
- task.SetException(e);
+ Log.Error(Globals.LogTag, "It failed to disconnect profile, " + (ConnectionError)ret);
+ ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth");
+ ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.set)");
+ ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero || profile.ProfileHandle == IntPtr.Zero), "Connection or Profile Handle may have been disposed or released");
+ ConnectionErrorFactory.ThrowConnectionException(ret);
}
}, null);
if (_disposed)
return;
- Interop.WiFi.AP.Destroy(_apHandle);
- _apHandle = IntPtr.Zero;
+ if (disposing)
+ {
+ Interop.WiFi.AP.Destroy(_apHandle);
+ _apHandle = IntPtr.Zero;
+ }
_disposed = true;
}
context.Post((x) =>
{
Log.Info(Globals.LogTag, "Interop.WiFi.Connect");
- try
- {
- int ret = Interop.WiFi.Connect(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, _callback_map[id], id);
- if (ret != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle);
- }
- }
- catch (Exception e)
+ int ret = Interop.WiFi.Connect(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
{
- Log.Error(Globals.LogTag, "Exception on ConnectAsync\n" + e.ToString());
- task.SetException(e);
+ Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle);
}
}, null);
context.Post((x) =>
{
- try
+ int ret = -1;
+ if (info.GetType() == typeof(WpsPbcInfo))
{
- int ret = -1;
- if (info.GetType() == typeof(WpsPbcInfo))
- {
- Log.Info(Globals.LogTag, "Interop.WiFi.ConnectByWpsPb");
- ret = Interop.WiFi.ConnectByWpsPbc(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, _callback_map[id], id);
- }
- else if (info.GetType() == typeof(WpsPinInfo))
+ Log.Info(Globals.LogTag, "Interop.WiFi.ConnectByWpsPb");
+ ret = Interop.WiFi.ConnectByWpsPbc(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, _callback_map[id], id);
+ }
+ else if (info.GetType() == typeof(WpsPinInfo))
+ {
+ WpsPinInfo pinInfo = (WpsPinInfo)info;
+ if (pinInfo.GetWpsPin() == null)
{
- WpsPinInfo pinInfo = (WpsPinInfo)info;
- if (pinInfo.GetWpsPin() == null)
- {
- throw new ArgumentNullException("Wps pin should not be null");
- }
-
- if (pinInfo.GetWpsPin().Length == 0 || pinInfo.GetWpsPin().Length > 8)
- {
- throw new ArgumentOutOfRangeException("Wps pin should not be empty or more than 7 characters");
- }
-
- Log.Info(Globals.LogTag, "Interop.WiFi.ConnectByWpsPin");
- ret = Interop.WiFi.ConnectByWpsPin(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, pinInfo.GetWpsPin(), _callback_map[id], id);
+ throw new ArgumentNullException("Wps pin should not be null");
}
- if (ret != (int)WiFiError.None)
+ if (pinInfo.GetWpsPin().Length == 0 || pinInfo.GetWpsPin().Length > 8)
{
- Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle);
+ throw new ArgumentOutOfRangeException("Wps pin should not be empty or more than 7 characters");
}
+
+ Log.Info(Globals.LogTag, "Interop.WiFi.ConnectByWpsPin");
+ ret = Interop.WiFi.ConnectByWpsPin(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, pinInfo.GetWpsPin(), _callback_map[id], id);
}
- catch (Exception e)
+
+ if (ret != (int)WiFiError.None)
{
- Log.Error(Globals.LogTag, "Exception on ConnectWpsAsync\n" + e.ToString());
- task.SetException(e);
+ Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle);
}
}, null);
s_context.Post((x) =>
{
- try
+ int ret = -1;
+ if (info.GetType() == typeof(WpsPbcInfo))
{
- int ret = -1;
- if (info.GetType() == typeof(WpsPbcInfo))
- {
- Log.Info(Globals.LogTag, "Interop.WiFi.ConnectByWpsPbcWithoutSsid");
- ret = Interop.WiFi.ConnectByWpsPbcWithoutSsid(WiFiManagerImpl.Instance.GetSafeHandle(), s_callbackMap[id], id);
- }
- else if (info.GetType() == typeof(WpsPinInfo))
+ Log.Info(Globals.LogTag, "Interop.WiFi.ConnectByWpsPbcWithoutSsid");
+ ret = Interop.WiFi.ConnectByWpsPbcWithoutSsid(WiFiManagerImpl.Instance.GetSafeHandle(), s_callbackMap[id], id);
+ }
+ else if (info.GetType() == typeof(WpsPinInfo))
+ {
+ WpsPinInfo pinInfo = (WpsPinInfo)info;
+ if (pinInfo.GetWpsPin() == null)
{
- WpsPinInfo pinInfo = (WpsPinInfo)info;
- if (pinInfo.GetWpsPin() == null)
- {
- throw new ArgumentNullException("Wps pin should not be null");
- }
-
- if (pinInfo.GetWpsPin().Length != 4 && pinInfo.GetWpsPin().Length != 8)
- {
- throw new ArgumentOutOfRangeException("Wps pin should be of 4 or 8 characters long");
- }
-
- Log.Info(Globals.LogTag, "Interop.WiFi.ConnectByWpsPinWithoutSsid");
- ret = Interop.WiFi.ConnectByWpsPinWithoutSsid(WiFiManagerImpl.Instance.GetSafeHandle(), pinInfo.GetWpsPin(), s_callbackMap[id], id);
+ throw new ArgumentNullException("Wps pin should not be null");
}
- if (ret != (int)WiFiError.None)
+ if (pinInfo.GetWpsPin().Length != 4 && pinInfo.GetWpsPin().Length != 8)
{
- Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle());
+ throw new ArgumentOutOfRangeException("Wps pin should be of 4 or 8 characters long");
}
+
+ Log.Info(Globals.LogTag, "Interop.WiFi.ConnectByWpsPinWithoutSsid");
+ ret = Interop.WiFi.ConnectByWpsPinWithoutSsid(WiFiManagerImpl.Instance.GetSafeHandle(), pinInfo.GetWpsPin(), s_callbackMap[id], id);
}
- catch (Exception e)
+
+ if (ret != (int)WiFiError.None)
{
- Log.Error(Globals.LogTag, "Exception on ConnectWpsWithoutSsidAsync\n" + e.ToString());
- task.SetException(e);
+ Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle());
}
}, null);
context.Post((x) =>
{
Log.Info(Globals.LogTag, "Interop.WiFi.Disconnect");
- try
- {
- int ret = Interop.WiFi.Disconnect(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, _callback_map[id], id);
- if (ret != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Failed to disconnect wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle);
- }
- }
- catch (Exception e)
+ int ret = Interop.WiFi.Disconnect(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
{
- Log.Error(Globals.LogTag, "Exception on Disconnect\n" + e.ToString());
- task.SetException(e);
+ Log.Error(Globals.LogTag, "Failed to disconnect wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle);
}
}, null);
if (_disposed)
return;
- Interop.WiFi.Config.Destroy(_configHandle);
- _configHandle = IntPtr.Zero;
+ if (disposing)
+ {
+ Interop.WiFi.Config.Destroy(_configHandle);
+ _configHandle = IntPtr.Zero;
+ }
_disposed = true;
}
context.Post((x) =>
{
Log.Info(Globals.LogTag, "Interop.WiFi.ActivateAsync");
- try
- {
- int ret = Interop.WiFi.Activate(GetSafeHandle(), _callback_map[id], id);
- if (ret != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Failed to activate wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
- }
- }
- catch (Exception e)
+ int ret = Interop.WiFi.Activate(GetSafeHandle(), _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
{
- Log.Error(Globals.LogTag, "Exception on ActivateAsync\n" + e.ToString());
- task.SetException(e);
+ Log.Error(Globals.LogTag, "Failed to activate wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
}
}, null);
context.Post((x) =>
{
Log.Info(Globals.LogTag, "Interop.WiFi.ActivateWithWiFiPickerTestedAsync");
- try
- {
- int ret = Interop.WiFi.ActivateWithWiFiPickerTested(GetSafeHandle(), _callback_map[id], id);
- if (ret != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Failed to activate wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
- }
- }
- catch (Exception e)
+ int ret = Interop.WiFi.ActivateWithWiFiPickerTested(GetSafeHandle(), _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
{
- Log.Error(Globals.LogTag, "Exception on ActivateWithWiFiPickerTestedAsync\n" + e.ToString());
- task.SetException(e);
+ Log.Error(Globals.LogTag, "Failed to activate wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
}
}, null);
context.Post((x) =>
{
Log.Info(Globals.LogTag, "Interop.WiFi.Deactivate");
- try
- {
- int ret = Interop.WiFi.Deactivate(GetSafeHandle(), _callback_map[id], id);
- if (ret != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Failed to deactivate wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
- }
- }
- catch (Exception e)
+ int ret = Interop.WiFi.Deactivate(GetSafeHandle(), _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
{
- Log.Error(Globals.LogTag, "Exception on Deactivate\n" + e.ToString());
- task.SetException(e);
+ Log.Error(Globals.LogTag, "Failed to deactivate wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
}
}, null);
context.Post((x) =>
{
Log.Info(Globals.LogTag, "Interop.WiFi.Scan");
- try
- {
- int ret = Interop.WiFi.Scan(GetSafeHandle(), _callback_map[id], id);
- if (ret != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Failed to scan all AP, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
- }
- }
- catch (Exception e)
+ int ret = Interop.WiFi.Scan(GetSafeHandle(), _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
{
- Log.Error(Globals.LogTag, "Exception on Scan\n" + e.ToString());
- task.SetException(e);
+ Log.Error(Globals.LogTag, "Failed to scan all AP, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
}
}, null);
context.Post((x) =>
{
Log.Info(Globals.LogTag, "Interop.WiFi.ScanSpecificAPAsync");
- try
- {
- int ret = Interop.WiFi.ScanSpecificAP(GetSafeHandle(), essid, _callback_map[id], id);
- if (ret != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Failed to scan with specific AP, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
- }
- }
- catch (Exception e)
+ int ret = Interop.WiFi.ScanSpecificAP(GetSafeHandle(), essid, _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
{
- Log.Error(Globals.LogTag, "Exception on ScanSpecificAPAsync\n" + e.ToString());
- task.SetException(e);
+ Log.Error(Globals.LogTag, "Failed to scan with specific AP, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
}
}, null);
{
if (_deviceStateChanged == null)
{
- try
- {
- RegisterDeviceStateChangedEvent();
- } catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on adding DeviceStateChanged\n" + e.ToString());
- return;
- }
+ RegisterDeviceStateChangedEvent();
}
_deviceStateChanged += value;
}, null);
_deviceStateChanged -= value;
if (_deviceStateChanged == null)
{
- try
- {
- UnregisterDeviceStateChangedEvent();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on removing DeviceStateChanged\n" + e.ToString());
- }
+ UnregisterDeviceStateChangedEvent();
}
}, null);
}
{
if (_connectionStateChanged == null)
{
- try
- {
- RegisterConnectionStateChangedEvent();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on adding ConnectionStateChanged\n" + e.ToString());
- return;
- }
+ RegisterConnectionStateChangedEvent();
}
_connectionStateChanged += value;
}, null);
_connectionStateChanged -= value;
if (_connectionStateChanged == null)
{
- try
- {
- UnregisterConnectionStateChangedEvent();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on removing ConnectionStateChanged\n" + e.ToString());
- }
+ UnregisterConnectionStateChangedEvent();
}
}, null);
}
{
if (_rssiLevelChanged == null)
{
- try
- {
- RegisterRssiLevelChangedEvent();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on adding RssiLevelChanged\n" + e.ToString());
- return;
- }
+ RegisterRssiLevelChangedEvent();
}
_rssiLevelChanged += value;
}, null);
_rssiLevelChanged -= value;
if (_rssiLevelChanged == null)
{
- try
- {
- UnregisterRssiLevelChangedEvent();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on removing RssiLevelChanged\n" + e.ToString());
- }
+ UnregisterRssiLevelChangedEvent();
}
}, null);
}
{
if (_backgroundScanFinished == null)
{
- try
- {
- RegisterBackgroundScanFinishedEvent();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on adding BackgroundScanFinished\n" + e.ToString());
- return;
- }
+ RegisterBackgroundScanFinishedEvent();
}
_backgroundScanFinished += value;
}, null);
_backgroundScanFinished -= value;
if (_backgroundScanFinished == null)
{
- try
- {
- UnregisterBackgroundScanFinishedEvent();
- }
- catch (Exception e)
- {
- Log.Error(Globals.LogTag, "Exception on removing BackgroundScanFinished\n" + e.ToString());
- }
+ UnregisterBackgroundScanFinishedEvent();
}
}, null);
}