simulateConnection

fun simulateConnection(preferredPhy: List<Phy> = listOf(Phy.PHY_LE_1M))

Simulates the situation when another application on the device tries to connects to the device.

If the device is already connected, the connections count will be increased. Otherwise, the PeripheralSpecEventHandler.onConnectionRequest will be called, and if the connection is accepted, the connections count will be increased.

If the device advertises with MockAdvertisingSet.isAdvertisingWhenConnected flag set to false the advertisement will stop.

A manager registered for connection event will be notified.

// TODO The preferred PHYs are ignored for now. It is not set as active PHY upon connection.

Parameters

preferredPhy

List of preferred PHYs for the connection.

Throws

if the peripheral is not connectable.