EXPECT_TRUE(
bluetooth_cb->WaitForCallback(kCallbackNameInitializationComplete)
- .first);
+ .no_timeout);
ASSERT_EQ(initialized, true);
}
int status_event_count = 0;
hidl_vec<uint8_t> event;
do {
- EXPECT_TRUE(
- bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).first);
- EXPECT_LT(static_cast<size_t>(0), event_queue.size());
- if (event_queue.size() == 0) {
- event.resize(0);
- break;
+ EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived)
+ .no_timeout);
+ EXPECT_LT(static_cast<size_t>(0), event_queue.size());
+ if (event_queue.size() == 0) {
+ event.resize(0);
+ break;
}
event = event_queue.front();
event_queue.pop();
bluetooth->sendHciCommand(cmd);
EXPECT_TRUE(
- bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).first);
+ bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).no_timeout);
EXPECT_LT(static_cast<size_t>(0), event_queue.size());
if (event_queue.size() == 0) return;
bluetooth->sendHciCommand(cmd);
// Check the loopback of the HCI packet
- EXPECT_TRUE(
- bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).first);
+ EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived)
+ .no_timeout);
hidl_vec<uint8_t> event = event_queue.front();
event_queue.pop();
size_t compare_length =
bluetooth->sendScoData(sco_vector);
// Check the loopback of the SCO packet
- EXPECT_TRUE(
- bluetooth_cb->WaitForCallback(kCallbackNameScoEventReceived).first);
+ EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameScoEventReceived)
+ .no_timeout);
hidl_vec<uint8_t> sco_loopback = sco_queue.front();
sco_queue.pop();
bluetooth->sendAclData(acl_vector);
// Check the loopback of the ACL packet
- EXPECT_TRUE(
- bluetooth_cb->WaitForCallback(kCallbackNameAclEventReceived).first);
+ EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameAclEventReceived)
+ .no_timeout);
hidl_vec<uint8_t> acl_loopback = acl_queue.front();
acl_queue.pop();
// Return the number of completed packets reported by the controller.
int BluetoothHidlTest::wait_for_completed_packets_event(uint16_t handle) {
- EXPECT_TRUE(
- bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).first);
- int packets_processed = 0;
- while (event_queue.size() > 0) {
- hidl_vec<uint8_t> event = event_queue.front();
- event_queue.pop();
+ EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived)
+ .no_timeout);
+ int packets_processed = 0;
+ while (event_queue.size() > 0) {
+ hidl_vec<uint8_t> event = event_queue.front();
+ event_queue.pop();
- EXPECT_EQ(EVENT_NUMBER_OF_COMPLETED_PACKETS, event[EVENT_CODE_BYTE]);
- EXPECT_EQ(1, event[EVENT_NUMBER_OF_COMPLETED_PACKETS_NUM_HANDLES]);
+ EXPECT_EQ(EVENT_NUMBER_OF_COMPLETED_PACKETS, event[EVENT_CODE_BYTE]);
+ EXPECT_EQ(1, event[EVENT_NUMBER_OF_COMPLETED_PACKETS_NUM_HANDLES]);
- uint16_t event_handle = event[3] + (event[4] << 8);
- EXPECT_EQ(handle, event_handle);
+ uint16_t event_handle = event[3] + (event[4] << 8);
+ EXPECT_EQ(handle, event_handle);
- packets_processed += event[5] + (event[6] << 8);
+ packets_processed += event[5] + (event[6] << 8);
}
return packets_processed;
}
int connection_event_count = 0;
hidl_vec<uint8_t> event;
do {
- EXPECT_TRUE(
- bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).first);
- event = event_queue.front();
- event_queue.pop();
- EXPECT_GT(event.size(),
- static_cast<size_t>(EVENT_COMMAND_COMPLETE_STATUS_BYTE));
- if (event[EVENT_CODE_BYTE] == EVENT_CONNECTION_COMPLETE) {
+ EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived)
+ .no_timeout);
+ event = event_queue.front();
+ event_queue.pop();
EXPECT_GT(event.size(),
- static_cast<size_t>(EVENT_CONNECTION_COMPLETE_TYPE));
- EXPECT_EQ(event[EVENT_LENGTH_BYTE],
- EVENT_CONNECTION_COMPLETE_PARAM_LENGTH);
- uint8_t connection_type = event[EVENT_CONNECTION_COMPLETE_TYPE];
-
- EXPECT_TRUE(connection_type == EVENT_CONNECTION_COMPLETE_TYPE_SCO ||
- connection_type == EVENT_CONNECTION_COMPLETE_TYPE_ACL);
-
- // Save handles
- uint16_t handle = event[EVENT_CONNECTION_COMPLETE_HANDLE_LSBYTE] |
- event[EVENT_CONNECTION_COMPLETE_HANDLE_LSBYTE + 1] << 8;
- if (connection_type == EVENT_CONNECTION_COMPLETE_TYPE_SCO)
- sco_handles.push_back(handle);
- else
- acl_handles.push_back(handle);
-
- ALOGD("Connect complete type = %d handle = %d",
- event[EVENT_CONNECTION_COMPLETE_TYPE], handle);
- connection_event_count++;
+ static_cast<size_t>(EVENT_COMMAND_COMPLETE_STATUS_BYTE));
+ if (event[EVENT_CODE_BYTE] == EVENT_CONNECTION_COMPLETE) {
+ EXPECT_GT(event.size(),
+ static_cast<size_t>(EVENT_CONNECTION_COMPLETE_TYPE));
+ EXPECT_EQ(event[EVENT_LENGTH_BYTE],
+ EVENT_CONNECTION_COMPLETE_PARAM_LENGTH);
+ uint8_t connection_type = event[EVENT_CONNECTION_COMPLETE_TYPE];
+
+ EXPECT_TRUE(connection_type == EVENT_CONNECTION_COMPLETE_TYPE_SCO ||
+ connection_type == EVENT_CONNECTION_COMPLETE_TYPE_ACL);
+
+ // Save handles
+ uint16_t handle = event[EVENT_CONNECTION_COMPLETE_HANDLE_LSBYTE] |
+ event[EVENT_CONNECTION_COMPLETE_HANDLE_LSBYTE + 1]
+ << 8;
+ if (connection_type == EVENT_CONNECTION_COMPLETE_TYPE_SCO)
+ sco_handles.push_back(handle);
+ else
+ acl_handles.push_back(handle);
+
+ ALOGD("Connect complete type = %d handle = %d",
+ event[EVENT_CONNECTION_COMPLETE_TYPE], handle);
+ connection_event_count++;
}
} while (event[EVENT_CODE_BYTE] == EVENT_CONNECTION_COMPLETE);
bluetooth->sendHciCommand(cmd);
EXPECT_TRUE(
- bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).first);
+ bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).no_timeout);
hidl_vec<uint8_t> event = event_queue.front();
event_queue.pop();
bluetooth->sendHciCommand(cmd);
EXPECT_TRUE(
- bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).first);
+ bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).no_timeout);
hidl_vec<uint8_t> event = event_queue.front();
event_queue.pop();