DrAma999 / LittleBlueTooth

A simple library that helps you in connecting with BLE devices
MIT License
79 stars 17 forks source link

LittleBlueTooth#startListen behavior #22

Closed NeverwinterMoon closed 3 years ago

NeverwinterMoon commented 3 years ago

First of all, great work on the library. I've just started with it and it's looking great!

I have a question though. When using LittleBlueTooth#startListen, I don't receive an initial value. Is this by design?

For example: littleBT.read(from: Self.BATTERY_CHARACTERISTIC) will publish a value as soon as I subscribe but littleBT.startListen(from: Self.BATTERY_CHARACTERISTIC) will not publish anything as soon I subscribe

DrAma999 commented 3 years ago

Hello sorry for replying so late, but Github doesn't notify me anymore.. don't know why. I don't think is something about the library, but more bluetooth related. When you read from a characteristic you are basically waiting for the pipeline to stop until the device reply with a value or an error. When you subscribe to a characteristic it can depend on the the logic of the bluetooth device:

Depending on how is implemented the firmware of the device you can have on of these three behaviour(and probably more).

Best, Andrea

DrAma999 commented 3 years ago

Closing as stale