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

Commit 83a2df89 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Do not set random address when public address is in use

Test: compilation
Change-Id: Ie9832b258aa85a9a4086c1608a32aa6f4049853b
parent 29498f57
Loading
Loading
Loading
Loading
+36 −26
Original line number Diff line number Diff line
@@ -422,6 +422,12 @@ class BleAdvertisingManagerImpl

            c->self->adv_inst[c->inst_id].tx_power = tx_power;

            if (c->self->adv_inst[c->inst_id].own_address_type == BLE_ADDR_PUBLIC) {
              c->self->StartAdvertisingSetAfterAddressPart(std::move(c));
              return;
            }

            //own_address_type == BLE_ADDR_RANDOM
            const RawAddress& rpa = c->self->adv_inst[c->inst_id].own_address;
            c->self->GetHciInterface()->SetRandomAddress(c->inst_id, rpa, Bind(
              [](c_type c, uint8_t status) {
@@ -432,6 +438,14 @@ class BleAdvertisingManagerImpl
                  return;
                }

                c->self->StartAdvertisingSetAfterAddressPart(std::move(c));
          }, base::Passed(&c)));
        }, base::Passed(&c)));
    }, base::Passed(&c)));
    // clang-format on
  }

  void StartAdvertisingSetAfterAddressPart(c_type c) {
    c->self->SetData(c->inst_id, false, std::move(c->advertise_data), Bind(
      [](c_type c, uint8_t status) {
        if (status != 0) {
@@ -457,10 +471,6 @@ class BleAdvertisingManagerImpl
            }
        }, base::Passed(&c)));
    }, base::Passed(&c)));
            }, base::Passed(&c)));
        }, base::Passed(&c)));
    }, base::Passed(&c)));
    // clang-format on
  }

  void StartAdvertisingSetPeriodicPart(c_type c) {