[Interest] BLE: reading a characteristic

Blasche Alexander alexander.blasche at theqtcompany.com
Fri Mar 6 09:24:59 CET 2015



--

Alex

________________________________
Hi,

From: Mario Ribeiro <mario.ribas at gmail.com>
>However, the thing with readings, and according to documentation, is that the value is cached and is only >updated after service's details discovery, a successful write operation or change notification.


>I'm discovering all services as the app starts so all of them will be on state ServiceDiscovered

> after a while. But then, how can I update the cached value of characteristics?


There is no way to trigger such a reread at this point in time. It could be added for 5.5 but the question really is why this would be necessary. Maybe you can provide the use case for it.


In general I would assume that if you have a characteristic with changing value (such as a sensor value)

that it would advertise those changes via a change notification. Subsequently you would have to ensure that your device attaches the Notify or Indicate property to the characteristic in question and provide the

required ClientCharacteristicConfiguration.


After all a select() statement is usually much better than busy polling.



>I attempted to re-discover the service's details before trying to read a characteristic belonging to it but I >don't get an updated value (and my BLE peripheral - which I'm developing so I have access do debugging >utilities - receives nothing).

>Any suggestion?


Indeed this won't work at this point in time. QLowEnergyService::discoverDetails() has the following code


if (d->state != QLowEnergyService::DiscoveryRequired)
   return;


This means the rediscover doesn't even start.


--
Mário Ribeiro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150306/17bf7a18/attachment.html>


More information about the Interest mailing list