Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Network.WiFiDirect / Tizen.Network.WiFiDirect / WiFiDirectManager.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.ComponentModel;
19 using System.Collections.Generic;
20
21 namespace Tizen.Network.WiFiDirect
22 {
23     /// <summary>
24     /// A class which is used to manage settings of Wi-Fi Direct.<br/>
25     /// This class is used to discover peer devices and manage settings of Wi-Fi Direct.
26     /// </summary>
27     public static class WiFiDirectManager
28     {
29         /// <summary>
30         /// Gets the IsInitialized.
31         /// </summary>
32         /// <value>
33         /// A property to check whether the Wifidirect is initialized or not.
34         /// </value>
35         /// <privilege>
36         /// http://tizen.org/privilege/wifidirect
37         /// </privilege>
38         /// <remarks>
39         /// If it is not initialized, false will be returned.
40         /// </remarks>
41         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
42         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
43         [EditorBrowsable(EditorBrowsableState.Never)]
44         public static bool IsInitialized
45         {
46             get
47             {
48                 return WiFiDirectManagerImpl.Instance.IsInitialize;
49             }
50         }
51         /// <summary>
52         /// Gets the IsGroupOwner.
53         /// </summary>
54         /// <value>
55         /// A property to check whether the device is group owner or not.
56         /// </value>
57         /// <privilege>
58         /// http://tizen.org/privilege/wifidirect
59         /// </privilege>
60         /// <remarks>
61         /// Wi-Fi Direct must be activated.
62         /// If it is deactivated, false will be returned.
63         /// </remarks>
64         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
65         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
66         public static bool IsGroupOwner
67         {
68             get
69             {
70                 if (Globals.IsActivated)
71                 {
72                     return WiFiDirectManagerImpl.Instance.IsGroupOwner;
73                 }
74
75                 else
76                 {
77                     return false;
78                 }
79             }
80         }
81
82         /// <summary>
83         /// Gets the IsAutonomousGroup.
84         /// </summary>
85         /// <value>
86         /// A property to check whether the current group is the autonomous group or not.
87         /// </value>
88         /// <privilege>
89         /// http://tizen.org/privilege/wifidirect
90         /// </privilege>
91         /// <remarks>
92         /// Wi-Fi Direct must be activated.
93         /// If it is deactivated, false will be returned.
94         /// </remarks>
95         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
96         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
97         public static bool IsAutonomousGroup
98         {
99             get
100             {
101                 if (Globals.IsActivated)
102                 {
103                     return WiFiDirectManagerImpl.Instance.IsAutonomousGroup;
104                 }
105
106                 else
107                 {
108                     return false;
109                 }
110             }
111         }
112
113         /// <summary>
114         /// Gets the Ssid.
115         /// </summary>
116         /// <value>
117         /// SSID of local device.
118         /// </value>
119         /// <privilege>
120         /// http://tizen.org/privilege/wifidirect
121         /// </privilege>
122         /// <remarks>
123         /// If there is any error, null will be returned.
124         /// </remarks>
125         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
126         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
127         public static string Ssid
128         {
129             get
130             {
131                 if (Globals.IsInitialize)
132                 {
133                     return WiFiDirectManagerImpl.Instance.Ssid;
134                 }
135
136                 else
137                 {
138                     return null;
139                 }
140             }
141         }
142
143         /// <summary>
144         /// Gets the NetworkInterface.
145         /// </summary>
146         /// <value>
147         /// Name of network interface.
148         /// </value>
149         /// <privilege>
150         /// http://tizen.org/privilege/wifidirect
151         /// </privilege>
152         /// <remarks>
153         /// Wi-Fi Direct must be activated.
154         /// If it is deactivated, null will be returned.
155         /// </remarks>
156         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
157         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
158         public static string NetworkInterface
159         {
160             get
161             {
162                 if (Globals.IsActivated)
163                 {
164                     return WiFiDirectManagerImpl.Instance.NetworkInterface;
165                 }
166
167                 else
168                 {
169                     return null;
170                 }
171             }
172         }
173
174         /// <summary>
175         /// Gets the IpAddress.
176         /// </summary>
177         /// <value>
178         /// IP address of a local device.
179         /// </value>
180         /// <privilege>
181         /// http://tizen.org/privilege/wifidirect
182         /// </privilege>
183         /// <remarks>
184         /// Wi-Fi Direct must be activated.
185         /// If it is deactivated, null will be returned.
186         /// </remarks>
187         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
188         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
189         public static string IpAddress
190         {
191             get
192             {
193                 if (Globals.IsActivated)
194                 {
195                     return WiFiDirectManagerImpl.Instance.IpAddress;
196                 }
197
198                 else
199                 {
200                     return null;
201                 }
202             }
203         }
204
205         /// <summary>
206         /// Gets the SubnetMask.
207         /// </summary>
208         /// <value>
209         /// Subnet mask.
210         /// </value>
211         /// <privilege>
212         /// http://tizen.org/privilege/wifidirect
213         /// </privilege>
214         /// <remarks>
215         /// Wi-Fi Direct must be activated.
216         /// If it is deactivated, null will be returned.
217         /// </remarks>
218         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
219         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
220         public static string SubnetMask
221         {
222             get
223             {
224                 if (Globals.IsActivated)
225                 {
226                     return WiFiDirectManagerImpl.Instance.SubnetMask;
227                 }
228
229                 else
230                 {
231                     return null;
232                 }
233             }
234         }
235
236         /// <summary>
237         /// Gets the GatewayAddress.
238         /// </summary>
239         /// <value>
240         /// Gateway address.
241         /// </value>
242         /// <privilege>
243         /// http://tizen.org/privilege/wifidirect
244         /// </privilege>
245         /// <remarks>
246         /// Wi-Fi Direct must be activated.
247         /// If it is deactivated, null will be returned.
248         /// </remarks>
249         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
250         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
251         public static string GatewayAddress
252         {
253             get
254             {
255                 if (Globals.IsActivated)
256                 {
257                     return WiFiDirectManagerImpl.Instance.GatewayAddress;
258                 }
259
260                 else
261                 {
262                     return null;
263                 }
264             }
265         }
266
267         /// <summary>
268         /// Gets the MacAddress.
269         /// </summary>
270         /// <value>
271         /// Mac address of a local device.
272         /// </value>
273         /// <privilege>
274         /// http://tizen.org/privilege/wifidirect
275         /// </privilege>
276         /// <remarks>
277         /// If there is any error, null will be returned.
278         /// </remarks>
279         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
280         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
281         public static string MacAddress
282         {
283             get
284             {
285                 if (Globals.IsInitialize)
286                 {
287                     return WiFiDirectManagerImpl.Instance.MacAddress;
288                 }
289
290                 else
291                 {
292                     return null;
293                 }
294             }
295         }
296
297         /// <summary>
298         /// Gets the State.
299         /// </summary>
300         /// <value>
301         /// State of Wi-Fi direct service.
302         /// </value>
303         /// <privilege>
304         /// http://tizen.org/privilege/wifidirect
305         /// </privilege>
306         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
307         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
308         public static WiFiDirectState State
309         {
310             get
311             {
312                 return WiFiDirectManagerImpl.Instance.State;
313             }
314         }
315
316         /// <summary>
317         /// A property to check whether the device is discoverable or not by P2P discovery.
318         /// </summary>
319         /// <value>
320         ///
321         /// </value>
322         /// <privilege>
323         /// http://tizen.org/privilege/wifidirect
324         /// </privilege>
325         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
326         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
327         public static bool IsDiscoverable
328         {
329             get
330             {
331                 if (Globals.IsInitialize)
332                 {
333                     return WiFiDirectManagerImpl.Instance.IsDiscoverable;
334                 }
335
336                 else
337                 {
338                     return false;
339                 }
340             }
341         }
342
343         /// <summary>
344         /// Gets the IsListenOnly.
345         /// </summary>
346         /// <value>
347         /// A property to check whether the local device is listening only.
348         /// </value>
349         /// <privilege>
350         /// http://tizen.org/privilege/wifidirect
351         /// </privilege>
352         /// <remarks>
353         /// Wi-Fi Direct must be activated.
354         /// If it is deactivated, false will be returned.
355         /// </remarks>
356         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
357         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
358         public static bool IsListenOnly
359         {
360             get
361             {
362                 if (Globals.IsActivated)
363                 {
364                     return WiFiDirectManagerImpl.Instance.IsListenOnly;
365                 }
366
367                 else
368                 {
369                     return false;
370                 }
371             }
372         }
373
374         /// <summary>
375         /// Gets the PrimaryType.
376         /// </summary>
377         /// <value>
378         /// Primary device type of local device.
379         /// </value>
380         /// <privilege>
381         /// http://tizen.org/privilege/wifidirect
382         /// </privilege>
383         /// <remarks>
384         /// If there is any error, 0 will be returned.
385         /// </remarks>
386         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
387         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
388         public static WiFiDirectPrimaryDeviceType PrimaryType
389         {
390             get
391             {
392                 if (Globals.IsInitialize)
393                 {
394                     return WiFiDirectManagerImpl.Instance.PrimaryType;
395                 }
396
397                 else
398                 {
399                     return default(WiFiDirectPrimaryDeviceType);
400                 }
401             }
402         }
403
404         /// <summary>
405         /// Gets the SecondaryType.
406         /// </summary>
407         /// <value>
408         /// Secondary device type of local device.
409         /// </value>
410         /// <privilege>
411         /// http://tizen.org/privilege/wifidirect
412         /// </privilege>
413         /// <remarks>
414         /// If there is any error, 0 will be returned.
415         /// </remarks>
416         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
417         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
418         public static WiFiDirectSecondaryDeviceType SecondaryType
419         {
420             get
421             {
422                 if (Globals.IsInitialize)
423                 {
424                     return WiFiDirectManagerImpl.Instance.SecondaryType;
425                 }
426
427                 else
428                 {
429                     return default(WiFiDirectSecondaryDeviceType);
430                 }
431             }
432         }
433
434         /// <summary>
435         /// Gets the WpsMode.
436         /// </summary>
437         /// <value>
438         /// Supported WPS (Wi-Fi Protected Setup) types at local device.
439         /// </value>
440         /// <privilege>
441         /// http://tizen.org/privilege/wifidirect
442         /// </privilege>
443         /// <remarks>
444         /// If there is any error, -1 will be returned.
445         /// </remarks>
446         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
447         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
448         public static int WpsMode
449         {
450             get
451             {
452                 if (Globals.IsInitialize)
453                 {
454                     return WiFiDirectManagerImpl.Instance.WpsMode;
455                 }
456
457                 else
458                 {
459                     return -1;
460                 }
461             }
462         }
463
464         /// <summary>
465         /// Gets the Wps.
466         /// </summary>
467         /// <value>
468         /// WPS (Wi-Fi Protected Setup) type.
469         /// </value>
470         /// <privilege>
471         /// http://tizen.org/privilege/wifidirect
472         /// </privilege>
473         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
474         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
475         public static WiFiDirectWpsType Wps
476         {
477             get
478             {
479                 if (Globals.IsInitialize)
480                 {
481                     return WiFiDirectManagerImpl.Instance.WpsType;
482                 }
483
484                 else
485                 {
486                     return default(WiFiDirectWpsType);
487                 }
488             }
489         }
490
491         /// <summary>
492         /// Gets the OperatingChannel.
493         /// </summary>
494         /// <value>
495         /// Channel number on which the P2P Device is operating as the P2P Group.
496         /// </value>
497         /// <privilege>
498         /// http://tizen.org/privilege/wifidirect
499         /// </privilege>
500         /// <remarks>
501         /// If there is any error, -1 will be returned.
502         /// </remarks>
503         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
504         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
505         public static int OperatingChannel
506         {
507             get
508             {
509                 if (Globals.IsInitialize)
510                 {
511                     return WiFiDirectManagerImpl.Instance.OperatingChannel;
512                 }
513
514                 else
515                 {
516                     return -1;
517                 }
518             }
519         }
520
521         /// <summary>
522         /// Gets and sets the PersistentGroupEnabled.
523         /// </summary>
524         /// <value>
525         /// A property to check whether persistent group is enabled.
526         /// </value>
527         /// <privilege>
528         /// http://tizen.org/privilege/wifidirect
529         /// </privilege>
530         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
531         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
532         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
533         public static bool PersistentGroupEnabled
534         {
535             get
536             {
537                 if (Globals.IsInitialize)
538                 {
539                     return WiFiDirectManagerImpl.Instance.PersistentGroupEnabled;
540                 }
541
542                 else
543                 {
544                     return false;
545                 }
546             }
547
548             set
549             {
550                 if (Globals.IsInitialize)
551                 {
552                     WiFiDirectManagerImpl.Instance.PersistentGroupEnabled = value;
553                 }
554             }
555         }
556
557         /// <summary>
558         /// Gets and sets the AutoConnect.
559         /// </summary>
560         /// <value>
561         /// Autoconnection mode status.
562         /// </value>
563         /// <privilege>
564         /// http://tizen.org/privilege/wifidirect
565         /// </privilege>
566         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
567         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
568         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
569         public static bool AutoConnect
570         {
571             get
572             {
573                 if (Globals.IsInitialize)
574                 {
575                     return WiFiDirectManagerImpl.Instance.AutoConnect;
576                 }
577
578                 else
579                 {
580                     return false;
581                 }
582             }
583
584             set
585             {
586                 if (Globals.IsInitialize)
587                 {
588                     WiFiDirectManagerImpl.Instance.AutoConnect = value;
589                 }
590             }
591         }
592
593         /// <summary>
594         /// Gets and sets the WpsPin.
595         /// </summary>
596         /// <value>
597         /// WPS PIN number.
598         /// </value>
599         /// <privilege>
600         /// http://tizen.org/privilege/wifidirect
601         /// </privilege>
602         /// <remarks>
603         /// Wi-Fi Direct must be activated.
604         /// If it is deactivated, null will be returned during get and Not permitted exception message will be returned during set.
605         /// </remarks>
606         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
607         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
608         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
609         public static string WpsPin
610         {
611             get
612             {
613                 if (Globals.IsActivated)
614                 {
615                     return WiFiDirectManagerImpl.Instance.WpsPin;
616                 }
617
618                 else
619                 {
620                     return null;
621                 }
622             }
623
624             set
625             {
626                 if (Globals.IsActivated)
627                 {
628                     WiFiDirectManagerImpl.Instance.WpsPin = value;
629                 }
630
631                 else
632                 {
633                     Log.Error(Globals.LogTag, "Wifi-direct is not activated");
634                     WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
635                 }
636             }
637         }
638
639         /// <summary>
640         /// Gets and sets the Name.
641         /// </summary>
642         /// <value>
643         /// Name of local device.
644         /// </value>
645         /// <privilege>
646         /// http://tizen.org/privilege/wifidirect
647         /// </privilege>
648         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
649         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
650         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
651         public static string Name
652         {
653             get
654             {
655                 if (Globals.IsInitialize)
656                 {
657                     return WiFiDirectManagerImpl.Instance.Name;
658                 }
659
660                 else
661                 {
662                     return null;
663                 }
664             }
665
666             set
667             {
668                 if (Globals.IsInitialize)
669                 {
670                     WiFiDirectManagerImpl.Instance.Name = value;
671                 }
672             }
673         }
674
675         /// <summary>
676         /// Gets and sets the RequestedWps.
677         /// </summary>
678         /// <value>
679         /// Requested WPS (Wi-Fi Protected Setup) type.
680         /// </value>
681         /// <privilege>
682         /// http://tizen.org/privilege/wifidirect
683         /// </privilege>
684         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
685         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
686         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
687         public static WiFiDirectWpsType RequestedWps
688         {
689             get
690             {
691                 if (Globals.IsInitialize)
692                 {
693                     return WiFiDirectManagerImpl.Instance.RequestedWps;
694                 }
695
696                 else
697                 {
698                     return default(WiFiDirectWpsType);
699                 }
700             }
701
702             set
703             {
704                 if (Globals.IsInitialize)
705                 {
706                     WiFiDirectManagerImpl.Instance.RequestedWps = value;
707                 }
708             }
709         }
710
711         /// <summary>
712         /// Gets and sets the GroupOwnerIntent.
713         /// </summary>
714         /// <value>
715         /// Intent of the group owner.
716         /// </value>
717         /// <privilege>
718         /// http://tizen.org/privilege/wifidirect
719         /// </privilege>
720         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
721         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
722         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
723         public static int GroupOwnerIntent
724         {
725             get
726             {
727                 if (Globals.IsInitialize)
728                 {
729                     return WiFiDirectManagerImpl.Instance.GroupOwnerIntent;
730                 }
731
732                 else
733                 {
734                     return -1;
735                 }
736             }
737
738             set
739             {
740                 if (Globals.IsInitialize)
741                 {
742                     WiFiDirectManagerImpl.Instance.GroupOwnerIntent = value;
743                 }
744             }
745         }
746
747         /// <summary>
748         /// Gets and sets the MaxClients.
749         /// </summary>
750         /// <value>
751         /// Max number of clients.
752         /// </value>
753         /// <privilege>
754         /// http://tizen.org/privilege/wifidirect
755         /// </privilege>
756         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
757         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
758         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
759         public static int MaxClients
760         {
761             get
762             {
763                 if (Globals.IsInitialize)
764                 {
765                     return WiFiDirectManagerImpl.Instance.MaxClients;
766                 }
767
768                 else
769                 {
770                     return -1;
771                 }
772             }
773
774             set
775             {
776                 if (Globals.IsInitialize)
777                 {
778                     WiFiDirectManagerImpl.Instance.MaxClients = value;
779                 }
780             }
781         }
782
783         /// <summary>
784         /// Gets and sets the Passphrase.
785         /// It is used during Wi-Fi Direct Group creation.
786         /// </summary>
787         /// <value>
788         /// Wi-Fi Protected Access (WPA) password.
789         /// </value>
790         /// <privilege>
791         /// http://tizen.org/privilege/wifidirect
792         /// </privilege>
793         /// <remarks>
794         /// Wi-Fi Direct must be activated.
795         /// If it is deactivated, null will be returned during get and Not permitted exception message will be returned during set.
796         /// </remarks>
797         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
798         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
799         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
800         public static string Passphrase
801         {
802             get
803             {
804                 if (Globals.IsActivated)
805                 {
806                     return WiFiDirectManagerImpl.Instance.Passphrase;
807                 }
808
809                 else
810                 {
811                     return null;
812                 }
813             }
814
815             set
816             {
817                 if (Globals.IsActivated)
818                 {
819                     WiFiDirectManagerImpl.Instance.Passphrase = value;
820                 }
821
822                 else
823                 {
824                     Log.Error(Globals.LogTag, "Wi-Fi direct is not activated");
825                     WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
826                 }
827             }
828         }
829
830         /// <summary>
831         /// Gets and sets the SessionTimer.
832         /// </summary>
833         /// <value>
834         /// Connection session timer value in second.
835         /// </value>
836         /// <privilege>
837         /// http://tizen.org/privilege/wifidirect
838         /// </privilege>
839         /// <remarks>
840         /// Wi-Fi Direct must be activated.
841         /// If it is deactivated, -1 will be returned during get and Not permitted exception message will be returned during set.
842         /// </remarks>
843         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
844         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
845         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
846         public static int SessionTimer
847         {
848             get
849             {
850                 if (Globals.IsActivated)
851                 {
852                     return WiFiDirectManagerImpl.Instance.SessionTimer;
853                 }
854
855                 else
856                 {
857                     return -1;
858                 }
859             }
860
861             set
862             {
863                 if (Globals.IsActivated)
864                 {
865                     WiFiDirectManagerImpl.Instance.SessionTimer = value;
866                 }
867
868                 else
869                 {
870                     Log.Error(Globals.LogTag, "Wi-Fi direct is not activated");
871                     WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
872                 }
873             }
874         }
875
876         /// <summary>
877         /// (event) StateChanged is raised when Wi-Fi Direct state is changed.
878         /// </summary>
879         public static event EventHandler<StateChangedEventArgs> StateChanged
880         {
881             add
882             {
883                 WiFiDirectManagerImpl.Instance.StateChanged += value;
884             }
885
886             remove
887             {
888                 WiFiDirectManagerImpl.Instance.StateChanged -= value;
889             }
890         }
891
892         /// <summary>
893         /// (event) DiscoveryStateChanged is raised when Wi-Fi Direct discovery state is changed.
894         /// </summary>
895         public static event EventHandler<DiscoveryStateChangedEventArgs> DiscoveryStateChanged
896         {
897             add
898             {
899                 if (Globals.IsInitialize)
900                 {
901                     WiFiDirectManagerImpl.Instance.DiscoveryStateChanged += value;
902                 }
903             }
904
905             remove
906             {
907                 if (Globals.IsInitialize)
908                 {
909                     WiFiDirectManagerImpl.Instance.DiscoveryStateChanged -= value;
910                 }
911             }
912         }
913
914         /// <summary>
915         /// (event) DeviceStateChanged is raised when device state is changed.
916         /// </summary>
917         public static event EventHandler<DeviceStateChangedEventArgs> DeviceStateChanged
918         {
919             add
920             {
921                 if (Globals.IsInitialize)
922                 {
923                     WiFiDirectManagerImpl.Instance.DeviceStateChanged += value;
924                 }
925             }
926
927             remove
928             {
929                 if (Globals.IsInitialize)
930                 {
931                     WiFiDirectManagerImpl.Instance.DeviceStateChanged -= value;
932                 }
933             }
934         }
935
936         /// <summary>
937         /// (event) PeerFound is raised when peer is found.
938         /// </summary>
939         public static event EventHandler<PeerFoundEventArgs> PeerFound
940         {
941             add
942             {
943                 if (Globals.IsInitialize)
944                 {
945                     WiFiDirectManagerImpl.Instance.PeerFound += value;
946                 }
947             }
948
949             remove
950             {
951                 if (Globals.IsInitialize)
952                 {
953                     WiFiDirectManagerImpl.Instance.PeerFound -= value;
954                 }
955             }
956         }
957
958         /// <summary>
959         /// (event) ConnectionStatusChanged is raised when status of connection is changed.
960         /// </summary>
961         public static event EventHandler<ConnectionStatusChangedEventArgs> ConnectionStatusChanged
962         {
963             add
964             {
965                 if (Globals.IsInitialize)
966                 {
967                     WiFiDirectManagerImpl.Instance.ConnectionStatusChanged += value;
968                 }
969             }
970
971             remove
972             {
973                 if (Globals.IsInitialize)
974                 {
975                     WiFiDirectManagerImpl.Instance.ConnectionStatusChanged -= value;
976                 }
977             }
978         }
979
980         /// <summary>
981         /// Activates the Wi-Fi Direct service.
982         /// </summary>
983         /// <remarks>
984         /// If this succeeds, DeviceStateChanged event will be invoked.
985         /// </remarks>
986         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
987         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
988         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
989         public static void Activate()
990         {
991             if (Globals.IsInitialize)
992             {
993                 WiFiDirectManagerImpl.Instance.Activate();
994             }
995
996             else
997             {
998                 Log.Error(Globals.LogTag, "Wi-Fi direct is not initialized");
999                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotInitialized);
1000             }
1001         }
1002
1003         /// <summary>
1004         /// Deactivates the Wi-Fi Direct service.
1005         /// </summary>
1006         /// <privilege>
1007         /// http://tizen.org/privilege/wifidirect
1008         /// </privilege>
1009         /// <feature>
1010         /// http://tizen.org/feature/network.wifidirect
1011         /// </feature>
1012         /// <remarks>
1013         /// Wi-Fi Direct must be activated.
1014         /// If this succeeds, DeviceStateChanged event will be invoked.
1015         /// </remarks>
1016         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1017         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1018         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1019         public static void Deactivate()
1020         {
1021             if (Globals.IsActivated)
1022             {
1023                 WiFiDirectManagerImpl.Instance.Deactivate();
1024             }
1025
1026             else
1027             {
1028                 Log.Error(Globals.LogTag, "Wi-Fi direct is not activated");
1029                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1030             }
1031         }
1032
1033         /// <summary>
1034         /// Starts discovery to find all P2P capable devices.
1035         /// </summary>
1036         /// <param name="listenOnly">Listen status.If False, then cycle between Scan and Listen.If True, then skip the initial 802.11 Scan and enter Listen state.</param>
1037         /// <param name="duration">Duration of discovery period, in seconds.</param>
1038         /// <param name="channel">Discovery channel.It is optional, default enum value FullScan is assigned.</param>
1039         /// <privilege>
1040         /// http://tizen.org/privilege/wifidirect
1041         /// </privilege>
1042         /// <feature>
1043         /// http://tizen.org/feature/network.wifidirect
1044         /// </feature>
1045         /// <remarks>
1046         /// Wi-Fi Direct must be activated.
1047         /// If this succeeds, DiscoveryStateChanged and PeerFound event will be invoked.
1048         /// </remarks>
1049         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1050         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1051         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1052         public static void StartDiscovery(bool listenOnly, int duration, WiFiDirectDiscoveryChannel channel = WiFiDirectDiscoveryChannel.FullScan)
1053         {
1054             if (Globals.IsActivated)
1055             {
1056                 WiFiDirectManagerImpl.Instance.StartDiscovery(listenOnly, duration, channel);
1057             }
1058
1059             else
1060             {
1061                 Log.Error(Globals.LogTag, "Wi-Fi direct is not activated");
1062                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1063             }
1064         }
1065
1066         /// <summary>
1067         /// Cancels discovery process.
1068         /// </summary>
1069         /// <privilege>
1070         /// http://tizen.org/privilege/wifidirect
1071         /// </privilege>
1072         /// <feature>
1073         /// http://tizen.org/feature/network.wifidirect
1074         /// </feature>
1075         /// <remarks>
1076         /// Discovery must be started by StartDiscovery.
1077         /// If this succeeds, DiscoveryStateChanged and PeerFound event will be invoked.
1078         /// </remarks>
1079         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1080         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1081         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1082         public static void CancelDiscovery()
1083         {
1084             if (WiFiDirectManager.State == WiFiDirectState.Discovering)
1085             {
1086                 WiFiDirectManagerImpl.Instance.CancelDiscovery();
1087             }
1088
1089             else
1090             {
1091                 Log.Error(Globals.LogTag, "Wi-Fi direct discovery is not started");
1092                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1093             }
1094         }
1095
1096         /// <summary>
1097         /// Gets the information of discovered peers.
1098         /// </summary>
1099         /// <returns> List of discovered peer objects.</returns>
1100         /// <privilege>
1101         /// http://tizen.org/privilege/wifidirect
1102         /// </privilege>
1103         /// <feature>
1104         /// http://tizen.org/feature/network.wifidirect
1105         /// </feature>
1106         /// <remarks>
1107         /// Wi-Fi Direct must be activated.
1108         /// </remarks>
1109         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1110         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1111         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1112         public static IEnumerable<WiFiDirectPeer> GetDiscoveredPeers()
1113         {
1114             if (Globals.IsActivated)
1115             {
1116                 return WiFiDirectManagerImpl.Instance.GetDiscoveredPeers();
1117             }
1118
1119             else
1120             {
1121                 return null;
1122             }
1123         }
1124
1125         /// <summary>
1126         /// Gets the information of connected peers.
1127         /// </summary>
1128         /// <returns> List of connected peer objects.</returns>
1129         /// <privilege>
1130         /// http://tizen.org/privilege/wifidirect
1131         /// </privilege>
1132         /// <feature>
1133         /// http://tizen.org/feature/network.wifidirect
1134         /// </feature>
1135         /// <remarks>
1136         /// Wi-Fi Direct must be activated.
1137         /// </remarks>
1138         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1139         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1140         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1141         public static IEnumerable<WiFiDirectPeer> GetConnectedPeers()
1142         {
1143             if (Globals.IsActivated)
1144             {
1145                 return WiFiDirectManagerImpl.Instance.GetConnectedPeers();
1146             }
1147
1148             else
1149             {
1150                 return null;
1151             }
1152         }
1153
1154         /// <summary>
1155         /// Disconnects all connected links to peers.
1156         /// </summary>
1157         /// <privilege>
1158         /// http://tizen.org/privilege/wifidirect
1159         /// </privilege>
1160         /// <feature>
1161         /// http://tizen.org/feature/network.wifidirect
1162         /// </feature>
1163         /// <remarks>
1164         /// Wi-Fi Direct must be activated.
1165         /// If this succeeds, ConnectionStatusChanged event will be invoked.
1166         /// </remarks>
1167         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1168         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1169         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1170         public static void DisconnectAll()
1171         {
1172             if (Globals.IsActivated)
1173             {
1174                 WiFiDirectManagerImpl.Instance.DisconnectAll();
1175             }
1176
1177             else
1178             {
1179                 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
1180                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1181             }
1182         }
1183
1184         /// <summary>
1185         /// Creates a Wi-Fi Direct group and sets up device as the group owner.
1186         /// </summary>
1187         /// <privilege>
1188         /// http://tizen.org/privilege/wifidirect
1189         /// </privilege>
1190         /// <feature>
1191         /// http://tizen.org/feature/network.wifidirect
1192         /// </feature>
1193         /// <remarks>
1194         /// Wi-Fi Direct must be activated.
1195         /// If this succeeds, ConnectionStatusChanged event will be invoked with GroupCreated.
1196         /// </remarks>
1197         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1198         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1199         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1200         public static void CreateGroup()
1201         {
1202             if (Globals.IsActivated)
1203             {
1204                 WiFiDirectManagerImpl.Instance.CreateGroup();
1205             }
1206
1207             else
1208             {
1209                 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
1210                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1211             }
1212         }
1213
1214         /// <summary>
1215         /// Destroys the Wi-Fi Direct group owned by a local device.If creating a group is in progress, this API cancels that process.
1216         /// </summary>
1217         /// <privilege>
1218         /// http://tizen.org/privilege/wifidirect
1219         /// </privilege>
1220         /// <feature>
1221         /// http://tizen.org/feature/network.wifidirect
1222         /// </feature>
1223         /// <remarks>
1224         /// Wi-Fi Direct must be activated.
1225         /// If this succeeds, ConnectionStatusChanged event will be invoked with GroupDestroyed.
1226         /// </remarks>
1227         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1228         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1229         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1230         public static void DestroyGroup()
1231         {
1232             if (Globals.IsActivated)
1233             {
1234                 WiFiDirectManagerImpl.Instance.DestroyGroup();
1235             }
1236
1237             else
1238             {
1239                 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
1240                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1241             }
1242         }
1243
1244         /// <summary>
1245         /// Set the WPS config PBC as preferred method for connection.
1246         /// </summary>
1247         /// <privilege>
1248         /// http://tizen.org/privilege/wifidirect
1249         /// </privilege>
1250         /// <feature>
1251         /// http://tizen.org/feature/network.wifidirect
1252         /// </feature>
1253         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1254         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1255         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1256         public static void ActivatePushButton()
1257         {
1258             if (Globals.IsActivated)
1259             {
1260                 WiFiDirectManagerImpl.Instance.ActivatePushButton();
1261             }
1262
1263             else
1264             {
1265                 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
1266                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1267             }
1268         }
1269
1270         /// <summary>
1271         /// Gets the supported WPS types.
1272         /// </summary>
1273         /// <returns>The list of supported wps types.</returns>
1274         /// <privilege>
1275         /// http://tizen.org/privilege/wifidirect
1276         /// </privilege>
1277         /// <feature>
1278         /// http://tizen.org/feature/network.wifidirect
1279         /// </feature>
1280         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1281         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1282         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1283         public static IEnumerable<WiFiDirectWpsType> GetSupportedWpsTypes()
1284         {
1285             if (Globals.IsInitialize)
1286             {
1287                 return WiFiDirectManagerImpl.Instance.GetSupportedWpsTypes();
1288             }
1289
1290             else
1291             {
1292                 return null;
1293             }
1294         }
1295
1296         /// <summary>
1297         /// Gets the persistent groups.
1298         /// </summary>
1299         /// <returns>List of the persistent group objects.</returns>
1300         /// <privilege>
1301         /// http://tizen.org/privilege/wifidirect
1302         /// </privilege>
1303         /// <feature>
1304         /// http://tizen.org/feature/network.wifidirect
1305         /// </feature>
1306         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1307         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1308         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1309         public static IEnumerable<WiFiDirectPersistentGroup> GetPersistentGroups()
1310         {
1311             if (Globals.IsInitialize)
1312             {
1313                 return WiFiDirectManagerImpl.Instance.GetPersistentGroups();
1314             }
1315
1316             else
1317             {
1318                 return null;
1319             }
1320         }
1321
1322         /// <summary>
1323         /// Removes a persistent group.
1324         /// </summary>
1325         /// <param name="group">Persistent group owner.</param>
1326         /// <privilege>
1327         /// http://tizen.org/privilege/wifidirect
1328         /// </privilege>
1329         /// <feature>
1330         /// http://tizen.org/feature/network.wifidirect
1331         /// </feature>
1332         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1333         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1334         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1335         public static void RemovePersistentGroup(WiFiDirectPersistentGroup group)
1336         {
1337             if (Globals.IsInitialize)
1338             {
1339                 WiFiDirectManagerImpl.Instance.RemovePersistentGroup(group);
1340             }
1341
1342             else
1343             {
1344                 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
1345                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotInitialized);
1346             }
1347         }
1348
1349         /// <summary>
1350         /// Initializes or Deintializes the WiFi-Direct Display(MIRACAST) service.
1351         /// </summary>
1352         /// <param name="enable">Enables/Disables service.</param>
1353         /// <privilege>
1354         /// http://tizen.org/privilege/wifidirect
1355         /// </privilege>
1356         /// <feature>
1357         /// http://tizen.org/feature/network.wifidirect
1358         /// http://tizen.org/feature/network.wifi.direct.display
1359         /// </feature>
1360         /// <remarks>
1361         /// Wi-Fi Direct must be activated.
1362         /// </remarks>
1363         /// <exception cref="NotSupportedException">
1364         /// Thrown during one of the following cases :
1365         /// 1. When the wifidirect is not supported
1366         /// 2. When the wifidirect display feature is not supported
1367         /// </exception>
1368         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1369         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1370         public static void InitMiracast(bool enable)
1371         {
1372             if (Globals.IsActivated)
1373             {
1374                 WiFiDirectManagerImpl.Instance.InitMiracast(enable);
1375             }
1376
1377             else
1378             {
1379                 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
1380                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1381             }
1382         }
1383
1384         /// <summary>
1385         /// Enables Wi-Fi Display functionality.
1386         /// </summary>
1387         /// <privilege>
1388         /// http://tizen.org/privilege/wifidirect
1389         /// </privilege>
1390         /// <feature>
1391         /// http://tizen.org/feature/network.wifidirect
1392         /// http://tizen.org/feature/network.wifi.direct.display
1393         /// </feature>
1394         /// <remarks>
1395         /// Wi-Fi Direct must be activated.
1396         /// </remarks>
1397         /// <exception cref="NotSupportedException">
1398         /// Thrown during one of the following cases :
1399         /// 1. When the wifidirect is not supported
1400         /// 2. When the wifidirect display feature is not supported
1401         /// </exception>
1402         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1403         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1404         public static void InitDisplay()
1405         {
1406             if (Globals.IsActivated)
1407             {
1408                 WiFiDirectManagerImpl.Instance.InitDisplay();
1409             }
1410
1411             else
1412             {
1413                 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
1414                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1415             }
1416         }
1417
1418         /// <summary>
1419         /// Disable Wi-Fi Display(WFD) functionality and disable the support of WFD Information Element(IE).
1420         /// </summary>
1421         /// <privilege>
1422         /// http://tizen.org/privilege/wifidirect
1423         /// </privilege>
1424         /// <feature>
1425         /// http://tizen.org/feature/network.wifidirect
1426         /// http://tizen.org/feature/network.wifi.direct.display
1427         /// </feature>
1428         /// <remarks>
1429         /// Wi-Fi Direct must be activated and WFD must be enabled.
1430         /// </remarks>
1431         /// <exception cref="NotSupportedException">
1432         /// Thrown during one of the following cases :
1433         /// 1. When the wifidirect is not supported
1434         /// 2. When the wifidirect display feature is not supported
1435         /// </exception>
1436         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1437         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1438         public static void DeinitDisplay()
1439         {
1440             if (Globals.IsActivated && Globals.s_isDisplay)
1441             {
1442                 WiFiDirectManagerImpl.Instance.DeinitDisplay();
1443             }
1444
1445             else
1446             {
1447                 Log.Error(Globals.LogTag, "Wifi-direct is not activated and/or Wi-Fi display is not enabled");
1448                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1449             }
1450         }
1451
1452         /// <summary>
1453         /// Sets the Wi-Fi Display parameters for the WFD IE of local device.
1454         /// </summary>
1455         /// <param name="type">WFD Device Type: define the Role of WFD device like source or sink.</param>
1456         /// <param name="port">Specifies Session Management Control Port number. It should be 2 bytes(0~65535).</param>
1457         /// <param name="hdcp">CP support bit: (1 = enable the hdcp support, 0 = disable the hdcp support).</param>
1458         /// <privilege>
1459         /// http://tizen.org/privilege/wifidirect
1460         /// </privilege>
1461         /// <feature>
1462         /// http://tizen.org/feature/network.wifidirect
1463         /// http://tizen.org/feature/network.wifi.direct.display
1464         /// </feature>
1465         /// <remarks>
1466         /// Wi-Fi Direct must be activated and WFD must be enabled.
1467         /// </remarks>
1468         /// <exception cref="NotSupportedException">
1469         /// Thrown during one of the following cases :
1470         /// 1. When the wifidirect is not supported
1471         /// 2. When the wifidirect display feature is not supported
1472         /// </exception>
1473         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1474         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1475         public static void SetDisplay(WiFiDirectDisplayType type, int port, int hdcp)
1476         {
1477             if (Globals.IsActivated && Globals.s_isDisplay)
1478             {
1479                 WiFiDirectManagerImpl.Instance.SetDisplay(type, port, hdcp);
1480             }
1481
1482             else
1483             {
1484                 Log.Error(Globals.LogTag, "Wifi-direct is not activated and/or Wi-Fi display is not enabled");
1485                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1486             }
1487         }
1488
1489         /// <summary>
1490         /// Sets the Wi-Fi Display session availability.
1491         /// </summary>
1492         /// <param name="availability">Wi-Fi Display session availability.</param>
1493         /// <privilege>
1494         /// http://tizen.org/privilege/wifidirect
1495         /// </privilege>
1496         /// <feature>
1497         /// http://tizen.org/feature/network.wifidirect
1498         /// http://tizen.org/feature/network.wifi.direct.display
1499         /// </feature>
1500         /// <remarks>
1501         /// Wi-Fi Direct must be activated and WFD must be enabled.
1502         /// </remarks>
1503         /// <exception cref="NotSupportedException">
1504         /// Thrown during one of the following cases :
1505         /// 1. When the wifidirect is not supported
1506         /// 2. When the wifidirect display feature is not supported
1507         /// </exception>
1508         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1509         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1510         public static void SetDisplayAvailability(bool availability)
1511         {
1512             if (Globals.IsActivated && Globals.s_isDisplay)
1513             {
1514                 WiFiDirectManagerImpl.Instance.SetDisplayAvailability(availability);
1515             }
1516
1517             else
1518             {
1519                 Log.Error(Globals.LogTag, "Wifi-direct is not activated and/or Wi-Fi display is not enabled");
1520                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1521             }
1522         }
1523
1524         /// <summary>
1525         /// Sets the automatic group removal feature when all peers are disconnected.
1526         /// </summary>
1527         /// <param name="enable">Enables/Disables group removal feature.</param>
1528         /// <privilege>
1529         /// http://tizen.org/privilege/wifidirect
1530         /// </privilege>
1531         /// <feature>
1532         /// http://tizen.org/feature/network.wifidirect
1533         /// </feature>
1534         /// <remarks>
1535         /// Wi-Fi Direct must be activated.
1536         /// ConnectionStatusChanged event will be invoked with GroupDestroyed when this feature is enabled and there's no connected group client and if device is group owner.
1537         /// </remarks>
1538         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1539         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1540         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1541         public static void SetAutoGroupRemove(bool enable)
1542         {
1543             if (Globals.IsActivated)
1544             {
1545                 WiFiDirectManagerImpl.Instance.SetAutoGroupRemove(enable);
1546             }
1547
1548             else
1549             {
1550                 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
1551                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1552             }
1553         }
1554
1555         /// <summary>
1556         /// Registers the service.
1557         /// </summary>
1558         /// <returns>The service Id of service getting registered.</returns>
1559         /// <param name="type">Type of Wi-Fi Direct Service.</param>
1560         /// <param name="info">Service specific information.</param>
1561         /// <param name="serviceInfo">Service information.</param>
1562         /// <privilege>
1563         /// http://tizen.org/privilege/wifidirect
1564         /// </privilege>
1565         /// <feature>
1566         /// http://tizen.org/feature/network.wifidirect
1567         /// http://tizen.org/feature/network.wifi.direct.service_discovery
1568         /// </feature>
1569         /// <remarks>
1570         /// Wi-Fi Direct must be activated.
1571         /// If there is any error while registering service, 0 will be returned.
1572         /// </remarks>
1573         /// <exception cref="NotSupportedException">
1574         /// Thrown during one of the following cases :
1575         /// 1. When the wifidirect is not supported
1576         /// 2. When the wifidirect service discovery is not supported
1577         /// </exception>
1578         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1579         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1580         public static uint RegisterService(WiFiDirectServiceType type, string info, string serviceInfo)
1581         {
1582             if (Globals.IsActivated)
1583             {
1584                 return WiFiDirectManagerImpl.Instance.RegisterService(type, info, serviceInfo);
1585             }
1586
1587             else
1588             {
1589                 return 0;
1590             }
1591         }
1592
1593         /// <summary>
1594         /// Deregisters for a service used for WiFi Direct Service Discovery.
1595         /// </summary>
1596         /// <param name="serviceId"> Service ID for which service has to be deregistered.</param>
1597         /// <privilege>
1598         /// http://tizen.org/privilege/wifidirect
1599         /// </privilege>
1600         /// <feature>
1601         /// http://tizen.org/feature/network.wifidirect
1602         /// http://tizen.org/feature/network.wifi.direct.service_discovery
1603         /// </feature>
1604         /// <remarks>
1605         /// Wi-Fi Direct must be activated.
1606         /// </remarks>
1607         /// <exception cref="NotSupportedException">
1608         /// Thrown during one of the following cases :
1609         /// 1. When the wifidirect is not supported
1610         /// 2. When the wifidirect service discovery is not supported
1611         /// </exception>
1612         /// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
1613         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
1614         public static void DeregisterService(uint serviceId)
1615         {
1616             if (Globals.IsActivated)
1617             {
1618                 WiFiDirectManagerImpl.Instance.DeregisterService(serviceId);
1619             }
1620
1621             else
1622             {
1623                 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
1624                 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1625             }
1626         }
1627     }
1628 }