From: Wootak Jung Date: Wed, 18 Oct 2023 03:19:35 +0000 (+0900) Subject: Fix device clicked event duplication issue X-Git-Tag: accepted/tizen/8.0/unified/20231019.051741^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bcc34238213b66701166e25b16913b55a60a37e2;p=profile%2Fiot%2Fapps%2Fdotnet%2Fsetting-bluetooth.git Fix device clicked event duplication issue Change-Id: I3b6c0847c700d3fd7cb7ea7f3c6cb7dc6f0c4654 Signed-off-by: Wootak Jung --- diff --git a/SettingBluetooth/SettingBluetooth/Controller/DeviceController.cs b/SettingBluetooth/SettingBluetooth/Controller/DeviceController.cs index 0da84c8..4da444d 100644 --- a/SettingBluetooth/SettingBluetooth/Controller/DeviceController.cs +++ b/SettingBluetooth/SettingBluetooth/Controller/DeviceController.cs @@ -95,37 +95,53 @@ namespace SettingBluetooth if (device.BtDevice.IsPaired) { - if (device.BtDevice.IsA2dpSupported) + if (device.BtDevice.DeviceState == BtDeviceState.Connecting || + device.BtDevice.DeviceState == BtDeviceState.Disconnecting) { - if (device.BtDevice.IsA2dpConnected) - { - DisconnectA2dp(device.BtDevice); - } - else - { - ConnectA2dp(device.BtDevice); - } + Log.Error(SettingBluetooth.LogTag, "Operation is in progress"); } - else if (device.BtDevice.IsHidSupported) + else { - if (device.BtDevice.IsHidConnected) + if (device.BtDevice.IsA2dpSupported) + { + if (device.BtDevice.IsA2dpConnected) + { + DisconnectA2dp(device.BtDevice); + } + else + { + ConnectA2dp(device.BtDevice); + } + } + else if (device.BtDevice.IsHidSupported) { - DisconnectHid(device.BtDevice); + if (device.BtDevice.IsHidConnected) + { + DisconnectHid(device.BtDevice); + } + else + { + ConnectHid(device.BtDevice); + } } else { - ConnectHid(device.BtDevice); + Log.Info(SettingBluetooth.LogTag, "No available profile"); } } - else - { - Log.Info(SettingBluetooth.LogTag, "No available profile"); - } } else { - Log.Info(SettingBluetooth.LogTag, "Pair to the remote device"); - device.BtDevice.Pair(); + if (device.BtDevice.DeviceState == BtDeviceState.Pairing || + device.BtDevice.DeviceState == BtDeviceState.Unpairing) + { + Log.Error(SettingBluetooth.LogTag, "Operation is in progress"); + } + else + { + Log.Info(SettingBluetooth.LogTag, "Pair to the remote device"); + device.BtDevice.Pair(); + } } } } diff --git a/SettingBluetooth/SettingBluetooth/View/BtDetailView.cs b/SettingBluetooth/SettingBluetooth/View/BtDetailView.cs index 38a8ee7..2fb9614 100644 --- a/SettingBluetooth/SettingBluetooth/View/BtDetailView.cs +++ b/SettingBluetooth/SettingBluetooth/View/BtDetailView.cs @@ -55,6 +55,7 @@ namespace SettingBluetooth }; unpairButton.Clicked += (obj, ev) => { + Log.Info(SettingBluetooth.LogTag, "Unpair to the remote device"); device.BtDevice.Unpair(); window.GetDefaultNavigator().Pop(); }; diff --git a/packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk b/packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk index 8cc3aef..9e09004 100644 Binary files a/packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk and b/packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk differ