diff options
author | 2015-10-06 15:56:36 -0700 | |
---|---|---|
committer | 2015-10-07 12:28:49 -0700 | |
commit | 2d13b50d44bd334797f770f0aef27a4b93bb64b4 (patch) | |
tree | fc2759ea95b2398149fdf81e3f696b4de1344093 | |
parent | dae381f1be075fa2bff028aec42512d7fbb1fd28 (diff) |
service: Create a client library for applications
This CL creates the libbluetooth-client static library that external
code can link against to interact with the Bluetooth daemon using
Binder. To this end, all service/ code that is common to the client
library and the daemon itself have been moved to service/common/bluetooth
and service/common is exported in LOCAL_EXPORT_C_INCLUDE_DIRS.
bluetooth-cli and bt-example-hr-server have been update to demonstrate
how an app should use this library (using library includes).
Bug: 23169160
Change-Id: Ie6841bd6c48846eecec824ff1e80a9971385d1fc
56 files changed, 154 insertions, 120 deletions
diff --git a/system/service/Android.mk b/system/service/Android.mk index 7f511e0d63..cd0ab96763 100644 --- a/system/service/Android.mk +++ b/system/service/Android.mk @@ -16,15 +16,29 @@ LOCAL_PATH:= $(call my-dir) -# Common variables +# Source variables # ======================================================== btserviceCommonSrc := \ + common/bluetooth/adapter_state.cpp \ + common/bluetooth/advertise_data.cpp \ + common/bluetooth/advertise_settings.cpp \ + common/bluetooth/gatt_identifier.cpp \ + common/bluetooth/util/address_helper.cpp \ + common/bluetooth/util/atomic_string.cpp \ + common/bluetooth/uuid.cpp + +btserviceCommonBinderSrc := \ + common/bluetooth/binder/IBluetooth.cpp \ + common/bluetooth/binder/IBluetoothCallback.cpp \ + common/bluetooth/binder/IBluetoothGattServer.cpp \ + common/bluetooth/binder/IBluetoothGattServerCallback.cpp \ + common/bluetooth/binder/IBluetoothLowEnergy.cpp \ + common/bluetooth/binder/IBluetoothLowEnergyCallback.cpp \ + common/bluetooth/binder/parcel_helpers.cpp + +btserviceDaemonSrc := \ adapter.cpp \ - adapter_state.cpp \ - advertise_data.cpp \ - advertise_settings.cpp \ daemon.cpp \ - gatt_identifier.cpp \ gatt_server.cpp \ gatt_server_old.cpp \ hal/gatt_helpers.cpp \ @@ -34,30 +48,26 @@ btserviceCommonSrc := \ ipc/ipc_manager.cpp \ logging_helpers.cpp \ low_energy_client.cpp \ - settings.cpp \ - util/address_helper.cpp \ - util/atomic_string.cpp \ - uuid.cpp + settings.cpp btserviceLinuxSrc := \ ipc/ipc_handler_linux.cpp \ ipc/linux_ipc_host.cpp -btserviceBinderSrc := \ +btserviceBinderDaemonImplSrc := \ ipc/binder/bluetooth_binder_server.cpp \ ipc/binder/bluetooth_gatt_server_binder_server.cpp \ ipc/binder/bluetooth_low_energy_binder_server.cpp \ - ipc/binder/IBluetooth.cpp \ - ipc/binder/IBluetoothCallback.cpp \ - ipc/binder/IBluetoothGattServer.cpp \ - ipc/binder/IBluetoothGattServerCallback.cpp \ - ipc/binder/IBluetoothLowEnergy.cpp \ - ipc/binder/IBluetoothLowEnergyCallback.cpp \ ipc/binder/interface_with_clients_base.cpp \ ipc/binder/ipc_handler_binder.cpp \ - ipc/binder/parcel_helpers.cpp -btserviceCommonIncludes := $(LOCAL_PATH)/../ +btserviceBinderDaemonSrc := \ + $(btserviceCommonBinderSrc) \ + $(btserviceBinderDaemonImplSrc) + +btserviceCommonIncludes := \ + $(LOCAL_PATH)/../ \ + $(LOCAL_PATH)/common # Main unit test sources. These get built for host and target. # ======================================================== @@ -78,9 +88,10 @@ btserviceBaseTestSrc := \ # ======================================================== include $(CLEAR_VARS) LOCAL_SRC_FILES := \ - $(btserviceBinderSrc) \ - $(btserviceLinuxSrc) \ + $(btserviceBinderDaemonSrc) \ $(btserviceCommonSrc) \ + $(btserviceLinuxSrc) \ + $(btserviceDaemonSrc) \ main.cpp LOCAL_C_INCLUDES += $(btserviceCommonIncludes) LOCAL_CFLAGS += -std=c++11 @@ -104,6 +115,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := \ $(btserviceBaseTestSrc) \ $(btserviceCommonSrc) \ + $(btserviceDaemonSrc) \ test/main.cpp \ test/stub_ipc_handler_binder.cpp ifeq ($(HOST_OS),linux) @@ -130,8 +142,9 @@ include $(BUILD_HOST_NATIVE_TEST) include $(CLEAR_VARS) LOCAL_SRC_FILES := \ $(btserviceBaseTestSrc) \ - $(btserviceBinderSrc) \ + $(btserviceBinderDaemonSrc) \ $(btserviceCommonSrc) \ + $(btserviceDaemonSrc) \ test/main.cpp \ test/parcel_helpers_unittest.cpp LOCAL_C_INCLUDES += $(btserviceCommonIncludes) @@ -145,21 +158,27 @@ LOCAL_SHARED_LIBRARIES += \ LOCAL_STATIC_LIBRARIES += libgmock libgtest liblog include $(BUILD_NATIVE_TEST) -# Native system service CLI for target +# Client library for interacting with Bluetooth daemon # ======================================================== include $(CLEAR_VARS) LOCAL_SRC_FILES := \ - $(btserviceBinderSrc) \ - adapter_state.cpp \ - advertise_data.cpp \ - advertise_settings.cpp \ - client/main.cpp \ - gatt_identifier.cpp \ - uuid.cpp + $(btserviceCommonSrc) \ + $(btserviceCommonBinderSrc) LOCAL_C_INCLUDES += $(btserviceCommonIncludes) +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/common +LOCAL_CFLAGS += -std=c++11 +LOCAL_MODULE := libbluetooth-client +LOCAL_SHARED_LIBRARIES += libbinder libchrome libutils +include $(BUILD_STATIC_LIBRARY) + +# Native system service CLI for target +# ======================================================== +include $(CLEAR_VARS) +LOCAL_SRC_FILES := client/main.cpp LOCAL_CFLAGS += -std=c++11 LOCAL_MODULE_TAGS := optional LOCAL_MODULE := bluetooth-cli +LOCAL_STATIC_LIBRARIES += libbluetooth-client LOCAL_SHARED_LIBRARIES += \ libbinder \ libchrome \ @@ -172,17 +191,13 @@ include $(BUILD_EXECUTABLE) # client static library that the examples can depend on. include $(CLEAR_VARS) LOCAL_SRC_FILES := \ - $(btserviceBinderSrc) \ - advertise_data.cpp \ - advertise_settings.cpp \ example/heart_rate/heart_rate_server.cpp \ - example/heart_rate/server_main.cpp \ - gatt_identifier.cpp \ - uuid.cpp -LOCAL_C_INCLUDES += $(btserviceCommonIncludes) + example/heart_rate/server_main.cpp +LOCAL_C_INCLUDES += $(LOCAL_PATH)/../ LOCAL_CFLAGS += -std=c++11 LOCAL_MODULE_TAGS := optional LOCAL_MODULE := bt-example-hr-server +LOCAL_STATIC_LIBRARIES += libbluetooth-client LOCAL_SHARED_LIBRARIES += \ libbinder \ libchrome \ diff --git a/system/service/adapter.h b/system/service/adapter.h index 73a8f1f111..d4eb966086 100644 --- a/system/service/adapter.h +++ b/system/service/adapter.h @@ -23,11 +23,11 @@ #include <base/macros.h> #include <base/observer_list.h> -#include "service/adapter_state.h" +#include "service/common/bluetooth/adapter_state.h" +#include "service/common/bluetooth/util/atomic_string.h" #include "service/gatt_server.h" #include "service/hal/bluetooth_interface.h" #include "service/low_energy_client.h" -#include "service/util/atomic_string.h" namespace bluetooth { diff --git a/system/service/bluetooth_client_instance.h b/system/service/bluetooth_client_instance.h index 57911a5232..5222729b0b 100644 --- a/system/service/bluetooth_client_instance.h +++ b/system/service/bluetooth_client_instance.h @@ -21,8 +21,8 @@ #include <base/macros.h> -#include "service/low_energy_constants.h" -#include "service/uuid.h" +#include "service/common/bluetooth/low_energy_constants.h" +#include "service/common/bluetooth/uuid.h" namespace bluetooth { diff --git a/system/service/client/main.cpp b/system/service/client/main.cpp index 617d8f909d..4c8a5e2490 100644 --- a/system/service/client/main.cpp +++ b/system/service/client/main.cpp @@ -26,10 +26,10 @@ #include <binder/IPCThreadState.h> #include <binder/ProcessState.h> -#include "service/adapter_state.h" -#include "service/ipc/binder/IBluetooth.h" -#include "service/ipc/binder/IBluetoothCallback.h" -#include "service/low_energy_constants.h" +#include <bluetooth/adapter_state.h> +#include <bluetooth/binder/IBluetooth.h> +#include <bluetooth/binder/IBluetoothCallback.h> +#include <bluetooth/low_energy_constants.h> using namespace std; diff --git a/system/service/common/README b/system/service/common/README new file mode 100644 index 0000000000..de9e9146f4 --- /dev/null +++ b/system/service/common/README @@ -0,0 +1,18 @@ +This directory contains all the "common" sources between the bluetooth daemon +and our client library. All source files here are under the "bluetooth" +subdirectory, which is the exported root path for the client static library. +Only common files should go here. All headers that go into common/bluetooth must +only include other headers from common/bluetooth and must use "bluetooth" as the +root path, e.g.: + +#include <bluetooth/uuid.h> + +This is so that client applications that link against the client library have +one common include path exported to them, and our headers can find eachother +within that. + +It is however OK to include from the package root when including common headers +from source files as these are pre-compiled. For example, +common/bluetooth/adapter_state.cpp should do: + +#include "service/common/bluetooth/adapter_state.h" diff --git a/system/service/adapter_state.cpp b/system/service/common/bluetooth/adapter_state.cpp index 72b5088b64..87d23b1d26 100644 --- a/system/service/adapter_state.cpp +++ b/system/service/common/bluetooth/adapter_state.cpp @@ -14,7 +14,7 @@ // limitations under the License. // -#include "service/adapter_state.h" +#include "service/common/bluetooth/adapter_state.h" namespace bluetooth { diff --git a/system/service/adapter_state.h b/system/service/common/bluetooth/adapter_state.h index 1b2fbe466f..1b2fbe466f 100644 --- a/system/service/adapter_state.h +++ b/system/service/common/bluetooth/adapter_state.h diff --git a/system/service/advertise_data.cpp b/system/service/common/bluetooth/advertise_data.cpp index 71f8935977..c745afa1b9 100644 --- a/system/service/advertise_data.cpp +++ b/system/service/common/bluetooth/advertise_data.cpp @@ -14,7 +14,7 @@ // limitations under the License. // -#include "service/advertise_data.h" +#include "service/common/bluetooth/advertise_data.h" #include <base/logging.h> diff --git a/system/service/advertise_data.h b/system/service/common/bluetooth/advertise_data.h index 5e6226af42..5e6226af42 100644 --- a/system/service/advertise_data.h +++ b/system/service/common/bluetooth/advertise_data.h diff --git a/system/service/advertise_settings.cpp b/system/service/common/bluetooth/advertise_settings.cpp index bd561b2e1f..ffe65ea118 100644 --- a/system/service/advertise_settings.cpp +++ b/system/service/common/bluetooth/advertise_settings.cpp @@ -14,7 +14,7 @@ // limitations under the License. // -#include "service/advertise_settings.h" +#include "service/common/bluetooth/advertise_settings.h" namespace bluetooth { diff --git a/system/service/advertise_settings.h b/system/service/common/bluetooth/advertise_settings.h index 5d928f4810..5d928f4810 100644 --- a/system/service/advertise_settings.h +++ b/system/service/common/bluetooth/advertise_settings.h diff --git a/system/service/ipc/binder/IBluetooth.cpp b/system/service/common/bluetooth/binder/IBluetooth.cpp index a14db5547c..00d16ff1d1 100644 --- a/system/service/ipc/binder/IBluetooth.cpp +++ b/system/service/common/bluetooth/binder/IBluetooth.cpp @@ -14,7 +14,7 @@ // limitations under the License. // -#include "service/ipc/binder/IBluetooth.h" +#include "service/common/bluetooth/binder/IBluetooth.h" #include <base/logging.h> #include <binder/IServiceManager.h> diff --git a/system/service/ipc/binder/IBluetooth.h b/system/service/common/bluetooth/binder/IBluetooth.h index a43cff7e09..de674ca788 100644 --- a/system/service/ipc/binder/IBluetooth.h +++ b/system/service/common/bluetooth/binder/IBluetooth.h @@ -23,10 +23,10 @@ #include <binder/IBinder.h> #include <binder/IInterface.h> -#include "service/ipc/binder/IBluetoothCallback.h" -#include "service/ipc/binder/IBluetoothGattServer.h" -#include "service/ipc/binder/IBluetoothLowEnergy.h" -#include "service/uuid.h" +#include <bluetooth/binder/IBluetoothCallback.h> +#include <bluetooth/binder/IBluetoothGattServer.h> +#include <bluetooth/binder/IBluetoothLowEnergy.h> +#include <bluetooth/uuid.h> namespace ipc { namespace binder { diff --git a/system/service/ipc/binder/IBluetoothCallback.cpp b/system/service/common/bluetooth/binder/IBluetoothCallback.cpp index 7ab4d135c4..65f17e4a61 100644 --- a/system/service/ipc/binder/IBluetoothCallback.cpp +++ b/system/service/common/bluetooth/binder/IBluetoothCallback.cpp @@ -14,7 +14,7 @@ // limitations under the License. // -#include "service/ipc/binder/IBluetoothCallback.h" +#include "service/common/bluetooth/binder/IBluetoothCallback.h" #include <base/logging.h> #include <binder/Parcel.h> diff --git a/system/service/ipc/binder/IBluetoothCallback.h b/system/service/common/bluetooth/binder/IBluetoothCallback.h index 37e3b5b993..e62cf3e4ec 100644 --- a/system/service/ipc/binder/IBluetoothCallback.h +++ b/system/service/common/bluetooth/binder/IBluetoothCallback.h @@ -20,7 +20,7 @@ #include <binder/IBinder.h> #include <binder/IInterface.h> -#include "service/adapter_state.h" +#include <bluetooth/adapter_state.h> namespace ipc { namespace binder { diff --git a/system/service/ipc/binder/IBluetoothGattServer.cpp b/system/service/common/bluetooth/binder/IBluetoothGattServer.cpp index 84c003575c..8f6998c0a7 100644 --- a/system/service/ipc/binder/IBluetoothGattServer.cpp +++ b/system/service/common/bluetooth/binder/IBluetoothGattServer.cpp @@ -14,12 +14,12 @@ // limitations under the License. // -#include "service/ipc/binder/IBluetoothGattServer.h" +#include "service/common/bluetooth/binder/IBluetoothGattServer.h" #include <base/logging.h> #include <binder/Parcel.h> -#include "service/ipc/binder/parcel_helpers.h" +#include "service/common/bluetooth/binder/parcel_helpers.h" using android::IBinder; using android::interface_cast; diff --git a/system/service/ipc/binder/IBluetoothGattServer.h b/system/service/common/bluetooth/binder/IBluetoothGattServer.h index 904d212f08..bbb79a9e37 100644 --- a/system/service/ipc/binder/IBluetoothGattServer.h +++ b/system/service/common/bluetooth/binder/IBluetoothGattServer.h @@ -24,8 +24,8 @@ #include <binder/IBinder.h> #include <binder/IInterface.h> -#include "service/gatt_identifier.h" -#include "service/ipc/binder/IBluetoothGattServerCallback.h" +#include <bluetooth/gatt_identifier.h> +#include <bluetooth/binder/IBluetoothGattServerCallback.h> namespace ipc { namespace binder { diff --git a/system/service/ipc/binder/IBluetoothGattServerCallback.cpp b/system/service/common/bluetooth/binder/IBluetoothGattServerCallback.cpp index 057f3faac7..8c79ab22c1 100644 --- a/system/service/ipc/binder/IBluetoothGattServerCallback.cpp +++ b/system/service/common/bluetooth/binder/IBluetoothGattServerCallback.cpp @@ -14,12 +14,12 @@ // limitations under the License. // -#include "service/ipc/binder/IBluetoothGattServerCallback.h" +#include "service/common/bluetooth/binder/IBluetoothGattServerCallback.h" #include <base/logging.h> #include <binder/Parcel.h> -#include "service/ipc/binder/parcel_helpers.h" +#include "service/common/bluetooth/binder/parcel_helpers.h" using android::IBinder; using android::Parcel; diff --git a/system/service/ipc/binder/IBluetoothGattServerCallback.h b/system/service/common/bluetooth/binder/IBluetoothGattServerCallback.h index ee90d0fae4..924a5593cb 100644 --- a/system/service/ipc/binder/IBluetoothGattServerCallback.h +++ b/system/service/common/bluetooth/binder/IBluetoothGattServerCallback.h @@ -24,7 +24,7 @@ #include <binder/IBinder.h> #include <binder/IInterface.h> -#include "service/gatt_identifier.h" +#include <bluetooth/gatt_identifier.h> namespace ipc { namespace binder { diff --git a/system/service/ipc/binder/IBluetoothLowEnergy.cpp b/system/service/common/bluetooth/binder/IBluetoothLowEnergy.cpp index 1060170213..5af26915ca 100644 --- a/system/service/ipc/binder/IBluetoothLowEnergy.cpp +++ b/system/service/common/bluetooth/binder/IBluetoothLowEnergy.cpp @@ -14,12 +14,12 @@ // limitations under the License. // -#include "service/ipc/binder/IBluetoothLowEnergy.h" +#include "service/common/bluetooth/binder/IBluetoothLowEnergy.h" #include <base/logging.h> #include <binder/Parcel.h> -#include "service/ipc/binder/parcel_helpers.h" +#include "service/common/bluetooth/binder/parcel_helpers.h" using android::IBinder; using android::interface_cast; diff --git a/system/service/ipc/binder/IBluetoothLowEnergy.h b/system/service/common/bluetooth/binder/IBluetoothLowEnergy.h index cd9d3027e1..dd3f3d356c 100644 --- a/system/service/ipc/binder/IBluetoothLowEnergy.h +++ b/system/service/common/bluetooth/binder/IBluetoothLowEnergy.h @@ -20,9 +20,9 @@ #include <binder/IBinder.h> #include <binder/IInterface.h> -#include "service/advertise_data.h" -#include "service/advertise_settings.h" -#include "service/ipc/binder/IBluetoothLowEnergyCallback.h" +#include <bluetooth/advertise_data.h> +#include <bluetooth/advertise_settings.h> +#include <bluetooth/binder/IBluetoothLowEnergyCallback.h> namespace ipc { namespace binder { diff --git a/system/service/ipc/binder/IBluetoothLowEnergyCallback.cpp b/system/service/common/bluetooth/binder/IBluetoothLowEnergyCallback.cpp index 6d251df392..f2a8959e2e 100644 --- a/system/service/ipc/binder/IBluetoothLowEnergyCallback.cpp +++ b/system/service/common/bluetooth/binder/IBluetoothLowEnergyCallback.cpp @@ -14,12 +14,12 @@ // limitations under the License. // -#include "service/ipc/binder/IBluetoothLowEnergyCallback.h" +#include "service/common/bluetooth/binder/IBluetoothLowEnergyCallback.h" #include <base/logging.h> #include <binder/Parcel.h> -#include "service/ipc/binder/parcel_helpers.h" +#include "service/common/bluetooth/binder/parcel_helpers.h" using android::IBinder; using android::Parcel; diff --git a/system/service/ipc/binder/IBluetoothLowEnergyCallback.h b/system/service/common/bluetooth/binder/IBluetoothLowEnergyCallback.h index fcf5b996fa..19ea0712d8 100644 --- a/system/service/ipc/binder/IBluetoothLowEnergyCallback.h +++ b/system/service/common/bluetooth/binder/IBluetoothLowEnergyCallback.h @@ -20,8 +20,8 @@ #include <binder/IBinder.h> #include <binder/IInterface.h> -#include "service/advertise_data.h" -#include "service/advertise_settings.h" +#include <bluetooth/advertise_data.h> +#include <bluetooth/advertise_settings.h> namespace ipc { namespace binder { diff --git a/system/service/ipc/binder/parcel_helpers.cpp b/system/service/common/bluetooth/binder/parcel_helpers.cpp index a2698946f2..d6d1cd9382 100644 --- a/system/service/ipc/binder/parcel_helpers.cpp +++ b/system/service/common/bluetooth/binder/parcel_helpers.cpp @@ -14,7 +14,7 @@ // limitations under the License. // -#include "service/ipc/binder/parcel_helpers.h" +#include "service/common/bluetooth/binder/parcel_helpers.h" using android::Parcel; diff --git a/system/service/ipc/binder/parcel_helpers.h b/system/service/common/bluetooth/binder/parcel_helpers.h index 00a42ea33e..b96ea9b5a4 100644 --- a/system/service/ipc/binder/parcel_helpers.h +++ b/system/service/common/bluetooth/binder/parcel_helpers.h @@ -20,10 +20,10 @@ #include <binder/Parcel.h> -#include "service/advertise_data.h" -#include "service/advertise_settings.h" -#include "service/gatt_identifier.h" -#include "service/uuid.h" +#include <bluetooth/advertise_data.h> +#include <bluetooth/advertise_settings.h> +#include <bluetooth/gatt_identifier.h> +#include <bluetooth/uuid.h> namespace ipc { namespace binder { diff --git a/system/service/gatt_identifier.cpp b/system/service/common/bluetooth/gatt_identifier.cpp index 296b8644d1..312a6c4de7 100644 --- a/system/service/gatt_identifier.cpp +++ b/system/service/common/bluetooth/gatt_identifier.cpp @@ -14,9 +14,9 @@ // limitations under the License. // -#include "service/gatt_identifier.h" +#include "service/common/bluetooth/gatt_identifier.h" -#include "service/util/address_helper.h" +#include "service/common/bluetooth/util/address_helper.h" namespace bluetooth { diff --git a/system/service/gatt_identifier.h b/system/service/common/bluetooth/gatt_identifier.h index d83079e3c2..00ebbefc68 100644 --- a/system/service/gatt_identifier.h +++ b/system/service/common/bluetooth/gatt_identifier.h @@ -19,7 +19,7 @@ #include <memory> #include <string> -#include "service/uuid.h" +#include <bluetooth/uuid.h> namespace bluetooth { diff --git a/system/service/low_energy_constants.h b/system/service/common/bluetooth/low_energy_constants.h index 0a72dbd767..0a72dbd767 100644 --- a/system/service/low_energy_constants.h +++ b/system/service/common/bluetooth/low_energy_constants.h diff --git a/system/service/util/address_helper.cpp b/system/service/common/bluetooth/util/address_helper.cpp index 2233f903ce..20bb8a44aa 100644 --- a/system/service/util/address_helper.cpp +++ b/system/service/common/bluetooth/util/address_helper.cpp @@ -14,7 +14,7 @@ // limitations under the License. // -#include "service/util/address_helper.h" +#include "service/common/bluetooth/util/address_helper.h" #include <cstdlib> diff --git a/system/service/util/address_helper.h b/system/service/common/bluetooth/util/address_helper.h index d71d9074c1..d71d9074c1 100644 --- a/system/service/util/address_helper.h +++ b/system/service/common/bluetooth/util/address_helper.h diff --git a/system/service/util/atomic_string.cpp b/system/service/common/bluetooth/util/atomic_string.cpp index fe12d7fe9f..0084700919 100644 --- a/system/service/util/atomic_string.cpp +++ b/system/service/common/bluetooth/util/atomic_string.cpp @@ -14,7 +14,7 @@ // limitations under the License. // -#include "service/util/atomic_string.h" +#include "service/common/bluetooth/util/atomic_string.h" namespace util { diff --git a/system/service/util/atomic_string.h b/system/service/common/bluetooth/util/atomic_string.h index 90e911f843..90e911f843 100644 --- a/system/service/util/atomic_string.h +++ b/system/service/common/bluetooth/util/atomic_string.h diff --git a/system/service/uuid.cpp b/system/service/common/bluetooth/uuid.cpp index 12e3128142..f7970e9674 100644 --- a/system/service/uuid.cpp +++ b/system/service/common/bluetooth/uuid.cpp @@ -14,7 +14,7 @@ // limitations under the License. // -#include "service/uuid.h" +#include "service/common/bluetooth/uuid.h" #include <algorithm> #include <array> diff --git a/system/service/uuid.h b/system/service/common/bluetooth/uuid.h index fd8d6f0fb2..d9e810a4f4 100644 --- a/system/service/uuid.h +++ b/system/service/common/bluetooth/uuid.h @@ -20,8 +20,7 @@ #include <string> #include <base/hash.h> - -#include "hardware/bluetooth.h" +#include <hardware/bluetooth.h> namespace bluetooth { diff --git a/system/service/example/heart_rate/constants.h b/system/service/example/heart_rate/constants.h index 1bcd8a7bbf..6159997cf0 100644 --- a/system/service/example/heart_rate/constants.h +++ b/system/service/example/heart_rate/constants.h @@ -16,7 +16,7 @@ #pragma once -#include "service/uuid.h" +#include <bluetooth/uuid.h> // This header defines constants specific to the GATT Heart Rate Service. diff --git a/system/service/example/heart_rate/heart_rate_server.cpp b/system/service/example/heart_rate/heart_rate_server.cpp index 0f18056095..5fb98534f7 100644 --- a/system/service/example/heart_rate/heart_rate_server.cpp +++ b/system/service/example/heart_rate/heart_rate_server.cpp @@ -21,8 +21,9 @@ #include <base/logging.h> #include <base/rand_util.h> +#include <bluetooth/low_energy_constants.h> + #include "service/example/heart_rate/constants.h" -#include "service/low_energy_constants.h" namespace heart_rate { diff --git a/system/service/example/heart_rate/heart_rate_server.h b/system/service/example/heart_rate/heart_rate_server.h index 86ced124e6..1b5ed84061 100644 --- a/system/service/example/heart_rate/heart_rate_server.h +++ b/system/service/example/heart_rate/heart_rate_server.h @@ -23,9 +23,9 @@ #include <base/memory/weak_ptr.h> #include <base/single_thread_task_runner.h> -#include "service/gatt_identifier.h" -#include "service/ipc/binder/IBluetooth.h" -#include "service/ipc/binder/IBluetoothGattServerCallback.h" +#include <bluetooth/binder/IBluetooth.h> +#include <bluetooth/binder/IBluetoothGattServerCallback.h> +#include <bluetooth/gatt_identifier.h> namespace heart_rate { diff --git a/system/service/example/heart_rate/server_main.cpp b/system/service/example/heart_rate/server_main.cpp index 8bac6ad40b..8fc15ffea4 100644 --- a/system/service/example/heart_rate/server_main.cpp +++ b/system/service/example/heart_rate/server_main.cpp @@ -25,8 +25,9 @@ #include <binder/IPCThreadState.h> #include <binder/ProcessState.h> +#include <bluetooth/binder/IBluetooth.h> + #include "service/example/heart_rate/heart_rate_server.h" -#include "service/ipc/binder/IBluetooth.h" using android::sp; using ipc::binder::IBluetooth; diff --git a/system/service/gatt_server.cpp b/system/service/gatt_server.cpp index 0517684222..fe913c8c57 100644 --- a/system/service/gatt_server.cpp +++ b/system/service/gatt_server.cpp @@ -16,9 +16,9 @@ #include "service/gatt_server.h" +#include "service/common/bluetooth/util/address_helper.h" #include "service/hal/gatt_helpers.h" #include "service/logging_helpers.h" -#include "service/util/address_helper.h" using std::lock_guard; using std::mutex; diff --git a/system/service/gatt_server.h b/system/service/gatt_server.h index f11c7c96f4..7b5c019903 100644 --- a/system/service/gatt_server.h +++ b/system/service/gatt_server.h @@ -26,9 +26,9 @@ #include <base/macros.h> #include "service/bluetooth_client_instance.h" -#include "service/gatt_identifier.h" +#include "service/common/bluetooth/gatt_identifier.h" +#include "service/common/bluetooth/uuid.h" #include "service/hal/bluetooth_gatt_interface.h" -#include "service/uuid.h" namespace bluetooth { diff --git a/system/service/gatt_server_old.cpp b/system/service/gatt_server_old.cpp index 73e2c3ab96..10667396dc 100644 --- a/system/service/gatt_server_old.cpp +++ b/system/service/gatt_server_old.cpp @@ -38,7 +38,6 @@ #include "service/hal/bluetooth_interface.h" #include "service/logging_helpers.h" -#include "service/uuid.h" extern "C" { #include "osi/include/log.h" diff --git a/system/service/gatt_server_old.h b/system/service/gatt_server_old.h index e385fed560..84ceb26b30 100644 --- a/system/service/gatt_server_old.h +++ b/system/service/gatt_server_old.h @@ -22,7 +22,7 @@ #include "hardware/bluetooth.h" #include "hardware/bt_gatt.h" -#include "uuid.h" +#include "service/common/bluetooth/uuid.h" namespace bluetooth { namespace gatt { diff --git a/system/service/hal/gatt_helpers.h b/system/service/hal/gatt_helpers.h index 1eceeda241..490c64e125 100644 --- a/system/service/hal/gatt_helpers.h +++ b/system/service/hal/gatt_helpers.h @@ -21,7 +21,7 @@ #include <hardware/bluetooth.h> #include <hardware/bt_gatt_types.h> -#include "service/gatt_identifier.h" +#include "service/common/bluetooth/gatt_identifier.h" // Some utility functions for interacting with GATT HAL interfaces. diff --git a/system/service/ipc/binder/bluetooth_binder_server.h b/system/service/ipc/binder/bluetooth_binder_server.h index b04885b58b..f9f822ec18 100644 --- a/system/service/ipc/binder/bluetooth_binder_server.h +++ b/system/service/ipc/binder/bluetooth_binder_server.h @@ -22,12 +22,12 @@ #include <base/macros.h> #include "service/adapter.h" -#include "service/ipc/binder/IBluetooth.h" -#include "service/ipc/binder/IBluetoothCallback.h" -#include "service/ipc/binder/IBluetoothGattServer.h" -#include "service/ipc/binder/IBluetoothLowEnergy.h" +#include "service/common/bluetooth/binder/IBluetooth.h" +#include "service/common/bluetooth/binder/IBluetoothCallback.h" +#include "service/common/bluetooth/binder/IBluetoothGattServer.h" +#include "service/common/bluetooth/binder/IBluetoothLowEnergy.h" +#include "service/common/bluetooth/uuid.h" #include "service/ipc/binder/remote_callback_list.h" -#include "service/uuid.h" namespace ipc { namespace binder { diff --git a/system/service/ipc/binder/bluetooth_gatt_server_binder_server.h b/system/service/ipc/binder/bluetooth_gatt_server_binder_server.h index 869a66fd93..eb6a491676 100644 --- a/system/service/ipc/binder/bluetooth_gatt_server_binder_server.h +++ b/system/service/ipc/binder/bluetooth_gatt_server_binder_server.h @@ -19,8 +19,8 @@ #include <base/macros.h> #include "service/gatt_server.h" -#include "service/ipc/binder/IBluetoothGattServer.h" -#include "service/ipc/binder/IBluetoothGattServerCallback.h" +#include "service/common/bluetooth/binder/IBluetoothGattServer.h" +#include "service/common/bluetooth/binder/IBluetoothGattServerCallback.h" #include "service/ipc/binder/interface_with_clients_base.h" namespace bluetooth { diff --git a/system/service/ipc/binder/bluetooth_low_energy_binder_server.h b/system/service/ipc/binder/bluetooth_low_energy_binder_server.h index 7cb7fb257e..70c9cfba9b 100644 --- a/system/service/ipc/binder/bluetooth_low_energy_binder_server.h +++ b/system/service/ipc/binder/bluetooth_low_energy_binder_server.h @@ -20,11 +20,11 @@ #include <base/macros.h> -#include "service/ipc/binder/IBluetoothLowEnergy.h" -#include "service/ipc/binder/IBluetoothLowEnergyCallback.h" +#include "service/common/bluetooth/binder/IBluetoothLowEnergy.h" +#include "service/common/bluetooth/binder/IBluetoothLowEnergyCallback.h" +#include "service/common/bluetooth/low_energy_constants.h" #include "service/ipc/binder/interface_with_clients_base.h" #include "service/low_energy_client.h" -#include "service/low_energy_constants.h" namespace bluetooth { class Adapter; diff --git a/system/service/ipc/binder/interface_with_clients_base.h b/system/service/ipc/binder/interface_with_clients_base.h index f9ea6e67c8..b96bef798f 100644 --- a/system/service/ipc/binder/interface_with_clients_base.h +++ b/system/service/ipc/binder/interface_with_clients_base.h @@ -22,8 +22,8 @@ #include <base/macros.h> #include "service/bluetooth_client_instance.h" +#include "service/common/bluetooth/uuid.h" #include "service/ipc/binder/remote_callback_map.h" -#include "service/uuid.h" namespace ipc { namespace binder { diff --git a/system/service/ipc/linux_ipc_host.cpp b/system/service/ipc/linux_ipc_host.cpp index f93d32ddfe..832366f60f 100644 --- a/system/service/ipc/linux_ipc_host.cpp +++ b/system/service/ipc/linux_ipc_host.cpp @@ -35,7 +35,6 @@ #include "osi/include/log.h" #include "service/adapter.h" -#include "service/uuid.h" using bluetooth::Adapter; using bluetooth::UUID; diff --git a/system/service/ipc/linux_ipc_host.h b/system/service/ipc/linux_ipc_host.h index c91e788334..48d25cb5fa 100644 --- a/system/service/ipc/linux_ipc_host.h +++ b/system/service/ipc/linux_ipc_host.h @@ -21,8 +21,8 @@ #include <string> #include <unordered_map> +#include "service/common/bluetooth/uuid.h" #include "service/gatt_server_old.h" -#include "service/uuid.h" namespace bluetooth { class Adapter; diff --git a/system/service/low_energy_client.h b/system/service/low_energy_client.h index 9228d53014..6132c6c56d 100644 --- a/system/service/low_energy_client.h +++ b/system/service/low_energy_client.h @@ -23,12 +23,12 @@ #include <base/macros.h> -#include "service/advertise_data.h" -#include "service/advertise_settings.h" #include "service/bluetooth_client_instance.h" +#include "service/common/bluetooth/advertise_data.h" +#include "service/common/bluetooth/advertise_settings.h" +#include "service/common/bluetooth/low_energy_constants.h" +#include "service/common/bluetooth/uuid.h" #include "service/hal/bluetooth_gatt_interface.h" -#include "service/low_energy_constants.h" -#include "service/uuid.h" namespace bluetooth { diff --git a/system/service/test/advertise_data_unittest.cpp b/system/service/test/advertise_data_unittest.cpp index d2408fd446..8c252817ad 100644 --- a/system/service/test/advertise_data_unittest.cpp +++ b/system/service/test/advertise_data_unittest.cpp @@ -16,7 +16,7 @@ #include <gtest/gtest.h> -#include "service/advertise_data.h" +#include "service/common/bluetooth/advertise_data.h" #include "stack/include/bt_types.h" #include "stack/include/hcidefs.h" diff --git a/system/service/test/gatt_identifier_unittest.cpp b/system/service/test/gatt_identifier_unittest.cpp index 624f1e6aa4..956edf90ee 100644 --- a/system/service/test/gatt_identifier_unittest.cpp +++ b/system/service/test/gatt_identifier_unittest.cpp @@ -16,7 +16,8 @@ #include <gtest/gtest.h> -#include "service/gatt_identifier.h" +#include "service/common/bluetooth/gatt_identifier.h" +#include "service/common/bluetooth/uuid.h" namespace bluetooth { namespace { diff --git a/system/service/test/gatt_server_unittest.cpp b/system/service/test/gatt_server_unittest.cpp index c7a660a93c..c42e5a3b74 100644 --- a/system/service/test/gatt_server_unittest.cpp +++ b/system/service/test/gatt_server_unittest.cpp @@ -17,10 +17,10 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> +#include "service/common/bluetooth/util/address_helper.h" #include "service/gatt_server.h" #include "service/hal/fake_bluetooth_gatt_interface.h" #include "service/hal/gatt_helpers.h" -#include "service/util/address_helper.h" using ::testing::_; using ::testing::Return; diff --git a/system/service/test/parcel_helpers_unittest.cpp b/system/service/test/parcel_helpers_unittest.cpp index 00ea6d251e..f79beec258 100644 --- a/system/service/test/parcel_helpers_unittest.cpp +++ b/system/service/test/parcel_helpers_unittest.cpp @@ -16,9 +16,9 @@ #include <gtest/gtest.h> -#include "service/advertise_data.h" -#include "service/advertise_settings.h" -#include "service/ipc/binder/parcel_helpers.h" +#include "service/common/bluetooth/advertise_data.h" +#include "service/common/bluetooth/advertise_settings.h" +#include "service/common/bluetooth/binder/parcel_helpers.h" using android::Parcel; diff --git a/system/service/test/util_unittest.cpp b/system/service/test/util_unittest.cpp index 2894d87707..78960d99f7 100644 --- a/system/service/test/util_unittest.cpp +++ b/system/service/test/util_unittest.cpp @@ -16,7 +16,7 @@ #include <gtest/gtest.h> -#include "service/util/address_helper.h" +#include "service/common/bluetooth/util/address_helper.h" namespace util { diff --git a/system/service/test/uuid_unittest.cpp b/system/service/test/uuid_unittest.cpp index c5b765aae2..281208b8a5 100644 --- a/system/service/test/uuid_unittest.cpp +++ b/system/service/test/uuid_unittest.cpp @@ -13,13 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. // + #include <algorithm> #include <array> #include <stdint.h> #include <gtest/gtest.h> -#include "service/uuid.h" +#include "service/common/bluetooth/uuid.h" using namespace bluetooth; |