public void StopScan() { LogImplementation.DLog("StopScan()"); // Call Tizen C# API WiFiDirectManager.CancelDiscovery(); // Remove DiscoveryStateChanged event WiFiDirectManager.DiscoveryStateChanged -= EventHandlerDiscoveryStateChanged; }
private void StartDiscovery() { // Add DiscoveryStateChanged event WiFiDirectManager.DiscoveryStateChanged += EventHandlerDiscoveryStateChanged; LogImplementation.DLog("StartDiscovery()"); // Call Tizen C# API WiFiDirectManager.StartDiscovery(false, 0); LogImplementation.DLog("StartDiscovery() done"); }
public void StartScan() { LogImplementation.DLog("StartScan()"); // Check if the Wi-Fi Direct is deactivated if (WiFiDirectManager.State == WiFiDirectState.Deactivated) { // Add DeviceStateChanged event WiFiDirectManager.DeviceStateChanged += EventHandlerDeviceStateChanged; // Call Tizen C# API WiFiDirectManager.Activate(); } else { // Start to discover Wi-Fi Direct devices StartDiscovery(); } }
private void EventHandlerDiscoveryStateChanged(object s, DiscoveryStateChangedEventArgs e) { LogImplementation.DLog("EventHandlerDiscoveryStateChanged"); if (e.DiscoveryState == WiFiDirectDiscoveryState.Found) { LogImplementation.DLog("Found"); // Get the found Wi-Fi Direct peer list IEnumerable <WiFiDirectPeer> peerList = WiFiDirectManager.GetDiscoveredPeers(); List <String> deviceList = new List <String>(); foreach (WiFiDirectPeer peer in peerList) { LogImplementation.DLog("Peer " + peer.Name); // Add name of the found device to device list deviceList.Add(peer.Name); } // Generate the DeviceDiscovered event DiscoveryEventArgs de = new DiscoveryEventArgs(deviceList); DeviceDiscovered(s, de); } }