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

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

Merge "Fix primary adv interval range"

am: dc92aba3

Change-Id: If01b28b701707057af7f3e456d897ff0841aa803
parents eb5d9c96 dc92aba3
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;