Add API reference and exception as per the guidelines
authorchleun.moon <chleun.moon@samsung.com>
Wed, 24 May 2017 05:20:24 +0000 (14:20 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Wed, 24 May 2017 09:56:07 +0000 (18:56 +0900)
Change-Id: I36981d2b6456fb164fd3c8ec70e2c1a1564c0e07
Signed-off-by: cheoleun <chleun.moon@samsung.com>
packaging/csapi-network-connection.spec
src/Tizen.Network.Connection/Tizen.Network.Connection/CellularProfile.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionError.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionInternalManager.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionManager.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfile.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfileManager.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/IAddressInformation.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/WiFiProfile.cs

index 157f778..6d48f9f 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       csapi-network-connection
 Summary:    Tizen Connection API for C#
-Version:    1.0.16
+Version:    1.0.17
 Release:    1
 Group:      Development/Libraries
 License:    Apache-2.0
index 628cc33..2c58096 100755 (executable)
@@ -41,10 +41,17 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The APN (access point name).
         /// </summary>
+        /// <value>Cellular access point name.</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>
         public string Apn
         {
             get
             {
+                Log.Debug(Globals.LogTag, "Get Apn");
                 IntPtr Value;
                 int ret = Interop.ConnectionCellularProfile.GetApn(ProfileHandle, out Value);
                 if ((ConnectionError)ret != ConnectionError.None)
@@ -55,13 +62,26 @@ namespace Tizen.Network.Connection
                 Interop.Libc.Free(Value);
                 return result;
             }
+
             set
             {
-                int ret = Interop.ConnectionCellularProfile.SetApn(ProfileHandle, (string)value);
-                if ((ConnectionError)ret != ConnectionError.None)
+                Log.Debug(Globals.LogTag, "Set Apn");
+                CheckDisposed();
+                if (value != null)
                 {
-                    Log.Error(Globals.LogTag, "It failed to set apn, " + (ConnectionError)ret);
-                    ConnectionErrorFactory.ThrowConnectionException(ret);
+                    int ret = Interop.ConnectionCellularProfile.SetApn(ProfileHandle, value);
+                    if ((ConnectionError)ret != ConnectionError.None)
+                    {
+                        Log.Error(Globals.LogTag, "It failed to set apn, " + (ConnectionError)ret);
+                        ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony");
+                        ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
+                        ConnectionErrorFactory.ThrowConnectionException(ret);
+                    }
+                }
+
+                else
+                {
+                    throw new ArgumentNullException("Value of Apn is null");
                 }
             }
         }
@@ -69,10 +89,17 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The home URL.
         /// </summary>
+        /// <value>Cellular home URL.</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>
         public string HomeUri
         {
             get
             {
+                Log.Debug(Globals.LogTag, "Get HomeUri");
                 IntPtr Value;
                 int ret = Interop.ConnectionCellularProfile.GetHomeUrl(ProfileHandle, out Value);
                 if ((ConnectionError)ret != ConnectionError.None)
@@ -83,25 +110,43 @@ namespace Tizen.Network.Connection
                 Interop.Libc.Free(Value);
                 return result;
             }
+
             set
             {
-                int ret = Interop.ConnectionCellularProfile.SetHomeUrl(ProfileHandle, (string)value);
-                if ((ConnectionError)ret != ConnectionError.None)
+                Log.Debug(Globals.LogTag, "Set HomeUri");
+                CheckDisposed();
+                if (value != null)
                 {
-                    Log.Error(Globals.LogTag, "It failed to set home url, " + (ConnectionError)ret);
-                    ConnectionErrorFactory.ThrowConnectionException(ret);
+                    int ret = Interop.ConnectionCellularProfile.SetHomeUrl(ProfileHandle, value);
+                    if ((ConnectionError)ret != ConnectionError.None)
+                    {
+                        Log.Error(Globals.LogTag, "It failed to set home url, " + (ConnectionError)ret);
+                        ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony");
+                        ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
+                        ConnectionErrorFactory.ThrowConnectionException(ret);
+                    }
                 }
 
+                else
+                {
+                    throw new ArgumentNullException("Value of HomeUri is null");
+                }
             }
         }
 
         /// <summary>
         /// The service type.
         /// </summary>
+        /// <value>Cellular service type.</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 when operation is performed on a disposed object.</exception>
         public CellularServiceType ServiceType
         {
             get
             {
+                Log.Debug(Globals.LogTag, "Get ServiceType");
                 int value;
                 int ret = Interop.ConnectionCellularProfile.GetServiceType(ProfileHandle, out value);
                 if ((ConnectionError)ret != ConnectionError.None)
@@ -110,20 +155,26 @@ namespace Tizen.Network.Connection
                 }
                 return (CellularServiceType)value;
             }
+
             set
             {
+                Log.Debug(Globals.LogTag, "Set ServiceType");
+                CheckDisposed();
                 int ret = Interop.ConnectionCellularProfile.SetServiceType(ProfileHandle, (int)value);
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to set service type, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony");
+                    ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
                     ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
             }
         }
 
         /// <summary>
-        /// Gets cellular Authentification Information.
+        /// The cellular Authentication Information.
         /// </summary>
+        /// <value>Cellular authentication information</value>
         public CellularAuthInformation CellularAuthInfo
         {
             get
@@ -135,6 +186,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Checks whether the profile is hidden.
         /// </summary>
+        /// <value>True if the cellular profile is hidden, otherwise false.</value>
         public bool Hidden
         {
             get
@@ -152,6 +204,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Checks whether the profile is editable.
         /// </summary>
+        /// <value>True if the cellular profile is editable, otherwise false.</value>
         public bool Editable
         {
             get
@@ -169,6 +222,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Checks whether the profile is default.
         /// </summary>
+        /// <value>True if the cellular profile is default, otherwise false.</value>
         public bool IsDefault
         {
             get
@@ -203,6 +257,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The user name.
         /// </summary>
+        /// <value>Cellular user name.</value>
         public string UserName
         {
             get
@@ -242,6 +297,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The password
         /// </summary>
+        /// <value>Cellular password.</value>
         public string Password
         {
             get
@@ -279,6 +335,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The authentication type
         /// </summary>
+        /// <value>Cellular authentication type.</value>
         public CellularAuthType AuthType
         {
             get
index be0e5dc..9e8d587 100755 (executable)
@@ -24,7 +24,34 @@ namespace Tizen.Network.Connection
 {
     internal static class ConnectionErrorFactory
     {
-        internal static void ThrowConnectionException(int errno)
+        internal static void CheckFeatureUnsupportedException(int err, string message)
+        {
+            if ((ConnectionError)err == ConnectionError.NotSupported)
+            {
+                ThrowConnectionException(err, message);
+            }
+        }
+
+        internal static void CheckPermissionDeniedException(int err, string message)
+        {
+            if ((ConnectionError)err == ConnectionError.PermissionDenied)
+            {
+                ThrowConnectionException(err, message);
+            }
+        }
+
+        internal static void CheckHandleNullException(int err, bool isHandleInvalid, string message)
+        {
+            if ((ConnectionError)err == ConnectionError.InvalidParameter)
+            {
+                if (isHandleInvalid)
+                {
+                    ThrowConnectionException((int)ConnectionError.InvalidOperation, message);
+                }
+            }
+        }
+
+        internal static void ThrowConnectionException(int errno , string message = "")
         {
             ConnectionError _error = (ConnectionError)errno;
             Log.Debug(Globals.LogTag, "ThrowConnectionException " + _error);
@@ -41,15 +68,15 @@ namespace Tizen.Network.Connection
                 case ConnectionError.InvalidKey:
                     throw new InvalidOperationException("Invalid Key");
                 case ConnectionError.InvalidOperation:
-                    throw new InvalidOperationException("Invalid Operation");
+                    throw new InvalidOperationException("Invalid Operation " + message);
                 case ConnectionError.InvalidParameter:
-                    throw new InvalidOperationException("Invalid Parameter");
+                    throw new ArgumentException("Invalid Parameter");
                 case ConnectionError.NoConnection:
                     throw new InvalidOperationException("No Connection");
                 case ConnectionError.NoReply:
                     throw new InvalidOperationException("No Reply");
                 case ConnectionError.NotSupported:
-                    throw new NotSupportedException("Not Supported");
+                    throw new NotSupportedException("Unsupported feature " + message);
                 case ConnectionError.NowInProgress:
                     throw new InvalidOperationException("Now In Progress");
                 case ConnectionError.OperationAborted:
@@ -57,9 +84,9 @@ namespace Tizen.Network.Connection
                 case ConnectionError.OperationFailed:
                     throw new InvalidOperationException("Operation Failed");
                 case ConnectionError.OutOfMemoryError:
-                    throw new InvalidOperationException("Out Of Memory Error");
+                    throw new OutOfMemoryException("Out Of Memory Error");
                 case ConnectionError.PermissionDenied:
-                    throw new InvalidOperationException("Permission Denied");
+                    throw new UnauthorizedAccessException("Permission Denied " + message);
             }
         }
     }
index deb59d4..374f2c2 100755 (executable)
@@ -32,9 +32,14 @@ namespace Tizen.Network.Connection
 
         public HandleHolder()
         {
-            Log.Debug(Globals.LogTag, "HandleHolder() ^^");
-            Interop.Connection.Create(out Handle);
             Log.Debug(Globals.LogTag, "Handle: " + Handle);
+            int ret = Interop.Connection.Create(out Handle);
+            if(ret != (int)ConnectionError.None)
+            {
+                ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet");
+                ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)");
+                ConnectionErrorFactory.ThrowConnectionException(ret);
+            }
         }
 
         ~HandleHolder()
@@ -71,6 +76,10 @@ namespace Tizen.Network.Connection
         private void Destroy()
         {
             Interop.Connection.Destroy(Handle);
+            if (Handle != IntPtr.Zero)
+            {
+                Handle = IntPtr.Zero;
+            }
         }
     }
 
@@ -397,8 +406,11 @@ namespace Tizen.Network.Connection
             if ((ConnectionError)ret != ConnectionError.None)
             {
                 Log.Error(Globals.LogTag, "It failed to get IP address, " + (ConnectionError)ret);
+                ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet");
+                ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released");
                 ConnectionErrorFactory.ThrowConnectionException(ret);
             }
+
             string result = Marshal.PtrToStringAnsi(ip);
             Interop.Libc.Free(ip);
             return result;
@@ -411,8 +423,11 @@ namespace Tizen.Network.Connection
             if ((ConnectionError)ret != ConnectionError.None)
             {
                 Log.Error(Globals.LogTag, "It failed to get proxy, " + (ConnectionError)ret);
+                ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet");
+                ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released");
                 ConnectionErrorFactory.ThrowConnectionException(ret);
             }
+
             string result = Marshal.PtrToStringAnsi(ip);
             Interop.Libc.Free(ip);
             return result;
@@ -425,6 +440,8 @@ namespace Tizen.Network.Connection
             if ((ConnectionError)ret != ConnectionError.None)
             {
                 Log.Error(Globals.LogTag, "It failed to get mac address, " + (ConnectionError)ret);
+                ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.ethernet");
+                ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released");
                 ConnectionErrorFactory.ThrowConnectionException(ret);
             }
             string result = Marshal.PtrToStringAnsi(ip);
@@ -526,60 +543,99 @@ namespace Tizen.Network.Connection
 
         internal IntPtr CreateCellularProfile(ConnectionProfileType type, string keyword)
         {
-            Log.Error(Globals.LogTag, "CreateCellularProfile, " + type + ", " + keyword);
-            IntPtr connectionHandle = GetHandle();
-            if (connectionHandle == IntPtr.Zero)
+
+            Log.Debug(Globals.LogTag, "CreateCellularProfile, " + type + ", " + keyword);
+            if (keyword != null)
             {
-                Log.Error(Globals.LogTag, "It failed to create connection handle");
-                throw new InvalidOperationException("Invalid connection handle");
+                IntPtr handle = IntPtr.Zero;
+                int ret = Interop.ConnectionProfile.Create((int)type, keyword, out handle);
+                if ((ConnectionError)ret != ConnectionError.None)
+                {
+                    Log.Error(Globals.LogTag, "It failed to Create profile, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.telephony");
+                    ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)");
+                    ConnectionErrorFactory.ThrowConnectionException(ret);
+                }
+
+                return handle;
             }
 
-            IntPtr handle = IntPtr.Zero;
-            int ret = Interop.ConnectionProfile.Create((int)type, keyword, out handle);
-            if ((ConnectionError)ret != ConnectionError.None)
+            else
             {
-                Log.Error(Globals.LogTag, "It failed to Create profile, " + (ConnectionError)ret);
-                ConnectionErrorFactory.ThrowConnectionException(ret);
+                throw new ArgumentNullException("Keyword is null");
             }
-
-            return handle;
         }
 
         internal void AddCellularProfile(CellularProfile profile)
         {
-            if (profile.Type == ConnectionProfileType.Cellular)
+
+            Log.Debug(Globals.LogTag, "AddCellularProfile");
+            if (profile != null)
             {
-                int ret = Interop.Connection.AddProfile(GetHandle(), profile.ProfileHandle);
-                if ((ConnectionError)ret != ConnectionError.None)
+                if (profile.Type == ConnectionProfileType.Cellular)
                 {
-                    Log.Error(Globals.LogTag, "Failed to add cellular profile, " + (ConnectionError)ret);
-                    ConnectionErrorFactory.ThrowConnectionException(ret);
+                    int ret = Interop.Connection.AddProfile(GetHandle(), profile.ProfileHandle);
+                    if ((ConnectionError)ret != ConnectionError.None)
+                    {
+                        Log.Error(Globals.LogTag, "Failed to add cellular profile, " + (ConnectionError)ret);
+                        ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony");
+                        ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.profile)");
+                        ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero || profile.ProfileHandle == IntPtr.Zero), "Connection or Profile Handle may have been disposed or released");
+                        ConnectionErrorFactory.ThrowConnectionException(ret);
+                    }
+                }
+
+                else
+                {
+                    throw new ArgumentException("Profile type is not cellular");
                 }
             }
 
             else
             {
-                throw new InvalidOperationException("Profile type is not cellular");
+                throw new ArgumentNullException("Profile is null");
             }
         }
 
         internal void RemoveProfile(ConnectionProfile profile)
         {
-            int ret = Interop.Connection.RemoveProfile(GetHandle(), profile.ProfileHandle);
-            if ((ConnectionError)ret != ConnectionError.None)
+            Log.Debug(Globals.LogTag, "RemoveProfile");
+            if (profile != null)
             {
-                Log.Error(Globals.LogTag, "It failed to remove profile, " + (ConnectionError)ret);
-                ConnectionErrorFactory.ThrowConnectionException(ret);
+                int ret = Interop.Connection.RemoveProfile(GetHandle(), profile.ProfileHandle);
+                if ((ConnectionError)ret != ConnectionError.None)
+                {
+                    Log.Error(Globals.LogTag, "It failed to remove profile, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.wifi " + "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);
+                }
+            }
+
+            else
+            {
+                throw new ArgumentNullException("Profile is null");
             }
         }
 
         internal void UpdateProfile(ConnectionProfile profile)
         {
-            int ret = Interop.Connection.UpdateProfile(GetHandle(), profile.ProfileHandle);
-            if ((ConnectionError)ret != ConnectionError.None)
+            Log.Debug(Globals.LogTag, "UpdateProfile");
+            if (profile != null)
             {
-                Log.Error(Globals.LogTag, "It failed to update profile, " + (ConnectionError)ret);
-                ConnectionErrorFactory.ThrowConnectionException(ret);
+                int ret = Interop.Connection.UpdateProfile(GetHandle(), profile.ProfileHandle);
+                if ((ConnectionError)ret != ConnectionError.None)
+                {
+                    Log.Error(Globals.LogTag, "It failed to update profile, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.ethernet");
+                    ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero || profile.ProfileHandle == IntPtr.Zero), "Connection or Profile Handle may have been disposed or released");
+                    ConnectionErrorFactory.ThrowConnectionException(ret);
+                }
+            }
+
+            else
+            {
+                throw new ArgumentNullException("Profile is null");
             }
         }
 
@@ -590,8 +646,12 @@ namespace Tizen.Network.Connection
             if ((ConnectionError)ret != ConnectionError.None)
             {
                 Log.Error(Globals.LogTag, "It failed to get current 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 " + "http://tizen.org/feature/network.ethernet");
+                ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)");
+                ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released");
                 ConnectionErrorFactory.ThrowConnectionException(ret);
             }
+
             ConnectionProfile Profile = new ConnectionProfile(ProfileHandle);
             return Profile;
         }
@@ -604,34 +664,49 @@ namespace Tizen.Network.Connection
             {
                 Log.Error(Globals.LogTag, "Error: " + ret);
                 Log.Error(Globals.LogTag, "It failed to get default cellular profile, " + (ConnectionError)ret);
+                ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony");
+                ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)");
+                ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released");
                 ConnectionErrorFactory.ThrowConnectionException(ret);
             }
+
             CellularProfile Profile = new CellularProfile(ProfileHandle);
             return Profile;
         }
 
         internal Task SetDefaultCellularProfile(CellularServiceType type, ConnectionProfile profile)
         {
-            TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
-            Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) =>
+            Log.Debug(Globals.LogTag, "SetDefaultCellularProfile");
+            if (profile != null)
             {
-                if (Result != ConnectionError.None)
+                TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+                Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) =>
+                {
+                    if (Result != ConnectionError.None)
+                    {
+                        Log.Error(Globals.LogTag, "Error occurs during set default cellular profile, " + Result);
+                        task.SetException(new InvalidOperationException("Error occurs during set default cellular profile, " + Result));
+                    }
+
+                    task.SetResult(true);
+                };
+
+                int ret = Interop.Connection.SetDefaultCellularServiceProfileAsync(GetHandle(), (int)type, profile.ProfileHandle, Callback, (IntPtr)0);
+                if ((ConnectionError)ret != ConnectionError.None)
                 {
-                    Log.Error(Globals.LogTag, "Error occurs during set default cellular profile, " + Result);
-                    task.SetException(new InvalidOperationException("Error occurs during set default cellular profile, " + Result));
+                    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);
                 }
 
-                task.SetResult(true);
-            };
+                return task.Task;
+            }
 
-            int ret = Interop.Connection.SetDefaultCellularServiceProfileAsync(GetHandle(), (int)type, profile.ProfileHandle, Callback, (IntPtr)0);
-            if ((ConnectionError)ret != ConnectionError.None)
+            else
             {
-                Log.Error(Globals.LogTag, "It failed to set default cellular profile, " + (ConnectionError)ret);
-                ConnectionErrorFactory.ThrowConnectionException(ret);
+                throw new ArgumentNullException("Profile is null");
             }
-
-            return task.Task;
         }
 
 
@@ -645,6 +720,10 @@ namespace Tizen.Network.Connection
             if ((ConnectionError)ret != ConnectionError.None)
             {
                 Log.Error(Globals.LogTag, "It failed to get profile iterator, " + (ConnectionError)ret);
+                ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet");
+                ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)");
+                ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released");
+                ConnectionErrorFactory.ThrowConnectionException(ret);
             }
 
             while (Interop.Connection.HasNextProfileIterator(iterator))
@@ -679,50 +758,76 @@ namespace Tizen.Network.Connection
 
         internal Task OpenProfileAsync(ConnectionProfile profile)
         {
-            TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
-            Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) =>
+            Log.Debug(Globals.LogTag, "OpenProfileAsync");
+            if (profile != null)
             {
-                if (Result != ConnectionError.None)
+                Log.Debug(Globals.LogTag, "OpenProfileAsync " + profile.Name);
+                TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+                Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) =>
+                {
+                    Log.Debug(Globals.LogTag, "Connected " + profile.Name);
+                    if (Result != ConnectionError.None)
+                    {
+                        Log.Error(Globals.LogTag, "Error occurs during connecting profile, " + Result);
+                        task.SetException(new InvalidOperationException("Error occurs during connecting profile, " + Result));
+                    }
+
+                    task.SetResult(true);
+                };
+
+                int ret = Interop.Connection.OpenProfile(GetHandle(), profile.ProfileHandle, Callback, IntPtr.Zero);
+                if ((ConnectionError)ret != ConnectionError.None)
                 {
-                    Log.Error(Globals.LogTag, "Error occurs during connecting profile, " + Result);
-                    task.SetException(new InvalidOperationException("Error occurs during connecting profile, " + Result));
+                    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);
                 }
 
-                task.SetResult(true);
-            };
+                return task.Task;
+            }
 
-            int ret = Interop.Connection.OpenProfile(GetHandle(), profile.ProfileHandle, Callback, IntPtr.Zero);
-            if ((ConnectionError)ret != ConnectionError.None)
+            else
             {
-                Log.Error(Globals.LogTag, "It failed to connect profile, " + (ConnectionError)ret);
-                ConnectionErrorFactory.ThrowConnectionException(ret);
+                throw new ArgumentNullException("Profile is null");
             }
-
-            return task.Task;
         }
 
         internal Task CloseProfileAsync(ConnectionProfile profile)
         {
-            TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
-            Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) =>
+            Log.Debug(Globals.LogTag, "CloseProfileAsync");
+            if (profile != null)
             {
-                if (Result != ConnectionError.None)
+                Log.Debug(Globals.LogTag, "CloseProfileAsync " + profile.Name);
+                TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+                Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) =>
+                {
+                    if (Result != ConnectionError.None)
+                    {
+                        Log.Error(Globals.LogTag, "Error occurs during disconnecting profile, " + Result);
+                        task.SetException(new InvalidOperationException("Error occurs during disconnecting profile, " + Result));
+                    }
+
+                    task.SetResult(true);
+                };
+
+                int ret = Interop.Connection.CloseProfile(GetHandle(), profile.ProfileHandle, Callback, IntPtr.Zero);
+                if ((ConnectionError)ret != ConnectionError.None)
                 {
-                    Log.Error(Globals.LogTag, "Error occurs during disconnecting profile, " + Result);
-                    task.SetException(new InvalidOperationException("Error occurs during disconnecting profile, " + Result));
+                    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);
                 }
 
-                task.SetResult(true);
-            };
+                return task.Task;
+            }
 
-            int ret = Interop.Connection.CloseProfile(GetHandle(), profile.ProfileHandle, Callback, IntPtr.Zero);
-            if ((ConnectionError)ret != ConnectionError.None)
+            else
             {
-                Log.Error(Globals.LogTag, "It failed to disconnect profile, " + (ConnectionError)ret);
-                ConnectionErrorFactory.ThrowConnectionException(ret);
+                throw new ArgumentNullException("Profile is null");
             }
-
-            return task.Task;
         }
     }
-}
\ No newline at end of file
+}
index 4b1c65b..13c4e58 100755 (executable)
@@ -40,6 +40,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Checks whether the handle value is valid or not.
         /// </summary>
+        /// <value>True if the handle is invalid, otherwise false.</value>
         public override bool IsInvalid
         {
             get
@@ -48,6 +49,10 @@ namespace Tizen.Network.Connection
             }
         }
 
+        /// <summary>
+        /// Frees the handle.
+        /// </summary>
+        /// <returns>True if the handle is released successfully, otherwise false.</returns>
         protected override bool ReleaseHandle()
         {
             this.SetHandle(IntPtr.Zero);
@@ -141,8 +146,17 @@ namespace Tizen.Network.Connection
         /// Gets the IP address of the current connection.
         /// </summary>
         /// <param name="family">The address family</param>
-        /// <returns>IP address of the connection.</returns>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        /// <returns>IP address of the connection (global address in case of IPv6).</returns>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</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.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection instance is invalid or when method failed due to invalid operation.</exception>
         public static string GetIPAddress(AddressFamily family)
         {
             return ConnectionInternalManager.Instance.GetIPAddress(family);
@@ -153,7 +167,16 @@ namespace Tizen.Network.Connection
         /// </summary>
         /// <param name="family">The address family</param>
         /// <returns>Proxy address of the connection.</returns>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</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.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection instance is invalid or when method failed due to invalid operation.</exception>
         public static string GetProxy(AddressFamily family)
         {
             return ConnectionInternalManager.Instance.GetProxy(family);
@@ -164,7 +187,16 @@ namespace Tizen.Network.Connection
         /// </summary>
         /// <param name="type">The type of current network connection</param>
         /// <returns>MAC address of the Wi-Fi or ethernet.</returns>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</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.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection instance is invalid or when method failed due to invalid operation.</exception>
         public static string GetMacAddress(ConnectionType type)
         {
             return ConnectionInternalManager.Instance.GetMacAddress(type);
@@ -173,6 +205,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Type and state of the current profile for data connection
         /// </summary>
+        /// <value>Instance of ConnectionItem</value>
         public static ConnectionItem CurrentConnection
         {
             get
@@ -192,6 +225,14 @@ namespace Tizen.Network.Connection
         /// <param name="type">The type of profile. Cellular profile type is supported.</param>
         /// <param name="keyword">The keyword included in profile name.</param>
         /// <returns>CellularProfile object</returns>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</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.ArgumentNullException">Thrown when keyword value is null.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
         public static CellularProfile CreateCellularProfile(ConnectionProfileType type, string keyword)
         {
             IntPtr profileHandle = IntPtr.Zero;
@@ -212,6 +253,8 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The state of cellular connection.
         /// </summary>
+        /// <value>Cellular network state.</value>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
         public static CellularState CellularState
         {
             get
@@ -223,6 +266,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The state of the Wi-Fi.
         /// </summary>
+        /// <value>WiFi connection state.</value>
         /// <privilege>http://tizen.org/privilege/network.get</privilege>
         public static ConnectionState WiFiState
         {
@@ -235,6 +279,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The state of the Bluetooth.
         /// </summary>
+        /// <value>Bluetooth connection state.</value>
         /// <privilege>http://tizen.org/privilege/network.get</privilege>
         public static ConnectionState BluetoothState
         {
@@ -247,6 +292,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The Ethernet connection state.
         /// </summary>
+        /// <value>Ethernet connection state.</value>
         /// <privilege>http://tizen.org/privilege/network.get</privilege>
         public static ConnectionState EthernetState
         {
@@ -259,6 +305,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Checks for ethernet cable is attached or not.
         /// </summary>
+        /// <value>Ethernet cable state.</value>
         /// <privilege>http://tizen.org/privilege/network.get</privilege>
         public static EthernetCableState EthernetCableState
         {
@@ -282,6 +329,8 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The type of the current profile for data connection.
         /// </summary>
+        /// <value>Data connection current profile.</value>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
         public ConnectionType Type
         {
             get
@@ -293,6 +342,8 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The state of the current profile for data connection.
         /// </summary>
+        /// <value>Connection state of the current connection type.</value>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
         public ConnectionState State
         {
             get
@@ -345,6 +396,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The connection type.
         /// </summary>
+        /// <value>Type of the connection.</value>
         public ConnectionType ConnectionType
         {
             get
@@ -369,6 +421,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The ethernet cable state.
         /// </summary>
+        /// <value>Attached or detached state of the ethernet cable.</value>
         public EthernetCableState EthernetCableState
         {
             get
@@ -395,6 +448,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The  IPV4 address.
         /// </summary>
+        /// <value>IP address in the format of IPV4 syntax.</value>
         public string IPv4Address
         {
             get
@@ -406,6 +460,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The  IPV6 address.
         /// </summary>
+        /// <value>IP address in the format of IPV6 syntax.</value>
         public string IPv6Address
         {
             get
index 7e70bc9..5087d8b 100755 (executable)
@@ -101,6 +101,9 @@ namespace Tizen.Network.Connection
             Dispose(false);
         }
 
+        /// <summary>
+        /// Disposes the memory allocated to unmanaged resources.
+        /// </summary>
         public void Dispose()
         {
             Dispose(true);
@@ -133,11 +136,21 @@ namespace Tizen.Network.Connection
         private void Destroy()
         {
             Interop.ConnectionProfile.Destroy(ProfileHandle);
+            ProfileHandle = IntPtr.Zero;
+        }
+
+        internal void CheckDisposed()
+        {
+            if (disposed)
+            {
+                throw new ObjectDisposedException(GetType().FullName);
+            }
         }
 
         /// <summary>
         /// The profile ID.
         /// </summary>
+        /// <value>Unique ID of the profile.</value>
         public string Id
         {
             get
@@ -157,7 +170,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The profile name.
         /// </summary>
-        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <value>User friendly name of the profile.</value>
         public string Name
         {
             get
@@ -177,6 +190,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The network type.
         /// </summary>
+        /// <value>Profile type of the network connection.</value>
         public ConnectionProfileType Type
         {
             get
@@ -192,8 +206,9 @@ namespace Tizen.Network.Connection
         }
 
         /// <summary>
-        /// The name of the network interface, e.g. eth0 and pdp0.
+        /// The name of the network interface.
         /// </summary>
+        /// <value>Network interface name, e.g. eth0 and pdp0.</value>
         public string InterfaceName
         {
             get
@@ -230,6 +245,11 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The Proxy type.
         /// </summary>
+        /// <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>
         public ProxyType ProxyType
         {
             get
@@ -243,12 +263,16 @@ namespace Tizen.Network.Connection
                 return (ProxyType)Value;
 
             }
+
             set
             {
+                CheckDisposed();
                 int ret = Interop.ConnectionProfile.SetProxyType(ProfileHandle, (int)value);
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to set proxy type, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet");
+                    ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
                     ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
             }
@@ -257,7 +281,13 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The proxy address.
         /// </summary>
-        public String ProxyAddress
+        /// <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>
+        public string ProxyAddress
         {
             get
             {
@@ -272,13 +302,25 @@ namespace Tizen.Network.Connection
                 return result;
 
             }
+
             set
             {
-                int ret = Interop.ConnectionProfile.SetProxyAddress(ProfileHandle, (int)AddressFamily.IPv4, value.ToString());
-                if ((ConnectionError)ret != ConnectionError.None)
+                CheckDisposed();
+                if (value != null)
                 {
-                    Log.Error(Globals.LogTag, "It failed to set proxy address, " + (ConnectionError)ret);
-                    ConnectionErrorFactory.ThrowConnectionException(ret);
+                    int ret = Interop.ConnectionProfile.SetProxyAddress(ProfileHandle, (int)AddressFamily.IPv4, value);
+                    if ((ConnectionError)ret != ConnectionError.None)
+                    {
+                        Log.Error(Globals.LogTag, "It failed to set proxy address, " + (ConnectionError)ret);
+                        ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet");
+                        ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
+                        ConnectionErrorFactory.ThrowConnectionException(ret);
+                    }
+                }
+
+                else
+                {
+                    throw new ArgumentNullException("ProxyAddress is null");
                 }
             }
         }
@@ -286,6 +328,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The subnet mask address(IPv4).
         /// </summary>
+        /// <value>Instance of IAddressInformation with IPV4 address.</value>
         public IAddressInformation IPv4Settings
         {
             get
@@ -298,6 +341,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The subnet mask address(IPv4).
         /// </summary>
+        /// <value>Instance of IAddressInformation with IPV6 address.</value>
         public IAddressInformation IPv6Settings
         {
             get
@@ -322,6 +366,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The profile state.
         /// </summary>
+        /// <value>State type of the connection profile.</value>
         public ProfileState State
         {
             get
index cbd2933..af696c4 100755 (executable)
@@ -31,9 +31,19 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Adds a new profile
         /// </summary>
-        /// <privilege>http://tizen.org/privilege/network.profile</privilege>
         /// <param name="profile">The cellular profile object</param>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        /// <privilege>http://tizen.org/privilege/network.profile</privilege>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</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.ArgumentNullException">Thrown when value is null.</exception>
+        /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection or profile instance is invalid or when method failed due to invalid operation</exception>
         public static void AddCellularProfile(CellularProfile profile)
         {
             ConnectionInternalManager.Instance.AddCellularProfile(profile);
@@ -42,9 +52,18 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Gets the list of profile with profile list type
         /// </summary>
-        /// <privilege>http://tizen.org/privilege/network.get</privilege>
         /// <param name="type">The type of profile</param>
         /// <returns>List of connection profile objects.</returns>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</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.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection instance has been disposed.</exception>
         public static Task<IEnumerable<ConnectionProfile>> GetProfileListAsync(ProfileListType type)
         {
             return ConnectionInternalManager.Instance.GetProfileListAsync(type);
@@ -53,11 +72,20 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Opens a connection of profile, asynchronously.
         /// </summary>
-        /// <privilege>http://tizen.org/privilege/network.get</privilege>
-        /// <privilege>http://tizen.org/privilege/network.set</privilege>
         /// <param name="profile">The connection profile object</param>
         /// <returns>A task indicates whether the ConnectProfileAsync method is done successfully or not.</returns>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <privilege>http://tizen.org/privilege/network.set</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</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.ArgumentNullException">Thrown when value is null.</exception>
+        /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection or profile instance is invalid or when method failed due to invalid operation</exception>
         public static Task ConnectProfileAsync(ConnectionProfile profile)
         {
             return ConnectionInternalManager.Instance.OpenProfileAsync(profile);
@@ -66,10 +94,20 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Closes a connection of profile.
         /// </summary>
-        /// <privilege>http://tizen.org/privilege/network.set</privilege>
         /// <param name="profile">The connection profile object</param>
         /// <returns>A task indicates whether the DisconnectProfileAsync method is done successfully or not.</returns>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <privilege>http://tizen.org/privilege/network.set</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</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.ArgumentNullException">Thrown when value is null.</exception>
+        /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection or profile instance is invalid or when method failed due to invalid operation</exception>
         public static Task DisconnectProfileAsync(ConnectionProfile profile)
         {
             return ConnectionInternalManager.Instance.CloseProfileAsync(profile);
@@ -78,10 +116,19 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Removes an existing profile.
         /// </summary>
+        /// <param name="profile">The connection profile object</param>
         /// <privilege>http://tizen.org/privilege/network.get</privilege>
         /// <privilege>http://tizen.org/privilege/network.profile</privilege>
-        /// <param name="profile">The connection profile object</param>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</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.ArgumentNullException">Thrown when value is null.</exception>
+        /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection or profile instance is invalid or when method failed due to invalid operation</exception>
         public static void RemoveProfile(ConnectionProfile profile)
         {
             Log.Debug(Globals.LogTag, "RemoveProfile. Id: " + profile.Id + ", Name: " + profile.Name + ", Type: " + profile.Type);
@@ -93,10 +140,19 @@ namespace Tizen.Network.Connection
         /// When a profile is changed, these changes will be not applied to the ConnectionProfileManager immediately.
         /// When you call this function, your changes affect the ConnectionProfileManager and the existing profile is updated.
         /// </summary>
+        /// <param name="profile">The connection profile object</param>
         /// <privilege>http://tizen.org/privilege/network.get</privilege>
         /// <privilege>http://tizen.org/privilege/network.profile</privilege>
-        /// <param name="profile">The connection profile object</param>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</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.ArgumentNullException">Thrown when value is null.</exception>
+        /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection or profile instance is invalid or when method failed due to invalid operation</exception>
         public static void UpdateProfile(ConnectionProfile profile)
         {
             ConnectionInternalManager.Instance.UpdateProfile(profile);
@@ -105,9 +161,17 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Gets the name of the default profile.
         /// </summary>
-        /// <privilege>http://tizen.org/privilege/network.get</privilege>
         /// <returns>Connection profile object.</returns>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</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.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection instance is invalid or when method failed due to invalid operation</exception>
         public static ConnectionProfile GetCurrentProfile()
         {
             return ConnectionInternalManager.Instance.GetCurrentProfile();
@@ -116,10 +180,18 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Gets the default profile which provides the given cellular service.
         /// </summary>
-        /// <privilege>http://tizen.org/privilege/network.get</privilege>
         /// <param name="type">The cellular service type</param>
         /// <returns>Connection profile object.</returns>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</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.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection instance is invalid or when method failed due to invalid operation</exception>
         public static ConnectionProfile GetDefaultCellularProfile(CellularServiceType type)
         {
             return ConnectionInternalManager.Instance.GetDefaultCellularProfile(type);
@@ -128,12 +200,21 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Sets the default profile which provides the given cellular service.
         /// </summary>
-        /// <privilege>http://tizen.org/privilege/network.get</privilege>
-        /// <privilege>http://tizen.org/privilege/network.profile</privilege>
         /// <param name="type">The cellular service type</param>
         /// <param name="profile">The connection profile object</param>
         /// <returns>A task indicates whether the SetDefaultCellularProfile method is done successfully or not.</returns>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <privilege>http://tizen.org/privilege/network.profile</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</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.ArgumentNullException">Thrown when value is null.</exception>
+        /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection or profile instance is invalid or when method failed due to invalid operation</exception>
         public static Task SetDefaultCellularProfile(CellularServiceType type, ConnectionProfile profile)
         {
             return ConnectionInternalManager.Instance.SetDefaultCellularProfile(type, profile);
@@ -155,6 +236,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The connection profile state.
         /// </summary>
+        /// <value>State of the connection profile.</value>
         public ConnectionProfileState ConnectionProfileState
         {
             get
index b9f76aa..767893d 100755 (executable)
@@ -32,31 +32,55 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The DNS address.
         /// </summary>
+        /// <value>First DNS 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.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
         System.Net.IPAddress Dns1 { get; set; }
 
         /// <summary>
         /// The DNS address.
         /// </summary>
+        /// <value>Second DNS 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.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
         System.Net.IPAddress Dns2 { get; set; }
 
         /// <summary>
         /// The gateway address.
         /// </summary>
+        /// <value>Gateway 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.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
         System.Net.IPAddress Gateway { get; set; }
 
         /// <summary>
         /// The subnet mask address.
         /// </summary>
+        /// <value>Subnet mask 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>
         System.Net.IPAddress SubnetMask { get; set; }
 
         /// <summary>
         /// The IP address.
         /// </summary>
+        /// <value>IP 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.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
         System.Net.IPAddress IP { get; set; }
 
         /// <summary>
         /// The type of IP config.
         /// </summary>
+        /// <value>IP config 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>
         IPConfigType IPConfigType { get; set; }
     }
 
@@ -80,7 +104,6 @@ namespace Tizen.Network.Connection
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to get dns1 address, " + (ConnectionError)ret);
-                    ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
                 string result = Marshal.PtrToStringAnsi(Value);
                 Interop.Libc.Free(Value);
@@ -88,12 +111,15 @@ namespace Tizen.Network.Connection
                     return System.Net.IPAddress.Parse("0.0.0.0");
                 return System.Net.IPAddress.Parse(result);
             }
+
             set
             {
                 int ret = Interop.ConnectionProfile.SetDnsAddress(_profileHandle, (int)_family, value.ToString());
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to set dns1 address, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet");
+                    ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
                     ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
             }
@@ -107,7 +133,6 @@ namespace Tizen.Network.Connection
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to get dns2 address, " + (ConnectionError)ret);
-                    ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
                 string result = Marshal.PtrToStringAnsi(Value);
                 Interop.Libc.Free(Value);
@@ -115,12 +140,15 @@ namespace Tizen.Network.Connection
                     return System.Net.IPAddress.Parse("0.0.0.0");
                 return System.Net.IPAddress.Parse(result);
             }
+
             set
             {
                 int ret = Interop.ConnectionProfile.SetDnsAddress(_profileHandle, (int)_family, value.ToString());
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to set dns2 address, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet");
+                    ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
                     ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
             }
@@ -135,7 +163,6 @@ namespace Tizen.Network.Connection
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to get gateway, " + (ConnectionError)ret);
-                    ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
                 string result = Marshal.PtrToStringAnsi(Value);
                 Interop.Libc.Free(Value);
@@ -143,12 +170,15 @@ namespace Tizen.Network.Connection
                     return System.Net.IPAddress.Parse("0.0.0.0");
                 return System.Net.IPAddress.Parse(result);
             }
+
             set
             {
                 int ret = Interop.ConnectionProfile.SetGatewayAddress(_profileHandle, (int)_family, value.ToString());
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to set gateway, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet");
+                    ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
                     ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
             }
@@ -164,7 +194,6 @@ namespace Tizen.Network.Connection
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to get subnet mask, " + (ConnectionError)ret);
-                    ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
                 string result = Marshal.PtrToStringAnsi(Value);
                 Interop.Libc.Free(Value);
@@ -172,12 +201,15 @@ namespace Tizen.Network.Connection
                     return System.Net.IPAddress.Parse("0.0.0.0");
                 return System.Net.IPAddress.Parse(result);
             }
+
             set
             {
                 int ret = Interop.ConnectionProfile.SetSubnetMask(_profileHandle, (int)_family, value.ToString());
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to set subnet mask, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet");
+                    ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
                     ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
             }
@@ -193,7 +225,6 @@ namespace Tizen.Network.Connection
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to get ip, " + (ConnectionError)ret);
-                    ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
                 string result = Marshal.PtrToStringAnsi(Value);
                 Interop.Libc.Free(Value);
@@ -201,12 +232,15 @@ namespace Tizen.Network.Connection
                     return System.Net.IPAddress.Parse("0.0.0.0");
                 return System.Net.IPAddress.Parse(result);
             }
+
             set
             {
                 int ret = Interop.ConnectionProfile.SetIPAddress(_profileHandle, (int)_family, value.ToString());
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to set ip, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet");
+                    ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
                     ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
             }
@@ -221,16 +255,18 @@ namespace Tizen.Network.Connection
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to get ip config type, " + (ConnectionError)ret);
-                    ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
                 return (IPConfigType)Value;
             }
+
             set
             {
                 int ret = Interop.ConnectionProfile.SetIPConfigType(_profileHandle, (int)_family, (int)value);
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to set ip config type, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet");
+                    ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
                     ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
             }
index 8e22ce2..dddfb0b 100755 (executable)
@@ -38,6 +38,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The ESSID (Extended Service Set Identifier).
         /// </summary>
+        /// <value>ESSID of the WiFi.</value>
         public string Essid
         {
             get
@@ -57,6 +58,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The BSSID (Basic Service Set Identifier).
         /// </summary>
+        /// <value>BSSID of the WiFi.</value>
         public string Bssid
         {
             get
@@ -76,6 +78,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The RSSI.
         /// </summary>
+        /// <value>RSSI of the WiFi.</value>
         public int Rssi
         {
             get
@@ -93,6 +96,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The frequency (MHz).
         /// </summary>
+        /// <value>Frequency of the WiFi.</value>
         public int Frequency
         {
             get
@@ -110,6 +114,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The max speed (Mbps).
         /// </summary>
+        /// <value>Maximum speed of the WiFi.</value>
         public int MaxSpeed
         {
             get
@@ -125,8 +130,9 @@ namespace Tizen.Network.Connection
         }
 
         /// <summary>
-        /// The security type of Wi-Fi.
+        /// The security type of WiFi.
         /// </summary>
+        /// <value>Security type of the WiFi.</value>
         public WiFiSecurityType SecurityType
         {
             get
@@ -142,8 +148,9 @@ namespace Tizen.Network.Connection
         }
 
         /// <summary>
-        /// The encryption type of Wi-Fi.
+        /// The encryption type of WiFi.
         /// </summary>
+        /// <value>Encryption mode of the WiFi.</value>
         public WiFiEncryptionType EncryptionType
         {
             get
@@ -161,6 +168,8 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Checks whether passphrase is required.
         /// </summary>
+        /// <value>True if a passphrase is required, otherwise false.</value>
+        /// <remarks>This property is not valid if <c>WiFiSecurityType</c> is <c>Eap</c>.</remarks>
         public bool PassphraseRequired
         {
             get
@@ -178,6 +187,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Checks whether the WPS (Wi-Fi Protected Setup) is supported.
         /// </summary>
+        /// <value>True if WPS is supported, otherwise false.</value>
         public bool WpsSupported
         {
             get
@@ -196,14 +206,30 @@ namespace Tizen.Network.Connection
         /// Sets the passphrase of the Wi-Fi WPA.
         /// </summary>
         /// <param name="passphrase">The passphrase of Wi-Fi security</param>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        /// <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.ArgumentNullException">Thrown when passphrase is null.</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>
         public void SetPassphrase(string passphrase)
         {
-            int ret = Interop.ConnectionWiFiProfile.SetPassphrase(ProfileHandle, (string)passphrase);
-            if ((ConnectionError)ret != ConnectionError.None)
+            CheckDisposed();
+            if (passphrase != null)
             {
-                Log.Error(Globals.LogTag, "It failed to set passphrase, " + (ConnectionError)ret);
-                ConnectionErrorFactory.ThrowConnectionException(ret);
+                int ret = Interop.ConnectionWiFiProfile.SetPassphrase(ProfileHandle, passphrase);
+                if ((ConnectionError)ret != ConnectionError.None)
+                {
+                    Log.Error(Globals.LogTag, "It failed to set passphrase, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.wifi");
+                    ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
+                    ConnectionErrorFactory.ThrowConnectionException(ret);
+                }
+            }
+
+            else
+            {
+                throw new ArgumentNullException("Value of passphrase is null");
             }
         }
     }