}
}
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Scan all avaiable LE devices")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.StartLeScan M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Wootak Jung, wootak.jung@samsung.com")]
+ [Property("COVPARAM", "BluetoothLeScanMode")]
+ public static async Task StartLeScan_MODE_CHECK_STATUS()
+ {
+ try
+ {
+ /* PRECONDITION
+ * 1. Enable Bluetooth
+ * 2. Register event handler
+ */
+ if (!BluetoothAdapter.IsBluetoothEnabled)
+ {
+ Assert.Fail("Bluetooth is not enabled");
+ return;
+ }
+
+ EventHandler<AdapterLeScanResultChangedEventArgs> scanDeviceResultEventHandler = null;
+ scanDeviceResultEventHandler = (sender, e) =>
+ {
+ Assert.IsTrue((int)e.Result == 0, "[TestCase][StartLeScan_MODE_CHECK_STATUS] Failed");
+ _flagDiscovery = true;
+ };
+ BluetoothAdapter.ScanResultChanged += scanDeviceResultEventHandler;
+
+ /* TEST CODE */
+ BluetoothAdapter.StartLeScan(BluetoothLeScanMode.Balanced);
+ _flagDiscovery = false;
+ await waitDiscoveryFlag();
+ Assert.IsTrue(_flagDiscovery, "ScanResultChanged event is not getting called");
+ BluetoothAdapter.StopLeScan();
+
+ BluetoothAdapter.StartLeScan(BluetoothLeScanMode.LowLatency);
+ _flagDiscovery = false;
+ await waitDiscoveryFlag();
+ Assert.IsTrue(_flagDiscovery, "ScanResultChanged event is not getting called");
+ BluetoothAdapter.StopLeScan();
+
+ BluetoothAdapter.StartLeScan(BluetoothLeScanMode.LowEnergy);
+ _flagDiscovery = false;
+ await waitDiscoveryFlag();
+ Assert.IsTrue(_flagDiscovery, "ScanResultChanged event is not getting called");
+ BluetoothAdapter.StopLeScan();
+
+ /* POSTCONDITION
+ * 1. Unregister event handler
+ */
+ BluetoothAdapter.ScanResultChanged -= scanDeviceResultEventHandler;
+ }
+ catch (Exception ex)
+ {
+ if (ex is NotSupportedException)
+ {
+ Assert.IsTrue(_isBluetoothLeSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.Fail("Throwing exception " + ex.ToString());
+ }
+ }
+ }
}
}