Added an exported function to enable/disable ble v3 from the dart UI including updating the UI. This is expected to be used in test and does not affect interfaces that are unaware of it (IOW, it breaks nothing and NS will still use v2). Now we can just switch back and forth between v2 and v3 without recompilation, but, it needs to be done carefully, once it's toggled toggling back should only be done when not advertising, discovering, or connected/ing. At some point, I will work out the logic for disabling it, it's gonna take a little dart coding.

PiperOrigin-RevId: 500748215
This commit is contained in:
John Carroll
2023-01-09 10:27:41 -08:00
committed by Copybara-Service
parent e156d93f80
commit a024710c58
2 changed files with 14 additions and 0 deletions
@@ -331,6 +331,17 @@ void PostResult(Dart_Port &result_cb, Status::Value value) {
}
}
void EnableBleV2Dart(Core *pCore, int64_t enable, Dart_Port result_cb) {
if (!pCore) {
PostResult(result_cb, Status::Value::kError);
return;
}
port = result_cb;
FeatureFlags::GetMutableFlagsForTesting().support_ble_v2 = enable;
PostResult(result_cb, Status::kSuccess);
}
void StartAdvertisingDart(
Core *pCore, const char *service_id,
AdvertisingOptionsDart connection_options_dart,
@@ -166,6 +166,9 @@ static void ListenerPayloadCB(const char *endpoint_id, PayloadW &payload);
static void ListenerPayloadProgressCB(const char *endpoint_id,
const PayloadProgressInfoW &info);
DLL_API void __stdcall EnableBleV2Dart(Core *pCore, int64_t enable,
Dart_Port result_cb);
// Starts advertising an endpoint for a local app.
//
// service_id - An identifier to advertise your app to other endpoints.