[DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_dhcp_server_address")]
public static extern int GetDhcpServerAddress(IntPtr profileHandle, AddressFamily family, out string dhcpServerAddress);
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_dhcp_lease_duration")]
+ public static extern int GetDhcpLeaseDuration(IntPtr profileHandle, AddressFamily family, out int dhcpLeaseDuration);
+
[DllImport(Libraries.Connection, EntryPoint = "connection_profile_refresh")]
public static extern int Refresh(IntPtr profileHandle);
/// <since_tizen> 4 </since_tizen>
/// <value>Server address of the DHCP.</value>
System.Net.IPAddress DhcpServerAddress { get; }
+
+ /// <summary>
+ /// The DHCP lease duration. It is only supported for the IPV4 address family.
+ /// </summary>
+ /// <since_tizen> 5 </since_tizen>
+ /// <value>Lease duration of the DHCP.</value>
+ int DhcpLeaseDuration { get; }
}
internal class ConnectionAddressInformation : IAddressInformation
else
return System.Net.IPAddress.Parse(DefaultIPv6);
}
+
+ public int DhcpLeaseDuration
+ {
+ get
+ {
+ int leaseDuration;
+ int ret = Interop.ConnectionProfile.GetDhcpLeaseDuration(_profileHandle, _family, out leaseDuration);
+ if ((ConnectionError)ret != ConnectionError.None)
+ {
+ Log.Error(Globals.LogTag, "It failed to get the DHCP lease duration, " + (ConnectionError)ret);
+ leaseDuration = 0;
+ }
+ return leaseDuration;
+ }
+ }
}
}
internal static extern int SetGatewayAddress(SafeWiFiAPHandle ap, int addressFamily, string gatewayAddress);
[DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_dhcp_server_address")]
internal static extern int GetDhcpServerAddress(SafeWiFiAPHandle ap, AddressFamily addressFamily, out string dhcpServer);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_dhcp_lease_duration")]
+ internal static extern int GetDhcpLeaseDuration(SafeWiFiAPHandle ap, AddressFamily addressFamily, out int dhcpLeaseDuration);
[DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_proxy_address")]
internal static extern int GetProxyAddress(SafeWiFiAPHandle ap, int addressFamily, out IntPtr proxyAddress);
[DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_proxy_address")]
}
}
+ /// <summary>
+ /// DHCP lease duration. It is only supported for IPv4 address family.
+ /// </summary>
+ /// <value>Represents DHCP lease duration.</value>
+ public int DhcpLeaseDuration
+ {
+ get
+ {
+ int leaseDuration;
+ int ret = Interop.WiFi.AP.GetDhcpLeaseDuration(_handle, AddressFamily.IPv4, out leaseDuration);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get DHCP lease duration, Error - " + (WiFiError)ret);
+ return 0;
+ }
+
+ return leaseDuration;
+ }
+ }
+
private System.Net.IPAddress ParseIPAddress(int ret, IntPtr addrPtr)
{
if (ret != (int)WiFiError.None)