From c217a28401864e3e52c473b606408c8c1a0917c4 Mon Sep 17 00:00:00 2001 From: Sonny Sasaka Date: Mon, 8 Feb 2021 22:09:48 -0800 Subject: [PATCH] Update source files to build on Linux/Chrome OS This modifies some source files to build on Linux: * Add missing includes * Add Linux empty stubs for metrics Bug: 176847216 Tag: #refactor Test: atest --host bluetooth_test_common Change-Id: I15c46cd9b748ddd9f7c0712b5a66b259e41cfaa1 --- bta/ag/bta_ag_at.h | 1 + common/metrics_linux.cc | 60 +++++++++++++++++++++++++++ gd/common/strings.h | 1 + gd/hci/uuid.cc | 3 +- gd/os/linux_generic/reactive_semaphore.cc | 1 + stack/acl/btm_ble_connection_establishment.cc | 2 + types/class_of_device.h | 3 +- 7 files changed, 69 insertions(+), 2 deletions(-) diff --git a/bta/ag/bta_ag_at.h b/bta/ag/bta_ag_at.h index abdd70266..e324e197f 100644 --- a/bta/ag/bta_ag_at.h +++ b/bta/ag/bta_ag_at.h @@ -24,6 +24,7 @@ #ifndef BTA_AG_AT_H #define BTA_AG_AT_H +#include #include #include diff --git a/common/metrics_linux.cc b/common/metrics_linux.cc index bf16960e0..aa01cbc85 100644 --- a/common/metrics_linux.cc +++ b/common/metrics_linux.cc @@ -88,6 +88,66 @@ void BluetoothMetricsLogger::ResetLog() {} void BluetoothMetricsLogger::Reset() {} +void LogClassicPairingEvent(const RawAddress& address, uint16_t handle, + uint32_t hci_cmd, uint16_t hci_event, + uint16_t cmd_status, uint16_t reason_code, + int64_t event_value) {} + +void LogSocketConnectionState( + const RawAddress& address, int port, int type, + android::bluetooth::SocketConnectionstateEnum connection_state, + int64_t tx_bytes, int64_t rx_bytes, int uid, int server_port, + android::bluetooth::SocketRoleEnum socket_role) {} + +void LogHciTimeoutEvent(uint32_t hci_cmd) {} + +void LogA2dpAudioUnderrunEvent(const RawAddress& address, + uint64_t encoding_interval_millis, + int num_missing_pcm_bytes) {} + +void LogA2dpAudioOverrunEvent(const RawAddress& address, + uint64_t encoding_interval_millis, + int num_dropped_buffers, + int num_dropped_encoded_frames, + int num_dropped_encoded_bytes) {} + +void LogReadRssiResult(const RawAddress& address, uint16_t handle, + uint32_t cmd_status, int8_t rssi) {} + +void LogReadFailedContactCounterResult(const RawAddress& address, + uint16_t handle, uint32_t cmd_status, + int32_t failed_contact_counter) {} + +void LogReadTxPowerLevelResult(const RawAddress& address, uint16_t handle, + uint32_t cmd_status, + int32_t transmit_power_level) {} + +void LogRemoteVersionInfo(uint16_t handle, uint8_t status, uint8_t version, + uint16_t manufacturer_name, uint16_t subversion) {} + +void LogLinkLayerConnectionEvent(const RawAddress* address, + uint32_t connection_handle, + android::bluetooth::DirectionEnum direction, + uint16_t link_type, uint32_t hci_cmd, + uint16_t hci_event, uint16_t hci_ble_event, + uint16_t cmd_status, uint16_t reason_code) {} + +void LogManufacturerInfo(const RawAddress& address, + android::bluetooth::DeviceInfoSrcEnum source_type, + const std::string& source_name, + const std::string& manufacturer, + const std::string& model, + const std::string& hardware_version, + const std::string& software_version) {} + +void LogSdpAttribute(const RawAddress& address, uint16_t protocol_uuid, + uint16_t attribute_id, size_t attribute_size, + const char* attribute_value) {} + +void LogSmpPairingEvent(const RawAddress& address, uint8_t smp_cmd, + android::bluetooth::DirectionEnum direction, + uint8_t smp_fail_reason) {} + } // namespace common } // namespace bluetooth diff --git a/gd/common/strings.h b/gd/common/strings.h index bc8ef70d2..59622992c 100644 --- a/gd/common/strings.h +++ b/gd/common/strings.h @@ -16,6 +16,7 @@ #pragma once +#include #include #include #include diff --git a/gd/hci/uuid.cc b/gd/hci/uuid.cc index 5be460427..551bc2b9e 100644 --- a/gd/hci/uuid.cc +++ b/gd/hci/uuid.cc @@ -20,6 +20,7 @@ #include +#include #include namespace bluetooth { @@ -227,4 +228,4 @@ std::string Uuid::ToLegacyConfigString() const { } } // namespace hci -} // namespace bluetooth \ No newline at end of file +} // namespace bluetooth diff --git a/gd/os/linux_generic/reactive_semaphore.cc b/gd/os/linux_generic/reactive_semaphore.cc index 31c4afc91..03339f99e 100644 --- a/gd/os/linux_generic/reactive_semaphore.cc +++ b/gd/os/linux_generic/reactive_semaphore.cc @@ -17,6 +17,7 @@ #include "reactive_semaphore.h" #include +#include #include #include diff --git a/stack/acl/btm_ble_connection_establishment.cc b/stack/acl/btm_ble_connection_establishment.cc index e99436527..5d9be912e 100644 --- a/stack/acl/btm_ble_connection_establishment.cc +++ b/stack/acl/btm_ble_connection_establishment.cc @@ -19,6 +19,8 @@ #include #include +#include + #include "bt_types.h" #include "btm_int.h" #include "common/metrics.h" diff --git a/types/class_of_device.h b/types/class_of_device.h index 4c37ebf26..b0fffc885 100644 --- a/types/class_of_device.h +++ b/types/class_of_device.h @@ -18,6 +18,7 @@ #pragma once +#include #include namespace bluetooth { @@ -59,4 +60,4 @@ inline std::ostream& operator<<(std::ostream& os, const ClassOfDevice& c) { } // namespace types } // namespace bluetooth -using ::bluetooth::types::ClassOfDevice; // TODO, remove \ No newline at end of file +using ::bluetooth::types::ClassOfDevice; // TODO, remove -- 2.11.0