X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.Network.Connection%2FTizen.Network.Connection%2FConnectionProfile.cs;h=9ba3f3aa1b5c703311e5822c124d7b70cb1bf5ac;hb=c75177820fa8e1bef809f44c65c2453e96a9d66d;hp=87fc8a201ee9870e5ed691cfc1e4c2896887401f;hpb=9a023d9955188ab46599ffd8d8ea00a374697340;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfile.cs b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfile.cs index 87fc8a2..9ba3f3a 100755 --- a/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfile.cs +++ b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfile.cs @@ -19,11 +19,12 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; +using Tizen.Applications; namespace Tizen.Network.Connection { /// - /// 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. /// /// 3 public class ConnectionProfile : IDisposable @@ -32,42 +33,51 @@ namespace Tizen.Network.Connection private IAddressInformation IPv4; private IAddressInformation IPv6; private bool disposed = false; - private EventHandler _ProfileStateChanged = null; + private EventHandler _ProfileStateChanged = null; private Interop.ConnectionProfile.ProfileStateChangedCallback _profileChangedCallback; + private TizenSynchronizationContext context = new TizenSynchronizationContext(); + internal IntPtr GetHandle() { return ProfileHandle; } /// - /// The event that is called when the state of profile is changed. + /// The event is called when the state of profile is changed. /// /// 3 /// http://tizen.org/feature/network.ethernet /// http://tizen.org/feature/network.telephony /// http://tizen.org/feature/network.tethering.bluetooth /// http://tizen.org/feature/network.wifi - public event EventHandler ProfileStateChanged + /// Thrown when a feature is not supported. + public event EventHandler 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); } } @@ -75,6 +85,7 @@ namespace Tizen.Network.Connection { _profileChangedCallback = (ProfileState state, IntPtr userData) => { + Log.Info(Globals.LogTag, "***** MOON ProfileStateChanged occur"); if (_ProfileStateChanged != null) { _ProfileStateChanged(null, new ProfileStateEventArgs(state)); @@ -106,6 +117,9 @@ namespace Tizen.Network.Connection IPv6 = new ConnectionAddressInformation(ProfileHandle, AddressFamily.IPv6); } + /// + /// Destroy the ConnectionProfile object + /// ~ConnectionProfile() { Dispose(false); @@ -127,12 +141,9 @@ namespace Tizen.Network.Connection if (disposed) return; - if (disposing) - { - // Free managed objects. - UnregisterEvents(); - Destroy(); - } + // Free unmanaged objects + UnregisterEvents(); + Destroy(); disposed = true; } @@ -223,7 +234,7 @@ namespace Tizen.Network.Connection /// The name of the network interface. /// /// 3 - /// Network interface name, e.g. eth0 and pdp0. + /// Network interface name, for example, eth0 and pdp0. public string InterfaceName { get @@ -249,11 +260,11 @@ namespace Tizen.Network.Connection /// http://tizen.org/feature/network.telephony /// http://tizen.org/feature/network.tethering.bluetooth /// http://tizen.org/feature/network.wifi - /// Thrown when feature is not supported. - /// Thrown when permission is denied. - /// Thrown when value is invalid parameter. - /// Thrown when profile instance is invalid or when method failed due to invalid operation - /// Thrown when operation is performed on a disposed object. + /// Thrown when a feature is not supported. + /// Thrown when a permission is denied. + /// Thrown when a value is an invalid parameter. + /// Thrown when a profile instance is invalid or when a method fails due to an invalid operation. + /// Thrown when an operation is performed on a disposed object. public void Refresh() { CheckDisposed(); @@ -269,19 +280,19 @@ namespace Tizen.Network.Connection } /// - /// Get the network state. + /// Gets the network state. /// /// 3 - /// The address family + /// The address family. /// The network state. /// http://tizen.org/feature/network.ethernet /// http://tizen.org/feature/network.telephony /// http://tizen.org/feature/network.tethering.bluetooth /// http://tizen.org/feature/network.wifi - /// Thrown when feature is not supported. - /// Thrown when value is invalid parameter. - /// Thrown when profile instance is invalid or when method failed due to invalid operation - /// Thrown when operation is performed on a disposed object. + /// Thrown when a feature is not supported. + /// Thrown when a value is an invalid parameter. + /// Thrown when a profile instance is invalid or when a method fails due to an invalid operation. + /// Thrown when an operation is performed on a disposed object. public ProfileState GetState(AddressFamily family) { CheckDisposed(); @@ -313,10 +324,10 @@ namespace Tizen.Network.Connection /// /// 3 /// Proxy type of the connection. - /// Thrown during set when feature is not supported. - /// Thrown during set when value is invalid parameter. - /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. - /// Thrown during set when operation is performed on a disposed object. + /// Thrown during set when a feature is not supported. + /// Thrown during set when a value is an invalid parameter. + /// Thrown during set when a profile instance is invalid or when a method fails due to an invalid operation. + /// Thrown during set when a operation is performed on a disposed object. public ProxyType ProxyType { get @@ -350,11 +361,11 @@ namespace Tizen.Network.Connection /// /// 3 /// Proxy address of the connection. - /// Thrown during set when feature is not supported. - /// Thrown during set when value is invalid parameter. - /// Thrown during set when value is null. - /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. - /// Thrown when operation is performed on a disposed object. + /// Thrown during set when a feature is not supported. + /// Thrown during set when a value is an invalid parameter. + /// Thrown during set when a value is null. + /// Thrown during set when a profile instance is invalid or when a method fails due to an invalid operation. + /// Thrown when an operation is performed on a disposed object. public string ProxyAddress { get @@ -394,7 +405,7 @@ namespace Tizen.Network.Connection } /// - /// The address information (IPv4) + /// The address information (IPv4). /// /// 3 /// Instance of IAddressInformation with IPV4 address. @@ -408,7 +419,7 @@ namespace Tizen.Network.Connection } /// - /// The address information (IPv6) + /// The address information (IPv6). /// /// 3 /// Instance of IAddressInformation with IPV6 address. @@ -422,7 +433,7 @@ namespace Tizen.Network.Connection } /// - /// An extended EventArgs class which contains changed profile state. + /// An extended EventArgs class, which contains changed profile state. /// /// 3 public class ProfileStateEventArgs : EventArgs