randdusing / ng-cordova-bluetoothle

Angular 1.x wrapper for the PhoneGap/Cordova Bluetooth Low Energy Plugin
Other
47 stars 34 forks source link

Read works only after discover function ended #8

Closed matteocodogno closed 8 years ago

matteocodogno commented 8 years ago

Is there any reason why the function read works only if executed inside the callback of function discover ?

randdusing commented 8 years ago

Yah, you can't read/write/subscribe until discovery has completed. Read doesn't necessarily need to be inside the discover callback, but it needs to be called after discovery has completed.... minor distinction.

matteocodogno commented 8 years ago

Thanks for the explanation!

I've another question, I'm developing my first app with bluetooth features so I'm a noob. If I need send a command to bluetooth device and after read the response, I need subscribe a service, write the command on correct service/characteristic and wait the response?

I'm sorry if it's a stupid question

randdusing commented 8 years ago

No worries, that's good approach. Subscribe, write command, and then wait for response.

matteocodogno commented 8 years ago

Thank you so much 😊

Matteo Codogno Analyst Programmer presso wellD.ch Sviluppo e restyling siti internet. Mail: codogno1990@live.it matteo.codogno.90@gmail.com Cell: +39 349 1390855 Sito: www.pongolab.com

2016-03-01 22:44 GMT+01:00 Rand Dusing notifications@github.com:

No worries, that's good approach. Subscribe, write command, and then wait for response.

— Reply to this email directly or view it on GitHub https://github.com/randdusing/ng-cordova-bluetoothle/issues/8#issuecomment-190919913 .