Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

[toble] Enable Thread-over-BLE configuration. #38

Closed
wants to merge 3 commits into from

Conversation

turon
Copy link
Contributor

@turon turon commented Oct 19, 2019

No description provided.

main/include/OpenThreadConfig.h Outdated Show resolved Hide resolved
main/main.cpp Outdated
@@ -285,6 +298,19 @@ int main(void)
}
}

// Disable Weave Pairing if Thread network has already been provisioned.
// TODO: Change this to only disable WoBLE when *full provisioning* has completed,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be resolved before we merge this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. The proposal is to disable pairing after a device has been fully provisioned (net, fabric, and service). A device will need to be factory reset to re-enable pairing mode. Will that paradigm be sufficient for the example apps?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having to factory reset is unfortunate, but unavoidabled. Since this won't be on by default, it shouldn't affect most users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to encapsulate this factory-reset behavior with the TOBLE flag or some new flag?

main/include/OpenThreadConfig.h Outdated Show resolved Hide resolved
main/include/OpenThreadConfig.h Outdated Show resolved Hide resolved
@turon turon force-pushed the pr/toble/config branch 2 times, most recently from 20bfa10 to 6812470 Compare October 22, 2019 13:48
main/main.cpp Outdated
{
// Disable advertising when Commissioner connected over WoBLE
// so ToBLE connectivity checks can occur.
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be conditional on OPENTHREAD_CONFIG_ENABLE_TOBLE as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Though what is the use case for leaving advertising on while a WoBLE connection is active? BTP doesn't support multi-connection and closing the connection should restart WoBLE advertisements.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API instructs the connectivity manager to enable/disable advertising altogether. It's value is entirely under the control of the application; it is never changed by the Device Layer. So while BLEAdvertisingEnabled() == false, closing the connection will not restart advertising.

I suggest the following approach to coordinating advertising when ToBLE is enabled:

  1. Add a compile-time option to the Device Layer that suppresses advertising while a WoBLE connection is active. E.g.: WEAVE_DEVICE_CONFIG_SINGLE_WOBLE_CONNECTION. For devices that use ToBLE, they would also need to enable this option.

  2. In the example app, inside the event handler function, monitor all changes to the device's network, fabric and service provisioning states. For any change to any of these states, evaluate whether the device is fully provisioned (network, fabric and service). If so, disable advertising by calling SetBLEAdvertisingEnabled(false). If not, enable advertising by calling SetBLEAdvertisingEnabled(true).

Using this approach, advertising is automatically disabled when a WoBLE connection is established, and only re-enabled when the connection ends and the device has not been fully provisioned.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, applied these suggestion in d178b9b.

@turon
Copy link
Contributor Author

turon commented Oct 25, 2019

Note: this PR will need to be updated to include openweave/openweave-core#398 in openweave-core submodule.

- Add OpenThread configuration for ToBLE feature.
- Make WoBLE and ToBLE use same BLE config tag on Nordic platforms.
- Increase GATT table size to account for both services.

- Add logic to disable WoBLE when ToBLE is provisioned.
- Add OpenThread logging configuration for platform and debug.
- Pivot to event-based evaluation of provisioning state.
@turon
Copy link
Contributor Author

turon commented Mar 25, 2020

Replaced by #59.

@turon turon closed this Mar 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants