Class WiFiDirectManager
Definition
- Namespace:
- Tizen.Network.WiFiDirect
- Assembly:
- Tizen.Network.WiFiDirect.dll
A class which is used to manage settings of Wi-Fi Direct.
This class is used to discover peer devices and manage settings of Wi-Fi Direct.
public static class WiFiDirectManager
- Inheritance
-
objectWiFiDirectManager
Properties
View SourceAutoConnect
Gets and sets the AutoConnect.
Declaration
public static bool AutoConnect { get; set; }
Property Value
Type | Description |
---|---|
bool | Autoconnection mode status. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
GatewayAddress
Gets the GatewayAddress.
Declaration
public static string GatewayAddress { get; }
Property Value
Type | Description |
---|---|
string | Gateway address. |
Remarks
Wi-Fi Direct must be activated. If it is deactivated, null will be returned.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
GroupOwnerIntent
Gets and sets the GroupOwnerIntent.
Declaration
public static int GroupOwnerIntent { get; set; }
Property Value
Type | Description |
---|---|
int | Intent of the group owner. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
IpAddress
Gets the IpAddress.
Declaration
public static string IpAddress { get; }
Property Value
Type | Description |
---|---|
string | IP address of a local device. |
Remarks
Wi-Fi Direct must be activated. If it is deactivated, null will be returned.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
IsAutonomousGroup
Gets the IsAutonomousGroup.
Declaration
public static bool IsAutonomousGroup { get; }
Property Value
Type | Description |
---|---|
bool | A property to check whether the current group is the autonomous group or not. |
Remarks
Wi-Fi Direct must be activated. If it is deactivated, false will be returned.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
IsDiscoverable
A property to check whether the device is discoverable or not by P2P discovery.
Declaration
public static bool IsDiscoverable { get; }
Property Value
Type | Description |
---|---|
bool |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
IsGroupOwner
Gets the IsGroupOwner.
Declaration
public static bool IsGroupOwner { get; }
Property Value
Type | Description |
---|---|
bool | A property to check whether the device is group owner or not. |
Remarks
Wi-Fi Direct must be activated. If it is deactivated, false will be returned.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
IsListenOnly
Gets the IsListenOnly.
Declaration
public static bool IsListenOnly { get; }
Property Value
Type | Description |
---|---|
bool | A property to check whether the local device is listening only. |
Remarks
Wi-Fi Direct must be activated. If it is deactivated, false will be returned.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
MacAddress
Gets the MacAddress.
Declaration
public static string MacAddress { get; }
Property Value
Type | Description |
---|---|
string | Mac address of a local device. |
Remarks
If there is any error, null will be returned.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
MaxClients
Gets and sets the MaxClients.
Declaration
public static int MaxClients { get; set; }
Property Value
Type | Description |
---|---|
int | Max number of clients. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
Name
Gets and sets the Name.
Declaration
public static string Name { get; set; }
Property Value
Type | Description |
---|---|
string | Name of local device. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
NetworkInterface
Gets the NetworkInterface.
Declaration
public static string NetworkInterface { get; }
Property Value
Type | Description |
---|---|
string | Name of network interface. |
Remarks
Wi-Fi Direct must be activated. If it is deactivated, null will be returned.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
OperatingChannel
Gets the OperatingChannel.
Declaration
public static int OperatingChannel { get; }
Property Value
Type | Description |
---|---|
int | Channel number on which the P2P Device is operating as the P2P Group. |
Remarks
If there is any error, -1 will be returned.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
Passphrase
Gets and sets the Passphrase. It is used during Wi-Fi Direct Group creation.
Declaration
public static string Passphrase { get; set; }
Property Value
Type | Description |
---|---|
string | Wi-Fi Protected Access (WPA) password. |
Remarks
Wi-Fi Direct must be activated. If it is deactivated, null will be returned during get and Not permitted exception message will be returned during set.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
PersistentGroupEnabled
Gets and sets the PersistentGroupEnabled.
Declaration
public static bool PersistentGroupEnabled { get; set; }
Property Value
Type | Description |
---|---|
bool | A property to check whether persistent group is enabled. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
PrimaryType
Gets the PrimaryType.
Declaration
public static WiFiDirectPrimaryDeviceType PrimaryType { get; }
Property Value
Type | Description |
---|---|
WiFiDirectPrimaryDeviceType | Primary device type of local device. |
Remarks
If there is any error, 0 will be returned.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
RequestedWps
Gets and sets the RequestedWps.
Declaration
public static WiFiDirectWpsType RequestedWps { get; set; }
Property Value
Type | Description |
---|---|
WiFiDirectWpsType | Requested WPS (Wi-Fi Protected Setup) type. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
SecondaryType
Gets the SecondaryType.
Declaration
public static WiFiDirectSecondaryDeviceType SecondaryType { get; }
Property Value
Type | Description |
---|---|
WiFiDirectSecondaryDeviceType | Secondary device type of local device. |
Remarks
If there is any error, 0 will be returned.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
SessionTimer
Gets and sets the SessionTimer.
Declaration
public static int SessionTimer { get; set; }
Property Value
Type | Description |
---|---|
int | Connection session timer value in second. |
Remarks
Wi-Fi Direct must be activated. If it is deactivated, -1 will be returned during get and Not permitted exception message will be returned during set.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
Ssid
Gets the Ssid.
Declaration
public static string Ssid { get; }
Property Value
Type | Description |
---|---|
string | SSID of local device. |
Remarks
If there is any error, null will be returned.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
State
Gets the State.
Declaration
public static WiFiDirectState State { get; }
Property Value
Type | Description |
---|---|
WiFiDirectState | State of Wi-Fi direct service. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
SubnetMask
Gets the SubnetMask.
Declaration
public static string SubnetMask { get; }
Property Value
Type | Description |
---|---|
string | Subnet mask. |
Remarks
Wi-Fi Direct must be activated. If it is deactivated, null will be returned.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
Wps
Gets the Wps.
Declaration
public static WiFiDirectWpsType Wps { get; }
Property Value
Type | Description |
---|---|
WiFiDirectWpsType | WPS (Wi-Fi Protected Setup) type. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
WpsMode
Gets the WpsMode.
Declaration
public static int WpsMode { get; }
Property Value
Type | Description |
---|---|
int | Supported WPS (Wi-Fi Protected Setup) types at local device. |
Remarks
If there is any error, -1 will be returned.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
WpsPin
Gets and sets the WpsPin.
Declaration
public static string WpsPin { get; set; }
Property Value
Type | Description |
---|---|
string | WPS PIN number. |
Remarks
Wi-Fi Direct must be activated. If it is deactivated, null will be returned during get and Not permitted exception message will be returned during set.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
Methods
View SourceActivate()
Activates the Wi-Fi Direct service.
Declaration
public static void Activate()
Remarks
If this succeeds, DeviceStateChanged event will be invoked.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
ActivatePushButton()
Set the WPS config PBC as preferred method for connection.
Declaration
public static void ActivatePushButton()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
AddVsie(WiFiDirectVsieFrameType, string)
Adds the Wi-Fi Vendor Specific Information Element (VSIE) to specific frame type.
Declaration
public static void AddVsie(WiFiDirectVsieFrameType frameType, string vsie)
Parameters
Type | Name | Description |
---|---|---|
WiFiDirectVsieFrameType | frameType | frame type for setting VSIE. |
string | vsie | VSIE value. A valid string contains hexadecimal characters i.e. [0-9a-f] |
Remarks
Wi-Fi Direct must be activated.
vsie
for frameType
will be in effect until Wi-Fi Direct is deactivated.
A valid value will be concatenated to already added VSIE values. If vsie value is invalid, InvalidOperationException
will be thrown. If same value for given frameType is already in effect, then there will be no change.
VSIE data structure is described in 802.11 specification.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
CancelDiscovery()
Cancels discovery process.
Declaration
public static void CancelDiscovery()
Remarks
Discovery must be started by StartDiscovery. If this succeeds, DiscoveryStateChanged and PeerFound event will be invoked.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
CreateGroup()
Creates a Wi-Fi Direct group and sets up device as the group owner.
Declaration
public static void CreateGroup()
Remarks
Wi-Fi Direct must be activated. If this succeeds, ConnectionStatusChanged event will be invoked with GroupCreated.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
Deactivate()
Deactivates the Wi-Fi Direct service.
Declaration
public static void Deactivate()
Remarks
Wi-Fi Direct must be activated. If this succeeds, DeviceStateChanged event will be invoked.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
DeinitDisplay()
Disable Wi-Fi Display(WFD) functionality and disable the support of WFD Information Element(IE).
Declaration
public static void DeinitDisplay()
Remarks
Wi-Fi Direct must be activated and WFD must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown during one of the following cases :
|
System.InvalidOperationException | The object is in invalid state. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
DeregisterService(uint)
Deregisters for a service used for WiFi Direct Service Discovery.
Declaration
public static void DeregisterService(uint serviceId)
Parameters
Type | Name | Description |
---|---|---|
uint | serviceId | Service ID for which service has to be deregistered. |
Remarks
Wi-Fi Direct must be activated.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown during one of the following cases :
|
System.InvalidOperationException | The object is in invalid state. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
DestroyGroup()
Destroys the Wi-Fi Direct group owned by a local device.If creating a group is in progress, this API cancels that process.
Declaration
public static void DestroyGroup()
Remarks
Wi-Fi Direct must be activated. If this succeeds, ConnectionStatusChanged event will be invoked with GroupDestroyed.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
DisconnectAll()
Disconnects all connected links to peers.
Declaration
public static void DisconnectAll()
Remarks
Wi-Fi Direct must be activated. If this succeeds, ConnectionStatusChanged event will be invoked.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
GetConnectedPeers()
Gets the information of connected peers.
Declaration
public static IEnumerable<WiFiDirectPeer> GetConnectedPeers()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><WiFiDirectPeer> | List of connected peer objects. |
Remarks
Wi-Fi Direct must be activated.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
GetConnectingPeer()
Gets the information of peer devices which is in the connecting state.
Declaration
public static WiFiDirectPeer GetConnectingPeer()
Returns
Type | Description |
---|---|
WiFiDirectPeer | Connecting peer object. |
Remarks
Wi-Fi Direct service must be in connecting state.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
GetDiscoveredPeers()
Gets the information of discovered peers.
Declaration
public static IEnumerable<WiFiDirectPeer> GetDiscoveredPeers()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><WiFiDirectPeer> | List of discovered peer objects. |
Remarks
Wi-Fi Direct must be activated.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
GetPersistentGroups()
Gets the persistent groups.
Declaration
public static IEnumerable<WiFiDirectPersistentGroup> GetPersistentGroups()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><WiFiDirectPersistentGroup> | List of the persistent group objects. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
GetSupportedWpsTypes()
Gets the supported WPS types.
Declaration
public static IEnumerable<WiFiDirectWpsType> GetSupportedWpsTypes()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><WiFiDirectWpsType> | The list of supported wps types. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
GetVsie(WiFiDirectVsieFrameType)
Gets the Wi-Fi Vendor Specific Information Elements (VSIE) from specific frame type.
Declaration
public static string GetVsie(WiFiDirectVsieFrameType frameType)
Parameters
Type | Name | Description |
---|---|---|
WiFiDirectVsieFrameType | frameType | frame type for getting VSIE. |
Returns
Type | Description |
---|---|
string | VSIE value if success else null value. |
Remarks
Wi-Fi Direct must be activated.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
InitDisplay()
Enables Wi-Fi Display functionality.
Declaration
public static void InitDisplay()
Remarks
Wi-Fi Direct must be activated.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown during one of the following cases :
|
System.InvalidOperationException | The object is in invalid state. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
InitMiracast(bool)
Initializes or Deintializes the Wi-Fi Direct Display(MIRACAST) service.
Declaration
public static void InitMiracast(bool enable)
Parameters
Type | Name | Description |
---|---|---|
bool | enable | Enables/Disables service. |
Remarks
Wi-Fi Direct must be activated.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown during one of the following cases :
|
System.InvalidOperationException | The object is in invalid state. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
RegisterService(WiFiDirectServiceType, string, string)
Registers the service.
Declaration
public static uint RegisterService(WiFiDirectServiceType type, string info, string serviceInfo)
Parameters
Type | Name | Description |
---|---|---|
WiFiDirectServiceType | type | Type of Wi-Fi Direct Service. |
string | info | Service specific information. |
string | serviceInfo | Service information. |
Returns
Type | Description |
---|---|
uint | The service Id of service getting registered. |
Remarks
Wi-Fi Direct must be activated. If there is any error while registering service, 0 will be returned.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown during one of the following cases :
|
System.InvalidOperationException | The object is in invalid state. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
RemovePersistentGroup(WiFiDirectPersistentGroup)
Removes a persistent group.
Declaration
public static void RemovePersistentGroup(WiFiDirectPersistentGroup group)
Parameters
Type | Name | Description |
---|---|---|
WiFiDirectPersistentGroup | group | Persistent group owner. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
RemoveVsie(WiFiDirectVsieFrameType, string)
Removes the Wi-Fi Vendor Specific Information Element (VSIE) from specific frame type.
Declaration
public static void RemoveVsie(WiFiDirectVsieFrameType frameType, string vsie)
Parameters
Type | Name | Description |
---|---|---|
WiFiDirectVsieFrameType | frameType | frame type for removing VSIE. |
string | vsie | VSIE value |
Remarks
Wi-Fi Direct must be activated. A VSIE value if already added, will be removed from VSIE value else InvalidOperationException will be thrown.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
SetAutoGroupRemove(bool)
Sets the automatic group removal feature when all peers are disconnected.
Declaration
public static void SetAutoGroupRemove(bool enable)
Parameters
Type | Name | Description |
---|---|---|
bool | enable | Enables/Disables group removal feature. |
Remarks
Wi-Fi Direct must be activated. 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.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
SetDisplay(WiFiDirectDisplayType, int, int)
Sets the Wi-Fi Display parameters for the WFD IE of local device.
Declaration
public static void SetDisplay(WiFiDirectDisplayType type, int port, int hdcp)
Parameters
Type | Name | Description |
---|---|---|
WiFiDirectDisplayType | type | WFD Device Type: define the Role of WFD device like source or sink. |
int | port | Specifies Session Management Control Port number. It should be 2 bytes(0~65535). |
int | hdcp | CP support bit: (1 = enable the hdcp support, 0 = disable the hdcp support). |
Remarks
Wi-Fi Direct must be activated and WFD must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown during one of the following cases :
|
System.InvalidOperationException | The object is in invalid state. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
SetDisplayAvailability(bool)
Sets the Wi-Fi Display session availability.
Declaration
public static void SetDisplayAvailability(bool availability)
Parameters
Type | Name | Description |
---|---|---|
bool | availability | Wi-Fi Display session availability. |
Remarks
Wi-Fi Direct must be activated and WFD must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown during one of the following cases :
|
System.InvalidOperationException | The object is in invalid state. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
StartDiscovery(bool, int, WiFiDirectDiscoveryChannel)
Starts discovery to find all P2P capable devices.
Declaration
public static void StartDiscovery(bool listenOnly, int duration, WiFiDirectDiscoveryChannel channel = WiFiDirectDiscoveryChannel.FullScan)
Parameters
Type | Name | Description |
---|---|---|
bool | listenOnly | Listen status.If False, then cycle between Scan and Listen.If True, then skip the initial 802.11 Scan and enter Listen state. |
int | duration | Duration of discovery period, in seconds. |
WiFiDirectDiscoveryChannel | channel | Discovery channel.It is optional, default enum value FullScan is assigned. |
Remarks
Wi-Fi Direct must be activated. If this succeeds, DiscoveryStateChanged and PeerFound event will be invoked.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The object is in invalid state. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | Thrown when application does not have privilege to access this method. |
Events
View SourceConnectionStatusChanged
(event) ConnectionStatusChanged is raised when status of connection is changed.
Declaration
public static event EventHandler<ConnectionStatusChangedEventArgs> ConnectionStatusChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><ConnectionStatusChangedEventArgs> |
DeviceStateChanged
(event) DeviceStateChanged is raised when device state is changed.
Declaration
public static event EventHandler<DeviceStateChangedEventArgs> DeviceStateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><DeviceStateChangedEventArgs> |
DiscoveryStateChanged
(event) DiscoveryStateChanged is raised when Wi-Fi Direct discovery state is changed.
Declaration
public static event EventHandler<DiscoveryStateChangedEventArgs> DiscoveryStateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><DiscoveryStateChangedEventArgs> |
PeerFound
(event) PeerFound is raised when peer is found.
Declaration
public static event EventHandler<PeerFoundEventArgs> PeerFound
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><PeerFoundEventArgs> |
StateChanged
(event) StateChanged is raised when Wi-Fi Direct state is changed.
Declaration
public static event EventHandler<StateChangedEventArgs> StateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><StateChangedEventArgs> |