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

Commit 1d3ad100 authored by Chris Manton's avatar Chris Manton
Browse files

Re-log stack/gap/gap_ble::client_connect_cback

Towards readable code

Bug: 163134718
Tag: #refactor
Test: Compiled and passed basic functionality

Change-Id: Ic1093dbfe77fd980fb8045bc0e16599a9978192c
parent 5791552b
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include <queue>
#include "gap_api.h"
#include "gatt_api.h"
#include "osi/include/log.h"
#include "types/bt_transport.h"

using base::StringPrintf;
@@ -289,14 +290,19 @@ void client_connect_cback(tGATT_IF, const RawAddress& bda, uint16_t conn_id,
                          bool connected, tGATT_DISCONN_REASON reason,
                          tBT_TRANSPORT) {
  tGAP_CLCB* p_clcb = find_clcb_by_bd_addr(bda);
  if (p_clcb == NULL) return;
  if (p_clcb == NULL) {
    LOG_WARN("Unable to find device after connection");
    return;
  }

  if (connected) {
    LOG_DEBUG("Connected GAP to remote device");
    p_clcb->conn_id = conn_id;
    p_clcb->connected = true;
    /* start operation is pending */
    send_cl_read_request(*p_clcb);
  } else {
    LOG_WARN("Disconnected GAP from remote device");
    p_clcb->connected = false;
    cl_op_cmpl(*p_clcb, false, 0, NULL);
    /* clean up clcb */