Bluetooth: add Device events, and cleanup JS API
The JavaScript API for getting the set of devices known to the adapter
and dealing with discovery was difficult to use, and had a messy
implementation. By streamlining the API not only does it become much
easier to work with, but the implementation becomes much cleaner as
well.
chrome.bluetooth.getDevices() now simply returns an array of devices in
its callback, it's up to the application to filter these since profile
filtering is unreliable during discovery and on Low Energy.
chrome.bluetooth.startDiscovery() now only has a callback to indicate
a success to the command, the hidden event and listener has been
removed in favor of the new device events.
Add chrome.bluetooth.onDeviceAdded, chrome.bluetooth.onDeviceChanged
and chrome.bluetooth.onDeviceRemoved events. These return updated
device objects when they are first known, changed and removed
respectively.
Take the opportunity of writing a proper documentation page for these
new methods and events showing their usage.
BUG=345050
TEST=BluetoothApiTest updated and included
R=armansito@chromium.org, miket@chromium.org, rpaquay@chromium.org, sky@chromium.org
Review URL: https://codereview.chromium.org/
177113013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255706 0039d316-1c4b-4281-b951-d872f2087c98