Builder

class Builder<ID : Any>

The builder for the PeripheralSpec.

Parameters

identifier

The peripheral identifier.

proximity

Approximate distance to the peripheral.

Type Parameters

ID

The type of the peripheral identifier.

Functions

Link copied to clipboard
fun advertising(parameters: AdvertisingSetParameters = LegacyAdvertisingSetParameters(true), delay: Duration = Duration.ZERO, maxAdvertisingEvents: @Range(from = 1, to = 255) Int, isAdvertisingWhenConnected: Boolean = false, isBeacon: Boolean = false, advertisingData: AdvertisingDataScope.() -> Unit)
fun advertising(parameters: AdvertisingSetParameters = LegacyAdvertisingSetParameters(true), delay: Duration = Duration.ZERO, timeout: Duration = Duration.INFINITE, isAdvertisingWhenConnected: Boolean = false, isBeacon: Boolean = false, advertisingData: AdvertisingDataScope.() -> Unit)

Adds an advertising set to the peripheral advertisement configuration.

Link copied to clipboard

Makes a connection to the device possible without scanning.

Link copied to clipboard

Builds the PeripheralSpec object.

Link copied to clipboard
fun connectable(name: String, appearance: Int = 0, preferredConnectionInterval: @Range(from = 6, to = 3200) IntRange = IntRange(25, 40), preferredSlaveLatency: @Range(from = 0, to = 499) Int = 0, preferredSupervisionTimeout: @Range(from = 10, to = 3200) Int = 400, maxAttMtu: @Range(from = 23, to = 517) Int = 23, maxL2capMtu: @Range(from = 27, to = 251) Int = 27, isPhyLe2MSupported: Boolean = false, isPhyCodedSupported: Boolean = false, eventHandler: PeripheralSpecEventHandler, services: MockServerScope.() -> Unit)
fun connectable(name: String, appearance: Int = 0, preferredConnectionInterval: @Range(from = 6, to = 3200) IntRange = IntRange(25, 40), preferredSlaveLatency: @Range(from = 0, to = 499) Int = 0, preferredSupervisionTimeout: @Range(from = 10, to = 3200) Int = 400, maxAttMtu: @Range(from = 23, to = 517) Int = 23, maxL2capMtu: @Range(from = 27, to = 251) Int = 27, isPhyLe2MSupported: Boolean = false, isPhyCodedSupported: Boolean = false, isBonded: Boolean = false, eventHandler: PeripheralSpecEventHandler, actualServices: MockServerScope.() -> Unit? = null, cachedServices: MockServerScope.() -> Unit)

Makes the device connectable, but not connected at the moment of initialization.

Link copied to clipboard
fun connected(name: String, appearance: Int = 0, preferredConnectionInterval: @Range(from = 6, to = 3200) IntRange = IntRange(25, 40), preferredSlaveLatency: @Range(from = 0, to = 499) Int = 0, preferredSupervisionTimeout: @Range(from = 10, to = 3200) Int = 400, maxAttMtu: @Range(from = 23, to = 517) Int = 23, maxL2capMtu: @Range(from = 27, to = 251) Int = 27, isPhyLe2MSupported: Boolean = false, isPhyCodedSupported: Boolean = false, isBonded: Boolean = false, eventHandler: PeripheralSpecEventHandler, actualServices: MockServerScope.() -> Unit? = null, cachedServices: MockServerScope.() -> Unit)

Makes the device connectable and already connected to the device at the moment of initialization (if it's in range).

Link copied to clipboard
fun highSpeed(preferredConnectionInterval: @Range(from = 6, to = 3200) IntRange = IntRange(12, 24), preferredSlaveLatency: @Range(from = 0, to = 499) Int = 0, preferredSupervisionTimeout: @Range(from = 10, to = 3200) Int = 100, maxAttMtu: @Range(from = 23, to = 517) Int = 498, maxL2capMtu: @Range(from = 27, to = 251) Int = 251, isPhyLe2MSupported: Boolean = true)

Configures the device for high speed connection.