OSDN Git Service

Various small warning/build fixes for Linux
authorJakub Pawlowski <jpawlowski@google.com>
Thu, 20 Oct 2016 17:19:50 +0000 (10:19 -0700)
committerJakub Pawlowski <jpawlowski@google.com>
Thu, 20 Oct 2016 17:47:55 +0000 (10:47 -0700)
Test: build with ninja
Change-Id: Ic0f4d23e4a56a42be6e660f2afec83400ea6daa6

stack/BUILD.gn
stack/btm/ble_advertiser_hci_interface.cc
stack/btm/ble_advertiser_hci_interface.h
stack/include/ble_advertiser.h
stack/test/stack_a2dp_test.cc
test/suite/adapter/bluetooth_test.h

index c5622b7..41353ed 100644 (file)
@@ -175,7 +175,6 @@ static_library("stack") {
 executable("stack_unittests") {
   testonly = true
   sources = [
-    "test/ble_advertiser_test.cc",
     "test/stack_a2dp_test.cc",
   ]
 
@@ -219,3 +218,34 @@ executable("stack_unittests") {
   ]
 }
 
+executable("net_test_stack_multi_adv") {
+  testonly = true
+  sources = [
+    "btm/btm_ble_multi_adv.cc",
+    "test/ble_advertiser_test.cc",
+  ]
+
+  include_dirs = [
+    "include",
+    "//",
+    "//btcore/include",
+    "//hci/include",
+    "//include",
+    "//stack/btm",
+  ]
+
+libs = [
+    "-ldl",
+    "-lpthread",
+    "-lresolv",
+    "-lrt",
+    "-lz",
+    "-latomic",
+  ]
+
+  deps = [
+    "//third_party/googletest:gmock_main",
+    "//third_party/libchrome:base",
+  ]
+}
+
index 494047e..5d94fdf 100644 (file)
@@ -122,7 +122,7 @@ class BleAdvertiserHciInterfaceImpl : public BleAdvertiserHciInterface {
 
   void SetScanResponseData(uint8_t scan_response_data_length,
                            uint8_t *scan_response_data, uint8_t inst_id,
-                           status_cb command_complete) {
+                           status_cb command_complete) override {
     VLOG(1) << __func__;
     uint8_t param[BTM_BLE_MULTI_ADV_WRITE_DATA_LEN];
     memset(param, 0, BTM_BLE_MULTI_ADV_WRITE_DATA_LEN);
@@ -138,7 +138,7 @@ class BleAdvertiserHciInterfaceImpl : public BleAdvertiserHciInterface {
   }
 
   void SetRandomAddress(uint8_t random_address[6], uint8_t inst_id,
-                        status_cb command_complete) {
+                        status_cb command_complete) override {
     VLOG(1) << __func__;
     uint8_t param[BTM_BLE_MULTI_ADV_SET_RANDOM_ADDR_LEN];
     memset(param, 0, BTM_BLE_MULTI_ADV_SET_RANDOM_ADDR_LEN);
@@ -153,7 +153,7 @@ class BleAdvertiserHciInterfaceImpl : public BleAdvertiserHciInterface {
   }
 
   void Enable(uint8_t advertising_enable, uint8_t inst_id,
-              status_cb command_complete) {
+              status_cb command_complete) override {
     VLOG(1) << __func__;
     uint8_t param[BTM_BLE_MULTI_ADV_ENB_LEN];
     memset(param, 0, BTM_BLE_MULTI_ADV_ENB_LEN);
index 0c09e4c..aa90498 100644 (file)
@@ -41,7 +41,7 @@ class BleAdvertiserHciInterface {
     virtual ~AdvertisingEventObserver() = default;
     virtual void OnAdvertisingStateChanged(uint8_t inst_id,
                                            uint8_t state_change_reason,
-                                           uint16_t connection_handle);
+                                           uint16_t connection_handle) = 0;
   };
 
   virtual void ReadInstanceCount(base::Callback<void(uint8_t /* inst_cnt*/)> cb) = 0;
index ef01c74..4ef2ff2 100644 (file)
@@ -68,25 +68,25 @@ class BleAdvertisingManager {
   * advertising is disabled by calling |BTM_BleDisableAdvInstance|, or when any
   * of the operations fails. */
   virtual void RegisterAdvertiser(
-      base::Callback<void(uint8_t /* inst_id */, uint8_t /* status */)>);
+      base::Callback<void(uint8_t /* inst_id */, uint8_t /* status */)>) = 0;
 
   /* This function enables/disables an advertising instance. Operation status is
    * returned in |cb| */
   virtual void Enable(uint8_t inst_id, bool enable, MultiAdvCb cb, int timeout_s,
-                    MultiAdvCb timeout_cb);
+                    MultiAdvCb timeout_cb) = 0;
 
   /* This function update a Multi-ADV instance with the specififed adv
    * parameters. */
   virtual void SetParameters(uint8_t inst_id, tBTM_BLE_ADV_PARAMS *p_params,
-                             MultiAdvCb cb);
+                             MultiAdvCb cb) = 0;
 
   /* This function configure a Multi-ADV instance with the specified adv data or
    * scan response data.*/
   virtual void SetData(uint8_t inst_id, bool is_scan_rsp,
-                       std::vector<uint8_t> data, MultiAdvCb cb);
+                       std::vector<uint8_t> data, MultiAdvCb cb) = 0;
 
   /*  This function disable a Multi-ADV instance */
-  virtual void Unregister(uint8_t inst_id);
+  virtual void Unregister(uint8_t inst_id) = 0;
 };
 
 #endif  // BLE_ADVERTISER_H
index 1ce89b0..8713f31 100644 (file)
 #include "stack/include/a2dp_sbc.h"
 #include "stack/include/a2dp_vendor.h"
 
+//TODO(jpawlowski): remove once weird dependency in hci_layer.cc is removed
+#include <hardware/bluetooth.h>
+bt_bdaddr_t btif_local_bd_addr;
+
 namespace {
 const uint8_t codec_info_sbc[AVDT_CODEC_SIZE] = {
   6,                    // Length (A2DP_SBC_INFO_LEN)
index 5e22a32..e655ab4 100644 (file)
@@ -81,20 +81,20 @@ class BluetoothTest : public ::testing::Test,
   void AdapterPropertiesCallback(
       bt_status_t status,
       int num_properties,
-      bt_property_t *properties);
+      bt_property_t *properties) override;
 
   // A callback that is called when the remote device's property changes
   void RemoteDevicePropertiesCallback(
       bt_status_t status,
       bt_bdaddr_t *remote_bd_addr,
       int num_properties,
-      bt_property_t *properties);
+      bt_property_t *properties) override;
 
   // A callback that is called when the adapter state changes
-  void AdapterStateChangedCallback(bt_state_t state);
+  void AdapterStateChangedCallback(bt_state_t state) override;
 
   // A callback that is called when the Discovery state changes
-  void DiscoveryStateChangedCallback(bt_discovery_state_t state);
+  void DiscoveryStateChangedCallback(bt_discovery_state_t state) override;
 
   // Semaphores used to wait for specific callback execution. Each callback
   // has its own semaphore associated with it.