From: Wootak Jung Date: Thu, 6 Apr 2023 01:32:49 +0000 (+0900) Subject: Fix auto connect logic and add scan stop logic if destroyed X-Git-Tag: accepted/tizen/unified/20230411.161259^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F72%2F290972%2F1;p=profile%2Fiot%2Fapps%2Fdotnet%2Fsetting-bluetooth.git Fix auto connect logic and add scan stop logic if destroyed Change-Id: I5bba7241fb4d9c2ba79c605ba01286a07727aafb Signed-off-by: Wootak Jung --- diff --git a/SettingBluetooth/SettingBluetooth/Model/BtDevice.cs b/SettingBluetooth/SettingBluetooth/Model/BtDevice.cs index 22ac570..ce6efe0 100644 --- a/SettingBluetooth/SettingBluetooth/Model/BtDevice.cs +++ b/SettingBluetooth/SettingBluetooth/Model/BtDevice.cs @@ -225,6 +225,16 @@ namespace SettingBluetooth mDeviceState = BtDeviceState.Paired; BtModel.NotifyDeviceChanged(this); //BtModel.NotifyOperationStateChanged(BtOperationState.Activated); + if (mIsA2dpSupported) + { + Log.Info(SettingBluetooth.LogTag, "Automatically connect to the remote audio device after pairing"); + ConnectAudio(); + } + else if (mIsHidSupported) + { + Log.Info(SettingBluetooth.LogTag, "Automatically connect to the remote hid device after pairing"); + ConnectHid(); + } } else { diff --git a/SettingBluetooth/SettingBluetooth/Model/BtModelImpl.cs b/SettingBluetooth/SettingBluetooth/Model/BtModelImpl.cs index 40af193..67b65a5 100644 --- a/SettingBluetooth/SettingBluetooth/Model/BtModelImpl.cs +++ b/SettingBluetooth/SettingBluetooth/Model/BtModelImpl.cs @@ -65,7 +65,14 @@ namespace SettingBluetooth foreach (BluetoothDevice device in devices) { Log.Info(SettingBluetooth.LogTag, "GetBondedDevices. Address: " + device.Address + ", Name: " + device.Name); - btDevice = new BtDevice(device, BtDeviceState.Paired); + if (device.IsConnected) + { + btDevice = new BtDevice(device, BtDeviceState.Connected); + } + else + { + btDevice = new BtDevice(device, BtDeviceState.Paired); + } args = new BtDeviceChangedEventArgs(btDevice); mDeviceChanged?.Invoke(null, args); } diff --git a/SettingBluetooth/SettingBluetooth/SettingBluetooth.cs b/SettingBluetooth/SettingBluetooth/SettingBluetooth.cs index 887a248..d469b9e 100644 --- a/SettingBluetooth/SettingBluetooth/SettingBluetooth.cs +++ b/SettingBluetooth/SettingBluetooth/SettingBluetooth.cs @@ -65,6 +65,10 @@ namespace SettingBluetooth protected override void OnDestroy() { Log.Info(LogTag, "OnDestroy"); + if (BtModel.IsScanning) + { + BtModel.StopDiscovery(); + } base.OnDestroy(); } diff --git a/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs b/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs index 58f1675..26990a9 100644 --- a/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs +++ b/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs @@ -547,10 +547,6 @@ namespace SettingBluetooth if (mDeviceSource.FindInPaired(ev.BtDevice) == null) { mDeviceSource.AddToPaired(ev.BtDevice); - if (ev.BtDevice.IsA2dpSupported) - { - DeviceController.ConnectA2dp(ev.BtDevice); - } } else // audio disconnected case { @@ -580,6 +576,10 @@ namespace SettingBluetooth mDeviceSource.AddToPaired(ev.BtDevice); mDeviceSource.UpdateState(ev.BtDevice); } + else + { + mDeviceSource.AddToPaired(ev.BtDevice); + } break; case BtDeviceState.Disconnecting: if (mDeviceSource.FindInPaired(ev.BtDevice) != null) diff --git a/packaging/org.tizen.SettingView-1.1.3-10213.tpk b/packaging/org.tizen.SettingView-1.1.3-10213.tpk deleted file mode 100644 index fe06883..0000000 Binary files a/packaging/org.tizen.SettingView-1.1.3-10213.tpk and /dev/null differ diff --git a/packaging/org.tizen.SettingView-1.1.3-10221.tpk b/packaging/org.tizen.SettingView-1.1.3-10221.tpk new file mode 100644 index 0000000..4881358 Binary files /dev/null and b/packaging/org.tizen.SettingView-1.1.3-10221.tpk differ diff --git a/packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk b/packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk index 02fb09f..108723e 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 diff --git a/packaging/org.tizen.example.NUIGadgetViewer-1.0.0.tpk b/packaging/org.tizen.example.NUIGadgetViewer-1.0.0.tpk deleted file mode 100644 index a6fb99f..0000000 Binary files a/packaging/org.tizen.example.NUIGadgetViewer-1.0.0.tpk and /dev/null differ diff --git a/packaging/org.tizen.settings.main-1.1.3.rpk b/packaging/org.tizen.settings.main-1.1.3.rpk deleted file mode 100644 index 855591b..0000000 Binary files a/packaging/org.tizen.settings.main-1.1.3.rpk and /dev/null differ