bluetooth_private.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. // This file was generated by:
  5. // tools/json_schema_compiler/compiler.py.
  6. // NOTE: The format of types has changed. 'FooType' is now
  7. // 'chrome.bluetoothPrivate.FooType'.
  8. // Please run the closure compiler before committing changes.
  9. // See https://chromium.googlesource.com/chromium/src/+/master/docs/closure_compilation.md
  10. // IMPORTANT NOTE: Work-around for crbug.com/543822
  11. // s/chrome.bluetoothPrivate.bluetooth.Device/chrome.bluetooth.Device/
  12. // s/chrome.bluetoothPrivate.bluetooth.Transport/chrome.bluetooth.Transport/
  13. /** @fileoverview Externs generated from namespace: bluetoothPrivate */
  14. /** @const */
  15. chrome.bluetoothPrivate = {};
  16. /**
  17. * @enum {string}
  18. */
  19. chrome.bluetoothPrivate.PairingEventType = {
  20. REQUEST_PINCODE: 'requestPincode',
  21. DISPLAY_PINCODE: 'displayPincode',
  22. REQUEST_PASSKEY: 'requestPasskey',
  23. DISPLAY_PASSKEY: 'displayPasskey',
  24. KEYS_ENTERED: 'keysEntered',
  25. CONFIRM_PASSKEY: 'confirmPasskey',
  26. REQUEST_AUTHORIZATION: 'requestAuthorization',
  27. COMPLETE: 'complete',
  28. };
  29. /**
  30. * @enum {string}
  31. */
  32. chrome.bluetoothPrivate.ConnectResultType = {
  33. ALREADY_CONNECTED: 'alreadyConnected',
  34. AUTH_CANCELED: 'authCanceled',
  35. AUTH_FAILED: 'authFailed',
  36. AUTH_REJECTED: 'authRejected',
  37. AUTH_TIMEOUT: 'authTimeout',
  38. FAILED: 'failed',
  39. IN_PROGRESS: 'inProgress',
  40. SUCCESS: 'success',
  41. UNKNOWN_ERROR: 'unknownError',
  42. UNSUPPORTED_DEVICE: 'unsupportedDevice',
  43. };
  44. /**
  45. * @enum {string}
  46. */
  47. chrome.bluetoothPrivate.PairingResponse = {
  48. CONFIRM: 'confirm',
  49. REJECT: 'reject',
  50. CANCEL: 'cancel',
  51. };
  52. /**
  53. * @enum {string}
  54. */
  55. chrome.bluetoothPrivate.TransportType = {
  56. LE: 'le',
  57. BREDR: 'bredr',
  58. DUAL: 'dual',
  59. };
  60. /**
  61. * @typedef {{
  62. * pairing: !chrome.bluetoothPrivate.PairingEventType,
  63. * device: !chrome.bluetooth.Device,
  64. * pincode: (string|undefined),
  65. * passkey: (number|undefined),
  66. * enteredKey: (number|undefined)
  67. * }}
  68. */
  69. chrome.bluetoothPrivate.PairingEvent;
  70. /**
  71. * @typedef {{
  72. * name: (string|undefined),
  73. * powered: (boolean|undefined),
  74. * discoverable: (boolean|undefined)
  75. * }}
  76. */
  77. chrome.bluetoothPrivate.NewAdapterState;
  78. /**
  79. * @typedef {{
  80. * device: !chrome.bluetooth.Device,
  81. * response: !chrome.bluetoothPrivate.PairingResponse,
  82. * pincode: (string|undefined),
  83. * passkey: (number|undefined)
  84. * }}
  85. */
  86. chrome.bluetoothPrivate.SetPairingResponseOptions;
  87. /**
  88. * @typedef {{
  89. * transport: (!chrome.bluetoothPrivate.TransportType|undefined),
  90. * uuids: ((string|!Array<string>)|undefined),
  91. * rssi: (number|undefined),
  92. * pathloss: (number|undefined)
  93. * }}
  94. */
  95. chrome.bluetoothPrivate.DiscoveryFilter;
  96. /**
  97. * Changes the state of the Bluetooth adapter.
  98. * @param {!chrome.bluetoothPrivate.NewAdapterState} adapterState The new state
  99. * of the adapter.
  100. * @param {function(): void=} callback Called when all the state changes have
  101. * been completed.
  102. */
  103. chrome.bluetoothPrivate.setAdapterState = function(adapterState, callback) {};
  104. /**
  105. * @param {!chrome.bluetoothPrivate.SetPairingResponseOptions} options
  106. * @param {function(): void=} callback
  107. */
  108. chrome.bluetoothPrivate.setPairingResponse = function(options, callback) {};
  109. /**
  110. * Tears down all connections to the given device.
  111. * @param {string} deviceAddress
  112. * @param {function(): void=} callback
  113. */
  114. chrome.bluetoothPrivate.disconnectAll = function(deviceAddress, callback) {};
  115. /**
  116. * Forgets the given device.
  117. * @param {string} deviceAddress
  118. * @param {function(): void=} callback
  119. */
  120. chrome.bluetoothPrivate.forgetDevice = function(deviceAddress, callback) {};
  121. /**
  122. * Set or clear discovery filter.
  123. * @param {!chrome.bluetoothPrivate.DiscoveryFilter} discoveryFilter
  124. * @param {function(): void=} callback
  125. */
  126. chrome.bluetoothPrivate.setDiscoveryFilter = function(discoveryFilter, callback) {};
  127. /**
  128. * Connects to the given device. This will only throw an error if the device
  129. * address is invalid or the device is already connected. Otherwise this will
  130. * succeed and invoke |callback| with ConnectResultType.
  131. * @param {string} deviceAddress
  132. * @param {function(!chrome.bluetoothPrivate.ConnectResultType): void=} callback
  133. */
  134. chrome.bluetoothPrivate.connect = function(deviceAddress, callback) {};
  135. /**
  136. * Pairs the given device.
  137. * @param {string} deviceAddress
  138. * @param {function(): void=} callback
  139. */
  140. chrome.bluetoothPrivate.pair = function(deviceAddress, callback) {};
  141. /**
  142. * Record that a pairing attempt finished. Ignores cancellations.
  143. * @param {!chrome.bluetooth.Transport} transport
  144. * @param {number} pairingDurationMs
  145. * @param {!chrome.bluetoothPrivate.ConnectResultType=} result
  146. */
  147. chrome.bluetoothPrivate.recordPairing = function(transport, pairingDurationMs, result) {};
  148. /**
  149. * Record that a user-initiated reconnection attempt to an already paired device
  150. * finished. Ignores cancellations.
  151. * @param {!chrome.bluetoothPrivate.ConnectResultType=} result
  152. */
  153. chrome.bluetoothPrivate.recordReconnection = function(result) {};
  154. /**
  155. * Record that a user selected a device to connect to.
  156. * @param {number} selectionDurationMs
  157. * @param {boolean} wasPaired
  158. * @param {!chrome.bluetooth.Transport} transport
  159. */
  160. chrome.bluetoothPrivate.recordDeviceSelection = function(selectionDurationMs, wasPaired, transport) {};
  161. /**
  162. * Fired when a pairing event occurs.
  163. * @type {!ChromeEvent}
  164. */
  165. chrome.bluetoothPrivate.onPairing;
  166. /**
  167. * Fired when a Bluetooth device changed its address.
  168. * @type {!ChromeEvent}
  169. */
  170. chrome.bluetoothPrivate.onDeviceAddressChanged;