diff --git a/connections/c/nc.cc b/connections/c/nc.cc index 53728843..43ae61e2 100644 --- a/connections/c/nc.cc +++ b/connections/c/nc.cc @@ -34,6 +34,7 @@ #include "connections/connection_options.h" #include "connections/core.h" #include "connections/discovery_options.h" +#include "connections/implementation/flags/nearby_connections_feature_flags.h" #include "connections/listeners.h" #include "connections/medium_selector.h" #include "connections/out_of_band_connection_metadata.h" @@ -800,6 +801,10 @@ int NcGetLocalEndpointId(NC_INSTANCE instance) { void NcEnableBleV2(NC_INSTANCE instance, bool enable, NcCallbackResult result_callback, CALLER_CONTEXT context) { + nearby::NearbyFlags::GetInstance().OverrideBoolFlagValue( + ::nearby::connections::config_package_nearby::nearby_connections_feature:: + kEnableBleV2, + enable); result_callback(NC_STATUS_SUCCESS, context); } diff --git a/connections/c/nc.h b/connections/c/nc.h index b3dd2505..1265fcba 100644 --- a/connections/c/nc.h +++ b/connections/c/nc.h @@ -181,7 +181,8 @@ NC_API void NcInitiateBandwidthUpgrade(NC_INSTANCE instance, int endpoint_id, // Gets the local endpoint generated by Nearby Connections. NC_API int NcGetLocalEndpointId(NC_INSTANCE instance); -// Enable/Disable BLE V2 advertising. The method is deprecated. It's a no-op. +// Enable/Disable BLE V2 advertising. The method should be deprecated after +// BLE V1 deprecated. NC_API void NcEnableBleV2(NC_INSTANCE instance, bool enable, NcCallbackResult result_callback, CALLER_CONTEXT context); diff --git a/connections/implementation/flags/nearby_connections_feature_flags.h b/connections/implementation/flags/nearby_connections_feature_flags.h index 1ca549d6..dfaded1f 100644 --- a/connections/implementation/flags/nearby_connections_feature_flags.h +++ b/connections/implementation/flags/nearby_connections_feature_flags.h @@ -49,6 +49,9 @@ constexpr auto kEnableBleL2cap = // Enable/Disable BLE medium injection. constexpr auto kEnableBleMediumInjection = flags::Flag(kConfigPackage, "45743128", false); +// Disable/Enable BLE v2 in Nearby Connections SDK. +constexpr auto kEnableBleV2 = + flags::Flag(kConfigPackage, "45401515", true); // Enable/Disable DCT advertising/scanning specification. constexpr auto kEnableDct = flags::Flag(kConfigPackage, "45697202", false); diff --git a/connections/swift/NearbyCoreAdapter/Sources/GNCFlags.mm b/connections/swift/NearbyCoreAdapter/Sources/GNCFlags.mm index 8c32211c..7b5cb6ba 100644 --- a/connections/swift/NearbyCoreAdapter/Sources/GNCFlags.mm +++ b/connections/swift/NearbyCoreAdapter/Sources/GNCFlags.mm @@ -24,12 +24,13 @@ @implementation GNCFlags + (BOOL)enableBLEV2 { - // This is deprecated. It's a no-op. - return true; + return nearby::NearbyFlags::GetInstance().GetBoolFlag( + nearby::connections::config_package_nearby::nearby_connections_feature::kEnableBleV2); } + (void)setEnableBLEV2:(BOOL)value { - // This is deprecated. It's a no-op. + nearby::NearbyFlags::GetInstance().OverrideBoolFlagValue( + nearby::connections::config_package_nearby::nearby_connections_feature::kEnableBleV2, value); } @end