Table of Contents

Class RetryOptions

Namespace
Bluetooth.Abstractions.Options
Assembly
Bluetooth.Abstractions.dll

Configuration for retry behavior of Bluetooth operations.

public record RetryOptions : IEquatable<RetryOptions>
Inheritance
RetryOptions
Implements
Inherited Members

Remarks

Provides flexible retry configuration for BLE operations that may fail intermittently. Common scenarios include Android GATT error 133 (connection failures), scan start failures when the adapter is busy, and transient GATT operation failures.

Properties

Aggressive

Aggressive retry configuration (5 retries, 100ms base delay, exponential backoff enabled).

public static RetryOptions Aggressive { get; }

Property Value

RetryOptions

Remarks

Use this for operations that frequently fail due to transient issues. The exponential backoff helps prevent overwhelming the BLE stack. Total max delay: 100ms + 200ms + 400ms + 800ms + 1600ms = 3100ms

Default

Default retry configuration (3 retries, 200ms delay, no exponential backoff).

public static RetryOptions Default { get; }

Property Value

RetryOptions

Remarks

This configuration works well for most BLE operations and matches the existing hardcoded retry behavior in GATT write operations.

DelayBetweenRetries

Gets the base delay between retry attempts (default: 200ms).

public TimeSpan DelayBetweenRetries { get; init; }

Property Value

TimeSpan

Remarks

This is the base delay used between retries. When ExponentialBackoff is enabled, the actual delay will increase exponentially: base, base2, base4, etc.

ExponentialBackoff

Gets whether to use exponential backoff for retry delays (default: false).

public bool ExponentialBackoff { get; init; }

Property Value

bool

Remarks

When enabled, delays between retries double with each attempt:

  • Attempt 1: DelayBetweenRetries
  • Attempt 2: DelayBetweenRetries * 2
  • Attempt 3: DelayBetweenRetries * 4
  • Etc. This reduces load on the BLE stack during retry storms.

MaxRetries

Gets the maximum number of retry attempts (default: 3).

public int MaxRetries { get; init; }

Property Value

int

Remarks

Setting to 0 disables retries (single attempt only). Higher values increase reliability but may increase operation time.

None

No retry configuration (0 retries, single attempt only).

public static RetryOptions None { get; }

Property Value

RetryOptions

Remarks

Use this when you want to disable retry logic for a specific operation.