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