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

Commit 570f6f79 authored by Nick Desaulniers's avatar Nick Desaulniers Committed by Gerrit Code Review
Browse files

Merge changes I30972458,I62dd309d

* changes:
  [system][bt] fix -Wdangling-gsl
  [system][bt] fix -Wreorder-init-list
parents eb622d37 d7dc7083
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -158,8 +158,9 @@ class BluetoothAudioClientInterface {

  static constexpr PcmParameters kInvalidPcmConfiguration = {
      .sampleRate = SampleRate::RATE_UNKNOWN,
      .channelMode = ChannelMode::UNKNOWN,
      .bitsPerSample = BitsPerSample::BITS_UNKNOWN,
      .channelMode = ChannelMode::UNKNOWN};
  };

 private:
  // Helper function to connect to an IBluetoothAudioProvider
+2 −2
Original line number Diff line number Diff line
@@ -171,9 +171,9 @@ void BtaGattQueue::WriteCharacteristic(uint16_t conn_id, uint16_t handle,
                                       GATT_WRITE_OP_CB cb, void* cb_data) {
  gatt_op_queue[conn_id].push_back({.type = GATT_WRITE_CHAR,
                                    .handle = handle,
                                    .write_type = write_type,
                                    .write_cb = cb,
                                    .write_cb_data = cb_data,
                                    .write_type = write_type,
                                    .value = std::move(value)});
  gatt_execute_next_op(conn_id);
}
@@ -184,9 +184,9 @@ void BtaGattQueue::WriteDescriptor(uint16_t conn_id, uint16_t handle,
                                   GATT_WRITE_OP_CB cb, void* cb_data) {
  gatt_op_queue[conn_id].push_back({.type = GATT_WRITE_DESC,
                                    .handle = handle,
                                    .write_type = write_type,
                                    .write_cb = cb,
                                    .write_cb_data = cb_data,
                                    .write_type = write_type,
                                    .value = std::move(value)});
  gatt_execute_next_op(conn_id);
}
+12 −10
Original line number Diff line number Diff line
@@ -127,11 +127,12 @@ Database Database::Deserialize(const std::vector<StoredAttribute>& nv_attr,
  for (; it != nv_attr.cend(); ++it) {
    const auto& attr = *it;
    if (attr.type != PRIMARY_SERVICE && attr.type != SECONDARY_SERVICE) break;
    result.services.emplace_back(
        Service{.handle = attr.handle,
                .end_handle = attr.value.service.end_handle,
    result.services.emplace_back(Service{
        .handle = attr.handle,
        .uuid = attr.value.service.uuid,
        .is_primary = (attr.type == PRIMARY_SERVICE),
                .uuid = attr.value.service.uuid});
        .end_handle = attr.value.service.end_handle,
    });
  }

  auto current_service_it = result.services.begin();
@@ -168,11 +169,12 @@ Database Database::Deserialize(const std::vector<StoredAttribute>& nv_attr,
          .end_handle = attr.value.included_service.end_handle,
      });
    } else if (attr.type == CHARACTERISTIC) {
      current_service_it->characteristics.emplace_back(
          Characteristic{.declaration_handle = attr.handle,
      current_service_it->characteristics.emplace_back(Characteristic{
          .declaration_handle = attr.handle,
          .uuid = attr.value.characteristic.uuid,
          .value_handle = attr.value.characteristic.value_handle,
          .properties = attr.value.characteristic.properties,
                         .uuid = attr.value.characteristic.uuid});
      });

    } else {
      current_service_it->characteristics.back().descriptors.emplace_back(
+18 −13
Original line number Diff line number Diff line
@@ -32,10 +32,12 @@ void DatabaseBuilder::AddService(uint16_t handle, uint16_t end_handle,
  // general case optimization - we add services in order
  if (database.services.empty() ||
      database.services.back().end_handle < handle) {
    database.services.emplace_back(Service{.handle = handle,
                                           .end_handle = end_handle,
    database.services.emplace_back(Service{
        .handle = handle,
        .uuid = uuid,
        .is_primary = is_primary,
                                           .uuid = uuid});
        .end_handle = end_handle,
    });
  } else {
    auto& vec = database.services;

@@ -45,10 +47,12 @@ void DatabaseBuilder::AddService(uint16_t handle, uint16_t end_handle,
        [](Service s, uint16_t handle) { return s.end_handle < handle; });

    // Insert new service just before it
    vec.emplace(it, Service{.handle = handle,
                            .end_handle = end_handle,
    vec.emplace(it, Service{
                        .handle = handle,
                        .uuid = uuid,
                        .is_primary = is_primary,
                            .uuid = uuid});
                        .end_handle = end_handle,
                    });
  }

  services_to_discover.insert({handle, end_handle});
@@ -90,11 +94,12 @@ void DatabaseBuilder::AddCharacteristic(uint16_t handle, uint16_t value_handle,
                 << loghex(value_handle) << " is after service end_handle="
                 << loghex(service->end_handle);

  service->characteristics.emplace_back(
      Characteristic{.declaration_handle = handle,
  service->characteristics.emplace_back(Characteristic{
      .declaration_handle = handle,
      .uuid = uuid,
      .value_handle = value_handle,
      .properties = properties,
                     .uuid = uuid});
  });
  return;
}

+2 −2
Original line number Diff line number Diff line
@@ -1885,16 +1885,16 @@ static struct fc_channel* fcchan_get(uint16_t chan, char create) {
  static tL2CAP_FIXED_CHNL_REG fcr = {
      .pL2CA_FixedConn_Cb = fcchan_conn_chng_cbk,
      .pL2CA_FixedData_Cb = fcchan_data_cbk,
      .default_idle_tout = 0xffff,
      .fixed_chnl_opts =
          {
              .mode = L2CAP_FCR_BASIC_MODE,
              .tx_win_sz = 1,
              .max_transmit = 0xFF,
              .rtrans_tout = 2000,
              .mon_tout = 12000,
              .mps = 670,
              .tx_win_sz = 1,
          },
      .default_idle_tout = 0xffff,
  };

  while (t && t->chan != chan) t = t->next;
Loading