New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 644694 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug-Regression



Sign in to add a comment

Did Bluetooth APIs change in 52.0.2743.116?

Reported by frjtrif...@gmail.com, Sep 7 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50
Platform: 8350.68.0 (Official Build) stable-channel peppy

Steps to reproduce the problem:
1. Scan for BLE devices (chrome.bluetooth.startDiscovery)
2. Connect to a BLE device (chrome.bluetoothLowEnergy.connect) and wait for the connect call to complete and observe that chrome.runtime.lastError is not set
3. Call chrome.bluetoothLowEnergy.getServices(string deviceAddress, function callback) - observe that the function(array of Service result) {...}; callback receives an array of length 0

What is the expected behavior?
In step 3 there used to be an array of services whose length was not 0

What went wrong?
The services are not returned as documented

Did this work before? Yes The last time we tested this was on 51.0.2704.106 (but it also worked on the previous versions from 48 up to and including the last stable 51 version for ChromeOS)

Chrome version: 52.0.2743.116  Channel: stable
OS Version: 52.0.2743.116
Flash Version: 22.0.0.209-r1

It seemed to break right around the time where chrome.bluetooth was added to Mac and the other platforms and was not just available on ChromeOS.
 
Correction:
"It seemed to break right around the time where chrome.bluetooth was added to Mac and the other platforms and was not just available on ChromeOS."

I meant to say
"It seemed to break right around the time where chrome.bluetoothLowEnergy was added to Mac and the other platforms and was not just available on ChromeOS."

Comment 2 Deleted

Code to reproduce the issue in step 3:

chrome.bluetoothLowEnergy.getServices(INSERT_MAC_ADDRESS_HERE, function(services) {
    if (chrome.runtime.lastError) 
        console.error('chrome runtime error set', chrome.runtime.lastError.message);
    } else {
        console.log('Services: ', services);
    }
})
Components: IO>Bluetooth

Comment 5 by ortuno@chromium.org, Sep 11 2016

Just to be clear we only officially support chrome.bluetoothlowenergy in Chrome OS. Some features started working on other platforms because of Web Bluetooth[1] which is supported on Chrome OS, Android and macOS. But there is no guarantee that all features work correctly.

re the error you are seeing. When you first connect to a device you have to wait a couple of seconds for the services to be discovered. You can check for this by adding a listener to chrome.bluetoothLowEnergy.onServiceAdded. The reason you the current code might have worked before is because there was a bug in that the services were being incorrectly cached. This lead to getServices sometimes returning incorrect services.

[1] https://webbluetoothcg.github.io/web-bluetooth/
Thank you very much. 
That explains what I'm seeing. I was able to some times get the code to work yesterday after I added a delay to the getServices call - like this:
setTimeOut(function () {
chrome.bluetoothLowEnergy.getServices(INSERT_MAC_ADDRESS_HERE, function(services) {
    if (chrome.runtime.lastError) 
        console.error('chrome runtime error set', chrome.runtime.lastError.message);
    } else {
        console.log('Services: ', services);
    }
})
}, 1500);

I am actually registering for the onServiceAdded callback - but I might be doing it too late - I will investigate that.

Thanks again
Flemming

Comment 7 by ortuno@chromium.org, Sep 12 2016

Status: WontFix (was: Unconfirmed)
Did some further investigation

On all the Chromebooks I have tested Chrome 53 (latest stable channel) this on:
Acer C720, Acer R11 (52 was latest stable version when I tested this, but same experience), Lenovo 100s, HP 14-x080no, Toshiba CB30-B-104

I am NOT getting any of the onServiceAdded, onServiceChanged or onServiceRemoved callbacks.

On Chrome on OSx and macOS I am getting the onServiceAdded/onServiceChanged/onServiceRemoved callbacks.

So on Chromebook I have to do polling of getServices - which works after a few attempts (with a 500ms delay between attempts) on most of the Chromebooks I have tried that approach on.  
However the Lenovo 100s does not - no matter how long I wait - return anything but an empty array of services when I call getServices to get the list of services.

I guess the Lenovo has a bug of some sort in 53 - our tester insist that his did work on 100s in an earlier test run (probably on 51)
Do you happen to have the same problem on Dev Channel (M55 at the moment)?
I have just now tested Chrome 55.0.2858.0 (latest Dev channel version for ChromeOS) on the Acer C720 on  - and that also does not call any of the onService* callbacks.

Polling getServices works fine though.

The Lenovo 100s is locked to stable - I don't know why - but after being turned off (not just restarted) it suddenly started returning services again. 
Still no calls to the onService* callbacks though.

On OSx they work fine on Chrome 55 and 53 - due to some V8 bug in 54 I cannot test our app on that version right now.
I installed it - added a breakpoint in onServiceAdded and in onServiceChanged - the breakpoint did not trigger on any of my test Chromebooks.

Doing the same on Chrome for OSx triggers the breakpoint just fine.

The statement printed to console in onServiceChanged 'The selected service has changed' is not found in my console log, neither is console.log('New Battery service added: ' + service.instanceId); from onServiceAdded.

I do get "Found Battery service" - which is printed from the getServices callback.

Are you testing Chrome on a Chromebook or are you by any chance using Chrome for another OS?

fyi the Chrome Apps API is not supported on macOS please don't rely on it working on that platform.
I'm not relying on OS X for our Chrome app - our app is purely meant for Chromebooks - I just happen to be working on a macbook and have a bunch of Chrome versions installed :)

But Chrome on OSx does actually fire the onService callbacks as I also mentioned earlier. My issue is that none of our Chromebooks fire the onService* callbacks. 

I am pretty sure it is not our code - the onService callbacks also don't fire with the BatteryService demo app.

 
First, clean your cache, you should see onServiceRemoved callback triggered.
Then, connect to the device and onServiceAdded callback should be triggered as well.
Has this been fixed now? I am running Chrome OS v 56.0.2924.
Cc: mcchou@chromium.org st...@chromium.org

Sign in to add a comment