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

Commit a265f61d authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Merge "Fix primary adv interval range" am: 39b550dc

am: d264c215

Change-Id: Ie08b145d8c32d9334131cdccfcf406ce0e88d4fc
parents ccf4ffd0 d264c215
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -1699,6 +1699,10 @@ static void advertiseCleanupNative(JNIEnv* env, jobject object) {
  }
}

static uint32_t INTERVAL_MAX = 0xFFFFFF;
// Always give controller 31.25ms difference between min and max
static uint32_t INTERVAL_DELTA = 50;

static AdvertiseParameters parseParams(JNIEnv* env, jobject i) {
  AdvertiseParameters p;

@@ -1731,9 +1735,13 @@ static AdvertiseParameters parseParams(JNIEnv* env, jobject i) {
  if (isAnonymous) props |= 0x20;
  if (includeTxPower) props |= 0x40;

  if (interval > INTERVAL_MAX - INTERVAL_DELTA) {
    interval = INTERVAL_MAX - INTERVAL_DELTA;
  }

  p.advertising_event_properties = props;
  p.min_interval = interval;
  p.max_interval = interval + 50;
  p.max_interval = interval + INTERVAL_DELTA;
  p.channel_map = 0x07; /* all channels */
  p.tx_power = txPowerLevel;
  p.primary_advertising_phy = primaryPhy;