New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nRF52: Get RSSI of connection when in Central mode #1047
Comments
Certainly a feature request, but it really is needed information to help authenticate that you're dealing with the correct device and/or let the user know when it is wandering out of range. Having the RSSI only while scanning makes it difficult, because there can me many, many devices (at least in my office there are >20). Hoping this can sneak into the next release (or a beta?). Happy to test! |
Have just added this in my repo. |
Great! I'm a bit of a NOOB; can you give me a quick example of usage? And how I can test it out? |
The branch is not reviewed, merged or released yet, so you have to build it first and flash it to your device. Then when you are connected to another peripheral, just do:
like when you are the peripheral yourself. Documentation: http://www.espruino.com/Reference#l_NRF_setRSSIHandler |
That’s just the way I thought it should work, so great! I’ll try to carve out some time and see if I can work my way through a build in the next few days.
Thank you for doing this!!
Bill
…--
Bill Saltzstein
Code Blue Communications, Inc.
billsalt@consultcodeblue.com
www.consultcodeblue.com
http://www.linkedin.com/in/billsaltzstein (LinkedIn)
+1 425-442-5854
Skype: billsaltz
On Mar 8, 2017, at 9:55 AM, Christian Winkgen ***@***.***> wrote:
The branch is not reviewed, merged or released yet, so you have to build it first and flash it to your device.
Then when you are connected to another peripheral, just do:
NRF.setRSSIHandler(function(rssi) { console.log(rssi); });
like when you are the peripheral yourself.
Documentation: http://www.espruino.com/Reference#l_NRF_setRSSIHandler <http://www.espruino.com/Reference#l_NRF_setRSSIHandler>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#1047 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABXIyeP5r2d856pvsz5mGo6l4VOvHCRzks5rjuulgaJpZM4L2slw>.
|
If it's for the puck.js I just compiled it (do not have the devices at hand, so you may test on your own risk): How to flash the ZIP to your puck is documented here: |
Thanks! I certainly can load a puck, but I also use the Nordic nRF52832 demo board. I’ve got both, but you just made it very easy to use the puck. Advantage of the kit is I can use the serial console log without having to wire anything up. Really helpful since what I’m trying to do is simultaneous master/slave work.
But I can certainly to the first pass testing with the puck.
Thanks!
…--
Bill Saltzstein
Code Blue Communications, Inc.
billsalt@consultcodeblue.com
www.consultcodeblue.com
http://www.linkedin.com/in/billsaltzstein (LinkedIn)
+1 425-442-5854
Skype: billsaltz
On Mar 8, 2017, at 10:01 AM, Christian Winkgen ***@***.***> wrote:
If it's for the puck.js I just compiled it (do not have the devices at hand, so you may test on your own risk):
espruino_1v91.2685_puckjs.zip <https://github.com/espruino/Espruino/files/828509/espruino_1v91.2685_puckjs.zip>
How to flash the ZIP to your puck is documented here:
http://www.espruino.com/Puck.js <http://www.espruino.com/Puck.js> -> Firmware Updates
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#1047 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABXIyX92t2Zsk5Fkj-YxYYA7qRI8cQeOks5rju0UgaJpZM4L2slw>.
|
Just realized that if I do have a central and a peripheral connection, it isn’t clear which RSSI I get. I don’t see a way to choose, or am I missing something?
…--
Bill Saltzstein
Code Blue Communications, Inc.
billsalt@consultcodeblue.com
www.consultcodeblue.com
http://www.linkedin.com/in/billsaltzstein (LinkedIn)
+1 425-442-5854
Skype: billsaltz
On Mar 8, 2017, at 10:01 AM, Christian Winkgen ***@***.***> wrote:
If it's for the puck.js I just compiled it (do not have the devices at hand, so you may test on your own risk):
espruino_1v91.2685_puckjs.zip <https://github.com/espruino/Espruino/files/828509/espruino_1v91.2685_puckjs.zip>
How to flash the ZIP to your puck is documented here:
http://www.espruino.com/Puck.js <http://www.espruino.com/Puck.js> -> Firmware Updates
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#1047 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABXIyX92t2Zsk5Fkj-YxYYA7qRI8cQeOks5rju0UgaJpZM4L2slw>.
|
Is it possible to have both? For the future there are two options: I think b) would be more elegant, since the RSSI with you being central is actually bound to the connection object. |
I really think you want to have two separate callbacks, since there are two separate connections to follow. Also consider if/when Espruino supports multiple peripheral connections as Central there will need to be a handle.
Glad you’re digging into this! I’ll still give this code a try. I’m actually more interested in the Central RSSI for what I’m trying to do.
Bill
…--
Bill Saltzstein
Code Blue Communications, Inc.
billsalt@consultcodeblue.com
www.consultcodeblue.com
http://www.linkedin.com/in/billsaltzstein (LinkedIn)
+1 425-442-5854
Skype: billsaltz
On Mar 8, 2017, at 10:50 AM, Christian Winkgen ***@***.***> wrote:
Is it possible to have both?
Indeed - I have not considered this.
From the way it is implemented currently you would get the RSSI from the connection where you are the central (because this is the handle that is checked finally and overrides the other one).
For the future there are two options:
a) keep the API and put something in the callback to tell both cases apart
b) have a different API and callback for both sides
I think b) would be more elegant, since the RSSI with you being central is actually bound to the connection object.
There is no such thing when you are peripheral, so the NRF-global-object approach is sufficient.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#1047 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABXIyQOS9-4ZlXwlcTnSWVkmqw-t5c_lks5rjvhkgaJpZM4L2slw>.
|
Thanks for the commit - as @billsalt says a separate API call might be better though. While your approach would work well, I guess it could be confusing if someone was having success using it for a peripheral connection but then started a central connection and it suddenly changed what it did. I guess we could add the central API call to the BluetoothDevice object just in case >1 central was ever supported (I don't think it would be given RAM constraints) - but then that's a non-Web Bluetooth compatible addition. I guess maybe |
OK - thanks for the feedback. Question: should I just assume there is only one central (global |
It's tricky, BluetoothRemoteGATTServer would be the obvious place, but then it's not following the Web Bluetooth spec. Actually yeah, just add it in there as Just assume one central and use m_central_conn_handle - it's what everything else does, so trying to handle multiple connections would require everything to change anyway :) Thanks! |
Let me know when you’d like me to test something. Best if compiled for the nRF52832 board since I can have the connections and easily have console through serial at the same time.
…--
Bill Saltzstein
Code Blue Communications, Inc.
billsalt@consultcodeblue.com
www.consultcodeblue.com
http://www.linkedin.com/in/billsaltzstein (LinkedIn)
+1 425-442-5854
Skype: billsaltz
On Mar 9, 2017, at 12:58 AM, Gordon Williams ***@***.***> wrote:
It's tricky, BluetoothRemoteGATTServer would be the obvious place, but then it's not following the Web Bluetooth spec. Actually yeah, just add it in there as setRSSIHandler - maybe just make a note in the comments that it's Espruino-specific :)
Just assume one central and use m_central_conn_handle - it's what everything else does, so trying to handle multiple connections would require everything to change anyway :)
Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#1047 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABXIyUldxO6DjLhbEGQ70SKZy6pHQw1-ks5rj78agaJpZM4L2slw>.
|
hi @gfwilliams and @Whizzard -- what's the status of this? I'm at the point where I'd like to try it out. I'll want to get it compiled for the nRF52830 dev board (PCA10040). Thanks! |
@gfwilliams thanks Gordon! Is this v1.92 or a new experimental build? Trying to understand the versioning/build process for espruino. |
It'll be in an experimental build, until 1v93... http://www.espruino.com/binaries/travis/master/ |
http://forum.espruino.com/conversations/299679/#comment13453621
The text was updated successfully, but these errors were encountered: