OSDN Git Service

Implements some additional commands
authorGreg Hartman <ghartman@google.com>
Tue, 26 Jul 2016 20:19:02 +0000 (13:19 -0700)
committerJorge E. Moreira <jemoreira@google.com>
Thu, 4 Aug 2016 19:24:15 +0000 (12:24 -0700)
- Added/Improved responses to certain opcodes on bt_vendor.cc
- Added handlers for a couple of commands used in L

Change-Id: I85c02553057e4ea3a3e51795c2e1a2bb679fd5e1

vendor_libs/test_vendor_lib/include/dual_mode_controller.h
vendor_libs/test_vendor_lib/src/bt_vendor.cc
vendor_libs/test_vendor_lib/src/dual_mode_controller.cc

index a4e4d8b..96c6def 100644 (file)
@@ -362,6 +362,16 @@ class DualModeController {
   void HciLeSetRandomAddress(const vector<uint8_t>& args);
 
   // OGF: 0x0008
+  // OCF: 0x0006
+  // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.8.5
+  void HciLeSetAdvertisingParameters(const vector<uint8_t>& args);
+
+  // OGF: 0x0008
+  // OCF: 0x0008
+  // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.8.7
+  void HciLeSetAdvertisingData(const vector<uint8_t>& args);
+
+  // OGF: 0x0008
   // OCF: 0x000B
   // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.8.10
   void HciLeSetScanParameters(const vector<uint8_t>& args);
index 9cd2345..ed97762 100644 (file)
@@ -80,7 +80,35 @@ static int TestVendorOp(bt_vendor_opcode_t opcode, void* param) {
 
     case BT_VND_OP_FW_CFG:
       LOG_INFO(LOG_TAG, "Unsupported op: BT_VND_OP_FW_CFG");
-      manager->GetVendorCallbacks().fwcfg_cb(BT_VND_OP_RESULT_FAIL);
+      manager->GetVendorCallbacks().fwcfg_cb(BT_VND_OP_RESULT_SUCCESS);
+      return -1;
+
+    case BT_VND_OP_SCO_CFG:
+      LOG_INFO(LOG_TAG, "Unsupported op: BT_VND_OP_SCO_CFG");
+      manager->GetVendorCallbacks().scocfg_cb(BT_VND_OP_RESULT_SUCCESS);
+      return -1;
+
+    case BT_VND_OP_GET_LPM_IDLE_TIMEOUT:
+      LOG_INFO(LOG_TAG, "Doing op: BT_VND_OP_SCO_CFG");
+      *((uint32_t*)param) = 1000;
+      return 0;
+
+    case BT_VND_OP_LPM_SET_MODE:
+      LOG_INFO(LOG_TAG, "Unsupported op: BT_VND_OP_LPM_SET_MODE");
+      manager->GetVendorCallbacks().lpm_cb(BT_VND_OP_RESULT_SUCCESS);
+      return -1;
+
+    case BT_VND_OP_LPM_WAKE_SET_STATE:
+      LOG_INFO(LOG_TAG, "Unsupported op: BT_VND_OP_LPM_WAKE_SET_STATE");
+      return -1;
+
+    case BT_VND_OP_SET_AUDIO_STATE:
+      LOG_INFO(LOG_TAG, "Unsupported op: BT_VND_OP_SET_AUDIO_STATE");
+      return -1;
+
+    case BT_VND_OP_EPILOG:
+      LOG_INFO(LOG_TAG, "Unsupported op: BT_VND_OP_EPILOG");
+      manager->GetVendorCallbacks().epilog_cb(BT_VND_OP_RESULT_SUCCESS);
       return -1;
 
     default:
index c8fd9fa..c6d78e5 100644 (file)
@@ -135,6 +135,8 @@ DualModeController::DualModeController()
   SET_HANDLER(HCI_BLE_READ_BUFFER_SIZE, HciLeReadBufferSize);
   SET_HANDLER(HCI_BLE_READ_LOCAL_SPT_FEAT, HciLeReadLocalSupportedFeatures);
   SET_HANDLER(HCI_BLE_WRITE_RANDOM_ADDR, HciLeSetRandomAddress);
+  SET_HANDLER(HCI_BLE_WRITE_ADV_DATA, HciLeSetAdvertisingData);
+  SET_HANDLER(HCI_BLE_WRITE_ADV_PARAMS, HciLeSetAdvertisingParameters);
   SET_HANDLER(HCI_BLE_WRITE_SCAN_PARAMS, HciLeSetScanParameters);
   SET_HANDLER(HCI_BLE_WRITE_SCAN_ENABLE, HciLeSetScanEnable);
   SET_HANDLER(HCI_BLE_READ_WHITE_LIST_SIZE, HciLeReadWhiteListSize);
@@ -537,6 +539,16 @@ void DualModeController::HciLeSetRandomAddress(const vector<uint8_t>& args) {
   SendCommandCompleteSuccess(HCI_BLE_WRITE_RANDOM_ADDR);
 }
 
+void DualModeController::HciLeSetAdvertisingParameters(const vector<uint8_t>& args){
+  LogCommand("LE SetAdvertisingParameters");
+  SendCommandCompleteSuccess(HCI_BLE_WRITE_ADV_PARAMS);
+}
+
+void DualModeController::HciLeSetAdvertisingData(const vector<uint8_t>& args){
+  LogCommand("LE SetAdvertisingData");
+  SendCommandCompleteSuccess(HCI_BLE_WRITE_ADV_DATA);
+}
+
 void DualModeController::HciLeSetScanParameters(const vector<uint8_t>& args) {
   LogCommand("LE SetScanParameters");
   CHECK(args.size() == 8);