MockPeripheral

interface MockPeripheral

A simulated peripheral, as seen by its PeripheralSpecEventHandler.

It is the peripheral for which the event was called. The handler can use it to make the peripheral do something, e.g. disconnect, send a notification, or change its services, and to check its state.

The behavior is defined in PeripheralSpec, which implements this interface. See the documentation there for the details of each method.

See also

Inheritors

Properties

Link copied to clipboard
abstract val isBonded: Boolean

Whether the phone has the bond information of the peripheral.

Link copied to clipboard
abstract val isConnected: Boolean

Whether the peripheral is connected.

Link copied to clipboard

Whether the peripheral has the bond information of the phone.

Functions

Link copied to clipboard
abstract fun simulateBondRequest()

The peripheral requests bonding, or a bonding request from the phone is processed.

Link copied to clipboard

The peripheral requests a connection parameters update.

Link copied to clipboard
abstract fun simulateDisconnection()

The peripheral disconnects.

Link copied to clipboard
abstract fun simulateMtuRequest(mtu: Int)

The peripheral requests an MTU exchange. The MTU may be changed only once per connection.

Link copied to clipboard

The peripheral forgets the bond information, for example after a factory reset.

Link copied to clipboard
abstract fun simulateReset()

The peripheral resets. Connected clients get a link loss after the supervision timeout.

Link copied to clipboard
abstract fun simulateServiceChange(newServices: MockServerScope.() -> Unit)

The peripheral changes the services it offers.

Link copied to clipboard
abstract fun simulateValueUpdate(handle: Int, value: ByteArray)

The peripheral notifies clients that the value of a characteristic has changed.