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

Permission Denied error when using chrome.bluetoothLowEnergy API #5010

Closed
rexpie opened this issue Jun 21, 2016 · 2 comments
Closed

Permission Denied error when using chrome.bluetoothLowEnergy API #5010

rexpie opened this issue Jun 21, 2016 · 2 comments
Assignees

Comments

@rexpie
Copy link

rexpie commented Jun 21, 2016

NW.js version
nwjs-sdk-v0.15.3-osx-x64

OS
El Capitan 10.11.5 64bit

code:

chrome.bluetooth.startDiscovery();
chrome.bluetooth.onDeviceAdded.addListener(device => {
  console.log(device.name + ":" + device.address);
  if (device.name == 'REXBLUNO') { // bluetooth name of my arduino with built-in bluetooth
    console.log(device);
    chrome.bluetooth.stopDiscovery(
      function () {
        if (chrome.runtime.lastError) {
          console.log('Failed to stop discovery: ' + chrome.runtime.lastError.message);
          return;
        }
        // so far no error
        chrome.bluetoothLowEnergy.connect(device.address, function () {
          if (chrome.runtime.lastError) {
            console.log('Failed to connect: ' + chrome.runtime.lastError.message);
            return;
          }
        });
      });
  }
});

Console output:

server.js:16 Failed to connect: Permission denied

According to this issue, NW.js should enable all chrome.* API. Some how the connect function within the bluetoothLowEnergy object fails.

The Bluetooth hardware is fine, my Android phone can connect to it and read/write data.

API reference:
https://developer.chrome.com/apps/bluetoothLowEnergy

@rogerwang rogerwang self-assigned this Jun 22, 2016
@rogerwang
Copy link
Member

I agree that it should be enabled by default in NW apps.

For now it can be workaround by adding "bluetooth": {"low_energy": true} in package.json: https://developer.chrome.com/apps/app_bluetooth

@rogerwang
Copy link
Member

This is now fixed in git and will be available in the next nightly build.

@rogerwang rogerwang assigned ghostoy and unassigned rogerwang Jul 26, 2016
ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Jul 28, 2016
rogerwang added a commit that referenced this issue Aug 2, 2016
@ghostoy ghostoy removed the test-todo label Aug 24, 2016
rogerwang pushed a commit that referenced this issue Aug 30, 2016
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

3 participants