1cc_defaults { 2 name: "fluoride_service_defaults", 3 defaults: ["fluoride_defaults"], 4 local_include_dirs: [ 5 "common" 6 ], 7 include_dirs: [ 8 "system/bt" 9 ], 10 srcs: [ 11 "common/bluetooth/adapter_state.cc", 12 "common/bluetooth/advertise_data.cc", 13 "common/bluetooth/advertise_settings.cc", 14 "common/bluetooth/descriptor.cc", 15 "common/bluetooth/characteristic.cc", 16 "common/bluetooth/scan_filter.cc", 17 "common/bluetooth/scan_result.cc", 18 "common/bluetooth/scan_settings.cc", 19 "common/bluetooth/service.cc", 20 "common/bluetooth/util/address_helper.cc", 21 "common/bluetooth/util/atomic_string.cc", 22 "common/bluetooth/uuid.cc", 23 ] 24} 25 26// Source variables 27// ======================================================== 28btserviceCommonBinderSrc = [ 29 "common/android/bluetooth/IBluetooth.aidl", 30 "common/android/bluetooth/IBluetoothCallback.aidl", 31 "common/android/bluetooth/IBluetoothGattClient.aidl", 32 "common/android/bluetooth/IBluetoothGattClientCallback.aidl", 33 "common/android/bluetooth/IBluetoothGattServer.aidl", 34 "common/android/bluetooth/IBluetoothGattServerCallback.aidl", 35 "common/android/bluetooth/IBluetoothLeAdvertiser.aidl", 36 "common/android/bluetooth/IBluetoothLeAdvertiserCallback.aidl", 37 "common/android/bluetooth/IBluetoothLeScanner.aidl", 38 "common/android/bluetooth/IBluetoothLeScannerCallback.aidl", 39 "common/android/bluetooth/IBluetoothLowEnergy.aidl", 40 "common/android/bluetooth/IBluetoothLowEnergyCallback.aidl", 41 "common/android/bluetooth/advertise_data.cc", 42 "common/android/bluetooth/advertise_settings.cc", 43 "common/android/bluetooth/bluetooth_gatt_characteristic.cc", 44 "common/android/bluetooth/bluetooth_gatt_descriptor.cc", 45 "common/android/bluetooth/bluetooth_gatt_included_service.cc", 46 "common/android/bluetooth/bluetooth_gatt_service.cc", 47 "common/android/bluetooth/scan_filter.cc", 48 "common/android/bluetooth/scan_result.cc", 49 "common/android/bluetooth/scan_settings.cc", 50 "common/android/bluetooth/uuid.cc", 51] 52 53btserviceCommonAidlInclude = [ 54 "system/bt/service/common", 55 "frameworks/native/aidl/binder", 56] 57 58btserviceDaemonSrc = [ 59 "adapter.cc", 60 "daemon.cc", 61 "gatt_client.cc", 62 "gatt_server.cc", 63 "gatt_server_old.cc", 64 "hal/bluetooth_gatt_interface.cc", 65 "hal/bluetooth_interface.cc", 66 "ipc/ipc_handler.cc", 67 "ipc/ipc_manager.cc", 68 "logging_helpers.cc", 69 "low_energy_advertiser.cc", 70 "low_energy_scanner.cc", 71 "low_energy_client.cc", 72 "settings.cc", 73] 74 75btserviceLinuxSrc = [ 76 "ipc/ipc_handler_linux.cc", 77 "ipc/linux_ipc_host.cc", 78] 79 80btserviceBinderDaemonImplSrc = [ 81 "ipc/binder/bluetooth_binder_server.cc", 82 "ipc/binder/bluetooth_gatt_client_binder_server.cc", 83 "ipc/binder/bluetooth_gatt_server_binder_server.cc", 84 "ipc/binder/bluetooth_le_advertiser_binder_server.cc", 85 "ipc/binder/bluetooth_le_scanner_binder_server.cc", 86 "ipc/binder/bluetooth_low_energy_binder_server.cc", 87 "ipc/binder/interface_with_instances_base.cc", 88 "ipc/binder/ipc_handler_binder.cc", 89] 90 91btserviceBinderDaemonSrc = btserviceCommonBinderSrc + btserviceBinderDaemonImplSrc 92 93// Main unit test sources. These get built for host and target. 94// ======================================================== 95btserviceBaseTestSrc = [ 96 "hal/fake_bluetooth_gatt_interface.cc", 97 "hal/fake_bluetooth_interface.cc", 98 "test/adapter_unittest.cc", 99 "test/advertise_data_unittest.cc", 100 "test/fake_hal_util.cc", 101 "test/gatt_client_unittest.cc", 102 "test/gatt_server_unittest.cc", 103 "test/low_energy_advertiser_unittest.cc", 104 "test/low_energy_client_unittest.cc", 105 "test/low_energy_scanner_unittest.cc", 106 "test/settings_unittest.cc", 107 "test/util_unittest.cc", 108 "test/uuid_unittest.cc", 109] 110 111// Native system service for target 112// ======================================================== 113cc_binary { 114 name: "bluetoothtbd", 115 defaults: ["fluoride_service_defaults"], 116 srcs: btserviceBinderDaemonSrc 117 + btserviceLinuxSrc 118 + btserviceDaemonSrc 119 + ["main.cc"], 120 aidl: { 121 include_dirs: btserviceCommonAidlInclude 122 }, 123 required: ["bluetooth.default"], 124 static_libs: ["libbtcore"], 125 shared_libs: [ 126 "libbinder", 127 "libcutils", 128 "libhardware", 129 "liblog", 130 "libutils", 131 ], 132 init_rc: ["bluetoothtbd.rc"], 133} 134 135// Native system service unit tests for target and host 136 137// ======================================================== 138cc_test { 139 name: "bluetoothtbd_test", 140 defaults: ["fluoride_service_defaults"], 141 srcs: btserviceBaseTestSrc 142 + btserviceDaemonSrc + [ 143 "test/main.cc" 144 ], 145 aidl: { 146 include_dirs: btserviceCommonAidlInclude, 147 }, 148 static_libs: [ 149 "libgmock", 150 "liblog", 151 ], 152 host_supported: true, 153 target: { 154 // This includes Binder related tests that can only be run 155 // on target. 156 android: { 157 srcs: btserviceBinderDaemonSrc + [ 158 "test/parcelable_unittest.cc", 159 "test/ParcelableTest.aidl", 160 ], 161 shared_libs: [ 162 "libbinder", 163 "libutils", 164 ], 165 }, 166 host: { 167 srcs: [ 168 "test/stub_ipc_handler_binder.cc", 169 ], 170 }, 171 darwin: { 172 srcs: [ 173 "test/stub_ipc_handler_linux.cc", 174 ], 175 }, 176 linux: { 177 srcs: btserviceLinuxSrc + [ 178 // TODO(bcf): Fix this test. 179 //"test/ipc_linux_unittest.cc", 180 ], 181 host_ldlibs: ["-lrt"], 182 }, 183 }, 184} 185 186// Client library for interacting with Bluetooth daemon 187// This is a static library for target. 188// ======================================================== 189cc_library_static { 190 name: "libbluetooth-client", 191 defaults: ["fluoride_service_defaults"], 192 srcs: btserviceCommonBinderSrc, 193 aidl: { 194 export_aidl_headers: true, 195 include_dirs: btserviceCommonAidlInclude 196 }, 197 export_include_dirs: ["common"], 198 shared_libs: [ 199 "libbinder", 200 "libutils", 201 ], 202} 203 204// Native system service CLI for target 205// ======================================================== 206cc_binary { 207 name: "bluetooth-cli", 208 defaults: ["fluoride_defaults"], 209 srcs: ["client/main.cc"], 210 static_libs: ["libbluetooth-client"], 211 shared_libs: [ 212 "libbinder", 213 "libutils", 214 ], 215} 216 217// Heart Rate GATT service example for target 218// ======================================================== 219cc_binary { 220 name: "bt-example-hr-server", 221 defaults: ["fluoride_defaults"], 222 local_include_dirs: ["example/heart_rate"], 223 srcs: [ 224 "example/heart_rate/heart_rate_server.cc", 225 "example/heart_rate/server_main.cc", 226 ], 227 static_libs: ["libbluetooth-client"], 228 shared_libs: [ 229 "libbinder", 230 "libutils", 231 ], 232} 233 234cc_library_static { 235 name: "libbluetoothtbd_hal", 236 defaults: ["fluoride_defaults"], 237 include_dirs: ["system/bt"], 238 srcs = [ 239 "hal/bluetooth_gatt_interface.cc", 240 "hal/bluetooth_interface.cc", 241 "logging_helpers.cc", 242 ] 243} 244