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