vendor_libs: test_vendor_lib: fix build
Change-Id: I1ba531c5289adea3fa5d6f9e0f68cf241a127219
Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
diff --git a/vendor_libs/test_vendor_lib/Android.mk b/vendor_libs/test_vendor_lib/Android.mk
index 3874ef2..626539d 100644
--- a/vendor_libs/test_vendor_lib/Android.mk
+++ b/vendor_libs/test_vendor_lib/Android.mk
@@ -22,6 +22,7 @@
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
$(BT_DIR) \
+ $(BT_DIR)/utils/include \
$(BT_DIR)/hci/include \
$(BT_DIR)/stack/include \
$(BT_DIR)/third_party/gtest/include
@@ -58,6 +59,7 @@
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
$(BT_DIR) \
+ $(BT_DIR)/utils/include \
$(BT_DIR)/hci/include \
$(BT_DIR)/stack/include
diff --git a/vendor_libs/test_vendor_lib/include/test_channel_transport.h b/vendor_libs/test_vendor_lib/include/test_channel_transport.h
index 600e932..f6e264e 100644
--- a/vendor_libs/test_vendor_lib/include/test_channel_transport.h
+++ b/vendor_libs/test_vendor_lib/include/test_channel_transport.h
@@ -68,8 +68,8 @@
std::unique_ptr<base::ScopedFD> fd_;
// TODO(dennischeng): Get port and enabled flag from a config file.
- int port_;
bool enabled_;
+ int port_;
DISALLOW_COPY_AND_ASSIGN(TestChannelTransport);
};
diff --git a/vendor_libs/test_vendor_lib/src/dual_mode_controller.cc b/vendor_libs/test_vendor_lib/src/dual_mode_controller.cc
index c21d9a5..be86753 100644
--- a/vendor_libs/test_vendor_lib/src/dual_mode_controller.cc
+++ b/vendor_libs/test_vendor_lib/src/dual_mode_controller.cc
@@ -27,6 +27,7 @@
extern "C" {
#include "stack/include/hcidefs.h"
+#include "osi/include/osi.h"
#include "osi/include/log.h"
} // extern "C"
@@ -124,7 +125,7 @@
void DualModeController::SendExtendedInquiryResult(
const std::string& name, const std::string& address) const {
std::vector<uint8_t> rssi = {0};
- std::vector<uint8_t> extended_inquiry_data = {name.length() + 1, 0x09};
+ std::vector<uint8_t> extended_inquiry_data = {static_cast<uint8_t>(name.length() + 1), 0x09};
std::copy(name.begin(), name.end(),
std::back_inserter(extended_inquiry_data));
std::vector<uint8_t> bd_address(address.begin(), address.end());
@@ -141,8 +142,8 @@
DualModeController::DualModeController()
: state_(kStandby),
- test_channel_state_(kNone),
- properties_(kControllerPropertiesFile) {
+ properties_(kControllerPropertiesFile),
+ test_channel_state_(kNone) {
#define SET_HANDLER(opcode, method) \
active_hci_commands_[opcode] = \
std::bind(&DualModeController::method, this, std::placeholders::_1);
@@ -242,7 +243,7 @@
}
void DualModeController::TestChannelClear(
- const std::vector<std::string>& args) {
+ const std::vector<std::string>& args UNUSED_ATTR) {
LogCommand("TestChannel Clear");
test_channel_state_ = kNone;
SetEventDelay(0);
@@ -256,7 +257,7 @@
}
void DualModeController::TestChannelTimeoutAll(
- const std::vector<std::string>& args) {
+ const std::vector<std::string>& args UNUSED_ATTR) {
LogCommand("TestChannel Timeout All");
test_channel_state_ = kTimeoutAll;
}
@@ -269,7 +270,7 @@
}
void DualModeController::TestChannelClearEventDelay(
- const std::vector<std::string>& args) {
+ const std::vector<std::string>& args UNUSED_ATTR) {
LogCommand("TestChannel Clear Event Delay");
test_channel_state_ = kNone;
SetEventDelay(0);
@@ -453,7 +454,7 @@
}
void DualModeController::HciDeleteStoredLinkKey(
- const std::vector<uint8_t>& args) {
+ const std::vector<uint8_t>& args UNUSED_ATTR) {
LogCommand("Delete Stored Link Key");
/* Check the last octect in |args|. If it is 0, delete only the link key for
* the given BD_ADDR. If is is 1, delete all stored link keys. */
@@ -461,7 +462,7 @@
}
void DualModeController::HciRemoteNameRequest(
- const std::vector<uint8_t>& args) {
+ const std::vector<uint8_t>& args UNUSED_ATTR) {
LogCommand("Remote Name Request");
SendCommandStatusSuccess(HCI_RMT_NAME_REQUEST);
}
@@ -490,17 +491,26 @@
const std::vector<uint8_t> DualModeController::Properties::GetBufferSize() {
return std::vector<uint8_t>(
- {kSuccessStatus, acl_data_packet_size_, acl_data_packet_size_ >> 8,
- sco_data_packet_size_, num_acl_data_packets_, num_acl_data_packets_ >> 8,
- num_sco_data_packets_, num_sco_data_packets_ >> 8});
+ {kSuccessStatus,
+ static_cast<uint8_t>(acl_data_packet_size_),
+ static_cast<uint8_t>(acl_data_packet_size_ >> 8),
+ sco_data_packet_size_,
+ static_cast<uint8_t>(num_acl_data_packets_),
+ static_cast<uint8_t>(num_acl_data_packets_ >> 8),
+ static_cast<uint8_t>(num_sco_data_packets_),
+ static_cast<uint8_t>(num_sco_data_packets_ >> 8)});
}
const std::vector<uint8_t>
DualModeController::Properties::GetLocalVersionInformation() {
- return std::vector<uint8_t>({kSuccessStatus, version_, revision_,
- revision_ >> 8, lmp_pal_version_,
- manufacturer_name_, manufacturer_name_ >> 8,
- lmp_pal_subversion_, lmp_pal_subversion_ >> 8});
+ return std::vector<uint8_t>({kSuccessStatus, version_,
+ static_cast<uint8_t>(revision_),
+ static_cast<uint8_t>(revision_ >> 8),
+ lmp_pal_version_,
+ static_cast<uint8_t>(manufacturer_name_),
+ static_cast<uint8_t>(manufacturer_name_ >> 8),
+ static_cast<uint8_t>(lmp_pal_subversion_),
+ static_cast<uint8_t>(lmp_pal_subversion_ >> 8)});
}
const std::vector<uint8_t> DualModeController::Properties::GetBdAddress() {
diff --git a/vendor_libs/test_vendor_lib/src/hci_transport.cc b/vendor_libs/test_vendor_lib/src/hci_transport.cc
index 8e64f71..9c6ec8e 100644
--- a/vendor_libs/test_vendor_lib/src/hci_transport.cc
+++ b/vendor_libs/test_vendor_lib/src/hci_transport.cc
@@ -16,6 +16,8 @@
#define LOG_TAG "hci_transport"
+#include <cinttypes>
+
#include "vendor_libs/test_vendor_lib/include/hci_transport.h"
#include "base/logging.h"
@@ -105,7 +107,6 @@
CHECK(fd == GetVendorFd());
if (!outbound_events_.empty()) {
base::TimeTicks current_time = base::TimeTicks::Now();
- auto it = outbound_events_.begin();
// Check outbound events for events that can be sent, i.e. events with a
// timestamp before the current time. Stop sending events when
// |packet_stream_| fails writing.
@@ -148,7 +149,7 @@
PostEventResponse(std::move(event));
}
- LOG_INFO(LOG_TAG, "Posting event response with delay of %lld ms.",
+ LOG_INFO(LOG_TAG, "Posting event response with delay of %" PRId64 " ms.",
delay.InMilliseconds());
AddEventToOutboundEvents(
diff --git a/vendor_libs/test_vendor_lib/src/test_channel_transport.cc b/vendor_libs/test_vendor_lib/src/test_channel_transport.cc
index 0b49711..45362ff 100644
--- a/vendor_libs/test_vendor_lib/src/test_channel_transport.cc
+++ b/vendor_libs/test_vendor_lib/src/test_channel_transport.cc
@@ -21,6 +21,7 @@
#include "base/logging.h"
extern "C" {
+#include "osi/include/osi.h"
#include "osi/include/log.h"
#include <sys/socket.h>
@@ -123,7 +124,9 @@
command_handler_(command_name, args);
}
-void TestChannelTransport::OnFileCanWriteWithoutBlocking(int fd) {}
+void TestChannelTransport::OnFileCanWriteWithoutBlocking(
+ int fd UNUSED_ATTR) {
+}
void TestChannelTransport::RegisterCommandHandler(
std::function<void(const std::string&, const std::vector<std::string>&)>
diff --git a/vendor_libs/test_vendor_lib/src/vendor_manager.cc b/vendor_libs/test_vendor_lib/src/vendor_manager.cc
index f7e640a..b9126c7 100644
--- a/vendor_libs/test_vendor_lib/src/vendor_manager.cc
+++ b/vendor_libs/test_vendor_lib/src/vendor_manager.cc
@@ -49,8 +49,8 @@
}
VendorManager::VendorManager()
- : running_(false),
- test_channel_transport_(true, 6111),
+ : test_channel_transport_(true, 6111),
+ running_(false),
thread_("TestVendorLibrary"),
weak_ptr_factory_(this) {}