Characteristic

abstract fun Characteristic(uuid: Uuid, properties: Set<CharacteristicProperty> = emptySet(), permissions: Set<Permission> = emptySet(), builder: CharacteristicScope.() -> Unit = {}): Int

Declares a characteristic with the given UUID.

Sample code:

val handle = Characteristic(
uuid = <Some UUID>,
properties = CharacteristicProperty.READ and CharacteristicProperty.WRITE,
permissions = Permission.READ and Permission.WRITE,
) {
CharacteristicUserDescriptionDescriptor("Some description")
}

Return

The handle number of the characteristic.

Parameters

uuid

The UUID of the characteristic.

properties

Set of properties of the characteristic.

permissions

The permissions of the characteristic.

builder

Scope of the characteristic.


open fun Characteristic(shortUuid: Int, properties: Set<CharacteristicProperty> = emptySet(), permissions: Set<Permission> = emptySet(), builder: CharacteristicScope.() -> Unit = {}): Int

Declares a characteristic with the given 16 or 32 bit short UUID.

Sample code:

val handle = Characteristic(
shortUuid = <16 or 32-bit UUID>,
properties = CharacteristicProperty.READ and CharacteristicProperty.WRITE,
permissions = Permission.READ and Permission.WRITE,
)

Return

The handle number of the characteristic.

Parameters

shortUuid

The 16 or 32 bit short UUID of the characteristic.

properties

Set of properties of the characteristic.

permissions

The permissions of the characteristic.

builder

Scope of the characteristic.

See also


open fun Characteristic(uuid: Uuid, properties: Set<CharacteristicProperty>, permission: Permission, builder: CharacteristicScope.() -> Unit = {}): Int

Declares a characteristic with the given UUID.

Sample code:

val handle = Characteristic(
uuid = <Some UUID>,
properties = CharacteristicProperty.READ and CharacteristicProperty.NOTIFY,
permission = Permission.READ,
) {
// Note: Client Characteristic Configuration descriptor is added automatically.

CharacteristicUserDescriptionDescriptor("Some description")
}

Return

The handle number of the characteristic.

Parameters

uuid

The UUID of the characteristic.

properties

Set of properties of the characteristic.

permission

The permission of the characteristic.

builder

Scope of the characteristic.


open fun Characteristic(shortUuid: Int, properties: Set<CharacteristicProperty>, permission: Permission, builder: CharacteristicScope.() -> Unit = {}): Int

Declares a characteristic with the given 16 or 32 bit short UUID.

Sample code:

val handle = Characteristic(
shortUuid = <16 pr 32-bit UUID>,
properties = CharacteristicProperty.READ and CharacteristicProperty.NOTIFY,
permission = Permission.READ,
) {
// Note: Client Characteristic Configuration descriptor is added automatically.

CharacteristicUserDescriptionDescriptor("Some description")
}

Return

The handle number of the characteristic.

Parameters

shortUuid

The 16 or 32 bit short UUID of the characteristic.

properties

Set of properties of the characteristic.

permission

The permission of the characteristic.

builder

Scope of the characteristic.

See also


open fun Characteristic(uuid: Uuid, property: CharacteristicProperty, permission: Permission, builder: CharacteristicScope.() -> Unit = {}): Int

Declares a characteristic with the given UUID.

Sample code:

val handle = Characteristic(
uuid = <Some UUID>,
property = CharacteristicProperty.READ,
permission = Permission.READ,
)

Return

The handle number of the characteristic.

Parameters

uuid

The UUID of the characteristic.

property

Set of properties of the characteristic.

permission

The permission of the characteristic.

builder

Scope of the characteristic.


open fun Characteristic(shortUuid: Int, property: CharacteristicProperty, permission: Permission, builder: CharacteristicScope.() -> Unit = {}): Int

Declares a characteristic with the given 16 or 32 bit short UUID.

Sample code:

val handle = Characteristic(
shortUuid = <16 or 32-bit UUID>,
property = CharacteristicProperty.WRITE,
permission = Permission.WRITE_ENCRYPTED,
)

Return

The handle number of the characteristic.

Parameters

shortUuid

The 16 or 32 bit short UUID of the characteristic.

property

Set of properties of the characteristic.

permission

The permission of the characteristic.

builder

Scope of the characteristic.

See also


open fun Characteristic(uuid: Uuid, property: CharacteristicProperty, builder: CharacteristicScope.() -> Unit = {}): Int

Declares a characteristic with the given UUID without permission to read or write.

Sample code:

val handle = Characteristic(
uuid = <Some UUID>,
property = CharacteristicProperty.NOTIFY,
)

Return

The handle number of the characteristic.

Parameters

uuid

The UUID of the characteristic.

property

Set of properties of the characteristic.

builder

Scope of the characteristic.


open fun Characteristic(shortUuid: Int, property: CharacteristicProperty, builder: CharacteristicScope.() -> Unit = {}): Int

Declares a characteristic with the given 16 or 32 bit short UUID without permission to read or write.

Sample code:

val handle = Characteristic(
shortUuid = <16 or 32-bit UUID>,
property = CharacteristicProperty.READ,
)

Return

The handle number of the characteristic.

Parameters

shortUuid

The 16 or 32 bit short UUID of the characteristic.

property

Set of properties of the characteristic.

builder

Scope of the characteristic.

See also