2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.Collections.Generic;
20 namespace Tizen.Network.WiFiDirect
23 /// A class which is used to manage settings of Wi-Fi Direct.<br>
24 /// This class is used to discover peer devices and manage settings of Wi-Fi Direct.
26 /// <privilege> http://tizen.org/privilege/wifidirect </privilege>
27 public static class WiFiDirectManager
30 /// A property to check whether the device is group owner or not.
33 /// Wi-Fi Direct must be activated.
34 /// If it is deactivated, false will be returned.
36 public static bool IsGroupOwner
40 if (Globals.IsActivated)
42 return WiFiDirectManagerImpl.Instance.IsGroupOwner;
53 /// A property to check whether the current group is the autonomous group or not.
56 /// Wi-Fi Direct must be activated.
57 /// If it is deactivated, false will be returned.
59 public static bool IsAutonomousGroup
63 if (Globals.IsActivated)
65 return WiFiDirectManagerImpl.Instance.IsAutonomousGroup;
76 /// SSID of local device.
79 /// If there is any error, null will be returned.
81 public static string Ssid
85 if (Globals.IsInitialize)
87 return WiFiDirectManagerImpl.Instance.Ssid;
98 /// Name of network interface.
101 /// Wi-Fi Direct must be activated.
102 /// If it is deactivated, null will be returned.
104 public static string NetworkInterface
108 if (Globals.IsActivated)
110 return WiFiDirectManagerImpl.Instance.NetworkInterface;
121 /// IP address of a local device.
124 /// Wi-Fi Direct must be activated.
125 /// If it is deactivated, null will be returned.
127 public static string IpAddress
131 if (Globals.IsActivated)
133 return WiFiDirectManagerImpl.Instance.IpAddress;
147 /// Wi-Fi Direct must be activated.
148 /// If it is deactivated, null will be returned.
150 public static string SubnetMask
154 if (Globals.IsActivated)
156 return WiFiDirectManagerImpl.Instance.SubnetMask;
170 /// Wi-Fi Direct must be activated.
171 /// If it is deactivated, null will be returned.
173 public static string GatewayAddress
177 if (Globals.IsActivated)
179 return WiFiDirectManagerImpl.Instance.GatewayAddress;
190 /// Mac address of a local device.
193 /// If there is any error, null will be returned.
195 public static string MacAddress
199 if (Globals.IsInitialize)
201 return WiFiDirectManagerImpl.Instance.MacAddress;
212 /// State of Wi-Fi direct service.
214 public static WiFiDirectState State
218 return WiFiDirectManagerImpl.Instance.State;
223 /// A property to check whether the device is discoverable or not by P2P discovery.
225 public static bool IsDiscoverable
229 if (Globals.IsInitialize)
231 return WiFiDirectManagerImpl.Instance.IsDiscoverable;
242 /// A property to check whether the local device is listening only.
245 /// Wi-Fi Direct must be activated.
246 /// If it is deactivated, false will be returned.
248 public static bool IsListenOnly
252 if (Globals.IsActivated)
254 return WiFiDirectManagerImpl.Instance.IsListenOnly;
265 /// Primary device type of local device.
268 /// If there is any error, 0 will be returned.
270 public static WiFiDirectPrimaryDeviceType PrimaryType
274 if (Globals.IsInitialize)
276 return WiFiDirectManagerImpl.Instance.PrimaryType;
281 return default(WiFiDirectPrimaryDeviceType);
287 /// Secondary device type of local device.
290 /// If there is any error, 0 will be returned.
292 public static WiFiDirectSecondaryDeviceType SecondaryType
296 if (Globals.IsInitialize)
298 return WiFiDirectManagerImpl.Instance.SecondaryType;
303 return default(WiFiDirectSecondaryDeviceType);
309 /// Supported WPS (Wi-Fi Protected Setup) types at local device.
312 /// If there is any error, -1 will be returned.
314 public static int WpsMode
318 if (Globals.IsInitialize)
320 return WiFiDirectManagerImpl.Instance.WpsMode;
331 /// WPS (Wi-Fi Protected Setup) type.
333 public static WiFiDirectWpsType Wps
337 if (Globals.IsInitialize)
339 return WiFiDirectManagerImpl.Instance.WpsType;
344 return default(WiFiDirectWpsType);
350 /// Channel number on which the P2P Device is operating as the P2P Group.
353 /// If there is any error, -1 will be returned.
355 public static int OperatingChannel
359 if (Globals.IsInitialize)
361 return WiFiDirectManagerImpl.Instance.OperatingChannel;
372 /// A property to check whether persistent group is enabled.
374 /// <exception cref="NotSupportedException">Thrown while setting this property when the wifidirect is not supported</exception>
375 public static bool PersistentGroupEnabled
379 if (Globals.IsInitialize)
381 return WiFiDirectManagerImpl.Instance.PersistentGroupEnabled;
392 if (Globals.IsInitialize)
394 WiFiDirectManagerImpl.Instance.PersistentGroupEnabled = value;
400 /// Autoconnection mode status.
402 /// <exception cref="NotSupportedException">Thrown while setting this property when the wifidirect is not supported</exception>
403 public static bool AutoConnect
407 if (Globals.IsInitialize)
409 return WiFiDirectManagerImpl.Instance.AutoConnect;
420 if (Globals.IsInitialize)
422 WiFiDirectManagerImpl.Instance.AutoConnect = value;
431 /// Wi-Fi Direct must be activated.
432 /// If it is deactivated, null will be returned during get and Not permitted exception message will be returned during set.
434 /// <exception cref="NotSupportedException">Thrown while setting this property when the wifidirect is not supported</exception>
435 public static string WpsPin
439 if (Globals.IsActivated)
441 return WiFiDirectManagerImpl.Instance.WpsPin;
452 if (Globals.IsActivated)
454 WiFiDirectManagerImpl.Instance.WpsPin = value;
459 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
460 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
466 /// Name of local device.
468 /// <exception cref="NotSupportedException">Thrown while setting this property when the wifidirect is not supported</exception>
469 public static string Name
473 if (Globals.IsInitialize)
475 return WiFiDirectManagerImpl.Instance.Name;
486 if (Globals.IsInitialize)
488 WiFiDirectManagerImpl.Instance.Name = value;
494 /// Requested WPS (Wi-Fi Protected Setup) type.
496 /// <exception cref="NotSupportedException">Thrown while setting this property when the wifidirect is not supported</exception>
497 public static WiFiDirectWpsType RequestedWps
501 if (Globals.IsInitialize)
503 return WiFiDirectManagerImpl.Instance.RequestedWps;
508 return default(WiFiDirectWpsType);
514 if (Globals.IsInitialize)
516 WiFiDirectManagerImpl.Instance.RequestedWps = value;
522 /// Intent of the group owner.
524 /// <exception cref="NotSupportedException">Thrown while setting this property when the wifidirect is not supported</exception>
525 public static int GroupOwnerIntent
529 if (Globals.IsInitialize)
531 return WiFiDirectManagerImpl.Instance.GroupOwnerIntent;
542 if (Globals.IsInitialize)
544 WiFiDirectManagerImpl.Instance.GroupOwnerIntent = value;
550 /// Max number of clients.
552 /// <exception cref="NotSupportedException">Thrown while setting this property when the wifidirect is not supported</exception>
553 public static int MaxClients
557 if (Globals.IsInitialize)
559 return WiFiDirectManagerImpl.Instance.MaxClients;
570 if (Globals.IsInitialize)
572 WiFiDirectManagerImpl.Instance.MaxClients = value;
578 /// Wi-Fi Protected Access (WPA) password.
579 /// It is used during Wi-Fi Direct Group creation.
582 /// Wi-Fi Direct must be activated.
583 /// If it is deactivated, null will be returned during get and Not permitted exception message will be returned during set.
585 /// <exception cref="NotSupportedException">Thrown while setting this property when the wifidirect is not supported</exception>
586 public static string Passphrase
590 if (Globals.IsActivated)
592 return WiFiDirectManagerImpl.Instance.Passphrase;
603 if (Globals.IsActivated)
605 WiFiDirectManagerImpl.Instance.Passphrase = value;
610 Log.Error(Globals.LogTag, "Wi-Fi direct is not activated");
611 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
617 /// Connection session timer value in second.
620 /// Wi-Fi Direct must be activated.
621 /// If it is deactivated, -1 will be returned during get and Not permitted exception message will be returned during set.
623 /// <exception cref="NotSupportedException">Thrown while setting this property when the wifidirect is not supported</exception>
624 public static int SessionTimer
628 if (Globals.IsActivated)
630 return WiFiDirectManagerImpl.Instance.SessionTimer;
641 if (Globals.IsActivated)
643 WiFiDirectManagerImpl.Instance.SessionTimer = value;
648 Log.Error(Globals.LogTag, "Wi-Fi direct is not activated");
649 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
655 /// (event) StateChanged is raised when Wi-Fi Direct state is changed.
657 public static event EventHandler<StateChangedEventArgs> StateChanged
661 WiFiDirectManagerImpl.Instance.StateChanged += value;
666 WiFiDirectManagerImpl.Instance.StateChanged -= value;
671 /// (event) DiscoveryStateChanged is raised when Wi-Fi Direct discovery state is changed.
673 public static event EventHandler<DiscoveryStateChangedEventArgs> DiscoveryStateChanged
677 if (Globals.IsInitialize)
679 WiFiDirectManagerImpl.Instance.DiscoveryStateChanged += value;
685 if (Globals.IsInitialize)
687 WiFiDirectManagerImpl.Instance.DiscoveryStateChanged -= value;
693 /// (event) DeviceStateChanged is raised when device state is changed.
695 public static event EventHandler<DeviceStateChangedEventArgs> DeviceStateChanged
699 if (Globals.IsInitialize)
701 WiFiDirectManagerImpl.Instance.DeviceStateChanged += value;
707 if (Globals.IsInitialize)
709 WiFiDirectManagerImpl.Instance.DeviceStateChanged -= value;
715 /// (event) PeerFound is raised when peer is found.
717 public static event EventHandler<PeerFoundEventArgs> PeerFound
721 if (Globals.IsInitialize)
723 WiFiDirectManagerImpl.Instance.PeerFound += value;
729 if (Globals.IsInitialize)
731 WiFiDirectManagerImpl.Instance.PeerFound -= value;
737 /// (event) ConnectionStatusChanged is raised when status of connection is changed.
739 public static event EventHandler<ConnectionStatusChangedEventArgs> ConnectionStatusChanged
743 if (Globals.IsInitialize)
745 WiFiDirectManagerImpl.Instance.ConnectionStatusChanged += value;
751 if (Globals.IsInitialize)
753 WiFiDirectManagerImpl.Instance.ConnectionStatusChanged -= value;
759 /// Activates the Wi-Fi Direct service.
762 /// If this succeeds, DeviceStateChanged event will be invoked.
764 /// <exception cref="NotSupportedException">Thrown when the wifidirect is not supported</exception>
765 public static void Activate()
767 if (Globals.IsInitialize)
769 WiFiDirectManagerImpl.Instance.Activate();
774 Log.Error(Globals.LogTag, "Wi-Fi direct is not initialized");
775 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotInitialized);
780 /// Deactivates the Wi-Fi Direct service.
783 /// Wi-Fi Direct must be activated.
784 /// If this succeeds, DeviceStateChanged event will be invoked.
786 /// <exception cref="NotSupportedException">Thrown when the wifidirect is not supported</exception>
787 public static void Deactivate()
789 if (Globals.IsActivated)
791 WiFiDirectManagerImpl.Instance.Deactivate();
796 Log.Error(Globals.LogTag, "Wi-Fi direct is not activated");
797 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
802 /// Starts discovery to find all P2P capable devices.
805 /// Wi-Fi Direct must be activated.
806 /// If this succeeds, DiscoveryStateChanged and PeerFound event will be invoked.
808 /// <exception cref="NotSupportedException">Thrown when the wifidirect is not supported</exception>
809 /// <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>
810 /// <param name="duration">Duration of discovery period, in seconds.</param>
811 /// <param name="channel">Discovery channel.It is optional, default enum value FullScan is assigned.</param>
812 public static void StartDiscovery(bool listenOnly, int duration, WiFiDirectDiscoveryChannel channel = WiFiDirectDiscoveryChannel.FullScan)
814 if (Globals.IsActivated)
816 WiFiDirectManagerImpl.Instance.StartDiscovery(listenOnly, duration, channel);
821 Log.Error(Globals.LogTag, "Wi-Fi direct is not activated");
822 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
827 /// Cancels discovery process.
830 /// Discovery must be started by StartDiscovery.
831 /// If this succeeds, DiscoveryStateChanged and PeerFound event will be invoked.
833 /// <exception cref="NotSupportedException">Thrown when the wifidirect is not supported</exception>
834 public static void CancelDiscovery()
836 if (WiFiDirectManager.State == WiFiDirectState.Discovering)
838 WiFiDirectManagerImpl.Instance.CancelDiscovery();
843 Log.Error(Globals.LogTag, "Wi-Fi direct discovery is not started");
844 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
849 /// Gets the information of discovered peers.
852 /// Wi-Fi Direct must be activated.
854 /// <exception cref="NotSupportedException">Thrown when the wifidirect is not supported</exception>
855 /// <returns> List of discovered peer objects.</returns>
856 public static IEnumerable<WiFiDirectPeer> GetDiscoveredPeers()
858 if (Globals.IsActivated)
860 return WiFiDirectManagerImpl.Instance.GetDiscoveredPeers();
870 /// Gets the information of connected peers.
873 /// Wi-Fi Direct must be activated.
875 /// <exception cref="NotSupportedException">Thrown when the wifidirect is not supported</exception>
876 /// <returns> List of connected peer objects.</returns>
877 public static IEnumerable<WiFiDirectPeer> GetConnectedPeers()
879 if (Globals.IsActivated)
881 return WiFiDirectManagerImpl.Instance.GetConnectedPeers();
891 /// Disconnects all connected links to peers.
894 /// Wi-Fi Direct must be activated.
895 /// If this succeeds, ConnectionStatusChanged event will be invoked.
897 /// <exception cref="NotSupportedException">Thrown when the wifidirect is not supported</exception>
898 public static void DisconnectAll()
900 if (Globals.IsActivated)
902 WiFiDirectManagerImpl.Instance.DisconnectAll();
907 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
908 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
913 /// Creates a Wi-Fi Direct group and sets up device as the group owner.
916 /// Wi-Fi Direct must be activated.
917 /// If this succeeds, ConnectionStatusChanged event will be invoked with GroupCreated.
919 /// <exception cref="NotSupportedException">Thrown when the wifidirect is not supported</exception>
920 public static void CreateGroup()
922 if (Globals.IsActivated)
924 WiFiDirectManagerImpl.Instance.CreateGroup();
929 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
930 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
935 /// Destroys the Wi-Fi Direct group owned by a local device.If creating a group is in progress, this API cancels that process.
938 /// Wi-Fi Direct must be activated.
939 /// If this succeeds, ConnectionStatusChanged event will be invoked with GroupDestroyed.
941 /// <exception cref="NotSupportedException">Thrown when the wifidirect is not supported</exception>
942 public static void DestroyGroup()
944 if (Globals.IsActivated)
946 WiFiDirectManagerImpl.Instance.DestroyGroup();
951 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
952 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
957 /// Set the WPS config PBC as preferred method for connection.
959 /// <exception cref="NotSupportedException">Thrown when the wifidirect is not supported</exception>
960 public static void ActivatePushButton()
962 if (Globals.IsActivated)
964 WiFiDirectManagerImpl.Instance.ActivatePushButton();
969 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
970 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
975 /// Gets the supported WPS types.
977 /// <exception cref="NotSupportedException">Thrown when the wifidirect is not supported</exception>
978 /// <returns>The list of supported wps types.</returns>
979 public static IEnumerable<WiFiDirectWpsType> GetSupportedWpsTypes()
981 if (Globals.IsInitialize)
983 return WiFiDirectManagerImpl.Instance.GetSupportedWpsTypes();
993 /// Gets the persistent groups.
995 /// <exception cref="NotSupportedException">Thrown when the wifidirect is not supported</exception>
996 /// <returns>List of the persistent group objects.</returns>
997 public static IEnumerable<WiFiDirectPersistentGroup> GetPersistentGroups()
999 if (Globals.IsInitialize)
1001 return WiFiDirectManagerImpl.Instance.GetPersistentGroups();
1011 /// Removes a persistent group.
1013 /// <exception cref="NotSupportedException">Thrown when the wifidirect is not supported</exception>
1014 /// <param name="group">Persistent group owner.</param>
1015 public static void RemovePersistentGroup(WiFiDirectPersistentGroup group)
1017 if (Globals.IsInitialize)
1019 WiFiDirectManagerImpl.Instance.RemovePersistentGroup(group);
1024 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
1025 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotInitialized);
1030 /// Initializes or Deintializes the WiFi-Direct Display(MIRACAST) service.
1033 /// Wi-Fi Direct must be activated.
1035 /// <exception cref="NotSupportedException">
1036 /// Thrown during one of the following cases :
1037 /// 1. When the wifidirect is not supported
1038 /// 2. When the wifidirect display feature is not supported
1040 /// <param name="enable">Enables/Disables service.</param>
1041 public static void InitMiracast(bool enable)
1043 if (Globals.IsActivated)
1045 WiFiDirectManagerImpl.Instance.InitMiracast(enable);
1050 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
1051 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1056 /// Enables Wi-Fi Display functionality.
1059 /// Wi-Fi Direct must be activated.
1061 /// <exception cref="NotSupportedException">
1062 /// Thrown during one of the following cases :
1063 /// 1. When the wifidirect is not supported
1064 /// 2. When the wifidirect display feature is not supported
1066 public static void InitDisplay()
1068 if (Globals.IsActivated)
1070 WiFiDirectManagerImpl.Instance.InitDisplay();
1075 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
1076 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1081 /// Disable Wi-Fi Display(WFD) functionality and disable the support of WFD Information Element(IE).
1084 /// Wi-Fi Direct must be activated and WFD must be enabled.
1086 /// <exception cref="NotSupportedException">
1087 /// Thrown during one of the following cases :
1088 /// 1. When the wifidirect is not supported
1089 /// 2. When the wifidirect display feature is not supported
1091 public static void DeinitDisplay()
1093 if (Globals.IsActivated && Globals.s_isDisplay)
1095 WiFiDirectManagerImpl.Instance.DeinitDisplay();
1100 Log.Error(Globals.LogTag, "Wifi-direct is not activated and/or Wi-Fi display is not enabled");
1101 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1106 /// Sets the Wi-Fi Display parameters for the WFD IE of local device.
1109 /// Wi-Fi Direct must be activated and WFD must be enabled.
1111 /// <exception cref="NotSupportedException">
1112 /// Thrown during one of the following cases :
1113 /// 1. When the wifidirect is not supported
1114 /// 2. When the wifidirect display feature is not supported
1116 /// <param name="type">WFD Device Type: define the Role of WFD device like source or sink.</param>
1117 /// <param name="port">Specifies Session Management Control Port number. It should be 2 bytes(0~65535).</param>
1118 /// <param name="hdcp">CP support bit: (1 = enable the hdcp support, 0 = disable the hdcp support).</param>
1119 public static void SetDisplay(WiFiDirectDisplayType type, int port, int hdcp)
1121 if (Globals.IsActivated && Globals.s_isDisplay)
1123 WiFiDirectManagerImpl.Instance.SetDisplay(type, port, hdcp);
1128 Log.Error(Globals.LogTag, "Wifi-direct is not activated and/or Wi-Fi display is not enabled");
1129 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1134 /// Sets the Wi-Fi Display session availability.
1137 /// Wi-Fi Direct must be activated and WFD must be enabled.
1139 /// <exception cref="NotSupportedException">
1140 /// Thrown during one of the following cases :
1141 /// 1. When the wifidirect is not supported
1142 /// 2. When the wifidirect display feature is not supported
1144 /// <param name="availability">Wi-Fi Display session availability.</param>
1145 public static void SetDisplayAvailability(bool availability)
1147 if (Globals.IsActivated && Globals.s_isDisplay)
1149 WiFiDirectManagerImpl.Instance.SetDisplayAvailability(availability);
1154 Log.Error(Globals.LogTag, "Wifi-direct is not activated and/or Wi-Fi display is not enabled");
1155 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1160 /// Sets the automatic group removal feature when all peers are disconnected.
1163 /// Wi-Fi Direct must be activated.
1164 /// 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.
1166 /// <exception cref="NotSupportedException">Thrown when the wifidirect is not supported</exception>
1167 /// <param name="enable">Enables/Disables group removal feature.</param>
1168 public static void SetAutoGroupRemove(bool enable)
1170 if (Globals.IsActivated)
1172 WiFiDirectManagerImpl.Instance.SetAutoGroupRemove(enable);
1177 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
1178 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
1183 /// Registers the service.
1186 /// Wi-Fi Direct must be activated.
1187 /// If there is any error while registering service, 0 will be returned.
1189 /// <exception cref="NotSupportedException">
1190 /// Thrown during one of the following cases :
1191 /// 1. When the wifidirect is not supported
1192 /// 2. When the wifidirect service discovery is not supported
1194 /// <returns>The service Id of service getting registered.</returns>
1195 /// <param name="type">Type of Wi-Fi Direct Service.</param>
1196 /// <param name="info">Service specific information.</param>
1197 /// <param name="serviceInfo">Service information.</param>
1198 public static uint RegisterService(WiFiDirectServiceType type, string info, string serviceInfo)
1200 if (Globals.IsActivated)
1202 return WiFiDirectManagerImpl.Instance.RegisterService(type, info, serviceInfo);
1212 /// Deregisters for a service used for WiFi Direct Service Discovery.
1215 /// Wi-Fi Direct must be activated.
1217 /// <exception cref="NotSupportedException">
1218 /// Thrown during one of the following cases :
1219 /// 1. When the wifidirect is not supported
1220 /// 2. When the wifidirect service discovery is not supported
1222 /// <param name="serviceId"> Service ID for which service has to be deregistered.</param>
1223 public static void DeregisterService(uint serviceId)
1225 if (Globals.IsActivated)
1227 WiFiDirectManagerImpl.Instance.DeregisterService(serviceId);
1232 Log.Error(Globals.LogTag, "Wifi-direct is not activated");
1233 WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);