In my program I would like to handle cases such as incorrect BLE initialization to prevent total crash on my esp32 device.
In the function BLEDevice::init(std::string deviceName) there are many assertions checking the correct execution of this function and return from it if fail occurs. However, the initialised flag is set at the very beginning of this function and even if the error occurs, initialized flag is set to true.
In my opinion the flag should be set at the very end of the function so it can be checked if the initialization was successful.
I mean then we could write for example:
BLEDevice::init("myDevice");
if (~BLEDevice::getInitialized())
throw exception; // or reset device
Is there any other possibility to check if BLEDevice was initialized correctly?
In my program I would like to handle cases such as incorrect BLE initialization to prevent total crash on my esp32 device. In the function BLEDevice::init(std::string deviceName) there are many assertions checking the correct execution of this function and return from it if fail occurs. However, the initialised flag is set at the very beginning of this function and even if the error occurs, initialized flag is set to true. In my opinion the flag should be set at the very end of the function so it can be checked if the initialization was successful.
I mean then we could write for example: BLEDevice::init("myDevice"); if (~BLEDevice::getInitialized()) throw exception; // or reset device
Is there any other possibility to check if BLEDevice was initialized correctly?