simulateConnection
fun simulateConnection(phy: PrimaryPhy = PrimaryPhy.PHY_LE_1M, mtu: Int = maxAttMtu ?: ATT_MTU_DEFAULT)
Simulates the situation when another application on the device tries to connect 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.
Parameters
phy
The PHY used to connect to the peripheral.
mtu
The ATT MTU negotiated for the connection, defaults to the max ATT MTU supported by the PeripheralSpec.
Throws
if the peripheral is not connectable.