Intented way to turn BLE OFF?

I see there are few functions releated to this…




and probably more.

  1. What is the correct way for me to turn the radio off?

  2. What will this do the AWSNetworkManager? Ideally I’d have a way to turn that to disconnected as well. Because… what if I was waiting on an MQTT packet over BLE, but had something else come up and disabled the radio? What is the right way to handle this?


BLE radio can be shutdown in two ways depending on if the application is using network manager or not:

  1. If not using network manager, use API IotBle_Off() which will stop advertisement, disconnect any existing BLE connection and teardown the GATT services. Note that any application registered BLE callbacks should be removed using IotBle_UnRegisterEventCb() before calling IotBle_Off().
  2. If application is using Network Manager, then use AwsIotNetworkManager_DisableNetwork(AWSIOT_NETWORK_TYPE_BLE) which will shutdown BLE radio and also update the network manger state for BLE.
    When a BLE connection is terminated, there is a channel closed event for BLE, which can be used to detect and reestablish the MQTT connection from the application if required. Sample for MQTT over BLE here shows how the demo uses this event to break out of the loop of publishing MQTT packets.


Yea, I saw that demoCallback (naming guys! That’s a bleTransportEventCallback imo) and we will be using that along with Core, and looking at the new Agent now.

That demo file was a bit of a headscratcher coming from the TaskPool demos previously, but I think what I’m seeing is you removed a lot of the complexity and have a start to finish example of how it could work and for simple programs that don’t need an agent that’s probably enough. Moving the right direction at least!