# BLE notify and READ

**URL:** <https://community.particle.io/t/ble-notify-and-read/55859>\
**Category:** Firmware\
**Tags:** argon\
**Created:** [April 27, 2020, 10:51am UTC](https://community.particle.io/t/ble-notify-and-read/55859 "2020-04-27T10:51:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmjobin](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jmjobin](https://community.particle.io/u/jmjobin)\
**Post date:** [April 27, 2020, 10:51am UTC](https://community.particle.io/t/ble-notify-and-read/55859/1 "2020-04-27T10:51:28Z")

</div>

Using Argon as BLE Central.  
My BLE peripheral sends 2 services  
one temperature as INDICATE  
BleCharacteristic temperatureMeasurementCharacteristic(“temp”, BleCharacteristicProperty::INDICATE, BleUuid(0x2A1C), healthThermometerService);  
and one as Battery level as READ  
BleCharacteristic batteryLevelCharacteristic(“bat”, BleCharacteristicProperty::READ, BleUuid(0x2A19), batteryLevelService);

In the Argon I am connecting and can read the temperature using  
peer.getCharacteristicByUUID(temperatureMeasurementCharacteristic, BleUuid(0x2a1c));  
But I cannot get the battery level  
peer.getCharacteristicByUUID(batteryLevelCharacteristic, BleUuid(0x2a19));

Since the battery level is READ and not NOTIFY what function can I use other than getCharacteristicByUUID(…)?  
I do not see any functions as readCharacteristics… or else.

Thank you for any help.  
Jean-Marc

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [April 27, 2020, 11:06am UTC](https://community.particle.io/t/ble-notify-and-read/55859/2 "2020-04-27T11:06:11Z")

</div>

You store the characteristic object reference you get back from `getCharacteristicByUUID()` and then use (the approriate overload of) [`getValue()`](https://docs.particle.io/reference/device-os/firmware/argon/#getvalue-buf-len-) on that object reference.

---

<div class="post-metadata">

**Author:** ![jmjobin](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jmjobin](https://community.particle.io/u/jmjobin)\
**Post date:** [April 27, 2020, 11:21am UTC](https://community.particle.io/t/ble-notify-and-read/55859/3 "2020-04-27T11:21:52Z")

</div>

@ScruffR, thank you for the rapid feeback. Not sure I understood…  
I am using onDataReceive for the result and seems not to get any callback for the battery read.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [April 27, 2020, 11:25am UTC](https://community.particle.io/t/ble-notify-and-read/55859/4 "2020-04-27T11:25:03Z")

</div>

For a callback like `onDataReceive()` you need someone to actively _push_ the data to your central - a `::READ` characterisitc does _ **not** _ do that, _you_ have to read it 😉

---

<div class="post-metadata">

**Author:** ![jmjobin](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jmjobin](https://community.particle.io/u/jmjobin)\
**Post date:** [April 27, 2020, 12:02pm UTC](https://community.particle.io/t/ble-notify-and-read/55859/5 "2020-04-27T12:02:10Z")

</div>

@ScruffR, you are right… 😃  
so how to I store the object value? What overload? sorry I am not very good in C++  
peer.getCharacteristicByUUID(…) return only a boolean.

Thank you for the help

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [April 27, 2020, 12:23pm UTC](https://community.particle.io/t/ble-notify-and-read/55859/6 "2020-04-27T12:23:44Z")

</div>

The first parameter you pass into `getCharachteristicByUUID()` will “catch” the found characteristic reference.

so you will use `batteryLevelCharacteristic.getValue(...)` where `...` should be the suitable type for the value you are going to read.

---

<div class="post-metadata">

**Author:** ![jmjobin](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jmjobin](https://community.particle.io/u/jmjobin)\
**Post date:** [April 27, 2020, 12:43pm UTC](https://community.particle.io/t/ble-notify-and-read/55859/7 "2020-04-27T12:43:44Z")

</div>

@ScruffR thx a lot your are the boss… 🙂 working perfectly…  
here is my code:

int8\_t batteryLevel;  
…  
peer.getCharacteristicByUUID(batteryLevelCharacteristic, BleUuid(0x2a19));  
batteryLevelCharacteristic.getValue(&batteryLevel);

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/3/2/3291e3c9351789fe8620ae5bcec8d3fec67ff221.png) [@system](https://community.particle.io/u/system)\
**Post date:** [October 27, 2020, 12:44am UTC](https://community.particle.io/t/ble-notify-and-read/55859/8 "2020-10-27T00:44:01Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
