tree: 5384b6d46c7b7e3f8287936eb05af5196a1525a6 [path history] [tgz]
  1. BUILD.gn
  2. DEPS
  3. OWNERS
  4. README.md
  5. adapter.cc
  6. adapter.h
  7. android/
  8. bluetooth_adapter.cc
  9. bluetooth_adapter.h
  10. bluetooth_adapter_android.cc
  11. bluetooth_adapter_android.h
  12. bluetooth_adapter_factory.cc
  13. bluetooth_adapter_factory.h
  14. bluetooth_adapter_factory_wrapper.cc
  15. bluetooth_adapter_factory_wrapper.h
  16. bluetooth_adapter_mac.h
  17. bluetooth_adapter_mac.mm
  18. bluetooth_adapter_mac_metrics.h
  19. bluetooth_adapter_mac_metrics.mm
  20. bluetooth_adapter_mac_unittest.mm
  21. bluetooth_adapter_stub.cc
  22. bluetooth_adapter_unittest.cc
  23. bluetooth_adapter_win.cc
  24. bluetooth_adapter_win.h
  25. bluetooth_adapter_win_unittest.cc
  26. bluetooth_adapter_winrt.cc
  27. bluetooth_adapter_winrt.h
  28. bluetooth_advertisement.cc
  29. bluetooth_advertisement.h
  30. bluetooth_advertisement_mac.h
  31. bluetooth_advertisement_mac.mm
  32. bluetooth_advertisement_unittest.cc
  33. bluetooth_advertisement_winrt.cc
  34. bluetooth_advertisement_winrt.h
  35. bluetooth_channel_mac.h
  36. bluetooth_channel_mac.mm
  37. bluetooth_classic_device_mac.h
  38. bluetooth_classic_device_mac.mm
  39. bluetooth_classic_win.cc
  40. bluetooth_classic_win.h
  41. bluetooth_classic_win_fake.cc
  42. bluetooth_classic_win_fake.h
  43. bluetooth_common.h
  44. bluetooth_device.cc
  45. bluetooth_device.h
  46. bluetooth_device_android.cc
  47. bluetooth_device_android.h
  48. bluetooth_device_mac.h
  49. bluetooth_device_mac.mm
  50. bluetooth_device_unittest.cc
  51. bluetooth_device_win.cc
  52. bluetooth_device_win.h
  53. bluetooth_device_win_unittest.cc
  54. bluetooth_device_winrt.cc
  55. bluetooth_device_winrt.h
  56. bluetooth_discovery_filter.cc
  57. bluetooth_discovery_filter.h
  58. bluetooth_discovery_filter_unittest.cc
  59. bluetooth_discovery_manager_mac.h
  60. bluetooth_discovery_manager_mac.mm
  61. bluetooth_discovery_session.cc
  62. bluetooth_discovery_session.h
  63. bluetooth_discovery_session_outcome.h
  64. bluetooth_export.h
  65. bluetooth_gatt_characteristic.cc
  66. bluetooth_gatt_characteristic.h
  67. bluetooth_gatt_connection.cc
  68. bluetooth_gatt_connection.h
  69. bluetooth_gatt_descriptor.cc
  70. bluetooth_gatt_descriptor.h
  71. bluetooth_gatt_discoverer_winrt.cc
  72. bluetooth_gatt_discoverer_winrt.h
  73. bluetooth_gatt_notify_session.cc
  74. bluetooth_gatt_notify_session.h
  75. bluetooth_gatt_service.cc
  76. bluetooth_gatt_service.h
  77. bluetooth_init_win.cc
  78. bluetooth_init_win.h
  79. bluetooth_l2cap_channel_mac.h
  80. bluetooth_l2cap_channel_mac.mm
  81. bluetooth_local_gatt_characteristic.cc
  82. bluetooth_local_gatt_characteristic.h
  83. bluetooth_local_gatt_characteristic_unittest.cc
  84. bluetooth_local_gatt_descriptor.cc
  85. bluetooth_local_gatt_descriptor.h
  86. bluetooth_local_gatt_descriptor_unittest.cc
  87. bluetooth_local_gatt_service.cc
  88. bluetooth_local_gatt_service.h
  89. bluetooth_local_gatt_service_unittest.cc
  90. bluetooth_low_energy_advertisement_manager_mac.h
  91. bluetooth_low_energy_advertisement_manager_mac.mm
  92. bluetooth_low_energy_advertisement_manager_mac_unittest.mm
  93. bluetooth_low_energy_central_manager_delegate.h
  94. bluetooth_low_energy_central_manager_delegate.mm
  95. bluetooth_low_energy_defs_win.cc
  96. bluetooth_low_energy_defs_win.h
  97. bluetooth_low_energy_device_mac.h
  98. bluetooth_low_energy_device_mac.mm
  99. bluetooth_low_energy_discovery_manager_mac.h
  100. bluetooth_low_energy_discovery_manager_mac.mm
  101. bluetooth_low_energy_peripheral_delegate.h
  102. bluetooth_low_energy_peripheral_delegate.mm
  103. bluetooth_low_energy_peripheral_manager_delegate.h
  104. bluetooth_low_energy_peripheral_manager_delegate.mm
  105. bluetooth_low_energy_win.cc
  106. bluetooth_low_energy_win.h
  107. bluetooth_low_energy_win_fake.cc
  108. bluetooth_low_energy_win_fake.h
  109. bluetooth_low_energy_win_unittest.cc
  110. bluetooth_pairing_winrt.cc
  111. bluetooth_pairing_winrt.h
  112. bluetooth_remote_gatt_characteristic.cc
  113. bluetooth_remote_gatt_characteristic.h
  114. bluetooth_remote_gatt_characteristic_android.cc
  115. bluetooth_remote_gatt_characteristic_android.h
  116. bluetooth_remote_gatt_characteristic_mac.h
  117. bluetooth_remote_gatt_characteristic_mac.mm
  118. bluetooth_remote_gatt_characteristic_unittest.cc
  119. bluetooth_remote_gatt_characteristic_win.cc
  120. bluetooth_remote_gatt_characteristic_win.h
  121. bluetooth_remote_gatt_characteristic_winrt.cc
  122. bluetooth_remote_gatt_characteristic_winrt.h
  123. bluetooth_remote_gatt_descriptor.cc
  124. bluetooth_remote_gatt_descriptor.h
  125. bluetooth_remote_gatt_descriptor_android.cc
  126. bluetooth_remote_gatt_descriptor_android.h
  127. bluetooth_remote_gatt_descriptor_mac.h
  128. bluetooth_remote_gatt_descriptor_mac.mm
  129. bluetooth_remote_gatt_descriptor_unittest.cc
  130. bluetooth_remote_gatt_descriptor_win.cc
  131. bluetooth_remote_gatt_descriptor_win.h
  132. bluetooth_remote_gatt_descriptor_winrt.cc
  133. bluetooth_remote_gatt_descriptor_winrt.h
  134. bluetooth_remote_gatt_service.cc
  135. bluetooth_remote_gatt_service.h
  136. bluetooth_remote_gatt_service_android.cc
  137. bluetooth_remote_gatt_service_android.h
  138. bluetooth_remote_gatt_service_mac.h
  139. bluetooth_remote_gatt_service_mac.mm
  140. bluetooth_remote_gatt_service_unittest.cc
  141. bluetooth_remote_gatt_service_win.cc
  142. bluetooth_remote_gatt_service_win.h
  143. bluetooth_remote_gatt_service_winrt.cc
  144. bluetooth_remote_gatt_service_winrt.h
  145. bluetooth_rfcomm_channel_mac.h
  146. bluetooth_rfcomm_channel_mac.mm
  147. bluetooth_service_record_win.cc
  148. bluetooth_service_record_win.h
  149. bluetooth_service_record_win_unittest.cc
  150. bluetooth_socket.cc
  151. bluetooth_socket.h
  152. bluetooth_socket_mac.h
  153. bluetooth_socket_mac.mm
  154. bluetooth_socket_net.cc
  155. bluetooth_socket_net.h
  156. bluetooth_socket_thread.cc
  157. bluetooth_socket_thread.h
  158. bluetooth_socket_win.cc
  159. bluetooth_socket_win.h
  160. bluetooth_strings.grd
  161. bluetooth_task_manager_win.cc
  162. bluetooth_task_manager_win.h
  163. bluetooth_task_manager_win_unittest.cc
  164. bluetooth_uuid.cc
  165. bluetooth_uuid.h
  166. bluetooth_uuid_unittest.cc
  167. bluez/
  168. cast/
  169. chromeos/
  170. dbus/
  171. device.cc
  172. device.h
  173. device_unittest.cc
  174. discovery_session.cc
  175. discovery_session.h
  176. event_utils_winrt.h
  177. public/
  178. string_util_icu.cc
  179. string_util_icu.h
  180. string_util_icu_unittest.cc
  181. strings/
  182. test/
  183. uribeacon/
device/bluetooth/README.md

Bluetooth

device/bluetooth abstracts Bluetooth Classic and Low Energy features across multiple platforms.

Classic and Low Energy based profiles differ substantially. Platform implementations may support only one or the other, even though several classes have interfaces for both, e.g. BluetoothAdapter & BluetoothDevice.

ClassicLow Energy
Androidnoyes
Chrome OSyesyes
Linuxyesyes
Macyesyes
Windowssomenearly

Chrome OS and Linux are supported via BlueZ, see *_bluez files.

Mojo interfaces in public/mojom have been started but are not ready for production use.

Maintainer History

Initial implementation OWNERS were youngki@chromium.org, keybuk@chromium.org, armansito@chromium.org, and rpaquay@chromium.org. They no longer contribute to chromium fulltime. They were responsible for support for Chrome OS Bluetooth features and the Chrome Apps APIs:

Active development in 2015 & 2016 focused on enabling GATT features for:

Future Work

The API and implementation have many known issues.

The initial API was heavily influenced by BlueZ. Low Energy GATT APIs are not consistent across platforms. Some of the high level abstractions built into device/bluetooth are difficult for clients. Several TODOs exist in the C++ header files, e.g. BluetoothAdapter::Observer.

Primarily, the API should be split into fundamental Bluetooth concepts and seperate, optional, high level utility classes.

E.g. receiving advertising packets should be routed directly to clients allowing contents of the individual packet to be inspected. Caching of known devices should not exist in the fundamental API, but be offered as utility classes.

See also the Refactoring meta issue.

Android

The android implementation requires crossing from C++ to Java using JNI.

Object ownership is rooted in the C++ classes, starting with the Adapter, which owns Devices, Services, etc. Java counter parts interface with the Android Bluetooth objects. E.g.

For testing, the Android objects are wrapped in: android/java/src/org/chromium/device/bluetooth/Wrappers.java.
and fakes implemented in: test/android/java/src/org/chromium/device/bluetooth/Fakes.java.

Thus:

  • bluetooth_adapter_android.h owns:
    • android/.../ChromeBluetoothAdapter.java uses:
      • android/.../Wrappers.java: BluetoothAdapterWrapper
        • Which under test is a FakeBluetoothAdapter
    • bluetooth_device_android.h owns:
      • android/.../ChromeBluetoothDevice.java uses:
        • android/.../Wrappers.java: BluetoothDeviceWrapper
          • Which under test is a FakeBluetoothDevice
      • bluetooth_gatt_service_android.h owns:
        • android/.../ChromeBluetoothService.java uses:
          • android/.../Wrappers.java: BluetoothServiceWrapper
            • Which under test is a FakeBluetoothService
        • ... and so on for characteristics and descriptors.

Fake objects are controlled by bluetooth_test_android.cc.

See also: Class Diagram of Web Bluetooth through Bluetooth Android

Testing

See test/README.md

Design Documents

  • Bluetooth Notifications 2016-08-26
    • Web Bluetooth through Android implementation details, class diagram and call flow.