summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Jiung <jiung.yu@samsung.com>2016-12-22 16:40:54 +0900
committerYu Jiung <jiung.yu@samsung.com>2016-12-26 11:10:19 +0900
commit8534679b71701f4883e058efa5451ae1debb53e9 (patch)
tree3c7d8676fc80ed67e1bbca1d858f88a4cdb165b9
parent85c74c0f074144974b6b1648185bc9cd21296e8f (diff)
downloadwifi-8534679b71701f4883e058efa5451ae1debb53e9.tar.gz
wifi-8534679b71701f4883e058efa5451ae1debb53e9.tar.bz2
wifi-8534679b71701f4883e058efa5451ae1debb53e9.zip
Change-Id: Ic107d5cda39e6617eabe69b5f143a5a0aab47ea4 Signed-off-by: Yu jiung <jiung.yu@samsung.com>
-rw-r--r--LICENSE202
-rw-r--r--Tizen.Network.WiFi/Interop/Interop.Libraries.cs25
-rw-r--r--Tizen.Network.WiFi/Interop/Interop.WiFi.cs254
-rw-r--r--Tizen.Network.WiFi/Properties/AssemblyInfo.cs36
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi.Net45.csproj81
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi.Net45.project.json12
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi.csproj90
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi.nuspec22
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi.project.json10
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi.sln22
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi.snkbin0 -> 596 bytes
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/ConnectionStateChangedEventArgs.cs55
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/DeviceStateChangedEventArgs.cs44
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/IWiFiEap.cs39
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/RssiLevelChangedEventArgs.cs43
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAddressInformation.cs205
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAp.cs148
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiConfiguration.cs174
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEap.cs255
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEapConfiguration.cs250
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEnumerations.cs161
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiErrorFactory.cs85
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs260
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs564
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetwork.cs286
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetworkChange.cs254
-rw-r--r--Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiSecurity.cs173
-rw-r--r--packaging/csapi-network-wifi.manifest5
-rw-r--r--packaging/csapi-network-wifi.spec45
29 files changed, 3800 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/Tizen.Network.WiFi/Interop/Interop.Libraries.cs b/Tizen.Network.WiFi/Interop/Interop.Libraries.cs
new file mode 100644
index 0000000..704b024
--- /dev/null
+++ b/Tizen.Network.WiFi/Interop/Interop.Libraries.cs
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+internal static partial class Interop
+{
+ internal static partial class Libraries
+ {
+ public const string WiFi = "libcapi-network-wifi.so.1";
+ public const string Glib = "libglib-2.0.so.0";
+ public const string Libc = "libc.so.6";
+ }
+}
diff --git a/Tizen.Network.WiFi/Interop/Interop.WiFi.cs b/Tizen.Network.WiFi/Interop/Interop.WiFi.cs
new file mode 100644
index 0000000..52c1ffb
--- /dev/null
+++ b/Tizen.Network.WiFi/Interop/Interop.WiFi.cs
@@ -0,0 +1,254 @@
+/*
+ * 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;
+
+internal static partial class Interop
+{
+ internal static partial class WiFi
+ {
+ //Callback for async method
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void VoidCallback(int result, IntPtr userData);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool HandleCallback(IntPtr handle, IntPtr userData);
+
+ //Callback for event
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void DeviceStateChangedCallback(int deviceState, IntPtr userData);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void ConnectionStateChangedCallback(int connectionState, IntPtr ap, IntPtr userData);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void RssiLevelChangedCallback(int level, IntPtr userData);
+
+ //capi-network-wifi-1.0.65-19.23.armv7l
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_initialize")]
+ internal static extern int Initialize();
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_deinitialize")]
+ internal static extern int Deinitialize();
+
+ ////Wi-Fi Manager
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_activate")]
+ internal static extern int Activate(VoidCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_activate_with_wifi_picker_tested")]
+ internal static extern int ActivateWithWiFiPickerTested(VoidCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_deactivate")]
+ internal static extern int Deactivate(VoidCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_is_activated")]
+ internal static extern int IsActivated(out bool activated);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_get_mac_address")]
+ internal static extern int GetMacAddress(out string macAddress);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_get_network_interface_name")]
+ internal static extern int GetNetworkInterfaceName(out string interfaceName);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_scan")]
+ internal static extern int Scan(VoidCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_scan_specific_ap")]
+ internal static extern int ScanSpecificAp(string essid, VoidCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_get_connected_ap")]
+ internal static extern int GetConnectedAp(out IntPtr ap);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_foreach_found_aps")]
+ internal static extern int GetForeachFoundAps(HandleCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_foreach_found_specific_aps")]
+ internal static extern int GetForeachFoundSpecificAps(HandleCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_connect")]
+ internal static extern int Connect(IntPtr ap, VoidCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_disconnect")]
+ internal static extern int Disconnect(IntPtr ap, VoidCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_connect_by_wps_pbc")]
+ internal static extern int ConnectByWpsPbc(IntPtr ap, VoidCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_connect_by_wps_pin")]
+ internal static extern int ConnectByWpsPin(IntPtr ap, string pin, VoidCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_forget_ap")]
+ internal static extern int RemoveAp(IntPtr ap);
+
+ //Wi-Fi Monitor
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_get_connection_state")]
+ internal static extern int GetConnectionState(out int connectionState);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_set_device_state_changed_cb")]
+ internal static extern int SetDeviceStateChangedCallback(DeviceStateChangedCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_unset_device_state_changed_cb")]
+ internal static extern int UnsetDeviceStateChangedCallback();
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_set_background_scan_cb")]
+ internal static extern int SetBackgroundScanCallback(VoidCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_unset_background_scan_cb")]
+ internal static extern int UnsetBackgroundScanCallback();
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_set_connection_state_changed_cb")]
+ internal static extern int SetConnectionStateChangedCallback(ConnectionStateChangedCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_unset_connection_state_changed_cb")]
+ internal static extern int UnsetConnectionStateChangedCallback();
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_set_rssi_level_changed_cb")]
+ internal static extern int SetRssiLevelchangedCallback(RssiLevelChangedCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_unset_rssi_level_changed_cb")]
+ internal static extern int UnsetRssiLevelchangedCallback();
+
+ internal static class Ap
+ {
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_create")]
+ internal static extern int Create(string essid, out IntPtr ap);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_hidden_create")]
+ internal static extern int CreateHiddenAp(string essid, out IntPtr ap);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_destroy")]
+ internal static extern int Destroy(IntPtr ap);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_clone")]
+ internal static extern int Clone(out IntPtr cloned, IntPtr original);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_refresh")]
+ internal static extern int Refresh(IntPtr ap);
+
+ ////Network Information
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_essid")]
+ internal static extern int GetEssid(IntPtr ap, out IntPtr essid);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_bssid")]
+ internal static extern int GetBssid(IntPtr ap, out IntPtr bssid);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_rssi")]
+ internal static extern int GetRssi(IntPtr ap, out int rssi);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_frequency")]
+ internal static extern int GetFrequency(IntPtr ap, out int frequency);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_max_speed")]
+ internal static extern int GetMaxSpeed(IntPtr ap, out int maxSpeed);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_is_favorite")]
+ internal static extern int IsFavorite(IntPtr ap, out bool isFavorite);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_is_passpoint")]
+ internal static extern int IsPasspoint(IntPtr ap, out bool isPasspoint);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_connection_state")]
+ internal static extern int GetConnectionState(IntPtr ap, out int connectionState);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_ip_config_type")]
+ internal static extern int GetIpConfigType(IntPtr ap, int addressFamily, out int ipConfigType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_ip_config_type")]
+ internal static extern int SetIpConfigType(IntPtr ap, int addressFamily, int ipConfigType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_ip_address")]
+ internal static extern int GetIpAddress(IntPtr ap, int addressFamily, out IntPtr ipAddress);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_ip_address")]
+ internal static extern int SetIpAddress(IntPtr ap, int addressFamily, string ipAddress);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_subnet_mask")]
+ internal static extern int GetSubnetMask(IntPtr ap, int addressFamily, out IntPtr subnetMask);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_subnet_mask")]
+ internal static extern int SetSubnetMask(IntPtr ap, int addressFamily, string subnetMask);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_gateway_address")]
+ internal static extern int GetGatewayAddress(IntPtr ap, int addressFamily, out IntPtr gatewayAddress);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_gateway_address")]
+ internal static extern int SetGatewayAddress(IntPtr ap, int addressFamily, string gatewayAddress);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_proxy_address")]
+ internal static extern int GetProxyAddress(IntPtr ap, int addressFamily, out IntPtr proxyAddress);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_proxy_address")]
+ internal static extern int SetProxyAddress(IntPtr ap, int addressFamily, string proxyAddress);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_proxy_type")]
+ internal static extern int GetProxyType(IntPtr ap, out int proxyType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_proxy_type")]
+ internal static extern int SetProxyType(IntPtr ap, int proxyType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_dns_address")]
+ internal static extern int GetDnsAddress(IntPtr ap, int order, int addressFamily, out IntPtr dnsAddress);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_dns_address")]
+ internal static extern int SetDnsAddress(IntPtr ap, int order, int addressFamily, string dnsAddress);
+
+ ////Security Information
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_security_type")]
+ internal static extern int GetSecurityType(IntPtr ap, out int securityType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_security_type")]
+ internal static extern int SetSecurityType(IntPtr ap, int securityType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_encryption_type")]
+ internal static extern int GetEncryptionType(IntPtr ap, out int encryptionType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_encryption_type")]
+ internal static extern int SetEncryptionType(IntPtr ap, int encryptionType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_is_passphrase_required")]
+ internal static extern int IsPassphraseRequired(IntPtr ap, out bool required);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_passphrase")]
+ internal static extern int SetPassphrase(IntPtr ap, string passphrase);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_is_wps_supported")]
+ internal static extern int IsWpsSupported(IntPtr ap, out bool supported);
+
+ ////EAP
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_eap_passphrase")]
+ internal static extern int SetEapPassphrase(IntPtr ap, string userName, string password);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_eap_passphrase")]
+ internal static extern int GetEapPassphrase(IntPtr ap, out IntPtr userName, out bool isPasswordSet);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_eap_ca_cert_file")]
+ internal static extern int GetEapCaCertFile(IntPtr ap, out IntPtr file);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_eap_ca_cert_file")]
+ internal static extern int SetEapCaCertFile(IntPtr ap, string file);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_eap_client_cert_file")]
+ internal static extern int GetEapClientCertFile(IntPtr ap, out IntPtr file);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_eap_client_cert_file")]
+ internal static extern int SetEapClientCertFile(IntPtr ap, string file);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_eap_private_key_file")]
+ internal static extern int GetEapPrivateKeyFile(IntPtr ap, out IntPtr file);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_eap_private_key_info")]
+ internal static extern int SetEapPrivateKeyInfo(IntPtr ap, string file, string password);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_eap_type")]
+ internal static extern int GetEapType(IntPtr ap, out int eapType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_eap_type")]
+ internal static extern int SetEapType(IntPtr ap, int eapType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_get_eap_auth_type")]
+ internal static extern int GetEapAuthType(IntPtr ap, out int file);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_ap_set_eap_auth_type")]
+ internal static extern int SetEapAuthType(IntPtr ap, int file);
+ }
+
+ internal static class Config
+ {
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_create")]
+ internal static extern int Create(string name, string passPhrase, int securityType, out IntPtr config);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_clone")]
+ internal static extern int Clone(IntPtr origin, out IntPtr cloned);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_destroy")]
+ internal static extern int Destroy(IntPtr config);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_save_configuration")]
+ internal static extern int SaveConfiguration(IntPtr config);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_foreach_configuration")]
+ internal static extern int GetForeachConfiguration(HandleCallback callback, IntPtr userData);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_get_name")]
+ internal static extern int GetName(IntPtr config, out IntPtr name);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_get_security_type")]
+ internal static extern int GetSecurityType(IntPtr config, out int securityType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_set_proxy_address")]
+ internal static extern int SetProxyAddress(IntPtr config, int addressFamily, string proxyAddress);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_get_proxy_address")]
+ internal static extern int GetProxyAddress(IntPtr config, out int addressFamily, out IntPtr proxyAddress);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_set_hidden_ap_property")]
+ internal static extern int SetHiddenApProperty(IntPtr config, bool isHidden);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_get_hidden_ap_property")]
+ internal static extern int GetHiddenApProperty(IntPtr config, out bool isHidden);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_get_eap_anonymous_identity")]
+ internal static extern int GetEapAnonymousIdentity(IntPtr config, out IntPtr anonymousIdentify);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_set_eap_anonymous_identity")]
+ internal static extern int SetEapAnonymousIdentity(IntPtr config, string anonymousIdentify);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_get_eap_ca_cert_file")]
+ internal static extern int GetEapCaCertFile(IntPtr config, out IntPtr caCert);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_set_eap_ca_cert_file")]
+ internal static extern int SetEapCaCertFile(IntPtr config, string caCert);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_get_eap_client_cert_file")]
+ internal static extern int GetEapClientCertFile(IntPtr config, out IntPtr clientCert);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_set_eap_client_cert_file")]
+ internal static extern int SetEapClientCertFile(IntPtr config, string privateKey, string clientCert);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_get_eap_identity")]
+ internal static extern int GetEapIdentity(IntPtr config, out IntPtr identify);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_set_eap_identity")]
+ internal static extern int SetEapIdentity(IntPtr config, string identify);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_get_eap_type")]
+ internal static extern int GetEapType(IntPtr config, out int eapType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_set_eap_type")]
+ internal static extern int SetEapType(IntPtr config, int eapType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_get_eap_auth_type")]
+ internal static extern int GetEapAuthType(IntPtr config, out int eapAuthType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_set_eap_auth_type")]
+ internal static extern int SetEapAuthType(IntPtr config, int eapAuthType);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_get_eap_subject_match")]
+ internal static extern int GetEapSubjectMatch(IntPtr config, out IntPtr subjectMatch);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_config_set_eap_subject_match")]
+ internal static extern int SetEapSubjectMatch(IntPtr config, string subjectMatch);
+ }
+ }
+}
diff --git a/Tizen.Network.WiFi/Properties/AssemblyInfo.cs b/Tizen.Network.WiFi/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..837f185
--- /dev/null
+++ b/Tizen.Network.WiFi/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Tizen.Network.WiFi")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Samsung Electronics")]
+[assembly: AssemblyProduct("Tizen.Network.WiFi")]
+[assembly: AssemblyCopyright("Copyright © Samsung Electronics 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("9a2167e1-3b35-4da9-ab78-8e699302baa7")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi.Net45.csproj b/Tizen.Network.WiFi/Tizen.Network.WiFi.Net45.csproj
new file mode 100644
index 0000000..e8362cf
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi.Net45.csproj
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{97C028B1-8A8F-411C-A52C-5B8B7ED90001}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Tizen.Network.WiFi</RootNamespace>
+ <AssemblyName>Tizen.Network.WiFi</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\Net45\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\Net45\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup>
+ <SignAssembly>true</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup>
+ <AssemblyOriginatorKeyFile>Tizen.Network.WiFi.snk</AssemblyOriginatorKeyFile>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Interop\Interop.Libraries.cs" />
+ <Compile Include="Interop\Interop.WiFi.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Tizen.Network.WiFi\ConnectionStateChangedEventArgs.cs" />
+ <Compile Include="Tizen.Network.WiFi\DeviceStateChangedEventArgs.cs" />
+ <Compile Include="Tizen.Network.WiFi\IWiFiEap.cs" />
+ <Compile Include="Tizen.Network.WiFi\RssiLevelChangedEventArgs.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiAddressInformation.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiAp.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiConfiguration.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiEap.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiEapConfiguration.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiEnumerations.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiErrorFactory.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiManager.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiManagerImpl.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiNetwork.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiNetworkChange.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiSecurity.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Tizen.Network.WiFi.nuspec" />
+ <None Include="Tizen.Network.WiFi.Net45.project.json" />
+ <None Include="Tizen.Network.WiFi.snk" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi.Net45.project.json b/Tizen.Network.WiFi/Tizen.Network.WiFi.Net45.project.json
new file mode 100644
index 0000000..7455788
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi.Net45.project.json
@@ -0,0 +1,12 @@
+{
+ "dependencies": {
+ "Tizen": "1.0.2",
+ "Tizen.Network.Connection": "1.0.2"
+ },
+ "frameworks": {
+ "net45": {}
+ },
+ "runtimes": {
+ "win": {}
+ }
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi.csproj b/Tizen.Network.WiFi/Tizen.Network.WiFi.csproj
new file mode 100644
index 0000000..4388ae9
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi.csproj
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{9A2167E1-3B35-4DA9-AB78-8E699302BAA7}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Tizen.Network.WiFi</RootNamespace>
+ <AssemblyName>Tizen.Network.WiFi</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup>
+ <TargetFrameworkIdentifier>.NETStandard</TargetFrameworkIdentifier>
+ <TargetFrameworkVersion>v1.3</TargetFrameworkVersion>
+ <NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
+ <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
+ <NoStdLib>true</NoStdLib>
+ <NoWarn>$(NoWarn);1701;1702</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup>
+ <SignAssembly>true</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup>
+ <AssemblyOriginatorKeyFile>Tizen.Network.WiFi.snk</AssemblyOriginatorKeyFile>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="Interop\Interop.Libraries.cs" />
+ <Compile Include="Interop\Interop.WiFi.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Tizen.Network.WiFi\ConnectionStateChangedEventArgs.cs" />
+ <Compile Include="Tizen.Network.WiFi\DeviceStateChangedEventArgs.cs" />
+ <Compile Include="Tizen.Network.WiFi\IWiFiEap.cs" />
+ <Compile Include="Tizen.Network.WiFi\RssiLevelChangedEventArgs.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiAddressInformation.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiAp.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiConfiguration.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiEap.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiEapConfiguration.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiEnumerations.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiErrorFactory.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiManager.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiManagerImpl.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiNetwork.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiNetworkChange.cs" />
+ <Compile Include="Tizen.Network.WiFi\WiFiSecurity.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Tizen.Network.WiFi.nuspec" />
+ <None Include="Tizen.Network.WiFi.project.json" />
+ <None Include="Tizen.Network.WiFi.snk" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <PropertyGroup>
+ <!-- https://github.com/dotnet/corefxlab/tree/master/samples/NetCoreSample and
+ https://docs.microsoft.com/en-us/dotnet/articles/core/tutorials/target-dotnetcore-with-msbuild
+ -->
+ <!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two
+ properties to any folder that exists to skip the GetReferenceAssemblyPaths task (not target) and
+ to prevent it from outputting a warning (MSB3644).
+ -->
+ <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)</_TargetFrameworkDirectories>
+ <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>
+ <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi.nuspec b/Tizen.Network.WiFi/Tizen.Network.WiFi.nuspec
new file mode 100644
index 0000000..adf6335
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi.nuspec
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<package>
+ <metadata>
+ <id>Tizen.Network.WiFi</id>
+ <version>$version$</version>
+ <authors>Samsung Electronics</authors>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+ <projectUrl>https://www.tizen.org/</projectUrl>
+ <iconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</iconUrl>
+ <copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
+ <description>Provides the Wi-Fi APIs for Tizen.Network.WiFi</description>
+ <dependencies>
+ <dependency id="Tizen" version="1.0.2" />
+ <dependency id="Tizen.Network.Connection" version="1.0.2" />
+ </dependencies>
+ </metadata>
+ <files>
+ <file src="bin/$Configuration$/Tizen.Network.WiFi.dll" target="lib/netstandard1.3" />
+ <file src="bin/$Configuration$/Net45/Tizen.Network.WiFi.dll" target="lib/net45" />
+ </files>
+</package>
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi.project.json b/Tizen.Network.WiFi/Tizen.Network.WiFi.project.json
new file mode 100644
index 0000000..a754ff9
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi.project.json
@@ -0,0 +1,10 @@
+{
+ "dependencies": {
+ "NETStandard.Library": "1.6.0",
+ "Tizen": "1.0.2",
+ "Tizen.Network.Connection": "1.0.2"
+ },
+ "frameworks": {
+ "netstandard1.3": {}
+ }
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi.sln b/Tizen.Network.WiFi/Tizen.Network.WiFi.sln
new file mode 100644
index 0000000..7763278
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Network.WiFi", "Tizen.Network.WiFi.csproj", "{9A2167E1-3B35-4DA9-AB78-8E699302BAA7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9A2167E1-3B35-4DA9-AB78-8E699302BAA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9A2167E1-3B35-4DA9-AB78-8E699302BAA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9A2167E1-3B35-4DA9-AB78-8E699302BAA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9A2167E1-3B35-4DA9-AB78-8E699302BAA7}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi.snk b/Tizen.Network.WiFi/Tizen.Network.WiFi.snk
new file mode 100644
index 0000000..e3e34af
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi.snk
Binary files differ
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/ConnectionStateChangedEventArgs.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/ConnectionStateChangedEventArgs.cs
new file mode 100644
index 0000000..58ccaed
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/ConnectionStateChangedEventArgs.cs
@@ -0,0 +1,55 @@
+/*
+ * 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;
+
+namespace Tizen.Network.WiFi
+{
+ /// <summary>
+ /// An extended EventArgs class which contains changed connection state.
+ /// </summary>
+ public class ConnectionStateChangedEventArgs : EventArgs
+ {
+ private WiFiConnectionState _state = WiFiConnectionState.Disconnected;
+ private WiFiAp _ap;
+
+ internal ConnectionStateChangedEventArgs(WiFiConnectionState s, IntPtr _apHandle)
+ {
+ _state = s;
+ _ap = new WiFiAp(_apHandle);
+ }
+ /// <summary>
+ /// The wifi connection state.
+ /// </summary>
+ public WiFiConnectionState State
+ {
+ get
+ {
+ return _state;
+ }
+ }
+ /// <summary>
+ /// The access point
+ /// </summary>
+ public WiFiAp Ap
+ {
+ get
+ {
+ return _ap;
+ }
+ }
+ }
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/DeviceStateChangedEventArgs.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/DeviceStateChangedEventArgs.cs
new file mode 100644
index 0000000..2271685
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/DeviceStateChangedEventArgs.cs
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+namespace Tizen.Network.WiFi
+{
+ /// <summary>
+ /// An extended EventArgs class which contains changed device state.
+ /// </summary>
+ public class DeviceStateChangedEventArgs : EventArgs
+ {
+ private WiFiDeviceState _state = WiFiDeviceState.Deactivated;
+
+ internal DeviceStateChangedEventArgs(WiFiDeviceState s)
+ {
+ _state = s;
+ }
+
+ /// <summary>
+ /// The wifi device state.
+ /// </summary>
+ public WiFiDeviceState State
+ {
+ get
+ {
+ return _state;
+ }
+ }
+ }
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/IWiFiEap.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/IWiFiEap.cs
new file mode 100644
index 0000000..5556be4
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/IWiFiEap.cs
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+namespace Tizen.Network.WiFi
+{
+ /// <summary>
+ /// An abstract class for WiFi EAP information.
+ /// </summary>
+ internal interface IWiFiEap
+ {
+ /// <summary>
+ /// The file path of CA Certificate of EAP.
+ /// </summary>
+ string CaCertificationFile { get; set; }
+ /// <summary>
+ /// The EAP type of wifi.
+ /// </summary>
+ WiFiEapType EapType { get; set; }
+ /// <summary>
+ /// The type of EAP phase2 authentication of Wi-Fi.
+ /// </summary>
+ WiFiAuthenticationType AuthenticationType { get; set; }
+ } //WiFiEap
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/RssiLevelChangedEventArgs.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/RssiLevelChangedEventArgs.cs
new file mode 100644
index 0000000..41d0e98
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/RssiLevelChangedEventArgs.cs
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+namespace Tizen.Network.WiFi
+{
+ /// <summary>
+ /// An extended EventArgs class which contains changed RSSI level.
+ /// </summary>
+ public class RssiLevelChangedEventArgs : EventArgs
+ {
+ private WiFiRssiLevel _level = WiFiRssiLevel.Level0;
+
+ internal RssiLevelChangedEventArgs(WiFiRssiLevel l)
+ {
+ _level = l;
+ }
+ /// <summary>
+ /// The wifi RSSI level.
+ /// </summary>
+ public WiFiRssiLevel Level
+ {
+ get
+ {
+ return _level;
+ }
+ }
+ }
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAddressInformation.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAddressInformation.cs
new file mode 100644
index 0000000..1e5dc37
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAddressInformation.cs
@@ -0,0 +1,205 @@
+/*
+ * 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;
+
+namespace Tizen.Network.WiFi
+{
+ internal class WiFiAddressInformation : IAddressInformation
+ {
+ private IntPtr _handle;
+ private AddressFamily _family;
+ private bool _disposed = false;
+
+ internal WiFiAddressInformation(IntPtr handle, AddressFamily family)
+ {
+ _handle = handle;
+ _family = family;
+ }
+
+ ~WiFiAddressInformation()
+ {
+ Dispose(false);
+ }
+
+ protected void Dispose(bool disposing)
+ {
+ if (_disposed)
+ return;
+
+ if (disposing)
+ {
+ // Free managed objects.
+ }
+ _handle = IntPtr.Zero;
+ _disposed = true;
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+
+ public System.Net.IPAddress Dns1
+ {
+ get
+ {
+ IntPtr addrPtr;
+ int ret = Interop.WiFi.Ap.GetDnsAddress(_handle, 1, (int)_family, out addrPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get first dns address, Error - " + (WiFiError)ret);
+ return System.Net.IPAddress.Parse("0.0.0.0");
+ }
+ string addrStr = Marshal.PtrToStringAnsi(addrPtr);
+ if (addrStr == null)
+ return System.Net.IPAddress.Parse("0.0.0.0");
+ return System.Net.IPAddress.Parse(addrStr);
+ }
+ set
+ {
+ int ret = Interop.WiFi.Ap.SetDnsAddress(_handle, 1, (int)_family, value.ToString());
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set first dns address, Error - " + (WiFiError)ret);
+ }
+ }
+ }
+ public System.Net.IPAddress Dns2
+ {
+ get
+ {
+ IntPtr addrPtr;
+ int ret = Interop.WiFi.Ap.GetDnsAddress(_handle, 2, (int)_family, out addrPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get second dns address, Error - " + (WiFiError)ret);
+ return System.Net.IPAddress.Parse("0.0.0.0");
+ }
+ string addrStr = Marshal.PtrToStringAnsi(addrPtr);
+ if (addrStr == null)
+ return System.Net.IPAddress.Parse("0.0.0.0");
+ return System.Net.IPAddress.Parse(addrStr);
+ }
+ set
+ {
+ int ret = Interop.WiFi.Ap.SetDnsAddress(_handle, 2, (int)_family, value.ToString());
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set second dns address, Error - " + (WiFiError)ret);
+ }
+ }
+ }
+ public System.Net.IPAddress Gateway
+ {
+ get
+ {
+ IntPtr addrPtr;
+ int ret = Interop.WiFi.Ap.GetGatewayAddress(_handle, (int)_family, out addrPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get gateway address, Error - " + (WiFiError)ret);
+ return System.Net.IPAddress.Parse("0.0.0.0");
+ }
+ string addrStr = Marshal.PtrToStringAnsi(addrPtr);
+ if (addrStr == null)
+ return System.Net.IPAddress.Parse("0.0.0.0");
+ return System.Net.IPAddress.Parse(addrStr);
+ }
+ set
+ {
+ int ret = Interop.WiFi.Ap.SetGatewayAddress(_handle, (int)_family, value.ToString());
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set gateway address, Error - " + (WiFiError)ret);
+ }
+ }
+ }
+ public System.Net.IPAddress SubnetMask
+ {
+ get
+ {
+ IntPtr addrPtr;
+ int ret = Interop.WiFi.Ap.GetSubnetMask(_handle, (int)_family, out addrPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get subnet mask, Error - " + (WiFiError)ret);
+ return System.Net.IPAddress.Parse("0.0.0.0");
+ }
+ string addrStr = Marshal.PtrToStringAnsi(addrPtr);
+ if (addrStr == null)
+ return System.Net.IPAddress.Parse("0.0.0.0");
+ return System.Net.IPAddress.Parse(addrStr);
+ }
+ set
+ {
+ int ret = Interop.WiFi.Ap.SetSubnetMask(_handle, (int)_family, value.ToString());
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set subnet mask, Error - " + (WiFiError)ret);
+ }
+ }
+ }
+ public System.Net.IPAddress Ip
+ {
+ get
+ {
+ IntPtr addrPtr;
+ int ret = Interop.WiFi.Ap.GetIpAddress(_handle, (int)_family, out addrPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get ip address, Error - " + (WiFiError)ret);
+ return System.Net.IPAddress.Parse("0.0.0.0");
+ }
+ string addrStr = Marshal.PtrToStringAnsi(addrPtr);
+ if (addrStr == null)
+ return System.Net.IPAddress.Parse("0.0.0.0");
+ return System.Net.IPAddress.Parse(addrStr);
+ }
+ set
+ {
+ int ret = Interop.WiFi.Ap.SetIpAddress(_handle, (int)_family, value.ToString());
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set ip address, Error - " + (WiFiError)ret);
+ }
+ }
+ }
+ public IpConfigType IpConfigType
+ {
+ get
+ {
+ int type;
+ int ret = Interop.WiFi.Ap.GetIpConfigType(_handle, (int)_family, out type);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get ip config type, Error - " + (WiFiError)ret);
+ }
+ return (IpConfigType)type;
+ }
+ set
+ {
+ int ret = Interop.WiFi.Ap.SetIpConfigType(_handle, (int)_family, (int)value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set ip config type, Error - " + (WiFiError)ret);
+ }
+ }
+ }
+ }
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAp.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAp.cs
new file mode 100644
index 0000000..35b1b67
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAp.cs
@@ -0,0 +1,148 @@
+/*
+ * 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;
+
+namespace Tizen.Network.WiFi
+{
+ /// <summary>
+ /// A class for manager the network information of the access point(AP). It allows applications to manager netowrk informaiton.
+ /// </summary>
+ public class WiFiAp : IDisposable
+ {
+ private IntPtr _apHandle = IntPtr.Zero;
+ private WiFiNetwork _network;
+ private WiFiSecurity _security;
+ private bool disposed = false;
+
+ /// <summary>
+ /// The network information of the acces point(AP).
+ /// </summary>
+ public WiFiNetwork NetworkInformation
+ {
+ get
+ {
+ return _network;
+ }
+ }
+ /// <summary>
+ /// The security information of the access point(AP).
+ /// </summary>
+ public WiFiSecurity SecurityInformation
+ {
+ get
+ {
+ return _security;
+ }
+ }
+
+ internal WiFiAp(IntPtr handle)
+ {
+ Log.Debug(Globals.LogTag, "New WiFiAp. Handle: " + handle);
+ _apHandle = handle;
+ Initialize();
+ }
+ /// <summary>
+ /// Creates a object for the access point.
+ /// </summary>
+ /// <param name="essid">The ESSID (Extended Service Set Identifier) can be UTF-8 encoded </param>
+ public WiFiAp(string essid)
+ {
+ Log.Debug(Globals.LogTag, "New WiFiAp. Essid: " + essid);
+ createHandle(essid, true);
+ Initialize();
+ }
+ /// <summary>
+ /// Creates a object for the hidden access point.
+ /// </summary>
+ /// <param name="essid">The ESSID (Extended Service Set Identifier) can be UTF-8 encoded </param>
+ /// <param name="hidden">The value to set hidden AP</param>
+ public WiFiAp(string essid, bool hidden)
+ {
+ createHandle(essid, hidden);
+ Initialize();
+ }
+
+ ~WiFiAp()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (disposed)
+ return;
+
+ if (disposing)
+ {
+ _network.Dispose();
+ _security.Dispose();
+ }
+ Interop.WiFi.Ap.Destroy(_apHandle);
+ _apHandle = IntPtr.Zero;
+ disposed = true;
+ }
+
+ private void createHandle(string id, bool hidden)
+ {
+ int ret = -1;
+ if (hidden)
+ {
+ ret = Interop.WiFi.Ap.Create(id, out _apHandle);
+ }
+ else
+ {
+ ret = Interop.WiFi.Ap.CreateHiddenAp(id, out _apHandle);
+ }
+
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to create handle, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ }
+
+ private void Initialize()
+ {
+ _network = new WiFiNetwork(_apHandle);
+ _security = new WiFiSecurity(_apHandle);
+ }
+
+ /// <summary>
+ /// Refreshes the access point information.
+ /// </summary>
+ public void Refresh()
+ {
+ int ret = Interop.WiFi.Ap.Refresh(_apHandle);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to refresh ap handle, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle);
+ }
+ }
+
+ internal IntPtr GetHandle()
+ {
+ return _apHandle;
+ }
+ }
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiConfiguration.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiConfiguration.cs
new file mode 100644
index 0000000..ac4d60a
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiConfiguration.cs
@@ -0,0 +1,174 @@
+/*
+ * 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.Net;
+using System.Threading.Tasks;
+using System.Runtime.InteropServices;
+using Tizen.Network.Connection;
+
+namespace Tizen.Network.WiFi
+{
+ /// <summary>
+ /// A class for managing the configuration of Wi-Fi. It allows applications to manage the configuration information of Wi-Fi.
+ /// </summary>
+ public class WiFiConfiguration : IDisposable
+ {
+ private IntPtr _configHandle = IntPtr.Zero;
+ private bool disposed = false;
+ private WiFiEapConfiguration _eapConfig;
+
+ /// <summary>
+ /// The name of access point(AP).
+ /// </summary>
+ public string Name
+ {
+ get
+ {
+ IntPtr strPtr;
+ int ret = Interop.WiFi.Config.GetName(_configHandle, out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get name, Error - " + (WiFiError)ret);
+ return "";
+ }
+ return Marshal.PtrToStringAnsi(strPtr);
+ }
+ }
+ /// <summary>
+ /// The security type of access point(AP).
+ /// </summary>
+ public WiFiSecureType SecurityType
+ {
+ get
+ {
+ int type;
+ int ret = Interop.WiFi.Config.GetSecurityType(_configHandle, out type);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get security type, Error - " + (WiFiError)ret);
+ }
+ return (WiFiSecureType)type;
+ }
+ }
+ /// <summary>
+ /// The proxy address.
+ /// </summary>
+ public string ProxyAddress
+ {
+ get
+ {
+ IntPtr strPtr;
+ int addressFamily;
+ int ret = Interop.WiFi.Config.GetProxyAddress(_configHandle, out addressFamily, out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get proxy address, Error - " + (WiFiError)ret);
+ return "";
+ }
+ return Marshal.PtrToStringAnsi(strPtr);
+ }
+ set
+ {
+ int ret = Interop.WiFi.Config.SetProxyAddress(_configHandle, (int)AddressFamily.Ipv4, value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set proxy address, Error - " + (WiFiError)ret);
+ }
+ }
+ }
+ /// <summary>
+ /// A property check whether the access point(AP) is hidden or not.
+ /// </summary>
+ public bool IsHidden
+ {
+ get
+ {
+ bool hidden;
+ int ret = Interop.WiFi.Config.GetHiddenApProperty(_configHandle, out hidden);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get isHidden, Error - " + (WiFiError)ret);
+ }
+ return hidden;
+ }
+ set
+ {
+ int ret = Interop.WiFi.Config.SetHiddenApProperty(_configHandle, value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set IsHidden, Error - " + (WiFiError)ret);
+ }
+ }
+ }
+ /// <summary>
+ /// The EAP Configuration.
+ /// </summary>
+ public WiFiEapConfiguration EapConfiguration
+ {
+ get
+ {
+ return _eapConfig;
+ }
+ }
+
+ internal WiFiConfiguration(IntPtr handle)
+ {
+ _configHandle = handle;
+ _eapConfig = new WiFiEapConfiguration(_configHandle);
+ }
+
+ public WiFiConfiguration(string name, string passPhrase, WiFiSecureType type)
+ {
+ int ret = Interop.WiFi.Config.Create(name, passPhrase, (int)type, out _configHandle);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to create config handle, Error - " + (WiFiError)ret);
+ }
+ _eapConfig = new WiFiEapConfiguration(_configHandle);
+ }
+
+ ~WiFiConfiguration()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (disposed)
+ return;
+
+ if (disposing)
+ {
+ _eapConfig.Dispose();
+ }
+ Interop.WiFi.Config.Destroy(_configHandle);
+ _configHandle = IntPtr.Zero;
+ disposed = true;
+ }
+
+ internal IntPtr GetHandle()
+ {
+ return _configHandle;
+ }
+ } //WiFiNetworkConfiguratin
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEap.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEap.cs
new file mode 100644
index 0000000..7b0193c
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEap.cs
@@ -0,0 +1,255 @@
+/*
+ * 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.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Runtime.InteropServices;
+
+namespace Tizen.Network.WiFi
+{
+ /// <summary>
+ /// A class for managing the EAP information of access point(AP). It allows applications to manager EAP information.
+ /// This class is not intended to create instance directly from applications.
+ /// </summary>
+ public class WiFiEap : IWiFiEap, IDisposable
+ {
+ private IntPtr _apHandle = IntPtr.Zero;
+ private bool disposed = false;
+
+ /// <summary>
+ /// The file path of CA Certificate of EAP.
+ /// </summary>
+ public string CaCertificationFile
+ {
+ get
+ {
+ IntPtr strPtr;
+ int ret = Interop.WiFi.Ap.GetEapCaCertFile(_apHandle, out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get caCertFile, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ return "";
+ }
+ return Marshal.PtrToStringAnsi(strPtr);
+ }
+ set
+ {
+ int ret = Interop.WiFi.Ap.SetEapCaCertFile(_apHandle, value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set caCertFile, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ }
+ }
+ /// <summary>
+ /// The EAP type of wifi.
+ /// </summary>
+ public WiFiEapType EapType
+ {
+ get
+ {
+ int type;
+ int ret = Interop.WiFi.Ap.GetEapType(_apHandle, out type);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get eap type, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return (WiFiEapType)type;
+ }
+ set
+ {
+ int ret = Interop.WiFi.Ap.SetEapType(_apHandle, (int)value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set eap type, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ }
+ }
+ /// <summary>
+ /// The type of EAP phase2 authentication of Wi-Fi.
+ /// </summary>
+ public WiFiAuthenticationType AuthenticationType
+ {
+ get
+ {
+ int type;
+ int ret = Interop.WiFi.Ap.GetEapAuthType(_apHandle, out type);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get auth type, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return (WiFiAuthenticationType)type;
+ }
+ set
+ {
+ int ret = Interop.WiFi.Ap.SetEapAuthType(_apHandle, (int)value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set eap auth type, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ }
+ }
+
+ internal WiFiEap(IntPtr apHandle)
+ {
+ _apHandle = apHandle;
+ }
+
+ ~WiFiEap()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (disposed)
+ return;
+
+ if (disposing)
+ {
+ // Free managed objects.
+ }
+ _apHandle = IntPtr.Zero;
+ disposed = true;
+ }
+
+ /// <summary>
+ /// Gets the private key file of EAP.
+ /// </summary>
+ /// <returns>The file path of private key.</returns>
+ public string GetPrivateKeyFile()
+ {
+ IntPtr strPtr;
+ int ret = Interop.WiFi.Ap.GetEapPrivateKeyFile(_apHandle, out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get private key file, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle);
+ }
+ return Marshal.PtrToStringAnsi(strPtr);
+ }
+
+ /// <summary>
+ /// Sets the private key information of EAP.
+ /// </summary>
+ /// <param name="privateKeyFile">The file path of private key.</param>
+ /// <param name="password">The password.</param>
+ public void SetPrivateKeyInfo(string privateKeyFile, string password)
+ {
+ int ret = Interop.WiFi.Ap.SetEapPrivateKeyInfo(_apHandle, privateKeyFile, password);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set private key info, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle);
+ }
+ }
+
+ /// <summary>
+ /// Gets the Client Certificate of EAP.
+ /// </summary>
+ /// <returns>The file path of Client Certificate.</returns>
+ public string GetClientCertFile()
+ {
+ IntPtr strPtr;
+ int ret = Interop.WiFi.Ap.GetEapClientCertFile(_apHandle, out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get client cert file, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle);
+ }
+ return Marshal.PtrToStringAnsi(strPtr);
+ }
+
+ /// <summary>
+ /// Sets the CA Certificate of EAP.
+ /// </summary>
+ /// <param name="clientCertFile">The file path of Client Certificate.</param>
+ public void SetClientCertFile(string clientCertFile)
+ {
+ int ret = Interop.WiFi.Ap.SetEapClientCertFile(_apHandle, clientCertFile);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set client cert file, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle);
+ }
+ }
+
+ /// <summary>
+ /// Gets the username of EAP passphrase.
+ /// </summary>
+ /// <returns>The user name</returns>
+ public string GetEapPassphraseUserName()
+ {
+ IntPtr strptr;
+ bool passwordSet;
+ int ret = Interop.WiFi.Ap.GetEapPassphrase(_apHandle, out strptr, out passwordSet);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get user name in eap passphrase, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle);
+ }
+ return Marshal.PtrToStringAnsi(strptr);
+ }
+ /// <summary>
+ /// Returns whether the password is set for not set.
+ /// </summary>
+ /// <returns>ture if password is set, otherwise flase if password is not set.</returns>
+ public bool IsEapPassphrasePasswordSet()
+ {
+ IntPtr strptr;
+ bool passwordSet;
+ int ret = Interop.WiFi.Ap.GetEapPassphrase(_apHandle, out strptr, out passwordSet);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get IsPasswordSet in passphrase, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle);
+ }
+ return passwordSet;
+ }
+
+ /// <summary>
+ /// Sets the passphrase of EAP.
+ /// You can set one of user_name and password as NULL.<br>
+ /// In this case, the value of a parameter which is set as NULL will be the previous value. But it is not allowed that both user_name and password are set as NULL.
+ /// </summary>
+ /// <param name="userName">The user name</param>
+ /// <param name="password">The password</param>
+ public void SetEapPassphrase(string userName, string password)
+ {
+ int ret = Interop.WiFi.Ap.SetEapPassphrase(_apHandle, userName, password);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set passphrase, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle);
+ }
+ }
+ } //WiFiEapInformation
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEapConfiguration.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEapConfiguration.cs
new file mode 100644
index 0000000..2a2175b
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEapConfiguration.cs
@@ -0,0 +1,250 @@
+/*
+ * 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;
+
+namespace Tizen.Network.WiFi
+{
+ /// <summary>
+ /// A class for managing the EAP configuration.
+ /// This class is not intended to create instance directly from applications.
+ /// </summary>
+ public class WiFiEapConfiguration : IWiFiEap, IDisposable
+ {
+ private IntPtr _configHandle = IntPtr.Zero;
+ private bool disposed = false;
+
+ /// <summary>
+ /// The file path of CA Certificate of EAP.
+ /// </summary>
+ public string CaCertificationFile
+ {
+ get
+ {
+ IntPtr strPtr;
+ int ret = Interop.WiFi.Config.GetEapCaCertFile(_configHandle, out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get caCertFile Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
+ }
+ return Marshal.PtrToStringAnsi(strPtr);
+ }
+ set
+ {
+ int ret = Interop.WiFi.Config.SetEapCaCertFile(_configHandle, value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set caCertFile, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
+ }
+ }
+ }
+ /// <summary>
+ /// The EAP type of wifi.
+ /// </summary>
+ public WiFiEapType EapType
+ {
+ get
+ {
+ int type;
+ int ret = Interop.WiFi.Config.GetEapType(_configHandle, out type);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to eap type Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
+ }
+ return (WiFiEapType)type;
+ }
+ set
+ {
+ int ret = Interop.WiFi.Config.SetEapType(_configHandle, (int)value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set eap type, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
+ }
+ }
+ }
+ /// <summary>
+ /// The type of EAP phase2 authentication of Wi-Fi.
+ /// </summary>
+ public WiFiAuthenticationType AuthenticationType
+ {
+ get
+ {
+ int type;
+ int ret = Interop.WiFi.Config.GetEapAuthType(_configHandle, out type);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get auth type Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
+ }
+ return (WiFiAuthenticationType)type;
+ }
+ set
+ {
+ int ret = Interop.WiFi.Config.SetEapAuthType(_configHandle, (int)value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set eap auth type, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
+ }
+ }
+ }
+ /// <summary>
+ /// The anonymous identity of access point(AP).
+ /// </summary>
+ public string AnonymousIdentify
+ {
+ get
+ {
+ IntPtr strPtr;
+ int ret = Interop.WiFi.Config.GetEapAnonymousIdentity(_configHandle, out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get anonymous identify Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
+ return "";
+ }
+ return Marshal.PtrToStringAnsi(strPtr);
+ }
+ set
+ {
+ int ret = Interop.WiFi.Config.SetEapAnonymousIdentity(_configHandle, value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set anonymous identify, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
+ }
+ }
+ }
+ /// <summary>
+ /// The identity of access point(AP).
+ /// </summary>
+ public string Identity
+ {
+ get
+ {
+ IntPtr strPtr;
+ int ret = Interop.WiFi.Config.GetEapIdentity(_configHandle, out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get identify Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
+ return "";
+ }
+ return Marshal.PtrToStringAnsi(strPtr);
+ }
+ set
+ {
+ int ret = Interop.WiFi.Config.SetEapIdentity(_configHandle, value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set identify, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
+ }
+ }
+ }
+ /// <summary>
+ /// The subject match of access point(AP).
+ /// </summary>
+ public string SubjectMatch
+ {
+ get
+ {
+ IntPtr strPtr;
+ int ret = Interop.WiFi.Config.GetEapSubjectMatch(_configHandle, out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get subject match Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
+ return "";
+ }
+ return Marshal.PtrToStringAnsi(strPtr);
+ }
+ set
+ {
+ int ret = Interop.WiFi.Config.SetEapSubjectMatch(_configHandle, value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set subject match, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
+ }
+ }
+ }
+
+ internal WiFiEapConfiguration(IntPtr handle)
+ {
+ _configHandle = handle;
+ }
+
+ ~WiFiEapConfiguration()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (disposed)
+ return;
+
+ if (disposing)
+ {
+ // Free managed objects.
+ }
+ _configHandle = IntPtr.Zero;
+ disposed = true;
+ }
+
+ /// <summary>
+ /// Gets access point client cert file from configuration.
+ /// </summary>
+ /// <returns>The certification authority(CA) certificates file of access point.</returns>
+ public string GetClientCertFile()
+ {
+ IntPtr strPtr;
+ int ret = Interop.WiFi.Config.GetEapClientCertFile(_configHandle, out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get client cert file, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
+ }
+ return Marshal.PtrToStringAnsi(strPtr);
+ }
+ /// <summary>
+ /// Sets access point client cert file to configuration.
+ /// </summary>
+ /// <param name="privateKey">The private key file.</param>
+ /// <param name="clientCert">The certification authority(CA) certificates file of access point.</param>
+ public void SetClientCertFile(string privateKey, string clientCert)
+ {
+ int ret = Interop.WiFi.Config.SetEapClientCertFile(_configHandle, privateKey, clientCert);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set client cert file, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
+ }
+ }
+ } //WiFiEapConfiguration
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEnumerations.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEnumerations.cs
new file mode 100644
index 0000000..1f36d92
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEnumerations.cs
@@ -0,0 +1,161 @@
+/*
+ * 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;
+
+namespace Tizen.Network.WiFi
+{
+ /// <summary>
+ /// Enumeration for Wi-Fi EAP type.
+ /// </summary>
+ public enum WiFiEapType
+ {
+ /// <summary>
+ /// EAP PEAP type
+ /// </summary>
+ Peap = 0,
+ /// <summary>
+ /// EAP TLS type
+ /// </summary>
+ Tls = 1,
+ /// <summary>
+ /// EAP TTLS type
+ /// </summary>
+ Ttls = 2,
+ /// <summary>
+ /// EAP SIM type
+ /// </summary>
+ Sim = 3,
+ /// <summary>
+ /// EAP AKA type
+ /// </summary>
+ Aka = 4
+ }
+ /// <summary>
+ /// Enumeration for Wi-Fi RSSI level.
+ /// </summary>
+ public enum WiFiRssiLevel
+ {
+ /// <summary>
+ /// Level 0
+ /// </summary>
+ Level0 = 0,
+ /// <summary>
+ /// Level 1
+ /// </summary>
+ Level1 = 1,
+ /// <summary>
+ /// Level 2
+ /// </summary>
+ Level2 = 2,
+ /// <summary>
+ /// Level 3
+ /// </summary>
+ Level3 = 3,
+ /// <summary>
+ /// Level 4
+ /// </summary>
+ Level4 = 4
+ }
+ /// <summary>
+ /// Enumeration for Wi-Fi connection state.
+ /// </summary>
+ public enum WiFiConnectionState
+ {
+ /// <summary>
+ /// Connection failed state
+ /// </summary>
+ Failure = -1,
+ /// <summary>
+ /// Disconnected state
+ /// </summary>
+ Disconnected = 0,
+ /// <summary>
+ /// Association state
+ /// </summary>
+ Association = 1,
+ /// <summary>
+ /// Configuration state
+ /// </summary>
+ Congfiguration = 2,
+ /// <summary>
+ /// Connected state
+ /// </summary>
+ Connected = 3
+ }
+ /// <summary>
+ /// Enumeration for Wi-Fi device state.
+ /// </summary>
+ public enum WiFiDeviceState
+ {
+ /// <summary>
+ /// Wi-Fi is Deactivated
+ /// </summary>
+ Deactivated = 0,
+ /// <summary>
+ /// Wi-Fi is activated
+ /// </summary>
+ Activated = 1
+ }
+ /// <summary>
+ /// Enumeration for Wi-Fi proxy type.
+ /// </summary>
+ public enum WiFiProxyType
+ {
+ /// <summary>
+ /// Direct connection
+ /// </summary>
+ Direct = 0,
+ /// <summary>
+ /// Auto configuration(Use PAC file). If URL property is not set, DHCP/WPAD auto-discover will be tried
+ /// </summary>
+ Auto = 1,
+ /// <summary>
+ /// Manual configuration
+ /// </summary>
+ Manual = 2
+ }
+ /// <summary>
+ /// Enumeration for Wi-Fi authentication type.
+ /// </summary>
+ public enum WiFiAuthenticationType
+ {
+ /// <summary>
+ /// EAP phase2 authentication none
+ /// </summary>
+ None = 0,
+ /// <summary>
+ /// EAP phase2 authentication PAP
+ /// </summary>
+ Pap = 1,
+ /// <summary>
+ /// EAP phase2 authentication MSCHAP
+ /// </summary>
+ Mschap = 2,
+ /// <summary>
+ /// EAP phase2 authentication MSCHAPv2
+ /// </summary>
+ Mschapv2 = 3,
+ /// <summary>
+ /// EAP phase2 authentication GTC
+ /// </summary>
+ Gtc = 4,
+ /// <summary>
+ /// EAP phase2 authentication MD5
+ /// </summary>
+ Md5 = 5
+ }
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiErrorFactory.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiErrorFactory.cs
new file mode 100644
index 0000000..687f154
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiErrorFactory.cs
@@ -0,0 +1,85 @@
+/*
+ * 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 Tizen.Internals.Errors;
+
+namespace Tizen.Network.WiFi
+{
+ internal enum WiFiError
+ {
+ None = ErrorCode.None,
+ InvalidParameterError = ErrorCode.InvalidParameter,
+ OutOfMemoryError = ErrorCode.OutOfMemory,
+ InvalidOperationError = ErrorCode.InvalidOperation,
+ AddressFamilyNotSupportedError = ErrorCode.AddressFamilyNotSupported,
+ OperationFailedError = -0x01C50000 | 0x0301,
+ NoConnectionError = -0x01C50000 | 0x0302,
+ NowInProgressError = ErrorCode.NowInProgress,
+ AlreadyExistsError = -0x01C50000 | 0x0303,
+ OperationAbortedError = -0x01C50000 | 0x0304,
+ DhcpFailedError = -0x01C50000 | 0x0306,
+ InvalidKeyError = -0x01C50000 | 0x0307,
+ NoReplyError = -0x01C50000 | 0x0308,
+ SecurityRestrictedError = -0x01C50000 | 0x0309,
+ PermissionDeniedError = ErrorCode.PermissionDenied,
+ NotSupportedError = ErrorCode.NotSupported
+ }
+
+ internal static class WiFiErrorFactory
+ {
+ static internal void ThrowWiFiException(int e)
+ {
+ ThrowExcption(e, false);
+ }
+
+ static internal void ThrowWiFiException(int e, IntPtr handle)
+ {
+ ThrowExcption(e, (handle == IntPtr.Zero));
+ }
+
+ static private void ThrowExcption(int e, bool isHandleNull)
+ {
+ WiFiError err = (WiFiError)e;
+ if (err == WiFiError.NotSupportedError)
+ {
+ throw new NotSupportedException("Not Supported");
+ }
+
+ if (isHandleNull)
+ {
+ if (err == WiFiError.InvalidParameterError || err == WiFiError.InvalidKeyError)
+ {
+ throw new ArgumentException(err.ToString());
+ }
+ else
+ {
+ throw new InvalidOperationException("Invalid instance (object may have been disposed or released)");
+ }
+ }
+
+ if (err == WiFiError.InvalidParameterError || err == WiFiError.InvalidKeyError)
+ {
+ throw new ArgumentException(err.ToString());
+ }
+ else
+ {
+ throw new InvalidOperationException(err.ToString());
+ }
+ }
+
+ }
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs
new file mode 100644
index 0000000..dd8b65a
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs
@@ -0,0 +1,260 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Tizen.Network.WiFi
+{
+ /// <summary>
+ /// A manager class which allows applications to connect to a Wireless Local Area Network (WLAN) and to transfer data over the network.<br>
+ /// The Wi-Fi Manager enables your application to activate and deactivate a local Wi-Fi device, and to connect to a WLAN network in the infrastructure mode.
+ /// </summary>
+ static public class WiFiManager
+ {
+ /// <summary>
+ /// The local MAC address.
+ /// </summary>
+ static public string MacAddress
+ {
+ get
+ {
+ return WiFiManagerImpl.Instance.MacAddress;
+ }
+ }
+ /// <summary>
+ /// The name of the network interface.
+ /// </summary>
+ static public string InterfaceName
+ {
+ get
+ {
+ return WiFiManagerImpl.Instance.InterfaceName;
+ }
+ }
+ /// <summary>
+ /// The networtk connection state.
+ /// </summary>
+ static public WiFiConnectionState ConnectionState
+ {
+ get
+ {
+ return WiFiManagerImpl.Instance.ConnectionState;
+ }
+ }
+ /// <summary>
+ /// A property to Check whether Wi-Fi is activated.
+ /// </summary>
+ static public bool IsActivated
+ {
+ get
+ {
+ return WiFiManagerImpl.Instance.IsActivated;
+ }
+ }
+
+ /// <summary>
+ /// (event) DeviceStateChanged is raised when the device state is changed.
+ /// </summary>
+ static public event EventHandler<DeviceStateChangedEventArgs> DeviceStateChanged
+ {
+ add
+ {
+ WiFiManagerImpl.Instance.DeviceStateChanged += value;
+ }
+ remove
+ {
+ WiFiManagerImpl.Instance.DeviceStateChanged -= value;
+ }
+ }
+ /// <summary>
+ /// (event) ConnectionStateChanged is rasied when the connection state is changed.
+ /// </summary>
+ static public event EventHandler<ConnectionStateChangedEventArgs> ConnectionStateChanged
+ {
+ add
+ {
+ WiFiManagerImpl.Instance.ConnectionStateChanged += value;
+ }
+ remove
+ {
+ WiFiManagerImpl.Instance.ConnectionStateChanged -= value;
+ }
+ }
+ /// <summary>
+ /// (event) RssiLevelChanged is rasied when the RSSI of connected Wi-Fi is changed.
+ /// </summary>
+ static public event EventHandler<RssiLevelChangedEventArgs> RssiLevelChanged
+ {
+ add
+ {
+ WiFiManagerImpl.Instance.RssiLevelChanged += value;
+ }
+ remove
+ {
+ WiFiManagerImpl.Instance.RssiLevelChanged -= value;
+ }
+ }
+ /// <summary>
+ /// (event) BackgroundScanFinished is rasied when the background scan is finished.
+ /// The background scan starts automatically when wifi is activated. The callback will be invoked periodically.
+ /// </summary>
+ static public event EventHandler BackgroundScanFinished
+ {
+ add
+ {
+ WiFiManagerImpl.Instance.BackgroundScanFinished += value;
+ }
+ remove
+ {
+ WiFiManagerImpl.Instance.BackgroundScanFinished -= value;
+ }
+ }
+ /// <summary>
+ /// Gets the result of the scan asynchronously.
+ /// </summary>
+ /// <returns> A task contains the lisf for WiFiApInformation objects.</returns>
+ static public IEnumerable<WiFiAp> GetFoundAps()
+ {
+ return WiFiManagerImpl.Instance.GetFoundAps();
+ }
+ /// <summary>
+ /// Gets the result of specific ap scan asynchronously.
+ /// </summary>
+ /// <returns> A task contains the WiFiApInformation object.</returns>
+ static public IEnumerable<WiFiAp> GetFoundSpecificAps()
+ {
+ return WiFiManagerImpl.Instance.GetFoundSpecificAps();
+ }
+ /// <summary>
+ /// Gets the list of wifi configuration.
+ /// </summary>
+ /// <returns>A task contains the lisf for WiFiConfiguration objects.</returns>
+ static public IEnumerable<WiFiConfiguration> GetWiFiConfigurations()
+ {
+ return WiFiManagerImpl.Instance.GetWiFiConfigurations();
+ }
+ /// <summary>
+ /// Saves Wi-Fi configuration of access point.
+ /// </summary>
+ /// <param name="configuration">The configuration to be stored</param>
+ static public void SaveWiFiNetworkConfiguration(WiFiConfiguration configuration)
+ {
+ WiFiManagerImpl.Instance.SaveWiFiNetworkConfiguration(configuration);
+ }
+ /// <summary>
+ /// Gets the handle of the connected access point.
+ /// </summary>
+ /// <returns> The connected wifi access point(AP) information.</returns>
+ static public WiFiAp GetConnectedAp()
+ {
+ return WiFiManagerImpl.Instance.GetConnectedAp();
+
+ }
+ /// <summary>
+ /// Deletes the information of stored access point and disconnects it when it connected.<br>
+ /// If an AP is connected, then connection information will be stored. This information is used when a connection to that AP is established automatically.
+ /// </summary>
+ /// <param name="ap">The access point to be removed</param>
+ static public void RemoveAP(WiFiAp ap)
+ {
+ WiFiManagerImpl.Instance.RemoveAp(ap);
+ }
+ /// <summary>
+ /// Activates Wi-Fi asynchronously.
+ /// </summary>
+ /// <returns> A task indicates whether the Activate method is done or not.</returns>
+ static public Task ActivateAsync()
+ {
+
+ return WiFiManagerImpl.Instance.ActivateAsync();
+ }
+ /// <summary>
+ /// Activates Wi-Fi asynchronously and displays Wi-Fi picker (popup) when Wi-Fi is not automatically connected.
+ /// </summary>
+ /// <returns> A task indicates whether the ActivateWithPickerTeated method is done or not.</returns>
+ static public Task ActivateWithPickerTeatedAsync()
+ {
+ return WiFiManagerImpl.Instance.ActivateWithWiFiPickerTestedAsync();
+ }
+ /// <summary>
+ /// Deactivates Wi-Fi asynchronously.
+ /// </summary>
+ /// <returns> A task indicates whether the Deactivate method is done or not.</returns>
+ static public Task DeactivateAsync()
+ {
+ return WiFiManagerImpl.Instance.DeactivateAsync();
+ }
+ /// <summary>
+ /// Starts scan asynchronously.
+ /// </summary>
+ /// <returns> A task indicates whether the Scan method is done or not.</returns>
+ static public Task ScanAsync()
+ {
+ Log.Debug(Globals.LogTag, "ScanAsync");
+ return WiFiManagerImpl.Instance.ScanAsync();
+ }
+ /// <summary>
+ /// Starts specific ap scan, asynchronously.
+ /// </summary>
+ /// <returns> A task contains WiFiApInformation object.</returns>
+ /// <param name="essid">The essid of hidden ap</param>
+ static public Task ScanSpecificApAsync(string essid)
+ {
+ return WiFiManagerImpl.Instance.ScanSpecificApAsync(essid);
+ }
+ /// <summary>
+ /// Connects the access point asynchronously.
+ /// </summary>
+ /// <param name="ap">The access point</param>
+ /// <returns> A task indicates whether the Connect method is done or not.</returns>
+ static public Task ConnectAsync(WiFiAp ap)
+ {
+ Log.Debug(Globals.LogTag, "ConnectAsync");
+ return WiFiManagerImpl.Instance.ConnectAsync(ap);
+ }
+ /// <summary>
+ /// Connects the access point with WPS PBC asynchronously.
+ /// </summary>
+ /// <returns> A task indicates whether the ConnectByWpsPbs method is done or not.</returns>
+ /// <param name="ap">The access point(AP)</param>
+ static public Task ConnectByWpsPbcAsync(WiFiAp ap)
+ {
+ Log.Debug(Globals.LogTag, "ConnectByWpsPbcAsync");
+ return WiFiManagerImpl.Instance.ConnectByWpsPbcAsync(ap);
+ }
+ /// <summary>
+ /// Connects the access point with WPS PIN asynchronously.
+ /// </summary>
+ /// <returns> A task indicates whether the ConnectByWpsPin method is done or not.</returns>
+ /// <param name="ap">The access point(AP)</param>
+ /// <param name="pin">The WPS PIN is a non-NULL string with length greater than 0 and less than or equal to 8.</param>
+ static public Task ConnectByWpsPinAsync(WiFiAp ap, string pin)
+ {
+ Log.Debug(Globals.LogTag, "ConnectByWpsPinAsync");
+ return WiFiManagerImpl.Instance.ConnectByWpsPinAsync(ap, pin);
+ }
+ /// <summary>
+ /// Disconnects the access point asynchronously.
+ /// </summary>
+ /// <returns> A task indicates whether the Disconnect method is done or not.</returns>
+ static public Task DisconnectAsync(WiFiAp ap)
+ {
+ return WiFiManagerImpl.Instance.DisconnectAsync(ap);
+ }
+ }
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs
new file mode 100644
index 0000000..7ea0a01
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs
@@ -0,0 +1,564 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Tizen.Network.WiFi
+{
+ static internal class Globals
+ {
+ internal const string LogTag = "Tizen.Network.WiFi";
+ }
+
+ internal partial class WiFiManagerImpl : IDisposable
+ {
+ private static readonly WiFiManagerImpl _instance = new WiFiManagerImpl();
+ private Dictionary<IntPtr, Interop.WiFi.VoidCallback> _callback_map = new Dictionary<IntPtr, Interop.WiFi.VoidCallback>();
+ private int _requestId = 0;
+ private string _macAddress;
+ private bool disposed = false;
+
+ internal string MacAddress
+ {
+ get
+ {
+ if (String.IsNullOrEmpty(_macAddress))
+ {
+ string address;
+ int ret = Interop.WiFi.GetMacAddress(out address);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get mac address, Error - " + (WiFiError)ret);
+ _macAddress = "";
+ }
+ else
+ {
+ _macAddress = address;
+ }
+ }
+ return _macAddress;
+ }
+ }
+ internal string InterfaceName
+ {
+ get
+ {
+ string name;
+ int ret = Interop.WiFi.GetNetworkInterfaceName(out name);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get interface name, Error - " + (WiFiError)ret);
+ return "";
+ }
+ return name;
+ }
+ }
+ internal WiFiConnectionState ConnectionState
+ {
+ get
+ {
+ int state;
+ int ret = Interop.WiFi.GetConnectionState(out state);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get connection state, Error - " + (WiFiError)ret);
+ return WiFiConnectionState.Failure;
+ }
+ return (WiFiConnectionState)state;
+ }
+ }
+ internal bool IsActivated
+ {
+ get
+ {
+ bool active;
+ int ret = Interop.WiFi.IsActivated(out active);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get isActive, Error - " + (WiFiError)ret);
+ }
+ return active;
+ }
+ }
+
+ internal static WiFiManagerImpl Instance
+ {
+ get
+ {
+ return _instance;
+ }
+ }
+
+ private WiFiManagerImpl()
+ {
+ initialize();
+ }
+
+ ~WiFiManagerImpl()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (disposed)
+ return;
+
+ if (disposing)
+ {
+ // Free managed objects.
+ }
+ //Free unmanaged objects
+ deinitialize();
+ RemoveAllRegisteredEvent();
+ disposed = true;
+ }
+
+ private void initialize()
+ {
+ int ret = Interop.WiFi.Initialize();
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to initialize wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ string address;
+ ret = Interop.WiFi.GetMacAddress(out address);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get mac address, Error - " + (WiFiError)ret);
+ _macAddress = "";
+ }
+ _macAddress = address;
+ }
+
+ private void deinitialize()
+ {
+ int ret = Interop.WiFi.Deinitialize();
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to deinitialize wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ }
+
+ internal IEnumerable<WiFiAp> GetFoundAps()
+ {
+ List<WiFiAp> apList = new List<WiFiAp>();
+ Interop.WiFi.HandleCallback callback = (IntPtr apHandle, IntPtr userData) =>
+ {
+ if (apHandle != IntPtr.Zero)
+ {
+ IntPtr clonedHandle;
+ Interop.WiFi.Ap.Clone(out clonedHandle, apHandle);
+ WiFiAp apItem = new WiFiAp(clonedHandle);
+ apList.Add(apItem);
+ return true;
+ }
+ return false;
+ };
+
+ int ret = Interop.WiFi.GetForeachFoundAps(callback, IntPtr.Zero);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get all APs, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+
+ return apList;
+ }
+
+ internal IEnumerable<WiFiAp> GetFoundSpecificAps()
+ {
+ List<WiFiAp> apList = new List<WiFiAp>();
+ Interop.WiFi.HandleCallback callback = (IntPtr apHandle, IntPtr userData) =>
+ {
+ if (apHandle != IntPtr.Zero)
+ {
+ IntPtr clonedHandle;
+ Interop.WiFi.Ap.Clone(out clonedHandle, apHandle);
+ WiFiAp apItem = new WiFiAp(clonedHandle);
+ apList.Add(apItem);
+ return true;
+ }
+ return false;
+
+ };
+
+ int ret = Interop.WiFi.GetForeachFoundSpecificAps(callback, IntPtr.Zero);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get specific APs, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+
+ return apList;
+ }
+
+ internal IEnumerable<WiFiConfiguration> GetWiFiConfigurations()
+ {
+ List<WiFiConfiguration> configList = new List<WiFiConfiguration>();
+ Interop.WiFi.HandleCallback callback = (IntPtr configHandle, IntPtr userData) =>
+ {
+ if (configHandle != IntPtr.Zero)
+ {
+ IntPtr clonedConfig;
+ Interop.WiFi.Config.Clone(configHandle, out clonedConfig);
+ WiFiConfiguration configItem = new WiFiConfiguration(clonedConfig);
+ configList.Add(configItem);
+ return true;
+ }
+ return false;
+ };
+
+ int ret = Interop.WiFi.Config.GetForeachConfiguration(callback, IntPtr.Zero);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get configurations, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+
+ return configList;
+ }
+
+ internal void SaveWiFiNetworkConfiguration(WiFiConfiguration config)
+ {
+ IntPtr configHandle = config.GetHandle();
+ int ret = Interop.WiFi.Config.SaveConfiguration(configHandle);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to save configuration, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ }
+
+ internal WiFiAp GetConnectedAp()
+ {
+ IntPtr apHandle;
+
+ int ret = Interop.WiFi.GetConnectedAp(out apHandle);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to connect with AP, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ WiFiAp ap = new WiFiAp(apHandle);
+ return ap;
+ }
+
+ internal void RemoveAp(WiFiAp ap)
+ {
+ IntPtr apHandle = ap.GetHandle();
+ int ret = Interop.WiFi.RemoveAp(apHandle);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to remove with AP, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ }
+
+ internal Task ActivateAsync()
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id;
+ lock (_callback_map)
+ {
+ id = (IntPtr)_requestId++;
+ _callback_map[id] = (error, key) =>
+ {
+ Log.Debug(Globals.LogTag, "wifi activated");
+ if (error != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Error occurs during WiFi activating, " + (WiFiError)error);
+ task.SetException(new InvalidOperationException("Error occurs during WiFi activating, " + (WiFiError)error));
+ }
+ task.SetResult(true);
+ lock (_callback_map)
+ {
+ _callback_map.Remove(key);
+ }
+ };
+ }
+ int ret = Interop.WiFi.Activate(_callback_map[id], id);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to activate wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return task.Task;
+ }
+
+ internal Task ActivateWithWiFiPickerTestedAsync()
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id;
+ lock (_callback_map)
+ {
+ id = (IntPtr)_requestId++;
+ _callback_map[id] = (error, key) =>
+ {
+ Log.Debug(Globals.LogTag, "Activation finished");
+ if (error != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Error occurs during WiFi activating, " + (WiFiError)error);
+ task.SetException(new InvalidOperationException("Error occurs during WiFi activating, " + (WiFiError)error));
+ }
+ task.SetResult(true);
+ lock (_callback_map)
+ {
+ _callback_map.Remove(key);
+ }
+ };
+ }
+ int ret = Interop.WiFi.ActivateWithWiFiPickerTested(_callback_map[id], id);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to activate wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return task.Task;
+ }
+
+ internal Task DeactivateAsync()
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id;
+ lock (_callback_map)
+ {
+ id = (IntPtr)_requestId++;
+ _callback_map[id] = (error, key) =>
+ {
+ Log.Debug(Globals.LogTag, "Deactivation finished");
+ if (error != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Error occurs during WiFi deactivating, " + (WiFiError)error);
+ task.SetException(new InvalidOperationException("Error occurs during WiFi deactivating, " + (WiFiError)error));
+ }
+ task.SetResult(true);
+ lock (_callback_map)
+ {
+ _callback_map.Remove(key);
+ }
+ };
+ }
+ int ret = Interop.WiFi.Deactivate(_callback_map[id], id);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to deactivate wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return task.Task;
+ }
+
+ internal Task ScanAsync()
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id;
+ lock (_callback_map)
+ {
+ id = (IntPtr)_requestId++;
+ _callback_map[id] = (error, key) =>
+ {
+ Log.Debug(Globals.LogTag, "Scanning finished");
+ if (error != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Error occurs during WiFi scanning, " + (WiFiError)error);
+ task.SetException(new InvalidOperationException("Error occurs during WiFi scanning, " + (WiFiError)error));
+ }
+ task.SetResult(true);
+ lock (_callback_map)
+ {
+ _callback_map.Remove(key);
+ }
+ };
+ }
+ int ret = Interop.WiFi.Scan(_callback_map[id], id);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to scan all AP, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return task.Task;
+ }
+
+ internal Task ScanSpecificApAsync(string essid)
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id;
+ lock (_callback_map)
+ {
+ id = (IntPtr)_requestId++;
+ _callback_map[id] = (error, key) =>
+ {
+ Log.Debug(Globals.LogTag, "Scanning with specific AP finished");
+ if (error != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Error occurs during WiFi scanning, " + (WiFiError)error);
+ task.SetException(new InvalidOperationException("Error occurs during WiFi scanning, " + (WiFiError)error));
+ }
+ task.SetResult(true);
+ lock (_callback_map)
+ {
+ _callback_map.Remove(key);
+ }
+ };
+ }
+ int ret = Interop.WiFi.ScanSpecificAp(essid, _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to scan with specific AP, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return task.Task;
+ }
+
+ internal Task ConnectAsync(WiFiAp ap)
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id;
+ lock (_callback_map)
+ {
+ id = (IntPtr)_requestId++;
+ _callback_map[id] = (error, key) =>
+ {
+ Log.Debug(Globals.LogTag, "Connecting finished : " + (WiFiError)error);
+ if (error != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Error occurs during WiFi connecting, " + (WiFiError)error);
+ task.SetException(new InvalidOperationException("Error occurs during WiFi connecting, " + (WiFiError)error));
+ }
+ task.SetResult(true);
+ lock (_callback_map)
+ {
+ _callback_map.Remove(key);
+ }
+ };
+ }
+ IntPtr apHandle = ap.GetHandle();
+ int ret = Interop.WiFi.Connect(apHandle, _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return task.Task;
+ }
+
+ internal Task DisconnectAsync(WiFiAp ap)
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id;
+ lock (_callback_map)
+ {
+ id = (IntPtr)_requestId++;
+ _callback_map[id] = (error, key) =>
+ {
+ Log.Debug(Globals.LogTag, "Disconnecting finished");
+ if (error != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Error occurs during WiFi disconnecting, " + (WiFiError)error);
+ task.SetException(new InvalidOperationException("Error occurs during WiFi disconnecting, " + (WiFiError)error));
+ }
+ task.SetResult(true);
+ lock (_callback_map)
+ {
+ _callback_map.Remove(key);
+ }
+ };
+ }
+ IntPtr apHandle = ap.GetHandle();
+ int ret = Interop.WiFi.Disconnect(apHandle, _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to disconnect wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return task.Task;
+ }
+
+ internal Task ConnectByWpsPbcAsync(WiFiAp ap)
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id;
+ lock (_callback_map)
+ {
+ id = (IntPtr)_requestId++;
+ _callback_map[id] = (error, key) =>
+ {
+ Log.Debug(Globals.LogTag, "Connecting by WPS PBC finished");
+ if (error != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Error occurs during WiFi connecting, " + (WiFiError)error);
+ task.SetException(new InvalidOperationException("Error occurs during WiFi connecting, " + (WiFiError)error));
+ }
+ task.SetResult(true);
+ lock (_callback_map)
+ {
+ _callback_map.Remove(key);
+ }
+ };
+ }
+ IntPtr apHandle = ap.GetHandle();
+ int ret = Interop.WiFi.ConnectByWpsPbc(apHandle, _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return task.Task;
+ }
+
+ internal Task ConnectByWpsPinAsync(WiFiAp ap, string pin)
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id;
+ lock (_callback_map)
+ {
+ id = (IntPtr)_requestId++;
+ _callback_map[id] = (error, key) =>
+ {
+ Log.Debug(Globals.LogTag, "Connecting by WPS PIN finished");
+ if (error != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Error occurs during WiFi connecting, " + (WiFiError)error);
+ task.SetException(new InvalidOperationException("Error occurs during WiFi connecting, " + (WiFiError)error));
+ }
+ task.SetResult(true);
+ lock (_callback_map)
+ {
+ _callback_map.Remove(key);
+ }
+ };
+ }
+ IntPtr apHandle = ap.GetHandle();
+ int ret = Interop.WiFi.ConnectByWpsPin(apHandle, pin, _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return task.Task;
+ }
+ }
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetwork.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetwork.cs
new file mode 100644
index 0000000..c80e03a
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetwork.cs
@@ -0,0 +1,286 @@
+/*
+ * 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.Collections.Generic;
+using System.Net;
+using System.Runtime.InteropServices;
+using Tizen.Network.Connection;
+
+namespace Tizen.Network.WiFi
+{
+ /// <summary>
+ /// A class for managing the Wi-Fi information. It allows applications to manager network information.
+ /// This class is not intended to create instance directly from applications.
+ /// </summary>
+ public class WiFiNetwork : IDisposable
+ {
+ private IntPtr _apHandle = IntPtr.Zero;
+ private IAddressInformation _ipv4;
+ private IAddressInformation _ipv6;
+ private bool disposed = false;
+ private string _essid;
+
+ /// <summary>
+ /// The Extended Service Set Identifier(ESSID).
+ /// </summary>
+ public string Essid
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(_essid))
+ {
+ IntPtr strPtr;
+ int ret = Interop.WiFi.Ap.GetEssid(_apHandle, out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get essid, Error - " + (WiFiError)ret);
+ _essid = "";
+ }
+ else
+ {
+ _essid = Marshal.PtrToStringAnsi(strPtr);
+ }
+ }
+ return _essid;
+ }
+ }
+ /// <summary>
+ /// The Basic Service Set Identifier(BSSID).
+ /// </summary>
+ public string Bssid
+ {
+ get
+ {
+ IntPtr strPtr;
+ int ret = Interop.WiFi.Ap.GetBssid(_apHandle, out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get bssid, Error - " + (WiFiError)ret);
+ return "";
+ }
+ return Marshal.PtrToStringAnsi(strPtr);
+ }
+ }
+ /// <summary>
+ /// The address informaiton for Ipv4.
+ /// </summary>
+ public IAddressInformation Ipv4Setting
+ {
+ get
+ {
+ return _ipv4;
+ }
+ }
+ /// <summary>
+ /// The address ainformation for Ipv6.
+ /// </summary>
+ public IAddressInformation Ipv6Setting
+ {
+ get
+ {
+ return _ipv6;
+ }
+ }
+ /// <summary>
+ /// The proxy address.
+ /// </summary>
+ public string ProxyAddress
+ {
+ get
+ {
+ IntPtr strPtr;
+ int ret = Interop.WiFi.Ap.GetProxyAddress(_apHandle, (int)AddressFamily.Ipv4, out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get proxy address, Error - " + (WiFiError)ret);
+ return "";
+ }
+ return Marshal.PtrToStringAnsi(strPtr);
+ }
+ set
+ {
+ int ret = Interop.WiFi.Ap.SetProxyAddress(_apHandle, (int)AddressFamily.Ipv4, value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set proxy address, Error - " + (WiFiError)ret);
+ }
+ }
+ }
+ /// <summary>
+ /// The proxy type(Ipv6).
+ /// </summary>
+ public WiFiProxyType ProxyType
+ {
+ get
+ {
+ int type;
+ int ret = Interop.WiFi.Ap.GetProxyType(_apHandle, out type);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get proxy type, Error - " + (WiFiError)ret);
+ }
+ return (WiFiProxyType)type;
+ }
+ set
+ {
+ int ret = Interop.WiFi.Ap.SetProxyType(_apHandle, (int)value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set proxy type, Error - " + (WiFiError)ret);
+ }
+ }
+ }
+ /// <summary>
+ /// The frequency band(MHz).
+ /// </summary>
+ public int Frequency
+ {
+ get
+ {
+ int freq;
+ int ret = Interop.WiFi.Ap.GetFrequency(_apHandle, out freq);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get frequency, Error - " + (WiFiError)ret);
+ }
+ return freq;
+ }
+ }
+ /// <summary>
+ /// The Received signal strength indication(RSSI).
+ /// </summary>
+ public int Rssi
+ {
+ get
+ {
+ int rssi;
+ int ret = Interop.WiFi.Ap.GetRssi(_apHandle, out rssi);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get rssi, Error - " + (WiFiError)ret);
+ }
+ return rssi;
+ }
+ }
+ /// <summary>
+ /// Rhe max speed (Mbps).
+ /// </summary>
+ public int MaxSpeed
+ {
+ get
+ {
+ int maxSpeed;
+ int ret = Interop.WiFi.Ap.GetMaxSpeed(_apHandle, out maxSpeed);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get max speed, Error - " + (WiFiError)ret);
+ }
+ return maxSpeed;
+ }
+ }
+ /// <summary>
+ /// A property to check whether the access point is favorite or not.
+ /// </summary>
+ public bool IsFavorite
+ {
+ get
+ {
+ bool isFavorite;
+ int ret = Interop.WiFi.Ap.IsFavorite(_apHandle, out isFavorite);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get favorite, Error - " + (WiFiError)ret);
+ }
+ return isFavorite;
+ }
+ }
+ /// <summary>
+ /// A property to check whether the access point is passpoint or not.
+ /// </summary>
+ public bool IsPasspoint
+ {
+ get
+ {
+ bool isPasspoint;
+ Log.Debug(Globals.LogTag, "Handle: " + _apHandle);
+ int ret = Interop.WiFi.Ap.IsPasspoint(_apHandle, out isPasspoint);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get isPassport, Error - " + (WiFiError)ret);
+ }
+ return isPasspoint;
+ }
+ }
+ /// <summary>
+ /// The connection state.
+ /// </summary>
+ public WiFiConnectionState ConnectionState
+ {
+ get
+ {
+ int state;
+ int ret = Interop.WiFi.Ap.GetConnectionState(_apHandle, out state);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get connection state, Error - " + (WiFiError)ret);
+ }
+ return (WiFiConnectionState)state;
+ }
+ }
+
+ internal WiFiNetwork(IntPtr apHandle)
+ {
+ _apHandle = apHandle;
+ _ipv4 = AddressFactory.CreateAddressInformation(apHandle, AddressFamily.Ipv4, AddressInformationType.WiFi);
+ _ipv6 = AddressFactory.CreateAddressInformation(apHandle, AddressFamily.Ipv6, AddressInformationType.WiFi);
+
+ IntPtr strPtr;
+ int ret = Interop.WiFi.Ap.GetEssid(_apHandle, out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get essid, Error - " + (WiFiError)ret);
+ }
+ _essid = Marshal.PtrToStringAnsi(strPtr);
+ }
+
+ ~WiFiNetwork()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (disposed)
+ return;
+
+ if (disposing)
+ {
+ _ipv4.Dispose();
+ _ipv6.Dispose();
+ }
+ _apHandle = IntPtr.Zero;
+ disposed = true;
+ }
+
+ } //WiFiNetworkInformation
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetworkChange.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetworkChange.cs
new file mode 100644
index 0000000..917d420
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetworkChange.cs
@@ -0,0 +1,254 @@
+/*
+ * 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.Threading.Tasks;
+
+namespace Tizen.Network.WiFi
+{
+ internal static class EventHandlerExtension
+ {
+ internal static void SafeInvoke(this EventHandler evt, object sender, EventArgs e)
+ {
+ var handler = evt;
+ if (handler != null)
+ {
+ handler(sender, e);
+ }
+ }
+ internal static void SafeInvoke<T>(this EventHandler<T> evt, object sender, T e) where T : EventArgs
+ {
+ var handler = evt;
+ if (handler != null)
+ {
+ handler(sender, e);
+ }
+ }
+ }
+
+ internal partial class WiFiManagerImpl
+ {
+ private event EventHandler<DeviceStateChangedEventArgs> _deviceStateChanged;
+ private event EventHandler<ConnectionStateChangedEventArgs> _connectionStateChanged;
+ private event EventHandler<RssiLevelChangedEventArgs> _rssiLevelChanged;
+ private event EventHandler _backgroundScanFinished;
+
+ private Interop.WiFi.DeviceStateChangedCallback _deviceChangedCallback;
+ private Interop.WiFi.ConnectionStateChangedCallback _connectionChangedCallback;
+ private Interop.WiFi.RssiLevelChangedCallback _rssiChangedCallback;
+ private Interop.WiFi.VoidCallback _backgroundScanFinishedCallback;
+
+ internal event EventHandler<DeviceStateChangedEventArgs> DeviceStateChanged
+ {
+ add
+ {
+ if (_deviceStateChanged == null)
+ {
+ RegisterDeviceStateChangedEvent();
+ }
+ _deviceStateChanged += value;
+ }
+ remove
+ {
+ _deviceStateChanged -= value;
+ if (_deviceStateChanged == null)
+ {
+ UnregisterDeviceStateChangedEvent();
+ }
+ }
+ }
+
+ internal event EventHandler<ConnectionStateChangedEventArgs> ConnectionStateChanged
+ {
+ add
+ {
+ if (_connectionStateChanged == null)
+ {
+ RegisterConnectionStateChangedEvent();
+ }
+ _connectionStateChanged += value;
+ }
+ remove
+ {
+ _connectionStateChanged -= value;
+ if (_connectionStateChanged == null)
+ {
+ UnregisterConnectionStateChangedEvent();
+ }
+ }
+ }
+
+ internal event EventHandler<RssiLevelChangedEventArgs> RssiLevelChanged
+ {
+ add
+ {
+ if (_rssiLevelChanged == null)
+ {
+ RegisterRssiLevelChangedEvent();
+ }
+ _rssiLevelChanged += value;
+ }
+ remove
+ {
+ _rssiLevelChanged -= value;
+ if (_rssiLevelChanged == null)
+ {
+ UnregisterRssiLevelChangedEvent();
+ }
+ }
+ }
+
+ internal event EventHandler BackgroundScanFinished
+ {
+ add
+ {
+ if (_backgroundScanFinished == null)
+ {
+ RegisterBackgroundScanFinishedEvent();
+ }
+ _backgroundScanFinished += value;
+ }
+ remove
+ {
+ _backgroundScanFinished -= value;
+ if (_backgroundScanFinished == null)
+ {
+ UnregisterBackgroundScanFinishedEvent();
+ }
+ }
+ }
+
+ internal void RemoveAllRegisteredEvent()
+ {
+ //unregister all remaining events when this object is released.
+ if (_deviceStateChanged != null)
+ {
+ UnregisterDeviceStateChangedEvent();
+ }
+
+ if (_connectionStateChanged != null)
+ {
+ UnregisterConnectionStateChangedEvent();
+ }
+
+ if (_rssiLevelChanged != null)
+ {
+ UnregisterRssiLevelChangedEvent();
+ }
+
+ if (_backgroundScanFinished != null)
+ {
+ UnregisterBackgroundScanFinishedEvent();
+ }
+ }
+
+ private void RegisterDeviceStateChangedEvent()
+ {
+ _deviceChangedCallback = (int deviceState, IntPtr userDate) =>
+ {
+ WiFiDeviceState state = (WiFiDeviceState)deviceState;
+ DeviceStateChangedEventArgs e = new DeviceStateChangedEventArgs(state);
+ _deviceStateChanged.SafeInvoke(null, e);
+ };
+ int ret = Interop.WiFi.SetDeviceStateChangedCallback(_deviceChangedCallback, IntPtr.Zero);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set device state changed callback, Error - " + (WiFiError)ret);
+ }
+ }
+
+ private void UnregisterDeviceStateChangedEvent()
+ {
+ int ret = Interop.WiFi.UnsetDeviceStateChangedCallback();
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to unset device state changed callback, Error - " + (WiFiError)ret);
+ }
+ }
+
+ private void RegisterConnectionStateChangedEvent()
+ {
+ _connectionChangedCallback = (int connectionState, IntPtr ap, IntPtr userDate) =>
+ {
+ WiFiConnectionState state = (WiFiConnectionState)connectionState;
+ ConnectionStateChangedEventArgs e = new ConnectionStateChangedEventArgs(state, ap);
+ _connectionStateChanged.SafeInvoke(null, e);
+ };
+ int ret = Interop.WiFi.SetConnectionStateChangedCallback(_connectionChangedCallback, IntPtr.Zero);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set copnnection state changed callback, Error - " + (WiFiError)ret);
+ }
+ }
+
+ private void UnregisterConnectionStateChangedEvent()
+ {
+ int ret = Interop.WiFi.UnsetConnectionStateChangedCallback();
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to unset device state changed callback, Error - " + (WiFiError)ret);
+ }
+ }
+
+ private void RegisterRssiLevelChangedEvent()
+ {
+
+ _rssiChangedCallback = (int rssiLevel, IntPtr userDate) =>
+ {
+ WiFiRssiLevel level = (WiFiRssiLevel)rssiLevel;
+ RssiLevelChangedEventArgs e = new RssiLevelChangedEventArgs(level);
+ _rssiLevelChanged.SafeInvoke(null, e);
+ };
+ int ret = Interop.WiFi.SetRssiLevelchangedCallback(_rssiChangedCallback, IntPtr.Zero);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set rssi level changed callback, Error - " + (WiFiError)ret);
+ }
+ }
+
+ private void UnregisterRssiLevelChangedEvent()
+ {
+ int ret = Interop.WiFi.UnsetRssiLevelchangedCallback();
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to unset rssi level changed callback, Error - " + (WiFiError)ret);
+ }
+ }
+
+ private void RegisterBackgroundScanFinishedEvent()
+ {
+ _backgroundScanFinishedCallback = (int result, IntPtr userDate) =>
+ {
+ EventArgs e = new EventArgs();
+ _backgroundScanFinished.SafeInvoke(null, e);
+ };
+ int ret = Interop.WiFi.SetBackgroundScanCallback(_backgroundScanFinishedCallback, IntPtr.Zero);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set background scan callback, Error - " + (WiFiError)ret);
+ }
+ }
+
+ private void UnregisterBackgroundScanFinishedEvent()
+ {
+ int ret = Interop.WiFi.UnsetBackgroundScanCallback();
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to unset background scan callback, Error - " + (WiFiError)ret);
+ }
+ }
+ }
+}
diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiSecurity.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiSecurity.cs
new file mode 100644
index 0000000..c35ba5a
--- /dev/null
+++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiSecurity.cs
@@ -0,0 +1,173 @@
+/*
+ * 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 Tizen.Network.Connection;
+
+namespace Tizen.Network.WiFi
+{
+ /// <summary>
+ /// A class for managing the security information. It allows applications to manager security information.
+ /// This class is not intended to create instance directly from applications.
+ /// </summary>
+ public class WiFiSecurity : IDisposable
+ {
+ private IntPtr _apHandle = IntPtr.Zero;
+ private WiFiEap _eap;
+ private bool disposed = false;
+
+ /// <summary>
+ /// The type of Wi-Fi security.
+ /// </summary>
+ public WiFiSecureType SecurityType
+ {
+ get
+ {
+ int type;
+ int ret = Interop.WiFi.Ap.GetSecurityType(_apHandle, out type);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get security type, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return (WiFiSecureType)type;
+ }
+ set
+ {
+ int ret = Interop.WiFi.Ap.SetSecurityType(_apHandle, (int)value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set security type, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ }
+ }
+ /// <summary>
+ /// The type of Wi-Fi encryption
+ /// </summary>
+ public WiFiEncryptionType EncryptionType
+ {
+ get
+ {
+ int type;
+ int ret = Interop.WiFi.Ap.GetEncryptionType(_apHandle, out type);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get encryption type, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return (WiFiEncryptionType)type;
+ }
+ set
+ {
+ int ret = Interop.WiFi.Ap.SetEncryptionType(_apHandle, (int)value);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set encryption type, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ }
+ }
+ /// <summary>
+ /// The EAP information
+ /// </summary>
+ public WiFiEap EapInformation
+ {
+ get
+ {
+ return _eap;
+ }
+ }
+
+ /// <summary>
+ /// A property to check whether the passphrase is required or not.
+ /// </summary>
+ public bool IsPassphraseRequired
+ {
+ get
+ {
+ bool required;
+ int ret = Interop.WiFi.Ap.IsPassphraseRequired(_apHandle, out required);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get isPassportRequired, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return required;
+ }
+ }
+ /// <summary>
+ /// A property to check whether the Wi-Fi Protected Setup(WPS) is supported or not.
+ /// </summary>
+ public bool IsWpsSupported
+ {
+ get
+ {
+ bool supported;
+ int ret = Interop.WiFi.Ap.IsWpsSupported(_apHandle, out supported);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get isWapSupported, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return supported;
+ }
+ }
+
+ internal WiFiSecurity(IntPtr apHandle)
+ {
+ _apHandle = apHandle;
+ _eap = new WiFiEap(apHandle);
+ }
+
+ ~WiFiSecurity()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (disposed)
+ return;
+
+ if (disposing)
+ {
+ _eap.Dispose();
+ }
+ _apHandle = IntPtr.Zero;
+ disposed = true;
+ }
+
+ /// <summary>
+ /// Sets the passphrase.
+ /// </summary>
+ public void SetPassphrase(string passphrase)
+ {
+ int ret = Interop.WiFi.Ap.SetPassphrase(_apHandle, passphrase);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set passphrase, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle);
+ }
+ }
+ } //WiFiSecurityInformation
+}
diff --git a/packaging/csapi-network-wifi.manifest b/packaging/csapi-network-wifi.manifest
new file mode 100644
index 0000000..75b0fa5
--- /dev/null
+++ b/packaging/csapi-network-wifi.manifest
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
diff --git a/packaging/csapi-network-wifi.spec b/packaging/csapi-network-wifi.spec
new file mode 100644
index 0000000..9e2a127
--- /dev/null
+++ b/packaging/csapi-network-wifi.spec
@@ -0,0 +1,45 @@
+Name: csapi-network-wifi
+Summary: Tizen Wi-Fi API for C#
+Version: 1.0.2
+Release: 1
+Group: Development/Libraries
+License: Apache-2.0
+URL: https://www.tizen.org
+Source0: %{name}-%{version}.tar.gz
+Source1: %{name}.manifest
+
+AutoReqProv: no
+ExcludeArch: aarch64 %ix86
+
+BuildRequires: dotnet-build-tools
+
+# C# API Requires
+BuildRequires: csapi-tizen-nuget
+BuildRequires: csapi-network-connection-nuget
+
+%define Assemblies Tizen.Network.WiFi
+
+%description
+%{summary}
+
+%dotnet_import_sub_packages
+
+%prep
+%setup -q
+cp %{SOURCE1} .
+
+%build
+for ASM in %{Assemblies}; do
+%dotnet_build $ASM
+%dotnet_pack $ASM/$ASM.nuspec %{version}
+done
+
+%install
+for ASM in %{Assemblies}; do
+%dotnet_install $ASM
+done
+
+%files
+%manifest %{name}.manifest
+%license LICENSE
+%attr(644,root,root) %{dotnet_assembly_files}