mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Enable Bluetooth connection status track
PiperOrigin-RevId: 501334205
This commit is contained in:
committed by
Copybara-Service
parent
5326cec7ab
commit
e261be1a16
@@ -54,7 +54,7 @@ class FeatureFlags {
|
||||
bool enable_connection_timeout = false;
|
||||
// Controls to enable or disable to track the status of Bluetooth classic
|
||||
// conncetion.
|
||||
bool enable_bluetooth_connection_status_track = false;
|
||||
bool enable_bluetooth_connection_status_track = true;
|
||||
};
|
||||
|
||||
static const FeatureFlags& GetInstance() {
|
||||
|
||||
@@ -39,6 +39,8 @@ BluetoothSocket::BluetoothSocket(StreamSocket streamSocket)
|
||||
if (FeatureFlags::GetInstance()
|
||||
.GetFlags()
|
||||
.enable_bluetooth_connection_status_track) {
|
||||
NEARBY_LOGS(INFO)
|
||||
<< "Flag enable_bluetooth_connection_status_track is enabled.";
|
||||
connection_status_changed_token_ =
|
||||
native_bluetooth_device_.ConnectionStatusChanged(
|
||||
{this, &BluetoothSocket::Listener_ConnectionStatusChanged});
|
||||
@@ -143,9 +145,15 @@ bool BluetoothSocket::Connect(HostName connectionHostName,
|
||||
windows_socket_.Information().RemoteHostName())
|
||||
.get();
|
||||
|
||||
connection_status_changed_token_ =
|
||||
native_bluetooth_device_.ConnectionStatusChanged(
|
||||
{this, &BluetoothSocket::Listener_ConnectionStatusChanged});
|
||||
if (FeatureFlags::GetInstance()
|
||||
.GetFlags()
|
||||
.enable_bluetooth_connection_status_track) {
|
||||
NEARBY_LOGS(INFO)
|
||||
<< "Flag enable_bluetooth_connection_status_track is enabled.";
|
||||
connection_status_changed_token_ =
|
||||
native_bluetooth_device_.ConnectionStatusChanged(
|
||||
{this, &BluetoothSocket::Listener_ConnectionStatusChanged});
|
||||
}
|
||||
|
||||
bluetooth_device_ =
|
||||
std::make_unique<BluetoothDevice>(native_bluetooth_device_);
|
||||
|
||||
Reference in New Issue
Block a user