Bluetooth Low Energy: Resetting serviceState without disconneting from the device
-
Hi,
I am developing a GUI application that allows a user to connect to a Bluetooth Low Energy device, determine services and service details, and finally read the properties. After I have connected to a device and determined the services, I would like to call up the characteristics of a selected service with the button "Determine characteristics", like this:
void Bluetooth::on_showCharacteristics_clicked() { /*delete object if it is not nullptr*/ if(selectedService) { delete selectedService; selectedService = nullptr; qDebug()<< "selectedService deleted"; } selectedService = lowEnergyController->createServiceObject(serviceUuid, this); connect(selectedService, &QLowEnergyService::stateChanged, this, &Bluetooth::serviceDetailsDiscoveredSlot); qDebug() << selectedService->state(); selectedService->discoverDetails(); }
So when I call this function for the first time, the state ist firstly "QLowEnergyService::DiscoveryRequired" - it finally becomes "QLowEnergyService::ServiceDiscovered"
When I call this function for the second time for the same service, the state is "QLowEnergyService::ServiceDiscovered" therefore the stateChanged signal is not being emitted. So is it possible, to "reset" the state of a service, without disconneting from the device?