Constants

object Constants

Central repository for constant values used throughout the BleX library.

This object contains configuration constants for BLE operations including logging tags, MTU (Maximum Transmission Unit) values, and timing parameters.

MTU (Maximum Transmission Unit)

The MTU defines the maximum size of a single BLE packet. The effective payload size is typically MTU - 3 bytes (due to ATT protocol overhead).

  • Default MTU: 23 bytes (20 bytes effective payload)

  • Maximum MTU: 517 bytes (514 bytes effective payload, as per Bluetooth 4.2+)

Usage Example

// Using the tag for logging
Log.d(Constants.TAG, "BLE operation completed")

// Requesting maximum MTU for faster data transfer
gatt.requestMtu(Constants.MAX_MTU)

Properties

Link copied to clipboard
const val DEFAULT_MTU: Int = 23

Default MTU (Maximum Transmission Unit) size in bytes.

Link copied to clipboard
const val MAX_MTU: Int = 517

Maximum supported MTU (Maximum Transmission Unit) size in bytes.

Link copied to clipboard
const val RECONNECT_DELAY_MS: Long = 2000

Default delay in milliseconds before attempting to reconnect after a disconnection.

Link copied to clipboard
const val TAG: String

Logging tag used for all BleX library log messages.