mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Add flag to control whether to disconnect the GATT client when exiting the BLE GATT service.
PiperOrigin-RevId: 758474539
This commit is contained in:
committed by
Copybara-Service
parent
30b32e52f2
commit
540f4bac7a
@@ -104,6 +104,9 @@ constexpr auto kEnableDynamicRoleSwitch =
|
||||
// Enable/Disable DCT advertising/scanning specification.
|
||||
constexpr auto kEnableDct =
|
||||
flags::Flag<bool>(kConfigPackage, "45697202", false);
|
||||
// Enable/Disable GATT client disconnection.
|
||||
constexpr auto kEnableGattClientDisconnection =
|
||||
flags::Flag<bool>(kConfigPackage, "45698964", false);
|
||||
} // namespace nearby_connections_feature
|
||||
} // namespace config_package_nearby
|
||||
} // namespace connections
|
||||
|
||||
@@ -20,4 +20,7 @@
|
||||
/** Checks whether DCT is enabled in the Nearby Connections SDK. */
|
||||
@property(nonatomic, class, readonly) BOOL dctEnabled;
|
||||
|
||||
/** Checks whether GATT client disconnection is enabled in the Nearby Connections SDK. */
|
||||
@property(nonatomic, class, readonly) BOOL gattClientDisconnectionEnabled;
|
||||
|
||||
@end
|
||||
|
||||
@@ -24,4 +24,10 @@
|
||||
nearby::connections::config_package_nearby::nearby_connections_feature::kEnableDct);
|
||||
}
|
||||
|
||||
+ (BOOL)gattClientDisconnectionEnabled {
|
||||
return nearby::NearbyFlags::GetInstance().GetBoolFlag(
|
||||
nearby::connections::config_package_nearby::nearby_connections_feature::
|
||||
kEnableGattClientDisconnection);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -133,9 +133,8 @@ void GattClient::Disconnect() {
|
||||
// not connect to the iOS device if the iOS device disconnects and then attempts to reconnect.
|
||||
// Because of this, we no-op here instead of calling `[gatt_client_ disconnect]`.
|
||||
// See: b/375176623
|
||||
if (GNCFeatureFlags.dctEnabled) {
|
||||
// Avoid to impact GTV functionality, put the disconnect for NC iOS SDK only, so thatGATT client
|
||||
// can reconnect to the GATT server.
|
||||
if (GNCFeatureFlags.gattClientDisconnectionEnabled) {
|
||||
// Avoid to impact GTV functionality, so that GATT client can reconnect to the GATT server.
|
||||
[gatt_client_ disconnect];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user