From 87891947e4f00adbd8162ddf9bafb9a948e7c523 Mon Sep 17 00:00:00 2001 From: Sudipto Date: Fri, 15 May 2020 19:37:52 +0530 Subject: [PATCH] [Bluetooth][TCSACR-323] Implement BT Avrcp Control Tests This patch has implementation of C# TCTs for APIs of the AVRCP Control Profile of bluetooth Change-Id: I5f7a460ea76fb9f453abb6931c290fe7c9c135df Signed-off-by: Sudipto Signed-off-by: Wootak Jung --- .../testcase/BluetoothSetup.cs | 39 + .../testcase/TSBluetoothAvrcpControl.cs | 1232 +++++++++++++++++ 2 files changed, 1271 insertions(+) create mode 100644 tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothAvrcpControl.cs diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/BluetoothSetup.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/BluetoothSetup.cs index a9717bb14..f27fc0902 100644 --- a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/BluetoothSetup.cs +++ b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/BluetoothSetup.cs @@ -19,6 +19,7 @@ namespace BluetoothNetworkUtils { public static BluetoothAudio BtAudio = null; public static BluetoothAvrcp BtAvrcp = null; + public static BluetoothAvrcpControl BtAvrcpControl = null; public static BluetoothHid BtHid = null; public static BluetoothOppClient BtOppClient = null; public static BluetoothServerSocket Server = null; @@ -28,6 +29,7 @@ namespace BluetoothNetworkUtils static BluetoothDevice pairedDevice = null; static BluetoothDevice audioDevice = null; static BluetoothDevice avrcpDevice = null; + static BluetoothDevice avrcpTargetDevice = null; static BluetoothDevice foundDevice = null; static BluetoothDevice hidDevice = null; public static bool FlagAcceptStateChanged = false; @@ -440,6 +442,43 @@ namespace BluetoothNetworkUtils return BtAvrcp; } + public static async Task GetBluetoothAvrcpControlProfileUtil() + { + if (avrcpTargetDevice == null) + { + // Get the audio device in the paired list + IEnumerable list = BluetoothAdapter.GetBondedDevices(); + if (!list.Any()) + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "There is no bonded device"); + } + else + { + foreach (BluetoothDevice item in list) + { + foreach (string s in item.ServiceUuidList) + { + if (s.Equals(A2dpSrcUuid)) + { + avrcpTargetDevice = item; + break; + } + } + if (avrcpTargetDevice != null) + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Found the avrcp Target Device device: " + avrcpTargetDevice.Address); + break; + } + } + } + } + + Assert.IsNotNull(avrcpTargetDevice, "PRECONDITION Failed: avrcp Target Device should not be null."); + + BtAvrcpControl = avrcpTargetDevice.GetProfile(); + return BtAvrcpControl; + } + public static async Task GetBluetoothHidProfileUtil() { if (hidDevice == null) diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothAvrcpControl.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothAvrcpControl.cs new file mode 100644 index 000000000..c2a7299cd --- /dev/null +++ b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothAvrcpControl.cs @@ -0,0 +1,1232 @@ +using System; +using System.Threading.Tasks; +using BluetoothNetworkUtils; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.System; +using Xamarin.Forms; + +namespace Tizen.Network.Bluetooth.Tests +{ + [TestFixture] + [Description("BluetoothAvrcpControl Tests")] + public class BluetoothAvrcpControlTests + { + private BluetoothAvrcpControl _avrcpControlProfile = null; + private BluetoothAudio _audioProfile = null; + private bool _isBluetoothAudioControlSupported = false; + private bool _isPositionPropertyReadPassed = false; + private bool _isPlayStatePropertyReadPassed = false; + private bool _isTrackDataPropertyReadPassed = false; + private bool _isIsConnectedPropertyReadPassed = false; + private bool _isRemoteAddressPropertyReadPassed = false; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST"); + Information.TryGetValue("http://tizen.org/feature/network.bluetooth.audio.controller", out _isBluetoothAudioControlSupported); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Listen control connection state changed event")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.ConnectionStateChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ConnectionStateChanged_CHECK_EVENT() + { + try + { + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("ConnectionStateChanged_CHECK_EVENT"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + EventHandler ControlConnectionChanged = null; + + ControlConnectionChanged = (sender, e) => { + Assert.IsInstanceOf(e.IsConnected, "IsConnected value is not of type bool"); + Assert.AreEqual(e.IsConnected, true, "IsConnected should be true"); + _isIsConnectedPropertyReadPassed = true; + Assert.IsInstanceOf(e.RemoteAddress, "RemoteAddress value is not of type string"); + Assert.AreNotEqual(e.RemoteAddress, "", "RemoteAddress is invalid"); + _isRemoteAddressPropertyReadPassed = true; + BluetoothHelper.DisplayPassLabel("ConnectionStateChanged_CHECK_EVENT"); + }; + + _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await ManualTest.WaitForConfirm(); + _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Listen control connection state changed event")] + [Property("SPEC", "Tizen.Network.Bluetooth.AvrcpControlConnectionChangedEventArgs.IsConnected A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task IsConnected_PROPERTY_READ_ONLY() + { + try + { + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("IsConnected_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_isIsConnectedPropertyReadPassed == true) + { + BluetoothHelper.DisplayPassLabel("IsConnected_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + EventHandler ControlConnectionChanged = null; + + ControlConnectionChanged = (sender, e) => { + Assert.IsInstanceOf(e.IsConnected, "IsConnected value is not of type bool"); + Assert.AreEqual(e.IsConnected, true, "IsConnected should be true"); + BluetoothHelper.DisplayPassLabel("IsConnected_PROPERTY_READ_ONLY"); + }; + + _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await ManualTest.WaitForConfirm(); + _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Listen control connection state changed event")] + [Property("SPEC", "Tizen.Network.Bluetooth.AvrcpControlConnectionChangedEventArgs.RemoteAddress A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task RemoteAddress_PROPERTY_READ_ONLY() + { + try + { + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("RemoteAddress_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_isRemoteAddressPropertyReadPassed == true) + { + BluetoothHelper.DisplayPassLabel("RemoteAddress_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + EventHandler ControlConnectionChanged = null; + + ControlConnectionChanged = (sender, e) => { + Assert.IsInstanceOf(e.RemoteAddress, "RemoteAddress value is not of type string"); + Assert.AreNotEqual(e.RemoteAddress, "", "RemoteAddress is invalid"); + BluetoothHelper.DisplayPassLabel("RemoteAddress_PROPERTY_READ_ONLY"); + }; + + _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await ManualTest.WaitForConfirm(); + _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Listen Play Position Changed")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.PositionChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT headset.")] + [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Change play position of a track by dragging seek bar on the target")] + [Postcondition(1, "NA")] + public async Task PositionChanged_CHECK_EVENT() + { + try + { + uint originValue = 0; + + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("PositionChanged_CHECK_EVENT"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + EventHandler PositionChanged = null; + + PositionChanged = (sender, e) => + { + Assert.IsInstanceOf(e.Position, "Position value is not of type uint"); + Assert.AreNotEqual(e.Position, originValue, "Position value is same original value"); + _isPositionPropertyReadPassed = true; + BluetoothHelper.DisplayPassLabel("PositionChanged_CHECK_EVENT"); + }; + + originValue = _avrcpControlProfile.GetPosition(); + _avrcpControlProfile.PositionChanged += PositionChanged; + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await ManualTest.WaitForConfirm(); + _avrcpControlProfile.PositionChanged -= PositionChanged; + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Listen Play Position Changed")] + [Property("SPEC", "Tizen.Network.Bluetooth.PositionChangedEventArgs.Position A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT headset.")] + [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Change play position of a track by dragging seek bar on the target")] + [Postcondition(1, "NA")] + public async Task Position_PROPERTY_READ_ONLY() + { + try + { + uint originValue = 0; + + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("Position_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_isPositionPropertyReadPassed == true) + { + BluetoothHelper.DisplayPassLabel("Position_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + EventHandler PositionChanged = null; + + PositionChanged = (sender, e) => + { + Assert.IsInstanceOf(e.Position, "Position value is not of type uint"); + Assert.AreNotEqual(e.Position, originValue, "Position value is same original value"); + BluetoothHelper.DisplayPassLabel("Position_PROPERTY_READ_ONLY"); + }; + + originValue = _avrcpControlProfile.GetPosition(); + _avrcpControlProfile.PositionChanged += PositionChanged; + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await ManualTest.WaitForConfirm(); + _avrcpControlProfile.PositionChanged -= PositionChanged; + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Listen PlayState changed")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.PlayStateChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT headset.")] + [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Play/pause a track on the target")] + [Postcondition(1, "NA")] + public async Task PlayStateChanged_CHECK_EVENT() + { + try + { + PlayerState originValue = 0; + + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("PlayStateChanged_CHECK_EVENT"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + EventHandler PlayStateChanged = null; + + PlayStateChanged = (sender, e) => + { + Assert.IsInstanceOf(e.PlayState, "PlayState value is not of type PlayerState"); + Assert.AreNotEqual(e.PlayState, originValue, "PlayState value is same original value"); + _isPlayStatePropertyReadPassed = true; + BluetoothHelper.DisplayPassLabel("PlayStateChanged_CHECK_EVENT"); + }; + + originValue = _avrcpControlProfile.GetPlayStatus(); + _avrcpControlProfile.PlayStateChanged += PlayStateChanged; + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await ManualTest.WaitForConfirm(); + _avrcpControlProfile.PlayStateChanged -= PlayStateChanged; + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Test Mode: Check if state has proper value")] + [Property("SPEC", "Tizen.Network.Bluetooth.PlayStateChangedEventArgs.PlayState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT headset.")] + [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Play/pause a track on the target")] + [Postcondition(1, "NA")] + public async Task PlayState_PROPERTY_READ_ONLY() + { + try + { + PlayerState originValue = 0; + + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("PlayState_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_isPlayStatePropertyReadPassed == true) + { + BluetoothHelper.DisplayPassLabel("PlayState_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + EventHandler PlayStateChanged = null; + + PlayStateChanged = (sender, e) => + { + Assert.IsInstanceOf(e.PlayState, "PlayState value is not of type PlayerState"); + Assert.AreNotEqual(e.PlayState, originValue, "PlayState value is same original value"); + BluetoothHelper.DisplayPassLabel("PlayState_PROPERTY_READ_ONLY"); + }; + + originValue = _avrcpControlProfile.GetPlayStatus(); + _avrcpControlProfile.PlayStateChanged += PlayStateChanged; + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await ManualTest.WaitForConfirm(); + _avrcpControlProfile.PlayStateChanged -= PlayStateChanged; + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Listen Track Info changed")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.TrackInfoChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT headset.")] + [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Change track on the target")] + [Postcondition(1, "NA")] + public async Task TrackInfoChanged_CHECK_EVENT() + { + try + { + Track originValue = new Track(); + + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("TrackInfoChanged_CHECK_EVENT"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + EventHandler TrackInfoChanged = null; + + TrackInfoChanged = (sender, e) => + { + Assert.IsInstanceOf(e.TrackData, "TrackData value is not of type Track"); + Assert.AreNotEqual(e.TrackData, originValue, "TrackData value is same original value"); + _isTrackDataPropertyReadPassed = true; + BluetoothHelper.DisplayPassLabel("TrackInfoChanged_CHECK_EVENT"); + }; + + originValue = _avrcpControlProfile.GetTrackInfo(); + _avrcpControlProfile.TrackInfoChanged += TrackInfoChanged; + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await ManualTest.WaitForConfirm(); + _avrcpControlProfile.TrackInfoChanged -= TrackInfoChanged; + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Listen Track Info changed")] + [Property("SPEC", "Tizen.Network.Bluetooth.TrackInfoChangedEventArgs.TrackData A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT headset.")] + [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Change track on the target")] + [Postcondition(1, "NA")] + public async Task TrackData_PROPERTY_READ_ONLY() + { + try + { + Track originValue = new Track(); + + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("TrackData_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_isTrackDataPropertyReadPassed == true) + { + BluetoothHelper.DisplayPassLabel("TrackData_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + EventHandler TrackInfoChanged = null; + + TrackInfoChanged = (sender, e) => + { + Assert.IsInstanceOf(e.TrackData, "TrackData value is not of type Track"); + Assert.AreNotEqual(e.TrackData, originValue, "TrackData value is same original value"); + BluetoothHelper.DisplayPassLabel("TrackData_PROPERTY_READ_ONLY"); + }; + + originValue = _avrcpControlProfile.GetTrackInfo(); + _avrcpControlProfile.TrackInfoChanged += TrackInfoChanged; + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await ManualTest.WaitForConfirm(); + _avrcpControlProfile.TrackInfoChanged -= TrackInfoChanged; + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Connect AVRCP Control")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.ConnectAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ConnectAsync_AVRCP_CONTROL_CONNECTION_TEST() + { + try + { + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("ConnectAsync_AVRCP_CONTROL_CONNECTION_TEST"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.DisconnectAsync(); // Disconnecting AVRCP Control initially + + EventHandler ControlConnectionChanged = null; + + ControlConnectionChanged = (sender, e) => { + BluetoothHelper.DisplayPassLabel("ConnectAsync_AVRCP_CONTROL_CONNECTION_TEST"); + }; + _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; + + await _avrcpControlProfile.ConnectAsync(); + await ManualTest.WaitForConfirm(); + _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Disconnect AVRCP Control")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.DisconnectAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST() + { + try + { + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + + EventHandler ControlConnectionChanged = null; + ControlConnectionChanged = (sender, e) => { + BluetoothHelper.DisplayPassLabel("DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST"); + _avrcpControlProfile.ConnectAsync(); //Reconnect AVRCP Control if TC passes + }; + _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; + + await _avrcpControlProfile.DisconnectAsync(); + await ManualTest.WaitForConfirm(); + _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Get Play Status")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.GetPlayStatus M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task GetPlayStatus_RETURN_VALUE() + { + try + { + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("GetPlayStatus_READ_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + PlayerState state = _avrcpControlProfile.GetPlayStatus(); + bool result = Enum.IsDefined(typeof(PlayerState), state); + Assert.True(result, "State value is not defined in enum"); + Assert.IsInstanceOf(state, "State value is not of type PlayerState"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Get Play Progress Position")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.GetPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task GetPosition_RETURN_VALUE() + { + try + { + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("GetPosition_READ_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + uint state = _avrcpControlProfile.GetPosition(); + Assert.IsInstanceOf(state, "State value is not of type uint"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Check whether EqualizerState is readable and writable")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.EqualizerState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task EqualizerState_READ_WRITE() + { + try + { + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("EqualizerState_READ_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + _avrcpControlProfile.EqualizerState = EqualizerState.On; + EqualizerState state = _avrcpControlProfile.EqualizerState; + Assert.IsInstanceOf(state, "State value is not of type EqualizerState"); + Assert.AreEqual(state, EqualizerState.On, "EqualizerState is not matching"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Check whether ShuffleMode is readable and writable")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.ShuffleMode A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ShuffleMode_READ_WRITE() + { + try + { + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("ShuffleMode_READ_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + _avrcpControlProfile.ShuffleMode = ShuffleMode.AllTrack; + ShuffleMode state = _avrcpControlProfile.ShuffleMode; + Assert.IsInstanceOf(state, "Mode value is not of type ShuffleMode"); + Assert.AreEqual(state, ShuffleMode.AllTrack, "ShuffleMode is not matching"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Check whether ScanMode is readable and writable")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.ScanMode A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ScanMode_READ_WRITE() + { + try + { + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("ScanMode_READ_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + _avrcpControlProfile.ScanMode = ScanMode.AllTrack; + ScanMode state = _avrcpControlProfile.ScanMode; + Assert.IsInstanceOf(state, "Mode value is not of type ScanMode"); + Assert.AreEqual(state, ScanMode.AllTrack, "ScanMode is not matching"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Check whether RepeatMode is readable and writable")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.RepeatMode A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task RepeatMode_READ_WRITE() + { + try + { + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("RepeatMode_READ_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + _avrcpControlProfile.RepeatMode = RepeatMode.AllTrack; + RepeatMode state = _avrcpControlProfile.RepeatMode; + Assert.IsInstanceOf(state, "Mode value is not of type RepeatMode"); + Assert.AreEqual(state, RepeatMode.AllTrack, "RepeatMode is not matching"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Get Track Info")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.GetTrackInfo M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task GetTrackInfo_RETURN_VALUE() + { + try + { + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("GetTrackInfo_READ_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Track track = _avrcpControlProfile.GetTrackInfo(); + Assert.IsInstanceOf(track, "track value is not of type Track"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + + [Test] + [Category("P1")] + [Description("Send a specific player state command to the target")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.SendPlayerCommand M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task SendPlayerCommand_RETURN_VALUE() + { + try + { + /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("SendPlayerCommand_WRITE_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (_audioProfile == null) + { + _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); + } + + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: avrcpavrcpControlProfile Profile should not be null"); + } + + _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + _avrcpControlProfile.SendPlayerCommand(PlayerCommand.Next); + //If there is no exception when method is called, the test is considered PASSED. + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_audioProfile != null) + { + _audioProfile.Disconnect(BluetoothAudioProfileType.All); + await Task.Delay(3000); + } + } + } + } +} -- 2.34.1