aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/bluetooth/index.html
blob: cd46b72ee7a620f01c46e90858b997989e44d662 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
title: Bluetooth
slug: Web/API/Bluetooth
tags:
  - API
  - 接口
  - 网页蓝牙接口说明
  - 蓝牙
  - 说明
translation_of: Web/API/Bluetooth
---
<p>{{ apiref("Web Bluetooth API") }} {{Non-standard_header()}}</p>

<p><a href="/Web/API/Web_Bluetooth_API">Web Bluetooth API</a> 的<strong><code>Bluetooth</code></strong><code>接口</code>返回指代{{domxref("BluetoothDevice")}}带有指定选项的对象的{{jsxref("Promise")}}</p>

<h2 id="接口">接口</h2>

<pre class="syntaxbox">interface <dfn>Bluetooth</dfn> {
  Promise&lt;BluetoothDevice&gt; requestDevice(RequestDeviceOptions <dfn>options</dfn>);
};
Bluetooth implements EventTarget;
Bluetooth implements BluetoothDeviceEventHandlers;
Bluetooth implements CharacteristicEventHandlers;
Bluetooth implements ServiceEventHandlers;</pre>

<h2 id="特性">特性</h2>

<dl>
 <dt></dt>
</dl>

<h2 id="方法">方法</h2>

<dl>
 <dt>{{domxref("Bluetooth.requestDevice()")}}</dt>
 <dd>返回一个包含指定选项的{{domxref("BluetoothDevice")}}对象的{{jsxref("Promise")}}</dd>
</dl>

<h2 id="详细说明">详细说明</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('Web Bluetooth', '#bluetooth', 'Bluetooth')}}</td>
   <td>{{Spec2('Web Bluetooth')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>

<div>{{CompatibilityTable}}</div>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatChrome (45.0)}} [1]</td>
   <td> </td>
   <td> </td>
   <td> </td>
   <td> </td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Android Webview</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>Firefox OS</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
   <th>Chrome for Android</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td> </td>
   <td> </td>
   <td> </td>
   <td> </td>
   <td> </td>
   <td>{{CompatChrome (48.0)}} [2]</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] 注意事项:仅谷歌浏览器可用</p>

<p>[2] 注意事项:仅安卓6以上可用</p>