[WiFi][TCSACR-116] Add a new API WiFiAP.Update 52/162352/4
authorchleun.moon <chleun.moon@samsung.com>
Thu, 30 Nov 2017 11:08:09 +0000 (20:08 +0900)
committercheoleun moon <chleun.moon@samsung.com>
Wed, 3 Jan 2018 05:15:35 +0000 (05:15 +0000)
Change-Id: I47763b75fb17238b4b2965841ffdfdea5f2f3048
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAP.cs
src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAddressInformation.cs
src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs
src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetwork.cs

index e170b25..472af01 100755 (executable)
@@ -17,7 +17,6 @@
 using System;
 using System.Threading.Tasks;
 using System.Collections.Generic;
-using System.ComponentModel;
 
 namespace Tizen.Network.WiFi
 {
@@ -491,6 +490,34 @@ namespace Tizen.Network.WiFi
                 WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle);
             }
         }
+
+        /// <summary>
+        /// Update the information of a stored access point.
+        /// When a AP information is changed, the change will not be applied until this method is called.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <privilege>http://tizen.org/privilege/network.profile</privilege>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <exception cref="NotSupportedException">Thrown when the Wi-Fi is not supported.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+        /// <exception cref="ObjectDisposedException">Thrown when the object instance is disposed or released.</exception>
+        /// <exception cref="OutOfMemoryException">Thrown when the system is out of memory.</exception>
+        /// <exception cref="InvalidOperationException">Thrown when the method failed due to an invalid operation.</exception>
+        public void Update()
+        {
+            Log.Debug(Globals.LogTag, "Update");
+            if (_disposed)
+            {
+                throw new ObjectDisposedException("Invalid AP instance (Object may have been disposed or released)");
+            }
+            int ret = Interop.WiFi.UpdateAP(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle);
+            if (ret != (int)WiFiError.None)
+            {
+                Log.Error(Globals.LogTag, "Failed to update AP, Error - " + (WiFiError)ret);
+                WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle);
+            }
+        }
    }
 
     /// <summary>
index f9419af..07506f0 100755 (executable)
@@ -57,7 +57,6 @@ namespace Tizen.Network.WiFi
                     Log.Error(Globals.LogTag, "Failed to set first dns address, Error - " + (WiFiError)ret);
                     WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle());
                 }
-                WiFiManagerImpl.Instance.UpdateAP(_handle);
             }
         }
 
@@ -86,7 +85,6 @@ namespace Tizen.Network.WiFi
                     Log.Error(Globals.LogTag, "Failed to set second dns address, Error - " + (WiFiError)ret);
                     WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle());
                 }
-                WiFiManagerImpl.Instance.UpdateAP(_handle);
             }
         }
 
@@ -115,7 +113,6 @@ namespace Tizen.Network.WiFi
                     Log.Error(Globals.LogTag, "Failed to set gateway address, Error - " + (WiFiError)ret);
                     WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle());
                 }
-                WiFiManagerImpl.Instance.UpdateAP(_handle);
             }
         }
 
@@ -144,7 +141,6 @@ namespace Tizen.Network.WiFi
                     Log.Error(Globals.LogTag, "Failed to set subnet mask, Error - " + (WiFiError)ret);
                     WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle());
                 }
-                WiFiManagerImpl.Instance.UpdateAP(_handle);
             }
         }
 
@@ -173,7 +169,6 @@ namespace Tizen.Network.WiFi
                     Log.Error(Globals.LogTag, "Failed to set ip address, Error - " + (WiFiError)ret);
                     WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle());
                 }
-                WiFiManagerImpl.Instance.UpdateAP(_handle);
             }
         }
 
@@ -197,7 +192,6 @@ namespace Tizen.Network.WiFi
                     Log.Error(Globals.LogTag, "Failed to set ip config type, Error - " + (WiFiError)ret);
                     WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle());
                 }
-                WiFiManagerImpl.Instance.UpdateAP(_handle);
             }
         }
 
@@ -223,7 +217,6 @@ namespace Tizen.Network.WiFi
                     Log.Error(Globals.LogTag, "It failed to set prefix length, " + (WiFiError)ret);
                     WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle());
                 }
-                WiFiManagerImpl.Instance.UpdateAP(_handle);
             }
         }
 
@@ -247,7 +240,6 @@ namespace Tizen.Network.WiFi
                     Log.Error(Globals.LogTag, "It failed to set DNS config type, " + (WiFiError)ret);
                     WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle());
                 }
-                WiFiManagerImpl.Instance.UpdateAP(_handle);
             }
         }
 
index 03c138e..1058ddd 100755 (executable)
@@ -453,15 +453,5 @@ namespace Tizen.Network.WiFi
             }
             return task.Task;
         }
-
-        internal void UpdateAP(Interop.WiFi.SafeWiFiAPHandle apHandle)
-        {
-            int ret = Interop.WiFi.UpdateAP(GetSafeHandle(), apHandle.DangerousGetHandle());
-            if (ret != (int)WiFiError.None)
-            {
-                Log.Error(Globals.LogTag, "Failed to update AP, Error - " + (WiFiError)ret);
-                WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle(), apHandle.DangerousGetHandle());
-            }
-        }
     }
 }
index c7b9aae..d77be57 100755 (executable)
@@ -135,7 +135,6 @@ namespace Tizen.Network.WiFi
                     Log.Error(Globals.LogTag, "Failed to set proxy address, Error - " + (WiFiError)ret);
                     WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle());
                 }
-                WiFiManagerImpl.Instance.UpdateAP(_apHandle);
             }
         }
 
@@ -167,7 +166,6 @@ namespace Tizen.Network.WiFi
                     Log.Error(Globals.LogTag, "Failed to set proxy type, Error - " + (WiFiError)ret);
                     WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle());
                 }
-                WiFiManagerImpl.Instance.UpdateAP(_apHandle);
             }
         }