Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89274d2b authored by Chris Manton's avatar Chris Manton Committed by android-build-merger
Browse files

Minor clean up detail for signalling am: f16d7e80 am: d9f6c4f4

am: 7afa8108

Change-Id: I2a7aad6f5317ebf487ac974817c4aee09bb587c9
parents a3f52313 7afa8108
Loading
Loading
Loading
Loading
+8 −11
Original line number Original line Diff line number Diff line
@@ -178,8 +178,8 @@ void ClassicSignallingManager::OnConnectionResponse(SignalId signal_id, Cid remo
    handle_send_next_command();
    handle_send_next_command();
    return;
    return;
  }
  }
  SendConfigurationRequest(remote_cid, {});
  alarm_.Cancel();
  alarm_.Cancel();
  SendConfigurationRequest(remote_cid, {});
  handle_send_next_command();
  handle_send_next_command();
}
}


@@ -190,13 +190,12 @@ void ClassicSignallingManager::OnConfigurationRequest(SignalId signal_id, Cid ci
    LOG_WARN("Configuration request for an unknown channel");
    LOG_WARN("Configuration request for an unknown channel");
    return;
    return;
  }
  }
  auto response = ConfigurationResponseBuilder::Create(signal_id.Value(), cid, is_continuation,
  auto response = ConfigurationResponseBuilder::Create(signal_id.Value(), channel->GetRemoteCid(), is_continuation,
                                                       ConfigurationResponseResult::SUCCESS, {});
                                                       ConfigurationResponseResult::SUCCESS, {});
  enqueue_buffer_->Enqueue(std::move(response), handler_);
  enqueue_buffer_->Enqueue(std::move(response), handler_);
  handle_send_next_command();
  handle_send_next_command();
  channel->SetIncomingConfigurationStatus(DynamicChannelImpl::ConfigurationStatus::CONFIGURED);
  channel->SetIncomingConfigurationStatus(DynamicChannelImpl::ConfigurationStatus::CONFIGURED);
  if (channel->GetOutgoingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) {
  if (channel->GetOutgoingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) {
    LOG_INFO();
    std::unique_ptr<DynamicChannel> user_channel = std::make_unique<DynamicChannel>(channel, handler_);
    std::unique_ptr<DynamicChannel> user_channel = std::make_unique<DynamicChannel>(channel, handler_);
    dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel));
    dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel));
  }
  }
@@ -213,21 +212,19 @@ void ClassicSignallingManager::OnConfigurationResponse(SignalId signal_id, Cid c
  auto last_sent_command = std::move(pending_commands_.front());
  auto last_sent_command = std::move(pending_commands_.front());
  pending_commands_.pop();
  pending_commands_.pop();


  auto channel = channel_allocator_->FindChannelByRemoteCid(cid);
  auto channel = channel_allocator_->FindChannelByCid(cid);
  if (channel == nullptr) {
  if (channel == nullptr) {
    LOG_WARN("Configuration request for an unknown channel");
    LOG_WARN("Configuration request for an unknown channel");
    handle_send_next_command();
    handle_send_next_command();
    return;
    return;
  }
  }
  // TODO(cmanton) verify configuration parameters are satisfied
  // TODO(cmanton) Indicate channel is open if config params are agreed upon
  handle_send_next_command();
  channel->SetOutgoingConfigurationStatus(DynamicChannelImpl::ConfigurationStatus::CONFIGURED);
  channel->SetOutgoingConfigurationStatus(DynamicChannelImpl::ConfigurationStatus::CONFIGURED);
  if (channel->GetIncomingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) {
  if (channel->GetIncomingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) {
    std::unique_ptr<DynamicChannel> user_channel = std::make_unique<DynamicChannel>(channel, handler_);
    std::unique_ptr<DynamicChannel> user_channel = std::make_unique<DynamicChannel>(channel, handler_);
    dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel));
    dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel));
  }
  }
  alarm_.Cancel();
  alarm_.Cancel();
  handle_send_next_command();
}
}


void ClassicSignallingManager::OnDisconnectionRequest(SignalId signal_id, Cid cid, Cid remote_cid) {
void ClassicSignallingManager::OnDisconnectionRequest(SignalId signal_id, Cid cid, Cid remote_cid) {
@@ -244,13 +241,14 @@ void ClassicSignallingManager::OnDisconnectionRequest(SignalId signal_id, Cid ci
  handle_send_next_command();
  handle_send_next_command();
}
}


void ClassicSignallingManager::OnDisconnectionResponse(SignalId signal_id, Cid cid, Cid remote_cid) {
void ClassicSignallingManager::OnDisconnectionResponse(SignalId signal_id, Cid remote_cid, Cid cid) {
  if (pending_commands_.empty()) {
  if (pending_commands_.empty()) {
    LOG_WARN("Unexpected response: no pending request");
    LOG_WARN("Unexpected response: no pending request");
    return;
    return;
  }
  }
  auto last_sent_command = std::move(pending_commands_.front());
  auto last_sent_command = std::move(pending_commands_.front());
  pending_commands_.pop();
  pending_commands_.pop();
  alarm_.Cancel();


  if (last_sent_command.signal_id_ != signal_id ||
  if (last_sent_command.signal_id_ != signal_id ||
      last_sent_command.command_code_ != CommandCode::DISCONNECTION_REQUEST) {
      last_sent_command.command_code_ != CommandCode::DISCONNECTION_REQUEST) {
@@ -267,7 +265,6 @@ void ClassicSignallingManager::OnDisconnectionResponse(SignalId signal_id, Cid c
  channel->OnClosed(hci::ErrorCode::SUCCESS);
  channel->OnClosed(hci::ErrorCode::SUCCESS);
  link_->FreeDynamicChannel(cid);
  link_->FreeDynamicChannel(cid);
  handle_send_next_command();
  handle_send_next_command();
  alarm_.Cancel();
}
}


void ClassicSignallingManager::OnEchoRequest(SignalId signal_id, const PacketView<kLittleEndian>& packet) {
void ClassicSignallingManager::OnEchoRequest(SignalId signal_id, const PacketView<kLittleEndian>& packet) {
@@ -291,8 +288,8 @@ void ClassicSignallingManager::OnEchoResponse(SignalId signal_id, const PacketVi
    return;
    return;
  }
  }
  LOG_INFO("Echo response received");
  LOG_INFO("Echo response received");
  handle_send_next_command();
  alarm_.Cancel();
  alarm_.Cancel();
  handle_send_next_command();
}
}


void ClassicSignallingManager::OnInformationRequest(SignalId signal_id, InformationRequestInfoType type) {
void ClassicSignallingManager::OnInformationRequest(SignalId signal_id, InformationRequestInfoType type) {
@@ -332,8 +329,8 @@ void ClassicSignallingManager::OnInformationResponse(SignalId signal_id, const I
    return;
    return;
  }
  }
  // TODO (hsz): Store the information response
  // TODO (hsz): Store the information response
  handle_send_next_command();
  alarm_.Cancel();
  alarm_.Cancel();
  handle_send_next_command();
}
}


void ClassicSignallingManager::on_incoming_packet() {
void ClassicSignallingManager::on_incoming_packet() {