+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Tizen.Network.Connection;
+
+internal static partial class Interop
+{
+ internal static partial class Connection
+ {
+ public delegate void ConnectionTypeChangedCallback(ConnectionType type, IntPtr userData);
+ public delegate void EthernetCableStateChangedCallback(EthernetCableState state, IntPtr userData);
+ public delegate void ConnectionAddressChangedCallback(IntPtr ipv4, IntPtr ipv6, IntPtr userData);
+ public delegate void ConnectionCallback(ConnectionError result, IntPtr userData);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_create")]
+ public static extern int Create(out IntPtr handle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_destroy")]
+ public static extern int Destroy(IntPtr handle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_get_type")]
+ public static extern int GetType(IntPtr handle, out int type);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_get_ip_address")]
+ public static extern int GetIpAddress(IntPtr handle, int family, out IntPtr address);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_get_proxy")]
+ public static extern int GetProxy(IntPtr handle, int family, out IntPtr address);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_get_mac_address")]
+ public static extern int GetMacAddress(IntPtr handle, int family, out IntPtr address);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_get_wifi_state")]
+ public static extern int GetWiFiState(IntPtr handle, out int state);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_get_cellular_state")]
+ public static extern int GetCellularState(IntPtr handle, out int state);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_get_ethernet_state")]
+ public static extern int GetEthernetState(IntPtr handle, out int state);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_get_ethernet_cable_state")]
+ public static extern int GetEthernetCableState(IntPtr handle, out int state);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_get_bt_state")]
+ public static extern int GetBtState(IntPtr handle, out int state);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_set_type_changed_cb")]
+ public static extern int SetTypeChangedCallback(IntPtr handle, ConnectionTypeChangedCallback callback, IntPtr userData);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_set_ip_address_changed_cb")]
+ public static extern int SetIpAddressChangedCallback(IntPtr handle, ConnectionAddressChangedCallback callback, IntPtr userData);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_set_ethernet_cable_state_chaged_cb")]
+ public static extern int SetEthernetCableStateChagedCallback(IntPtr handle, EthernetCableStateChangedCallback callback, IntPtr userData);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_set_proxy_address_changed_cb")]
+ public static extern int SetProxyAddressChangedCallback(IntPtr handle, ConnectionAddressChangedCallback callback, IntPtr userData);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_unset_type_changed_cb")]
+ public static extern int UnsetTypeChangedCallback(IntPtr handle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_unset_ip_address_changed_cb")]
+ public static extern int UnsetIpAddressChangedCallback(IntPtr handle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_unset_ethernet_cable_state_chaged_cb")]
+ public static extern int UnsetEthernetCableStateChagedCallback(IntPtr handle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_unset_proxy_address_changed_cb")]
+ public static extern int UnsetProxyAddressChangedCallback(IntPtr handle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_add_profile")]
+ public static extern int AddProfile(IntPtr handle, IntPtr profileHandle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_remove_profile")]
+ public static extern int RemoveProfile(IntPtr handle, IntPtr profileHandle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_update_profile")]
+ public static extern int UpdateProfile(IntPtr handle, IntPtr profileHandle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_get_default_cellular_service_profile")]
+ public static extern int GetDefaultCellularServiceProfile(IntPtr handle, int type, out IntPtr profileHandle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_get_current_profile")]
+ public static extern int GetCurrentProfile(IntPtr handle, out IntPtr profileHandle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_open_profile")]
+ public static extern int OpenProfile(IntPtr handle, IntPtr profileHandle, ConnectionCallback callback, IntPtr userData);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_close_profile")]
+ public static extern int CloseProfile(IntPtr handle, IntPtr profileHandle, ConnectionCallback callback, IntPtr userData);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_reset_profile")]
+ public static extern int ResetProfile(IntPtr handle, int Option, int Id, ConnectionCallback callback, IntPtr userData);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_set_default_cellular_service_profile_async")]
+ public static extern int SetDefaultCellularServiceProfileAsync(IntPtr handle, int Type, IntPtr profileHandle, ConnectionCallback callback, IntPtr userData);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_get_profile_iterator")]
+ public static extern int GetProfileIterator(IntPtr handle, int type, out IntPtr iterHandle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_iterator_next")]
+ public static extern int GetNextProfileIterator(IntPtr iterHandle, out IntPtr profileHandle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_iterator_has_next")]
+ public static extern bool HasNextProfileIterator(IntPtr iterHandle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_destroy_profile_iterator")]
+ public static extern int DestroyProfileIterator(IntPtr iterHandle);
+ }
+
+ internal static partial class ConnectionProfile
+ {
+ public delegate void profile_state_changed_cb(ProfileState type, IntPtr userData);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_create")]
+ public static extern int Create(int ProfileType, string Keyword, out IntPtr profileHandle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_clone")]
+ public static extern int Clone(out IntPtr cloneHandle, IntPtr profileHandle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_destroy")]
+ public static extern int Destroy(IntPtr profileHandle);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_id")]
+ public static extern int GetId(IntPtr profileHandle, out IntPtr profileId);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_name")]
+ public static extern int GetName(IntPtr profileHandle, out IntPtr name);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_type")]
+ public static extern int GetType(IntPtr profileHandle, out int type);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_network_interface_name")]
+ public static extern int GetNetworkInterfaceName(IntPtr profileHandle, out IntPtr interfaceName);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_state")]
+ public static extern int GetState(IntPtr profileHandle, out int type);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_ip_config_type")]
+ public static extern int GetIpConfigType(IntPtr profileHandle, int family, out int type);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_proxy_type")]
+ public static extern int GetProxyType(IntPtr profileHandle, out int type);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_ip_address")]
+ public static extern int GetIpAddress(IntPtr profileHandle, int family, out IntPtr address);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_subnet_mask")]
+ public static extern int GetSubnetMask(IntPtr profileHandle, int family, out IntPtr address);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_gateway_address")]
+ public static extern int GetGatewayAddress(IntPtr profileHandle, int family, out IntPtr address);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_dns_address")]
+ public static extern int GetDnsAddress(IntPtr profileHandle, int order, int Family, out IntPtr address);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_proxy_address")]
+ public static extern int GetProxyAddress(IntPtr profileHandle, int family, out IntPtr address);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_ip_config_type")]
+ public static extern int SetIpConfigType(IntPtr profileHandle, int family, int type);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_proxy_type")]
+ public static extern int SetProxyType(IntPtr profileHandle, int type);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_ip_address")]
+ public static extern int SetIpAddress(IntPtr profileHandle, int family, string address);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_subnet_mask")]
+ public static extern int SetSubnetMask(IntPtr profileHandle, int family, string address);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_gateway_address")]
+ public static extern int SetGatewayAddress(IntPtr profileHandle, int family, string address);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_dns_address")]
+ public static extern int SetDnsAddress(IntPtr profileHandle, int family, string address);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_proxy_address")]
+ public static extern int SetProxyAddress(IntPtr profileHandle, int family, string address);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_state_changed_cb")]
+ public static extern int SetStateChangeCallback(IntPtr profileHandle, profile_state_changed_cb callback, IntPtr userData);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_unset_state_changed_cb")]
+ public static extern int UnsetStateChangeCallback(IntPtr profileHandle);
+ }
+
+ internal static partial class ConnectionCellularProfile
+ {
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_service_type")]
+ public static extern int GetServiceType(IntPtr profileHandle, out int type);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_apn")]
+ public static extern int GetApn(IntPtr profileHandle, out IntPtr apn);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_auth_info")]
+ public static extern int GetAuthInfo(IntPtr profileHandle, out int authType, out IntPtr name, out IntPtr password);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_home_url")]
+ public static extern int GetHomeUrl(IntPtr profileHandle, out IntPtr homeUrl);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_cellular_roaming")]
+ public static extern int IsRoaming(IntPtr profileHandle, out bool roaming);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_cellular_hidden")]
+ public static extern int IsHidden(IntPtr profileHandle, out bool hidden);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_cellular_editable")]
+ public static extern int IsEditable(IntPtr profileHandle, out bool editable);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_cellular_default")]
+ public static extern int IsDefault(IntPtr profileHandle, out bool isDefault);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_service_type")]
+ public static extern int SetServiceType(IntPtr profileHandle, int type);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_apn")]
+ public static extern int SetApn(IntPtr profileHandle, string apn);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_auth_info")]
+ public static extern int SetAuthInfo(IntPtr profileHandle, int authType, string name, string password);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_home_url")]
+ public static extern int SetHomeUrl(IntPtr profileHandle, string homeUrl);
+
+ }
+
+ internal static partial class ConnectionWiFiProfile
+ {
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_essid")]
+ public static extern int GetEssid(IntPtr profileHandle, out IntPtr essid);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_bssid")]
+ public static extern int GetBssid(IntPtr profileHandle, out IntPtr bssid);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_rssi")]
+ public static extern int GetRssi(IntPtr profileHandle, out int rssi);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_frequency")]
+ public static extern int GetFrequency(IntPtr profileHandle, out int frequency);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_max_speed")]
+ public static extern int GetMaxSpeed(IntPtr profileHandle, out int maxSpeed);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_security_type")]
+ public static extern int GetSecurityType(IntPtr profileHandle, out int type);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_encryption_type")]
+ public static extern int GetEncryptionType(IntPtr profileHandle, out int type);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_wifi_passphrase_required")]
+ public static extern int IsRequiredPassphrase(IntPtr profileHandle, out bool required);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_wifi_passphrase")]
+ public static extern int SetPassphrase(IntPtr profileHandle, string passphrase);
+
+ [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_wifi_wps_supported")]
+ public static extern int IsSupportedWps(IntPtr profileHandle, out bool supported);
+ }
+
+ internal static partial class Libc
+ {
+ [DllImport(Libraries.Libc, EntryPoint = "free")]
+ public static extern void Free(IntPtr userData);
+
+ }
+}