Skip to content
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

Reading characteristics with LightBlue kills reconnecting to the peripheral #54

Closed
heiko-s opened this issue Jul 1, 2014 · 11 comments
Closed

Comments

@heiko-s
Copy link

heiko-s commented Jul 1, 2014

First of all: I've started using Bleno yesterday and it works great on my Macbook. The BT service is advertised - reading and writing of characteristics works as expected. Awesome.

I use the LightBlue app (https://itunes.apple.com/us/app/lightblue-bluetooth-low-energy/id557428110?mt=8) on my iPhone to read the service and change values from there. As long as I only stay on the top level service overview (after tapping the peripheral name) it works fine. In this case, I can connect to the peripheral, disconnect and reconnect many times.

However, once I dive into one of the characteristics to read or write the value, it will prevent any future reconnects. Reading/writing the characteristic and browsing the service still works fine while you're connected, but once you disconnect you won't be able to go back and will end up with a 'Timeout interrogating the peripheral' error message.

I tried bleno on a Macbook (10.9.3) and a Raspberry Pi (latest raspbian). Same behaviour on both machines. I also tried multiple iPhones running LightBlue.

@heiko-s heiko-s changed the title Service advertising broken after first connection with LightBlue Reading characteristics with LightBlue kills reconnecting to the peripheral Jul 1, 2014
@sandeepmistry
Copy link
Collaborator

Is the iPhone still connected to your Mac (click on BT icon in menubar)?

Could you share some screenshots on your iPhone?

@heiko-s
Copy link
Author

heiko-s commented Jul 1, 2014

Yes, this happened a few times. I updated my comment after testing on both Mac and Linux.

@sandeepmistry
Copy link
Collaborator

So is this an iOS/LightBlue issue as oppose to bleno?

@heiko-s
Copy link
Author

heiko-s commented Jul 1, 2014

It's hard to say, it feels very random. Sometimes the peripheral is entirely gone after disconnect, sometimes I get a timeout when I want to reconnect and every now and then it works well. Can you suggest another bluetooth client to figure out what's going on?

@heiko-s
Copy link
Author

heiko-s commented Jul 1, 2014

In many cases I have to disable/enable Bluetooth on both the machine and the smartphone to get it working again.

@sandeepmistry
Copy link
Collaborator

You could try a CoreBluetooth OS X app instead of bleno: https://github.com/sandeepmistry/osx-ble-peripheral

For iOS clients, I haven't tried it myself, but heard good things about BLExplr

For Android, I use nRF Master Control Panel (BLE)

@ksarkar
Copy link

ksarkar commented Jul 2, 2014

I also faced similar problems. I am running bleno on Debian 7.5 on Oracle Virtual box on Windows 7, and using LightBlue from my iPhone.

  1. Till yesterday whenever I was trying to connect to test.js, LightBlue was able to detect and connect to the service, but every time it was timing out while interrogating the peripheral. (Same 'Timeout interrogating the peripheral' error message), and was not able to display any of the services.
  2. When I tried today, LightBlue connected to the peripheral and was able to display the service. But it showed only one chararteristic (the static read only one).

nRF Master Control Panel was able to show all the four characteristics. I tried BLExplr as well. But again it was able to display only one characteristic (the static read only one).

@ndhunju
Copy link

ndhunju commented Jul 3, 2014

@ksarkar LightBlue caches every peripheral it has previously connected to. So if you later add services or anything to the peripheral, it won't be updated on LightBlue when you connect to that peripheral. Usually turning off and on Bluetooth on my iPhone fixes the issue.

@ksarkar
Copy link

ksarkar commented Jul 3, 2014

Aha! I get it now. Today I wrote a separate service with only one characteristic and used LightBlue to read that. That is why when I was next running test.js, it was reading only one characteristics. There was some anomaly in uuids as well. I turned off and on the bluetooth in the linux machine, but it didn't help.

After turning off and on the bluetooth on iphone I ran test.js once again. But none of the following iPhone apps - LightBlue, BLExplr, BLE Explorer, BLE Utility, BTLExplorer were able to read the characteristics.

However, the dummy service with one characteristics that I wrote was read by all the above apps.

@sandeepmistry
Copy link
Collaborator

Thanks @ndhunju!

@ksarkar call we close this issue?

@sandeepmistry
Copy link
Collaborator

Closing due to inactivty, @heiko-s / @ksarkar necessary ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants