{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleChrome/samples/pulls/comments/35076853","id":35076853,"diff_hunk":"@@ -0,0 +1,66 @@\n+---\n+feature_name: Web Bluetooth\n+chrome_version: 45\n+feature_id: 5264933985976320\n+---\n+\n+<p>The <a href=\"https://github.com/WebBluetoothCG/web-bluetooth\">Web Bluetooth API</a> aims to discover and communicate with devices over the Bluetooth 4 wireless standard using the Generic Attribute Profile (GATT). It is currently only partially implemented in Chrome OS behind the experimental flag <code>chrome://flags/#enable-web-bluetooth</code>.</p>\n+\n+<p>This sample illustrates the use of the Web Bluetooth API to retrieve battery\n+information from a nearby Bluetooth Device advertising Battery information with\n+Bluetooth Low Energy. You may want to try this demo with the BLE Peripheral\n+Simulator App from the <a href=\"_blank\"\n+target=\"https://play.google.com/store/apps/details?id=io.github.webbluetoothcg.bletestperipheral\">Google\n+Play Store</a>.</p>\n+\n+<button>Get Bluetooth Device Battery</button>\n+{% capture initial_output_content %}\n+{% endcapture %}\n+{% include output_helper.html initial_output_content=initial_output_content %}\n+\n+{% capture js %}\n+function onButtonClick() {\n+  'use strict';\n+\n+  log('Requesting Bluetooth Device...');\n+  navigator.bluetooth.requestDevice({filters:[{services:['battery_service']}]})\n+  .then(device => {\n+    log('> Found ' + device.name);\n+    log('Connecting to GATT Server...');\n+    return device.connectGATT()\n+  })\n+  .then(server => {\n+    log('Getting Battery Service...');\n+    return server.getPrimaryService('battery_service')\n+  })\n+  .then(service => {\n+    log('Getting Battery Level Characteristic...');","path":"web-bluetooth/index.html","position":37,"original_position":37,"commit_id":"4970f89403cc541a9cbeaf3050a9f497b3833b56","original_commit_id":"4970f89403cc541a9cbeaf3050a9f497b3833b56","user":{"login":"beaufortfrancois","id":634478,"avatar_url":"https://avatars.githubusercontent.com/u/634478?v=3","gravatar_id":"","url":"https://api.github.com/users/beaufortfrancois","html_url":"https://github.com/beaufortfrancois","followers_url":"https://api.github.com/users/beaufortfrancois/followers","following_url":"https://api.github.com/users/beaufortfrancois/following{/other_user}","gists_url":"https://api.github.com/users/beaufortfrancois/gists{/gist_id}","starred_url":"https://api.github.com/users/beaufortfrancois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beaufortfrancois/subscriptions","organizations_url":"https://api.github.com/users/beaufortfrancois/orgs","repos_url":"https://api.github.com/users/beaufortfrancois/repos","events_url":"https://api.github.com/users/beaufortfrancois/events{/privacy}","received_events_url":"https://api.github.com/users/beaufortfrancois/received_events","type":"User","site_admin":false},"body":"Added check for service.","created_at":"2015-07-21T07:45:02Z","updated_at":"2015-07-21T07:45:02Z","html_url":"https://github.com/GoogleChrome/samples/pull/165#discussion_r35076853","pull_request_url":"https://api.github.com/repos/GoogleChrome/samples/pulls/165","_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/samples/pulls/comments/35076853"},"html":{"href":"https://github.com/GoogleChrome/samples/pull/165#discussion_r35076853"},"pull_request":{"href":"https://api.github.com/repos/GoogleChrome/samples/pulls/165"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleChrome/samples/pulls/165","id":40336478,"html_url":"https://github.com/GoogleChrome/samples/pull/165","diff_url":"https://github.com/GoogleChrome/samples/pull/165.diff","patch_url":"https://github.com/GoogleChrome/samples/pull/165.patch","issue_url":"https://api.github.com/repos/GoogleChrome/samples/issues/165","number":165,"state":"open","locked":false,"title":"Add Web Bluetooth Sample","user":{"login":"beaufortfrancois","id":634478,"avatar_url":"https://avatars.githubusercontent.com/u/634478?v=3","gravatar_id":"","url":"https://api.github.com/users/beaufortfrancois","html_url":"https://github.com/beaufortfrancois","followers_url":"https://api.github.com/users/beaufortfrancois/followers","following_url":"https://api.github.com/users/beaufortfrancois/following{/other_user}","gists_url":"https://api.github.com/users/beaufortfrancois/gists{/gist_id}","starred_url":"https://api.github.com/users/beaufortfrancois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beaufortfrancois/subscriptions","organizations_url":"https://api.github.com/users/beaufortfrancois/orgs","repos_url":"https://api.github.com/users/beaufortfrancois/repos","events_url":"https://api.github.com/users/beaufortfrancois/events{/privacy}","received_events_url":"https://api.github.com/users/beaufortfrancois/received_events","type":"User","site_admin":false},"body":"This \"Read BLE Battery\" sample will go with the upcoming \"web/updates\" article on the Web Bluetooth API.\r\n\r\nNote: You can easily play with this on Chrome OS Dev Channel at https://beaufortfrancois.github.io/samples/web-bluetooth\r\n\r\n@scheib Can you review this simple code?","created_at":"2015-07-20T09:50:05Z","updated_at":"2015-07-21T07:45:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2c2be52a863ffe2254eaede1832b04279090ff8b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GoogleChrome/samples/pulls/165/commits","review_comments_url":"https://api.github.com/repos/GoogleChrome/samples/pulls/165/comments","review_comment_url":"https://api.github.com/repos/GoogleChrome/samples/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleChrome/samples/issues/165/comments","statuses_url":"https://api.github.com/repos/GoogleChrome/samples/statuses/4970f89403cc541a9cbeaf3050a9f497b3833b56","head":{"label":"beaufortfrancois:web-bluetooth","ref":"web-bluetooth","sha":"4970f89403cc541a9cbeaf3050a9f497b3833b56","user":{"login":"beaufortfrancois","id":634478,"avatar_url":"https://avatars.githubusercontent.com/u/634478?v=3","gravatar_id":"","url":"https://api.github.com/users/beaufortfrancois","html_url":"https://github.com/beaufortfrancois","followers_url":"https://api.github.com/users/beaufortfrancois/followers","following_url":"https://api.github.com/users/beaufortfrancois/following{/other_user}","gists_url":"https://api.github.com/users/beaufortfrancois/gists{/gist_id}","starred_url":"https://api.github.com/users/beaufortfrancois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beaufortfrancois/subscriptions","organizations_url":"https://api.github.com/users/beaufortfrancois/orgs","repos_url":"https://api.github.com/users/beaufortfrancois/repos","events_url":"https://api.github.com/users/beaufortfrancois/events{/privacy}","received_events_url":"https://api.github.com/users/beaufortfrancois/received_events","type":"User","site_admin":false},"repo":{"id":38493045,"name":"samples","full_name":"beaufortfrancois/samples","owner":{"login":"beaufortfrancois","id":634478,"avatar_url":"https://avatars.githubusercontent.com/u/634478?v=3","gravatar_id":"","url":"https://api.github.com/users/beaufortfrancois","html_url":"https://github.com/beaufortfrancois","followers_url":"https://api.github.com/users/beaufortfrancois/followers","following_url":"https://api.github.com/users/beaufortfrancois/following{/other_user}","gists_url":"https://api.github.com/users/beaufortfrancois/gists{/gist_id}","starred_url":"https://api.github.com/users/beaufortfrancois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beaufortfrancois/subscriptions","organizations_url":"https://api.github.com/users/beaufortfrancois/orgs","repos_url":"https://api.github.com/users/beaufortfrancois/repos","events_url":"https://api.github.com/users/beaufortfrancois/events{/privacy}","received_events_url":"https://api.github.com/users/beaufortfrancois/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/beaufortfrancois/samples","description":"A repo containing samples tied to new functionality in each release of Google Chrome.","fork":true,"url":"https://api.github.com/repos/beaufortfrancois/samples","forks_url":"https://api.github.com/repos/beaufortfrancois/samples/forks","keys_url":"https://api.github.com/repos/beaufortfrancois/samples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/beaufortfrancois/samples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/beaufortfrancois/samples/teams","hooks_url":"https://api.github.com/repos/beaufortfrancois/samples/hooks","issue_events_url":"https://api.github.com/repos/beaufortfrancois/samples/issues/events{/number}","events_url":"https://api.github.com/repos/beaufortfrancois/samples/events","assignees_url":"https://api.github.com/repos/beaufortfrancois/samples/assignees{/user}","branches_url":"https://api.github.com/repos/beaufortfrancois/samples/branches{/branch}","tags_url":"https://api.github.com/repos/beaufortfrancois/samples/tags","blobs_url":"https://api.github.com/repos/beaufortfrancois/samples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/beaufortfrancois/samples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/beaufortfrancois/samples/git/refs{/sha}","trees_url":"https://api.github.com/repos/beaufortfrancois/samples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/beaufortfrancois/samples/statuses/{sha}","languages_url":"https://api.github.com/repos/beaufortfrancois/samples/languages","stargazers_url":"https://api.github.com/repos/beaufortfrancois/samples/stargazers","contributors_url":"https://api.github.com/repos/beaufortfrancois/samples/contributors","subscribers_url":"https://api.github.com/repos/beaufortfrancois/samples/subscribers","subscription_url":"https://api.github.com/repos/beaufortfrancois/samples/subscription","commits_url":"https://api.github.com/repos/beaufortfrancois/samples/commits{/sha}","git_commits_url":"https://api.github.com/repos/beaufortfrancois/samples/git/commits{/sha}","comments_url":"https://api.github.com/repos/beaufortfrancois/samples/comments{/number}","issue_comment_url":"https://api.github.com/repos/beaufortfrancois/samples/issues/comments{/number}","contents_url":"https://api.github.com/repos/beaufortfrancois/samples/contents/{+path}","compare_url":"https://api.github.com/repos/beaufortfrancois/samples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/beaufortfrancois/samples/merges","archive_url":"https://api.github.com/repos/beaufortfrancois/samples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/beaufortfrancois/samples/downloads","issues_url":"https://api.github.com/repos/beaufortfrancois/samples/issues{/number}","pulls_url":"https://api.github.com/repos/beaufortfrancois/samples/pulls{/number}","milestones_url":"https://api.github.com/repos/beaufortfrancois/samples/milestones{/number}","notifications_url":"https://api.github.com/repos/beaufortfrancois/samples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/beaufortfrancois/samples/labels{/name}","releases_url":"https://api.github.com/repos/beaufortfrancois/samples/releases{/id}","created_at":"2015-07-03T13:05:08Z","updated_at":"2015-07-03T13:05:09Z","pushed_at":"2015-07-20T09:47:56Z","git_url":"git://github.com/beaufortfrancois/samples.git","ssh_url":"git@github.com:beaufortfrancois/samples.git","clone_url":"https://github.com/beaufortfrancois/samples.git","svn_url":"https://github.com/beaufortfrancois/samples","homepage":"https://www.chromestatus.com/features","size":3463,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"gh-pages"}},"base":{"label":"GoogleChrome:gh-pages","ref":"gh-pages","sha":"4baa7c22667bbd1806facd2cece881fa0a3827b3","user":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"repo":{"id":20438302,"name":"samples","full_name":"GoogleChrome/samples","owner":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleChrome/samples","description":"A repo containing samples tied to new functionality in each release of Google Chrome.","fork":false,"url":"https://api.github.com/repos/GoogleChrome/samples","forks_url":"https://api.github.com/repos/GoogleChrome/samples/forks","keys_url":"https://api.github.com/repos/GoogleChrome/samples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleChrome/samples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleChrome/samples/teams","hooks_url":"https://api.github.com/repos/GoogleChrome/samples/hooks","issue_events_url":"https://api.github.com/repos/GoogleChrome/samples/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleChrome/samples/events","assignees_url":"https://api.github.com/repos/GoogleChrome/samples/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleChrome/samples/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleChrome/samples/tags","blobs_url":"https://api.github.com/repos/GoogleChrome/samples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleChrome/samples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleChrome/samples/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleChrome/samples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleChrome/samples/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleChrome/samples/languages","stargazers_url":"https://api.github.com/repos/GoogleChrome/samples/stargazers","contributors_url":"https://api.github.com/repos/GoogleChrome/samples/contributors","subscribers_url":"https://api.github.com/repos/GoogleChrome/samples/subscribers","subscription_url":"https://api.github.com/repos/GoogleChrome/samples/subscription","commits_url":"https://api.github.com/repos/GoogleChrome/samples/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleChrome/samples/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleChrome/samples/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleChrome/samples/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleChrome/samples/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleChrome/samples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleChrome/samples/merges","archive_url":"https://api.github.com/repos/GoogleChrome/samples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleChrome/samples/downloads","issues_url":"https://api.github.com/repos/GoogleChrome/samples/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleChrome/samples/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleChrome/samples/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleChrome/samples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleChrome/samples/labels{/name}","releases_url":"https://api.github.com/repos/GoogleChrome/samples/releases{/id}","created_at":"2014-06-03T10:15:52Z","updated_at":"2015-07-20T07:17:10Z","pushed_at":"2015-07-21T05:05:36Z","git_url":"git://github.com/GoogleChrome/samples.git","ssh_url":"git@github.com:GoogleChrome/samples.git","clone_url":"https://github.com/GoogleChrome/samples.git","svn_url":"https://github.com/GoogleChrome/samples","homepage":"https://www.chromestatus.com/features","size":4607,"stargazers_count":720,"watchers_count":720,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":176,"mirror_url":null,"open_issues_count":24,"forks":176,"open_issues":24,"watchers":720,"default_branch":"gh-pages"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/samples/pulls/165"},"html":{"href":"https://github.com/GoogleChrome/samples/pull/165"},"issue":{"href":"https://api.github.com/repos/GoogleChrome/samples/issues/165"},"comments":{"href":"https://api.github.com/repos/GoogleChrome/samples/issues/165/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleChrome/samples/pulls/165/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleChrome/samples/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleChrome/samples/pulls/165/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleChrome/samples/statuses/4970f89403cc541a9cbeaf3050a9f497b3833b56"}}}}