using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
+using Tizen.Applications;
namespace Tizen.Network.Connection
{
/// <summary>
- /// This Class is ConnectionProfile. It provides event and propeties of the connection profile.
+ /// This is the ConnectionProfile class. It provides event and properties of the connection profile.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class ConnectionProfile : IDisposable
private IAddressInformation IPv4;
private IAddressInformation IPv6;
private bool disposed = false;
- private EventHandler _ProfileStateChanged = null;
+ private EventHandler<ProfileStateEventArgs> _ProfileStateChanged = null;
private Interop.ConnectionProfile.ProfileStateChangedCallback _profileChangedCallback;
+ private TizenSynchronizationContext context = new TizenSynchronizationContext();
+
internal IntPtr GetHandle()
{
return ProfileHandle;
}
/// <summary>
- /// The event that is called when the state of profile is changed.
+ /// The event is called when the state of profile is changed.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <feature>http://tizen.org/feature/network.ethernet</feature>
/// <feature>http://tizen.org/feature/network.telephony</feature>
/// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
/// <feature>http://tizen.org/feature/network.wifi</feature>
- public event EventHandler ProfileStateChanged
+ /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
+ public event EventHandler<ProfileStateEventArgs> ProfileStateChanged
{
add
{
Log.Debug(Globals.LogTag, "ProfileStateChanged add");
- if (_ProfileStateChanged == null)
+ context.Post((x) =>
{
- ProfileStateChangedStart();
- }
- _ProfileStateChanged += value;
+ if (_ProfileStateChanged == null)
+ {
+ ProfileStateChangedStart();
+ }
+ _ProfileStateChanged += value;
+ }, null);
}
remove
{
Log.Debug(Globals.LogTag, "ProfileStateChanged remove");
- _ProfileStateChanged -= value;
- if (_ProfileStateChanged == null)
+ context.Post((x) =>
{
- ProfileStateChangedStop();
- }
+ _ProfileStateChanged -= value;
+ if (_ProfileStateChanged == null)
+ {
+ ProfileStateChangedStop();
+ }
+ }, null);
}
}
{
_profileChangedCallback = (ProfileState state, IntPtr userData) =>
{
+ Log.Info(Globals.LogTag, "***** MOON ProfileStateChanged occur");
if (_ProfileStateChanged != null)
{
_ProfileStateChanged(null, new ProfileStateEventArgs(state));
IPv6 = new ConnectionAddressInformation(ProfileHandle, AddressFamily.IPv6);
}
+ /// <summary>
+ /// Destroy the ConnectionProfile object
+ /// </summary>
~ConnectionProfile()
{
Dispose(false);
if (disposed)
return;
- if (disposing)
- {
- // Free managed objects.
- UnregisterEvents();
- Destroy();
- }
+ // Free unmanaged objects
+ UnregisterEvents();
+ Destroy();
disposed = true;
}
/// The name of the network interface.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <value>Network interface name, e.g. eth0 and pdp0.</value>
+ /// <value>Network interface name, for example, eth0 and pdp0.</value>
public string InterfaceName
{
get
/// <feature>http://tizen.org/feature/network.telephony</feature>
/// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
/// <feature>http://tizen.org/feature/network.wifi</feature>
- /// <exception cref="System.NotSupportedException">Thrown when feature is not supported.</exception>
- /// <exception cref="System.UnauthorizedAccessException">Thrown when permission is denied.</exception>
- /// <exception cref="System.ArgumentException">Thrown when value is invalid parameter.</exception>
- /// <exception cref="System.InvalidOperationException">Thrown when profile instance is invalid or when method failed due to invalid operation</exception>
- /// <exception cref="System.ObjectDisposedException">Thrown when operation is performed on a disposed object.</exception>
+ /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
+ /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception>
+ /// <exception cref="System.ArgumentException">Thrown when a value is an invalid parameter.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when a profile instance is invalid or when a method fails due to an invalid operation.</exception>
+ /// <exception cref="System.ObjectDisposedException">Thrown when an operation is performed on a disposed object.</exception>
public void Refresh()
{
CheckDisposed();
}
/// <summary>
- /// Get the network state.
+ /// Gets the network state.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="family">The address family</param>
+ /// <param name="family">The address family.</param>
/// <returns>The network state.</returns>
/// <feature>http://tizen.org/feature/network.ethernet</feature>
/// <feature>http://tizen.org/feature/network.telephony</feature>
/// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
/// <feature>http://tizen.org/feature/network.wifi</feature>
- /// <exception cref="System.NotSupportedException">Thrown when feature is not supported.</exception>
- /// <exception cref="System.ArgumentException">Thrown when value is invalid parameter.</exception>
- /// <exception cref="System.InvalidOperationException">Thrown when profile instance is invalid or when method failed due to invalid operation</exception>
- /// <exception cref="System.ObjectDisposedException">Thrown when operation is performed on a disposed object.</exception>
+ /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
+ /// <exception cref="System.ArgumentException">Thrown when a value is an invalid parameter.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when a profile instance is invalid or when a method fails due to an invalid operation.</exception>
+ /// <exception cref="System.ObjectDisposedException">Thrown when an operation is performed on a disposed object.</exception>
public ProfileState GetState(AddressFamily family)
{
CheckDisposed();
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>Proxy type of the connection.</value>
- /// <exception cref="System.NotSupportedException">Thrown during set when feature is not supported.</exception>
- /// <exception cref="System.ArgumentException">Thrown during set when value is invalid parameter.</exception>
- /// <exception cref="System.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
- /// <exception cref="System.ObjectDisposedException">Thrown during set when operation is performed on a disposed object.</exception>
+ /// <exception cref="System.NotSupportedException">Thrown during set when a feature is not supported.</exception>
+ /// <exception cref="System.ArgumentException">Thrown during set when a value is an invalid parameter.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown during set when a profile instance is invalid or when a method fails due to an invalid operation.</exception>
+ /// <exception cref="System.ObjectDisposedException">Thrown during set when a operation is performed on a disposed object.</exception>
public ProxyType ProxyType
{
get
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>Proxy address of the connection.</value>
- /// <exception cref="System.NotSupportedException">Thrown during set when feature is not supported.</exception>
- /// <exception cref="System.ArgumentException">Thrown during set when value is invalid parameter.</exception>
- /// <exception cref="System.ArgumentNullException">Thrown during set when value is null.</exception>
- /// <exception cref="System.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
- /// <exception cref="System.ObjectDisposedException">Thrown when operation is performed on a disposed object.</exception>
+ /// <exception cref="System.NotSupportedException">Thrown during set when a feature is not supported.</exception>
+ /// <exception cref="System.ArgumentException">Thrown during set when a value is an invalid parameter.</exception>
+ /// <exception cref="System.ArgumentNullException">Thrown during set when a value is null.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown during set when a profile instance is invalid or when a method fails due to an invalid operation.</exception>
+ /// <exception cref="System.ObjectDisposedException">Thrown when an operation is performed on a disposed object.</exception>
public string ProxyAddress
{
get
}
/// <summary>
- /// The address information (IPv4)
+ /// The address information (IPv4).
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>Instance of IAddressInformation with IPV4 address.</value>
}
/// <summary>
- /// The address information (IPv6)
+ /// The address information (IPv6).
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>Instance of IAddressInformation with IPV6 address.</value>
}
/// <summary>
- /// An extended EventArgs class which contains changed profile state.
+ /// An extended EventArgs class, which contains changed profile state.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class ProfileStateEventArgs : EventArgs