Release 4.0.0-preview1-00144
[platform/core/csapi/tizenfx.git] / src / Tizen.Network.Connection / Tizen.Network.Connection / ConnectionManager.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Linq;
21 using System.Text;
22 using System.Threading.Tasks;
23 using System.Runtime.InteropServices;
24
25 /// <summary>
26 /// The Connection API provides functions and enumerations to get the status of network and current profile and manages profiles.
27 /// </summary>
28 namespace Tizen.Network.Connection
29 {
30     /// <summary>
31     /// This class manages the connection handle resources.
32     /// </summary>
33     [EditorBrowsable(EditorBrowsableState.Never)]
34     public sealed class SafeConnectionHandle : SafeHandle
35     {
36         internal SafeConnectionHandle(IntPtr handle) : base(handle, true)
37         {
38         }
39
40         /// <summary>
41         /// Checks whether the handle value is valid or not.
42         /// </summary>
43         /// <value>True if the handle is invalid, otherwise false.</value>
44         public override bool IsInvalid
45         {
46             get
47             {
48                 return this.handle == IntPtr.Zero;
49             }
50         }
51
52         /// <summary>
53         /// Frees the handle.
54         /// </summary>
55         /// <returns>True if the handle is released successfully, otherwise false.</returns>
56         protected override bool ReleaseHandle()
57         {
58             this.SetHandle(IntPtr.Zero);
59             return true;
60         }
61     }
62
63     /// <summary>
64     /// This is the ConnectionManager class. It provides functions to manage data connections.
65     /// </summary>
66     /// <since_tizen> 3 </since_tizen>
67     public static class ConnectionManager
68     {
69         private static ConnectionItem _currentConnection = null;
70
71         /// <summary>
72         /// An event is called when the type of the current connection is changed.
73         /// </summary>
74         /// <since_tizen> 3 </since_tizen>
75         /// <privilege>http://tizen.org/privilege/network.get</privilege>
76         /// <feature>http://tizen.org/feature/network.ethernet</feature>
77         /// <feature>http://tizen.org/feature/network.telephony</feature>
78         /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
79         /// <feature>http://tizen.org/feature/network.wifi</feature>
80         /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
81         /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception>
82         public static event EventHandler<ConnectionTypeEventArgs> ConnectionTypeChanged
83         {
84             add
85             {
86                 ConnectionInternalManager.Instance.ConnectionTypeChanged += value;
87             }
88
89             remove
90             {
91                 ConnectionInternalManager.Instance.ConnectionTypeChanged -= value;
92             }
93         }
94
95         /// <summary>
96         /// An event for the ethernet cable is plugged [in/out] event.
97         /// </summary>
98         /// <since_tizen> 3 </since_tizen>
99         /// <privilege>http://tizen.org/privilege/network.get</privilege>
100         /// <feature>http://tizen.org/feature/network.ethernet</feature>
101         /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
102         /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception>
103         public static event EventHandler<EthernetCableStateEventArgs> EthernetCableStateChanged
104         {
105             add
106             {
107                 ConnectionInternalManager.Instance.EthernetCableStateChanged += value;
108             }
109
110             remove
111             {
112                 ConnectionInternalManager.Instance.EthernetCableStateChanged -= value;
113             }
114         }
115
116         /// <summary>
117         /// An event is called when the IP address is changed.
118         /// </summary>
119         /// <since_tizen> 3 </since_tizen>
120         /// <privilege>http://tizen.org/privilege/network.get</privilege>
121         /// <feature>http://tizen.org/feature/network.ethernet</feature>
122         /// <feature>http://tizen.org/feature/network.telephony</feature>
123         /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
124         /// <feature>http://tizen.org/feature/network.wifi</feature>
125         /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
126         /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception>
127         public static event EventHandler<AddressEventArgs> IPAddressChanged
128         {
129             add
130             {
131                 ConnectionInternalManager.Instance.IPAddressChanged += value;
132             }
133
134             remove
135             {
136                 ConnectionInternalManager.Instance.IPAddressChanged -= value;
137             }
138         }
139
140         /// <summary>
141         /// An event is called when the proxy address is changed.
142         /// </summary>
143         /// <since_tizen> 3 </since_tizen>
144         /// <privilege>http://tizen.org/privilege/network.get</privilege>
145         /// <feature>http://tizen.org/feature/network.ethernet</feature>
146         /// <feature>http://tizen.org/feature/network.telephony</feature>
147         /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
148         /// <feature>http://tizen.org/feature/network.wifi</feature>
149         /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
150         /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception>
151         public static event EventHandler<AddressEventArgs> ProxyAddressChanged
152         {
153             add
154             {
155                 ConnectionInternalManager.Instance.ProxyAddressChanged += value;
156             }
157
158             remove
159             {
160                 ConnectionInternalManager.Instance.ProxyAddressChanged -= value;
161             }
162         }
163
164         /// <summary>
165         /// Gets the connection handle.
166         /// </summary>
167         /// <since_tizen> 3 </since_tizen>
168         /// <returns>Instance of SafeConnectionHandle.</returns>
169         [EditorBrowsable(EditorBrowsableState.Never)]
170         public static SafeConnectionHandle GetConnectionHandle()
171         {
172             IntPtr handle = ConnectionInternalManager.Instance.GetHandle();
173             return new SafeConnectionHandle(handle);
174         }
175
176         /// <summary>
177         /// Gets the IP address of the current connection.
178         /// </summary>
179         /// <since_tizen> 3 </since_tizen>
180         /// <param name="family">The address family.</param>
181         /// <returns>IP address of the connection (global address in case of IPv6).</returns>
182         /// <privilege>http://tizen.org/privilege/network.get</privilege>
183         /// <feature>http://tizen.org/feature/network.ethernet</feature>
184         /// <feature>http://tizen.org/feature/network.telephony</feature>
185         /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
186         /// <feature>http://tizen.org/feature/network.wifi</feature>
187         /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
188         /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception>
189         /// <exception cref="System.ArgumentException">Thrown when a value is an invalid parameter.</exception>
190         /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
191         /// <exception cref="System.InvalidOperationException">Thrown when a connection instance is invalid or when a method fails due to an invalid operation.</exception>
192         public static System.Net.IPAddress GetIPAddress(AddressFamily family)
193         {
194             return ConnectionInternalManager.Instance.GetIPAddress(family);
195         }
196
197         /// <summary>
198         /// Gets all the IPv6 addresses of the current connection.
199         /// </summary>
200         /// <since_tizen> 3 </since_tizen>
201         /// <param name="type">The type of current network connection.</param>
202         /// <returns>A list of IPv6 addresses of the connection.</returns>
203         /// <privilege>http://tizen.org/privilege/network.get</privilege>
204         /// <feature>http://tizen.org/feature/network.ethernet</feature>
205         /// <feature>http://tizen.org/feature/network.telephony</feature>
206         /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
207         /// <feature>http://tizen.org/feature/network.wifi</feature>
208         /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
209         /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception>
210         /// <exception cref="System.ArgumentException">Thrown when a value is an invalid parameter.</exception>
211         /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
212         /// <exception cref="System.InvalidOperationException">Thrown when a connection instance is invalid or when a method fails due to an invalid operation.</exception>
213         public static IEnumerable<System.Net.IPAddress> GetAllIPv6Addresses(ConnectionType type)
214         {
215             return ConnectionInternalManager.Instance.GetAllIPv6Addresses(type);
216         }
217
218         /// <summary>
219         /// Gets the proxy address of the current connection.
220         /// </summary>
221         /// <since_tizen> 3 </since_tizen>
222         /// <param name="family">The address family.</param>
223         /// <returns>Proxy address of the connection.</returns>
224         /// <privilege>http://tizen.org/privilege/network.get</privilege>
225         /// <feature>http://tizen.org/feature/network.ethernet</feature>
226         /// <feature>http://tizen.org/feature/network.telephony</feature>
227         /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
228         /// <feature>http://tizen.org/feature/network.wifi</feature>
229         /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
230         /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception>
231         /// <exception cref="System.ArgumentException">Thrown when a value is an invalid parameter.</exception>
232         /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
233         /// <exception cref="System.InvalidOperationException">Thrown when a connection instance is invalid or when a method fails due to an invalid operation.</exception>
234         public static string GetProxy(AddressFamily family)
235         {
236             return ConnectionInternalManager.Instance.GetProxy(family);
237         }
238
239         /// <summary>
240         /// Gets the MAC address of the Wi-Fi or ethernet.
241         /// </summary>
242         /// <since_tizen> 3 </since_tizen>
243         /// <param name="type">The type of current network connection.</param>
244         /// <returns>MAC address of the Wi-Fi or ethernet.</returns>
245         /// <privilege>http://tizen.org/privilege/network.get</privilege>
246         /// <feature>http://tizen.org/feature/network.ethernet</feature>
247         /// <feature>http://tizen.org/feature/network.telephony</feature>
248         /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
249         /// <feature>http://tizen.org/feature/network.wifi</feature>
250         /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
251         /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception>
252         /// <exception cref="System.ArgumentException">Thrown when value is an invalid parameter.</exception>
253         /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
254         /// <exception cref="System.InvalidOperationException">Thrown when a connection instance is invalid or when a method fails due to an invalid operation.</exception>
255         public static string GetMacAddress(ConnectionType type)
256         {
257             return ConnectionInternalManager.Instance.GetMacAddress(type);
258         }
259
260         /// <summary>
261         /// Gets the statistics information.
262         /// </summary>
263         /// <since_tizen> 3 </since_tizen>
264         /// <param name="connectionType">The type of connection (only WiFi and Cellular are supported).</param>
265         /// <param name="statisticsType">The type of statistics.</param>
266         /// <returns>The statistics information associated with statisticsType.</returns>
267         /// <privilege>http://tizen.org/privilege/network.get</privilege>
268         /// <feature>http://tizen.org/feature/network.ethernet</feature>
269         /// <feature>http://tizen.org/feature/network.telephony</feature>
270         /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
271         /// <feature>http://tizen.org/feature/network.wifi</feature>
272         /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
273         /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception>
274         /// <exception cref="System.ArgumentException">Thrown when value is an invalid parameter.</exception>
275         /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
276         /// <exception cref="System.InvalidOperationException">Thrown when a connection instance is invalid or when a method fails due to invalid operation.</exception>
277         public static long GetStatistics(ConnectionType connectionType, StatisticsType statisticsType)
278         {
279             return ConnectionInternalManager.Instance.GetStatistics(connectionType, statisticsType);
280         }
281
282         /// <summary>
283         /// Resets the statistics information.
284         /// </summary>
285         /// <since_tizen> 3 </since_tizen>
286         /// <param name="connectionType">The type of connection (only WiFi and Cellular are supported).</param>
287         /// <param name="statisticsType">The type of statistics.</param>
288         /// <privilege>http://tizen.org/privilege/network.get</privilege>
289         /// <privilege>http://tizen.org/privilege/network.set</privilege>
290         /// <feature>http://tizen.org/feature/network.ethernet</feature>
291         /// <feature>http://tizen.org/feature/network.telephony</feature>
292         /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
293         /// <feature>http://tizen.org/feature/network.wifi</feature>
294         /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
295         /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception>
296         /// <exception cref="System.ArgumentException">Thrown when a value is an invalid parameter.</exception>
297         /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
298         /// <exception cref="System.InvalidOperationException">Thrown when a connection instance is invalid or when a method fails due to an invalid operation.</exception>
299         public static void ResetStatistics(ConnectionType connectionType, StatisticsType statisticsType)
300         {
301             ConnectionInternalManager.Instance.ResetStatistics(connectionType, statisticsType);
302         }
303
304         /// <summary>
305         /// Adds a route to the routing table.
306         /// </summary>
307         /// <param name="family">The address family.</param>
308         /// <param name="interfaceName">The name of the network interface.</param>
309         /// <param name="hostAddress">The IP address of the host.</param>
310         /// <param name="gateway">The gateway address.</param>
311         /// <privilege>http://tizen.org/privilege/network.get</privilege>
312         /// <privilege>http://tizen.org/privilege/network.set</privilege>
313         /// <feature>http://tizen.org/feature/network.telephony</feature>
314         /// <feature>http://tizen.org/feature/network.wifi</feature>
315         /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
316         /// <feature>http://tizen.org/feature/network.ethernet</feature>
317         /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
318         /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception>
319         /// <exception cref="System.ArgumentException">Thrown when a value is an invalid parameter.</exception>
320         /// <exception cref="System.ArgumentNullException">Thrown when an interfaceName or a hostAddress or a gateway is null.</exception>
321         /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
322         /// <exception cref="System.InvalidOperationException">Thrown when a connection instance is invalid or when a method fails due to an invalid operation.</exception>
323         public static void AddRoute(AddressFamily family, string interfaceName, System.Net.IPAddress hostAddress, System.Net.IPAddress gateway)
324         {
325             ConnectionInternalManager.Instance.AddRoute(family, interfaceName, hostAddress, gateway);
326         }
327
328         /// <summary>
329         /// Removes a route from the routing table.
330         /// </summary>
331         /// <param name="family">The address family.</param>
332         /// <param name="interfaceName">The name of network interface.</param>
333         /// <param name="hostAddress">The IP address of the host.</param>
334         /// <param name="gateway">The gateway address.</param>
335         /// <privilege>http://tizen.org/privilege/network.get</privilege>
336         /// <privilege>http://tizen.org/privilege/network.set</privilege>
337         /// <feature>http://tizen.org/feature/network.telephony</feature>
338         /// <feature>http://tizen.org/feature/network.wifi</feature>
339         /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
340         /// <feature>http://tizen.org/feature/network.ethernet</feature>
341         /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
342         /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception>
343         /// <exception cref="System.ArgumentException">Thrown when a value is an invalid parameter.</exception>
344         /// <exception cref="System.ArgumentNullException">Thrown when an interfaceName or a hostAddress or a gateway is null.</exception>
345         /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
346         /// <exception cref="System.InvalidOperationException">Thrown when a connection instance is invalid or when a method fails due to an invalid operation.</exception>
347         public static void RemoveRoute(AddressFamily family, string interfaceName, System.Net.IPAddress hostAddress, System.Net.IPAddress gateway)
348         {
349             ConnectionInternalManager.Instance.RemoveRoute(family, interfaceName, hostAddress, gateway);
350         }
351
352         /// <summary>
353         /// The type and state of the current profile for data connection.
354         /// </summary>
355         /// <since_tizen> 3 </since_tizen>
356         /// <value>Instance of ConnectionItem.</value>
357         public static ConnectionItem CurrentConnection
358         {
359             get
360             {
361                 if (_currentConnection == null)
362                 {
363                     _currentConnection = new ConnectionItem();
364                 }
365
366                 return _currentConnection;
367             }
368         }
369
370         /// <summary>
371         /// Creates a cellular profile handle.
372         /// </summary>
373         /// <since_tizen> 3 </since_tizen>
374         /// <param name="type">The type of profile. Cellular profile type is supported.</param>
375         /// <param name="keyword">The keyword included in profile name.</param>
376         /// <returns>CellularProfile object.</returns>
377         /// <privilege>http://tizen.org/privilege/network.get</privilege>
378         /// <feature>http://tizen.org/feature/network.telephony</feature>
379         /// <feature>http://tizen.org/feature/network.wifi</feature>
380         /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception>
381         /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception>
382         /// <exception cref="System.ArgumentException">Thrown when a value is an invalid parameter.</exception>
383         /// <exception cref="System.ArgumentNullException">Thrown when a keyword value is null.</exception>
384         /// <exception cref="System.InvalidOperationException">Thrown when a method fails due to invalid operation.</exception>
385         public static CellularProfile CreateCellularProfile(ConnectionProfileType type, string keyword)
386         {
387             IntPtr profileHandle = IntPtr.Zero;
388             if (type == ConnectionProfileType.Cellular)
389             {
390                 profileHandle = ConnectionInternalManager.Instance.CreateCellularProfile(type, keyword);
391             }
392
393             else
394             {
395                 Log.Error(Globals.LogTag, "ConnectionProfile Type is not supported");
396                 ConnectionErrorFactory.ThrowConnectionException((int)ConnectionError.InvalidParameter);
397             }
398
399             return new CellularProfile(profileHandle);
400         }
401
402         /// <summary>
403         /// The state of the cellular connection.
404         /// </summary>
405         /// <since_tizen> 3 </since_tizen>
406         /// <value>Cellular network state.</value>
407         /// <privilege>http://tizen.org/privilege/network.get</privilege>
408         public static CellularState CellularState
409         {
410             get
411             {
412                 return ConnectionInternalManager.Instance.CellularState;
413             }
414         }
415
416         /// <summary>
417         /// The state of the Wi-Fi connection.
418         /// </summary>
419         /// <since_tizen> 3 </since_tizen>
420         /// <value>WiFi connection state.</value>
421         /// <privilege>http://tizen.org/privilege/network.get</privilege>
422         public static ConnectionState WiFiState
423         {
424             get
425             {
426                 return ConnectionInternalManager.Instance.WiFiState;
427             }
428         }
429
430         /// <summary>
431         /// The state of the Bluetooth connection.
432         /// </summary>
433         /// <since_tizen> 3 </since_tizen>
434         /// <value>Bluetooth connection state.</value>
435         /// <privilege>http://tizen.org/privilege/network.get</privilege>
436         public static ConnectionState BluetoothState
437         {
438             get
439             {
440                 return ConnectionInternalManager.Instance.BluetoothState;
441             }
442         }
443
444         /// <summary>
445         /// The Ethernet connection state.
446         /// </summary>
447         /// <since_tizen> 3 </since_tizen>
448         /// <value>Ethernet connection state.</value>
449         /// <privilege>http://tizen.org/privilege/network.get</privilege>
450         public static ConnectionState EthernetState
451         {
452             get
453             {
454                 return ConnectionInternalManager.Instance.EthernetState;
455             }
456         }
457
458         /// <summary>
459         /// Checks if the ethernet cable is attached or not.
460         /// </summary>
461         /// <since_tizen> 3 </since_tizen>
462         /// <value>Ethernet cable state.</value>
463         /// <privilege>http://tizen.org/privilege/network.get</privilege>
464         public static EthernetCableState EthernetCableState
465         {
466             get
467             {
468                 return ConnectionInternalManager.Instance.EthernetCableState;
469             }
470         }
471
472     } // class ConnectionManager
473
474     /// <summary>
475     /// This class contains connection information, such as connection type and state.
476     /// </summary>
477     /// <since_tizen> 3 </since_tizen>
478     public class ConnectionItem
479     {
480         internal ConnectionItem()
481         {
482         }
483
484         /// <summary>
485         /// The type of the current profile for data connection.
486         /// </summary>
487         /// <since_tizen> 3 </since_tizen>
488         /// <value>Data connection current profile.</value>
489         /// <privilege>http://tizen.org/privilege/network.get</privilege>
490         public ConnectionType Type
491         {
492             get
493             {
494                 return ConnectionInternalManager.Instance.ConnectionType;
495             }
496         }
497
498         /// <summary>
499         /// The state of the current profile for data connection.
500         /// </summary>
501         /// <since_tizen> 3 </since_tizen>
502         /// <value>Connection state of the current connection type.</value>
503         /// <privilege>http://tizen.org/privilege/network.get</privilege>
504         public ConnectionState State
505         {
506             get
507             {
508                 if (ConnectionInternalManager.Instance.ConnectionType == ConnectionType.Cellular)
509                 {
510                     if (ConnectionInternalManager.Instance.CellularState == CellularState.Connected)
511                     {
512                         return ConnectionState.Connected;
513                     }
514                     else if (ConnectionInternalManager.Instance.CellularState == CellularState.Available)
515                     {
516                         return ConnectionState.Disconnected;
517                     }
518                     else {
519                         return ConnectionState.Deactivated;
520                     }
521                 }
522                 else if (ConnectionInternalManager.Instance.ConnectionType == ConnectionType.Bluetooth)
523                 {
524                     return ConnectionInternalManager.Instance.BluetoothState;
525                 }
526                 else if (ConnectionInternalManager.Instance.ConnectionType == ConnectionType.WiFi)
527                 {
528                     return ConnectionInternalManager.Instance.WiFiState;
529                 }
530                 else if (ConnectionInternalManager.Instance.ConnectionType == ConnectionType.Ethernet)
531                 {
532                     return ConnectionInternalManager.Instance.EthernetState;
533                 }
534                 else { // TO DO : Add Net Proxy
535                     return ConnectionState.Disconnected;
536                 }
537             }
538         }
539     } // class ConnectionItem
540
541     /// <summary>
542     /// An extended EventArgs class, which contains changed connection type.
543     /// </summary>
544     /// <since_tizen> 3 </since_tizen>
545     public class ConnectionTypeEventArgs : EventArgs
546     {
547         private ConnectionType Type = ConnectionType.Disconnected;
548
549         internal ConnectionTypeEventArgs(ConnectionType type)
550         {
551             Type = type;
552         }
553
554         /// <summary>
555         /// The connection type.
556         /// </summary>
557         /// <since_tizen> 3 </since_tizen>
558         /// <value>Type of the connection.</value>
559         public ConnectionType ConnectionType
560         {
561             get
562             {
563                 return Type;
564             }
565         }
566     }
567
568     /// <summary>
569     /// An extended EventArgs class, which contains changed ethernet cable state.
570     /// </summary>
571     /// <since_tizen> 3 </since_tizen>
572     public class EthernetCableStateEventArgs : EventArgs
573     {
574         private EthernetCableState State;
575
576         internal EthernetCableStateEventArgs(EthernetCableState state)
577         {
578             State = state;
579         }
580
581         /// <summary>
582         /// The ethernet cable state.
583         /// </summary>
584         /// <since_tizen> 3 </since_tizen>
585         /// <value>Attached or detached state of the ethernet cable.</value>
586         public EthernetCableState EthernetCableState
587         {
588             get
589             {
590                 return State;
591             }
592         }
593     }
594
595     /// <summary>
596     /// An extended EventArgs class, which contains changed address.
597     /// </summary>
598     /// <since_tizen> 3 </since_tizen>
599     public class AddressEventArgs : EventArgs
600     {
601         private string IPv4 = "";
602         private string IPv6 = "";
603
604         internal AddressEventArgs(string ipv4, string ipv6)
605         {
606             IPv4 = ipv4;
607             IPv6 = ipv6;
608         }
609
610         /// <summary>
611         /// The IPV4 address.
612         /// </summary>
613         /// <since_tizen> 3 </since_tizen>
614         /// <value>IP address in the format of the IPV4 syntax.</value>
615         public string IPv4Address
616         {
617             get
618             {
619                 return IPv4;
620             }
621         }
622
623         /// <summary>
624         /// The IPV6 address.
625         /// </summary>
626         /// <since_tizen> 3 </since_tizen>
627         /// <value>IP address in the format of the IPV6 syntax.</value>
628         public string IPv6Address
629         {
630             get
631             {
632                 return IPv6;
633             }
634         }
635     }
636 }