Descriptor
public class Descriptor
extension Descriptor: Equatable
Descriptor is a class implementing ReactiveX which wraps CoreBluetooth functions related to interaction with CBDescriptor Descriptors provide more information about a characteristic’s value.
-
Intance of CoreBluetooth descriptor class
Declaration
Swift
public let descriptor: CBDescriptor
-
Characteristic to which this descriptor belongs.
Declaration
Swift
public let characteristic: Characteristic
-
The Bluetooth UUID of the
Descriptor
instance.Declaration
Swift
public var uuid: CBUUID { get }
-
The value of the descriptor. It can be written and read through functions on
Descriptor
instance.Declaration
Swift
public var value: Any? { get }
-
Function that allow to observe writes that happened for descriptor.
Observable can ends with following errors:
BluetoothError.descriptorWriteFailed
BluetoothError.peripheralDisconnected
BluetoothError.destroyed
BluetoothError.bluetoothUnsupported
BluetoothError.bluetoothUnauthorized
BluetoothError.bluetoothPoweredOff
BluetoothError.bluetoothInUnknownState
BluetoothError.bluetoothResetting
Declaration
Swift
public func observeWrite() -> Observable<Descriptor>
Return Value
Observable that emits
next
withDescriptor
instance every time when write has happened. It’s infinite stream, so.complete
is never called. -
Function that triggers write of data to descriptor. Write is called after subscribtion to
Observable
is made.Observable can ends with following errors:
BluetoothError.descriptorWriteFailed
BluetoothError.peripheralDisconnected
BluetoothError.destroyed
BluetoothError.bluetoothUnsupported
BluetoothError.bluetoothUnauthorized
BluetoothError.bluetoothPoweredOff
BluetoothError.bluetoothInUnknownState
BluetoothError.bluetoothResetting
Declaration
Swift
public func writeValue(_ data: Data) -> Single<Descriptor>
Parameters
data
Data
that’ll be written toDescriptor
instanceReturn Value
Single
that emitsNext
withDescriptor
instance, once value is written successfully. -
Function that allow to observe value updates for
Descriptor
instance.Observable can ends with following errors:
BluetoothError.descriptorReadFailed
BluetoothError.peripheralDisconnected
BluetoothError.destroyed
BluetoothError.bluetoothUnsupported
BluetoothError.bluetoothUnauthorized
BluetoothError.bluetoothPoweredOff
BluetoothError.bluetoothInUnknownState
BluetoothError.bluetoothResetting
Declaration
Swift
public func observeValueUpdate() -> Observable<Descriptor>
Return Value
Observable that emits
next
withDescriptor
instance every time when value has changed. It’s infinite stream, so.complete
is never called. -
Function that triggers read of current value of the
Descriptor
instance. Read is called after subscription toObservable
is made.Observable can ends with following errors:
BluetoothError.descriptorReadFailed
BluetoothError.peripheralDisconnected
BluetoothError.destroyed
BluetoothError.bluetoothUnsupported
BluetoothError.bluetoothUnauthorized
BluetoothError.bluetoothPoweredOff
BluetoothError.bluetoothInUnknownState
BluetoothError.bluetoothResetting
Declaration
Swift
public func readValue() -> Single<Descriptor>
Return Value
Single
which emitsnext
with given descriptor when value is ready to read.