void OnReadClockOffsetComplete(uint16_t clock_offset) override {
SAVE_OR_CALL(OnReadClockOffsetComplete, clock_offset)
}
- void OnModeChange(Mode current_mode, uint16_t interval) override {
- SAVE_OR_CALL(OnModeChange, current_mode, interval)
+ void OnModeChange(ErrorCode status, Mode current_mode, uint16_t interval) override {
+ SAVE_OR_CALL(OnModeChange, status, current_mode, interval)
}
void OnSniffSubrating(
uint16_t maximum_transmit_latency,
if (status != ErrorCode::SUCCESS) {
std::string error_code = ErrorCodeText(status);
LOG_ERROR("Received on_mode_change on handle 0x0%04hx with error code %s", handle, error_code.c_str());
- return;
}
auto callbacks = get_callbacks(handle);
if (callbacks == nullptr) {
}
Mode current_mode = mode_change_view.GetCurrentMode();
uint16_t interval = mode_change_view.GetInterval();
- callbacks->OnModeChange(current_mode, interval);
+ callbacks->OnModeChange(status, current_mode, interval);
}
void on_sniff_subrating(EventView packet) {
// Invoked when controller sends Read Clock Offset Complete event with Success error code
virtual void OnReadClockOffsetComplete(uint16_t clock_offset) = 0;
// Invoked when controller sends Mode Change event with Success error code
- virtual void OnModeChange(Mode current_mode, uint16_t interval) = 0;
+ virtual void OnModeChange(ErrorCode status, Mode current_mode, uint16_t interval) = 0;
// Invoked when controller sends Sniff Subrating event with Success error code
virtual void OnSniffSubrating(
uint16_t maximum_transmit_latency,
MOCK_METHOD1(OnEncryptionChange, void(EncryptionEnabled enabled));
MOCK_METHOD0(OnChangeConnectionLinkKeyComplete, void());
MOCK_METHOD1(OnReadClockOffsetComplete, void(uint16_t clock_offse));
- MOCK_METHOD2(OnModeChange, void(Mode current_mode, uint16_t interval));
+ MOCK_METHOD3(OnModeChange, void(ErrorCode status, Mode current_mode, uint16_t interval));
MOCK_METHOD4(
OnSniffSubrating,
void(
ASSERT_EQ(command_view.GetHoldModeMaxInterval(), 0x0500);
ASSERT_EQ(command_view.GetHoldModeMinInterval(), 0x0020);
- EXPECT_CALL(mock_connection_management_callbacks_, OnModeChange(Mode::HOLD, 0x0020));
+ EXPECT_CALL(mock_connection_management_callbacks_, OnModeChange(ErrorCode::SUCCESS, Mode::HOLD, 0x0020));
test_hci_layer_->IncomingEvent(ModeChangeBuilder::Create(ErrorCode::SUCCESS, handle_, Mode::HOLD, 0x0020));
}
ASSERT_EQ(command_view.GetSniffAttempt(), 0x0040);
ASSERT_EQ(command_view.GetSniffTimeout(), 0x0014);
- EXPECT_CALL(mock_connection_management_callbacks_, OnModeChange(Mode::SNIFF, 0x0028));
+ EXPECT_CALL(mock_connection_management_callbacks_, OnModeChange(ErrorCode::SUCCESS, Mode::SNIFF, 0x0028));
test_hci_layer_->IncomingEvent(ModeChangeBuilder::Create(ErrorCode::SUCCESS, handle_, Mode::SNIFF, 0x0028));
}
auto command_view = ExitSniffModeView::Create(packet);
ASSERT_TRUE(command_view.IsValid());
- EXPECT_CALL(mock_connection_management_callbacks_, OnModeChange(Mode::ACTIVE, 0x00));
+ EXPECT_CALL(mock_connection_management_callbacks_, OnModeChange(ErrorCode::SUCCESS, Mode::ACTIVE, 0x00));
test_hci_layer_->IncomingEvent(ModeChangeBuilder::Create(ErrorCode::SUCCESS, handle_, Mode::ACTIVE, 0x00));
}
LOG_INFO("OnReadClockOffsetComplete clock_offset:%d", clock_offset);
};
- void OnModeChange(Mode current_mode, uint16_t interval) override {
+ void OnModeChange(ErrorCode status, Mode current_mode, uint16_t interval) override {
LOG_INFO("OnModeChange Mode:%d, interval:%d", (uint8_t)current_mode, interval);
};
link_manager_->OnReadClockOffset(GetDevice().GetAddress(), clock_offset);
}
-void Link::OnModeChange(hci::Mode current_mode, uint16_t interval) {
+void Link::OnModeChange(hci::ErrorCode status, hci::Mode current_mode, uint16_t interval) {
link_manager_->OnModeChange(GetDevice().GetAddress(), current_mode, interval);
}
void OnEncryptionChange(hci::EncryptionEnabled enabled) override;
void OnChangeConnectionLinkKeyComplete() override;
void OnReadClockOffsetComplete(uint16_t clock_offset) override;
- void OnModeChange(hci::Mode current_mode, uint16_t interval) override;
+ void OnModeChange(hci::ErrorCode status, hci::Mode current_mode, uint16_t interval) override;
void OnSniffSubrating(
uint16_t maximum_transmit_latency,
uint16_t maximum_receive_latency,
LOG_INFO("UNIMPLEMENTED");
}
- void OnModeChange(hci::Mode current_mode, uint16_t interval) override {
- TRY_POSTING_ON_MAIN(interface_.on_mode_change,
- ToLegacyHciErrorCode(hci::ErrorCode::SUCCESS), handle_,
- ToLegacyHciMode(current_mode), interval);
+ void OnModeChange(hci::ErrorCode status, hci::Mode current_mode,
+ uint16_t interval) override {
+ TRY_POSTING_ON_MAIN(interface_.on_mode_change, ToLegacyHciErrorCode(status),
+ handle_, ToLegacyHciMode(current_mode), interval);
}
void OnSniffSubrating(uint16_t maximum_transmit_latency,