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

List of characteristics are empty in service #59

Open
bitabs opened this issue Feb 2, 2018 · 1 comment
Open

List of characteristics are empty in service #59

bitabs opened this issue Feb 2, 2018 · 1 comment

Comments

@bitabs
Copy link

bitabs commented Feb 2, 2018

I am trying to connect to my Arduino via BLE using this library. But for some reason the services array are always empty:

Here's my code

    noble.on('stateChange', function(state) {
      if (state === 'poweredOn') {
        //
        // Once the BLE radio has been powered on, it is possible
        // to begin scanning for services. Pass an empty array to
        // scan for all services (uses more time and power).
        //
        console.log('scanning...');
        noble.startScanning(['0000222000001000800000805f9b34fb'], false);
      }
      else {
        noble.stopScanning();
      }
    })

    noble.on('discover', function(peripheral) {
      console.log(peripheral);
      // we found a peripheral, stop scanning
      noble.stopScanning();

      console.log("scanning stopped")


      peripheral.connect(err => {
        peripheral.discoverServices(['0000222000001000800000805f9b34fb'], function(err, services) {
          console.log({error: err, service: services});
        });
      })

    });

And this is the output:
capture

@bitabs
Copy link
Author

bitabs commented Feb 2, 2018

Nevermind I restarted, and the services are shown but the characteristics are null
capture

But it is visible in BLE scanner from play store:
capture

@bitabs bitabs changed the title List of services are empty List of characteristics are empty in service Feb 2, 2018
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

1 participant