PreviewPeripheral
constructor(scope: CoroutineScope, address: String = "00:11:22:33:44:55", name: String? = "My Device", type: PeripheralType = PeripheralType.LE, rssi: Int = -40, phy: PhyInUse = PhyInUse.PHY_LE_1M, state: ConnectionState = ConnectionState.Closed, services: ServerScope.() -> Unit = {
Service(Service.GENERIC_ACCESS_UUID) {
Characteristic(
uuid = Characteristic.DEVICE_NAME,
property = CharacteristicProperty.READ,
permission = Permission.READ,
)
Characteristic(
uuid = Characteristic.APPEARANCE,
property = CharacteristicProperty.READ,
permission = Permission.READ,
)
Characteristic(
uuid = Characteristic.PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS,
property = CharacteristicProperty.READ,
permission = Permission.READ,
)
}
Service(Service.GENERIC_ATTRIBUTE_UUID) {
Characteristic(
uuid = Characteristic.SERVICE_CHANGED,
property = CharacteristicProperty.INDICATE,
permission = Permission.READ,
)
}
}, hasBondInformation: Boolean = false)
Parameters
scope
The coroutine scope. This can be set to rememberCoroutineScope()
.
address
The MAC address of the peripheral.
name
An optional name of the peripheral.
type
The type of the peripheral, defaults to PeripheralType.LE.
rssi
The signal strength of the peripheral in dBm.
state
The connection state of the peripheral.
services
The list of fake services discovered on the peripheral.
hasBondInformation
true
if the Android device has the bond information for the peripheral, that is, if the peripheral is bonded to the device. Defaults to false
.