1[
2  {
3    "namespace": "bluetoothPrivate",
4    "description": " Use the <code>chrome.bluetoothPrivate</code> API to control the Bluetooth\n adapter state and handle device pairing.",
5    "compiler_options": {
6      "implemented_in": "extensions/browser/api/bluetooth/bluetooth_private_api.h"
7    },
8    "functions": [
9      {
10        "name": "setAdapterState",
11        "type": "function",
12        "description": "Changes the state of the Bluetooth adapter.",
13        "parameters": [
14          {
15            "name": "adapterState",
16            "$ref": "NewAdapterState"
17          },
18          {
19            "name": "callback",
20            "type": "function",
21            "parameters": []
22          }
23        ]
24      },
25      {
26        "name": "setPairingResponse",
27        "type": "function",
28        "parameters": [
29          {
30            "name": "options",
31            "$ref": "SetPairingResponseOptions"
32          },
33          {
34            "name": "callback",
35            "type": "function",
36            "parameters": []
37          }
38        ]
39      }
40    ],
41    "events": [
42      {
43        "name": "onPairing",
44        "type": "function",
45        "description": "Fired when a pairing event occurs.",
46        "parameters": [
47          {
48            "name": "pairingEvent",
49            "description": "A pairing event.",
50            "$ref": "PairingEvent"
51          }
52        ],
53        "options":
54        {
55          "maxListeners": 1
56        }
57      }
58    ],
59    "types": [
60      {
61        "type": "string",
62        "id": "PairingEventType",
63        "description": "Events that can occur during pairing. The method used for pairing varies depending on the capability of the two devices.",
64        "enum": [
65          {
66            "name": "requestPincode",
67            "description": "An alphanumeric PIN code is required to be entered by the user."
68          },
69          {
70            "name": "displayPincode",
71            "description": "Display a PIN code to the user."
72          },
73          {
74            "name": "requestPasskey",
75            "description": "A numeric passkey is required to be entered by the user."
76          },
77          {
78            "name": "displayPasskey",
79            "description": "Display a zero padded 6 digit numeric passkey that the user entered on the remote device. This event may occur multiple times during pairing to update the entered passkey."
80          },
81          {
82            "name": "keysEntered",
83            "description": "The number of keys inputted by the user on the remote device when entering a passkey. This event may be called multiple times during pairing to update the number of keys inputted."
84          },
85          {
86            "name": "confirmPasskey",
87            "description": "Requests that a 6 digit passkey be displayed and the user confirms that both devies show the same passkey."
88          },
89          {
90            "name": "requestAuthorization",
91            "description": "Requests authorization for a pairing under the just-works model. It is up to the app to ask for user confirmation."
92          },
93          {
94            "name": "complete",
95            "description": "Pairing is completed"
96          }
97        ]
98      },
99      {
100        "type": "string",
101        "id": "PairingResponse",
102        "description": "Valid pairing responses.",
103        "enum": [ "confirm", "reject", "cancel"]
104      },
105      {
106        "type": "object",
107        "id": "PairingEvent",
108        "description": "A pairing event received from a Bluetooth device.",
109        "properties": {
110          "pairing": {
111            "name": "pairing",
112            "$ref": "PairingEventType"
113          },
114          "device": {
115            "name": "device",
116            "$ref": "bluetooth.Device"
117          },
118          "pincode": {
119            "optional": true,
120            "name": "pincode",
121            "type": "string"
122          },
123          "passkey": {
124            "optional": true,
125            "name": "passkey",
126            "type": "integer"
127          },
128          "enteredKey": {
129            "optional": true,
130            "name": "enteredKey",
131            "type": "integer"
132          }
133        }
134      },
135      {
136        "type": "object",
137        "id": "NewAdapterState",
138        "properties": {
139          "name": {
140            "optional": true,
141            "name": "name",
142            "type": "string",
143            "description": "The human-readable name of the adapter."
144          },
145          "powered": {
146            "optional": true,
147            "name": "powered",
148            "type": "boolean",
149            "description": "Whether or not the adapter has power."
150          },
151          "discoverable": {
152            "optional": true,
153            "name": "discoverable",
154            "type": "boolean",
155            "description": "Whether the adapter is discoverable by other devices."
156          }
157        }
158      },
159      {
160        "type": "object",
161        "id": "SetPairingResponseOptions",
162        "properties": {
163          "device": {
164            "name": "device",
165            "$ref": "bluetooth.Device",
166            "description": "The remote device to send the pairing response."
167          },
168          "response": {
169            "optional": true,
170            "name": "response",
171            "$ref": "PairingResponse",
172            "description": "The response type"
173          },
174          "pincode": {
175            "optional": true,
176            "name": "pincode",
177            "type": "string",
178            "description": "A 1-16 character alphanumeric set in response to <code>requestPincode</code>."
179          },
180          "passkey": {
181            "optional": true,
182            "name": "passkey",
183            "type": "integer",
184            "description": "An integer between 0-999999 set in response to <code>requestPasskey</code>."
185          }
186        }
187      }
188    ]
189  }
190]
191