Skip to content

CurieBLE: discovering attributes of connect central fails #382

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

Closed
sandeepmistry opened this issue Dec 30, 2016 · 13 comments
Closed

CurieBLE: discovering attributes of connect central fails #382

sandeepmistry opened this issue Dec 30, 2016 · 13 comments
Assignees
Milestone

Comments

@sandeepmistry
Copy link
Contributor

When running the following sketch, and connecting from LightBlue on my Mac, discovering attributes of the connected central fails:

#include <CurieBLE.h>

void setup() {
  Serial.begin(9600);
  while(!Serial);

  BLE.begin();

  BLE.advertise();
}

void loop() {
  BLEDevice central = BLE.central();

  if (central) {
    Serial.print("Central connected: ");
    Serial.println(central.address());

    if (central.discoverAttributes()) {
      Serial.println("Discovered attributes");
    } else {
      Serial.println("Discovering attributes failed!");
    }

    while(central.connected()) {
      
    }

    Serial.print("Central disconnected: ");
    Serial.println(central.address());
  }
}
@noelpaz
Copy link
Contributor

noelpaz commented Jan 2, 2017

I thought that discoverAttributes works only in central mode and not meant for the peripheral to discover central. I am also adding @sgbihu to this and hope he answers. I am still on vacation.

@noelpaz noelpaz assigned noelpaz and SidLeung and unassigned noelpaz and SidLeung Jan 2, 2017
@noelpaz
Copy link
Contributor

noelpaz commented Jan 2, 2017

It looks like I cannot assign @sgbihu . @eriknyquist can you send him an email to look into this

@sandeepmistry
Copy link
Contributor Author

I thought that discoverAttributes works only in central mode and not meant for the peripheral to discover central.

@noelpaz as discussed with @SidLeung during the initial calls, both centrals and peripherals can operate a GATT server and GATT client.

@sgbihu
Copy link
Contributor

sgbihu commented Jan 4, 2017

This is a bug. The program doesn't add the connected central to the profile buffer. And that makes discover failed. The discover can't find it in the buffer. The current code only consider the connected peripheral device.

@sgbihu
Copy link
Contributor

sgbihu commented Jan 4, 2017

Hi @sandeepmistry ,

You can get the fix from https://github.com/sgbihu/corelibs-arduino101. The commit is a8c834a.

Thanks!

@SidLeung SidLeung assigned SidLeung and unassigned noelpaz and SidLeung Jan 5, 2017
@SidLeung
Copy link
Contributor

SidLeung commented Jan 5, 2017

Please note Jira ticket, 788, has been created. A solution has been created for internal review, approval, and testing. Upon the completion of that process, the solution will be merged to the master, will be in the nightly JSON build, and will post the status here.

@noelpaz
Copy link
Contributor

noelpaz commented Jan 25, 2017

Tested and works accordingly.

@noelpaz noelpaz closed this as completed Jan 25, 2017
@sandeepmistry
Copy link
Contributor Author

@noelpaz was the fix for this merged into master?

@noelpaz noelpaz reopened this Jan 31, 2017
@kitsunami
Copy link

This was addressed in #410

@SidLeung
Copy link
Contributor

SidLeung commented Mar 1, 2017

PR #410 addresses this issue.

@SidLeung SidLeung assigned sandeepmistry and unassigned SidLeung Mar 1, 2017
@sandeepmistry
Copy link
Contributor Author

I'm still seeing this issue with the sketch from #382 (comment) and my Mac running macOS 10.12.3.

The Serial monitor displays the following when I connect from LightBlue on my Mac:

Central connected: AC:BC:32:7C:FA:26
Discovering attributes failed!
Central disconnected: 

Here's a screenshot from the PacketLogger app, I don't see any incoming attribute discovery requests either:

screen shot 2017-03-15 at 11 14 13 am

@sgbihu
Copy link
Contributor

sgbihu commented Mar 16, 2017

Hi @sandeepmistry ,
I have test those two sketches https://github.com/01org/corelibs-arduino101/tree/master/libraries/CurieBLE/examples/test/discoveratperipheral and https://github.com/01org/corelibs-arduino101/tree/master/libraries/CurieBLE/examples/test/profileatcentral. They doesn't have problem.

So I want to confirm your does your light blue has profiles? Please tell me the setups if you have. And does iPhone's light blue has same results? I don't have MAC OS to duplicate this issue. It's better we can do on IOS.

Thanks!

@sandeepmistry
Copy link
Contributor Author

I tried this again today with Github master and the 2.0.1 RC JSON. The sketch I provided works with both macOS and iOS.

Not exactly sure why it was failing yesterday, it could be that the GATT server on the Mac had too many attributes like #479 (comment).

I'll close this for now, and re-open if I see it again.

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

Successfully merging a pull request may close this issue.

7 participants