Peripheral
public class Peripheral
extension Peripheral: Equatable
                Peripheral is a class implementing ReactiveX API which wraps all Core Bluetooth functions allowing to talk to peripheral like discovering characteristics, services and all of the read/write calls.
- 
                  
                  
Intance of CentralManager which is used to the bluetooth communication
Declaration
Swift
public unowned let manager: CentralManager - 
                  
                  
Implementation of peripheral
Declaration
Swift
public let peripheral: CBPeripheral - 
                  
                  
Attaches RxBluetoothKit delegate to CBPeripheral. This method is useful in cases when delegate of CBPeripheral was reassigned outside of RxBluetoothKit library (e.g. CBPeripheral was used in some other library or used in non-reactive way)
Declaration
Swift
public func attach() - 
                  
                  
Value indicating if peripheral is currently in connected state.
Declaration
Swift
public var isConnected: Bool { get } - 
                  
                  
Current state of
Peripheralinstance described by CBPeripheralState.Declaration
Swift
public var state: CBPeripheralState { get }Return Value
Current state of
PeripheralasCBPeripheralState. - 
                  
                  
Current name of
Peripheralinstance. Analogous to name ofCBPeripheral.Declaration
Swift
public var name: String? { get } - 
                  
                  
Unique identifier of
Peripheralinstance. Assigned once peripheral is discovered by the system.Declaration
Swift
public var identifier: UUID { get } - 
                  
                  
YES if the remote device has space to send a write without response. If this value is NO, the value will be set to YES after the current writes have been flushed, and
peripheralIsReadyToSendWriteWithoutResponse:will be called.Declaration
Swift
public var canSendWriteWithoutResponse: Bool { get } 
- 
                  
                  
Continuous value indicating if peripheral is in connected state. This is continuous value, which emits
.nextwhenever state change occursObservable can ends with following errors:
Declaration
Swift
public func observeConnection() -> Observable<Bool> - 
                  
                  
Establishes connection with a given
Peripheral. For more information look intoCentralManager.establishConnection(with:options:)because this method calls it directly.Observable can ends with following errors:
BluetoothError.peripheralIsAlreadyObservingConnectionBluetoothError.peripheralConnectionFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func establishConnection(options: [String : Any]? = nil) -> Observable<Peripheral>Parameters
optionsDictionary to customise the behaviour of connection.
Return Value
Observablewhich emitsnextevent after connection is established. 
- 
                  
                  
Triggers discover of specified services of peripheral. If the servicesUUIDs parameter is nil, all the available services of the peripheral are returned; setting the parameter to nil is considerably slower and is not recommended. If all of the specified services are already discovered - these are returned without doing any underlying Bluetooth operations.
Observable can ends with following errors:
BluetoothError.servicesDiscoveryFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func discoverServices(_ serviceUUIDs: [CBUUID]?) -> Single<[Service]>Parameters
serviceUUIDsReturn Value
Singlethat emitsnextwith array ofServiceinstances, once they’re discovered. - 
                  
                  
Function that triggers included services discovery for specified services. Discovery is called after subscribtion to
Observableis made. If all of the specified included services are already discovered - these are returned without doing any underlying Bluetooth operations.Observable can ends with following errors:
BluetoothError.includedServicesDiscoveryFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Parameters
includedServiceUUIDsIdentifiers of included services that should be discovered. If
nil- all of the included services will be discovered. If you’ll pass empty array - none of them will be discovered.serviceService of which included services should be discovered.
Return Value
Singlethat emitsnextwith array ofServiceinstances, once they’re discovered. 
- 
                  
                  
Function that triggers characteristics discovery for specified Services and identifiers. Discovery is called after subscribtion to
Observableis made. If all of the specified characteristics are already discovered - these are returned without doing any underlying Bluetooth operations.Observable can ends with following errors:
BluetoothError.characteristicsDiscoveryFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func discoverCharacteristics(_ characteristicUUIDs: [CBUUID]?, for service: Service) -> Single<[Characteristic]>Parameters
characteristicUUIDsIdentifiers of characteristics that should be discovered. If
nil- all of the characteristics will be discovered. If you’ll pass empty array - none of them will be discovered.serviceService of which characteristics should be discovered.
Return Value
Singlethat emitsnextwith array ofCharacteristicinstances, once they’re discovered. - 
                  
                  
Function that allow to observe writes that happened for characteristic.
Observable can ends with following errors:
BluetoothError.characteristicWriteFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func observeWrite(for characteristic: Characteristic? = nil) -> Observable<Characteristic>Parameters
characteristicOptional
Characteristicof which value changes should be observed. When not specified it will observe for anyCharacteristic.Return Value
Observable that emits
nextwithCharacteristicinstance every time when write has happened. It’s infinite stream, so.completeis never called. - 
                  
                  
The maximum amount of data, in bytes, that can be sent to a characteristic in a single write.
Seealso
writeValue(_:for:type:)Declaration
Swift
@available(OSX 10.12, iOS 9.0, *) public func maximumWriteValueLength(for type: CBCharacteristicWriteType) -> IntParameters
typeType of write operation. Possible values:
.withResponse,.withoutResponse - 
                  
                  
Function that triggers write of data to characteristic. Write is called after subscribtion to
Observableis made. Behavior of this function strongly depends on CBCharacteristicWriteType, so be sure to check this out before usage of the method.Behavior is following:
withResponse- Observable emitsnextwithCharacteristicinstance write was confirmed without any errors. Immediately after thatcompleteis called. If any problem has happened, errors are emitted.withoutResponse- Observable emitsnextwithCharacteristicinstance once write was called. Immediately after that.completeis called. Result of this call is not checked, so as a user you are not sure if everything completed successfully. Errors are not emitted. It ensures that peripheral is ready to write without response by listening to the proper delegate method
Observable can ends with following errors:
BluetoothError.characteristicWriteFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func writeValue(_ data: Data, for characteristic: Characteristic, type: CBCharacteristicWriteType, canSendWriteWithoutResponseCheckEnabled: Bool = true) -> Single<Characteristic>Parameters
dataData that’ll be written to
CharacteristicinstancecharacteristicCharacteristicinstance to write value to.typeType of write operation. Possible values:
.withResponse,.withoutResponsecanSendWriteWithoutResponseCheckEnabledcheck if canSendWriteWithoutResponse should be enabled. Done because of internal MacOS bug.
Return Value
Observable that emission depends on
CBCharacteristicWriteTypepassed to the function call. - 
                  
                  
Function that allow to observe value updates for
Characteristicinstance.Observable can ends with following errors:
BluetoothError.characteristicReadFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func observeValueUpdate(for characteristic: Characteristic? = nil) -> Observable<Characteristic>Parameters
characteristicOptional
Characteristicof which value changes should be observed. When not specified it will observe for anyCharacteristic.Return Value
Observable that emits
nextwithCharacteristicinstance every time when value has changed. It’s infinite stream, so.completeis never called. - 
                  
                  
Function that triggers read of current value of the
Characteristicinstance. Read is called after subscription toObservableis made.Observable can ends with following errors:
BluetoothError.characteristicReadFailed
Declaration
Swift
public func readValue(for characteristic: Characteristic) -> Single<Characteristic>Parameters
characteristicCharacteristicto read value fromReturn Value
Singlewhich emitsnextwith given characteristic when value is ready to read. - 
                  
                  
Setup characteristic notification in order to receive callbacks when given characteristic has been changed. Returned observable will emit
Characteristicon every notification change. It is possible to setup more observables for the same characteristic and the lifecycle of the notification will be shared among them.Notification is automaticaly unregistered once this observable is unsubscribed
This is infinite stream of values.
Observable can ends with following errors:
BluetoothError.characteristicReadFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func observeValueUpdateAndSetNotification(for characteristic: Characteristic) -> Observable<Characteristic>Parameters
characteristicCharacteristicfor notification setup.Return Value
ObservableemittingCharacteristicwhen given characteristic has been changed. - 
                  
                  
Use this function in order to know the exact time, when isNotyfing value has changed on a Characteristic.
Observable can ends with following errors:
BluetoothError.characteristicSetNotifyValueFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func observeNotifyValue(for characteristic: Characteristic) -> Observable<Characteristic>Parameters
characteristicCharacteristicwhich you observe for isNotyfing changes.Return Value
ObservableemittingCharacteristicwhen given characteristic has changed it’s isNoytfing value. 
- 
                  
                  
Function that triggers descriptors discovery for characteristic If all of the descriptors are already discovered - these are returned without doing any underlying Bluetooth operations.
Observable can ends with following errors:
BluetoothError.descriptorsDiscoveryFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func discoverDescriptors(for characteristic: Characteristic) -> Single<[Descriptor]>Parameters
characteristicCharacteristicinstance for which descriptors should be discovered.Return Value
Singlethat emitsnextwith array ofDescriptorinstances, once they’re discovered. - 
                  
                  
Function that allow to observe writes that happened for descriptor.
Observable can ends with following errors:
BluetoothError.descriptorWriteFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func observeWrite(for descriptor: Descriptor? = nil) -> Observable<Descriptor>Parameters
descriptorOptional
Descriptorof which value changes should be observed. When not specified it will observe for anyDescriptor.Return Value
Observable that emits
nextwithDescriptorinstance every time when write has happened. It’s infinite stream, so.completeis never called. - 
                  
                  
Function that allow to observe value updates for
Descriptorinstance.Observable can ends with following errors:
BluetoothError.descriptorReadFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func observeValueUpdate(for descriptor: Descriptor? = nil) -> Observable<Descriptor>Parameters
descriptorOptional
Descriptorof which value changes should be observed. When not specified it will observe for anyDescriptor.Return Value
Observable that emits
nextwithDescriptorinstance every time when value has changed. It’s infinite stream, so.completeis never called. - 
                  
                  
Function that triggers read of current value of the
Descriptorinstance. Read is called after subscription toObservableis made.Observable can ends with following errors:
BluetoothError.descriptorReadFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func readValue(for descriptor: Descriptor) -> Single<Descriptor>Parameters
descriptorDescriptorto read value fromReturn Value
Singlewhich emitsnextwith given descriptor when value is ready to read. - 
                  
                  
Function that triggers write of data to descriptor. Write is called after subscribtion to
Observableis made.Observable can ends with following errors:
BluetoothError.descriptorWriteFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func writeValue(_ data: Data, for descriptor: Descriptor) -> Single<Descriptor>Parameters
dataDatathat’ll be written toDescriptorinstancedescriptorDescriptorinstance to write value to.Return Value
Singlethat emitsnextwithDescriptorinstance, once value is written successfully. 
- 
                  
                  
Function that triggers read of
PeripheralRSSI value. Read is called after subscription toObservableis made.Observable can ends with following errors:
BluetoothError.peripheralRSSIReadFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func readRSSI() -> Single<(Peripheral, Int)>Return Value
Singlethat emits tuple:(Peripheral, Int)once new RSSI value is read.Intis new RSSI value,Peripheralis returned to allow easier chaining. - 
                  
                  
Function that allow user to observe incoming
nameproperty changes ofPeripheralinstance.Observable can ends with following errors:
Declaration
Swift
public func observeNameUpdate() -> Observable<(Peripheral, String?)>Return Value
Observablethat emits tuples:(Peripheral, String?)when name has changed. It’soptional Stringbecause peripheral could also lost his name. It’s infinite stream of values, so.completeis never emitted. - 
                  
                  
Function that allow to observe incoming service modifications for
Peripheralinstance. In case you’re interested what exact changes might occur - please refer to Apple DocumentationObservable can ends with following errors:
Declaration
Swift
public func observeServicesModification() -> Observable<(Peripheral, [Service])>Return Value
Observablethat emits tuples:(Peripheral, [Service])when services were modified. It’s infinite stream of values, so.completeis never emitted. - 
                  
                  
Resulting observable emits next element if call to
writeValue:forCharacteristic:type:has failed, to indicate when peripheral is again ready to send characteristic value updates again.Declaration
Swift
public func observeWriteWithoutResponseReadiness() -> Observable<Void> - 
                  
                  
Function that allow to open L2CAP channel for
Peripheralinstance. For more information, please refer to What’s New in CoreBluetooth, 712, WWDC 2017Since
iOS 11, tvOS 11, watchOS 4Observable can ends with following errors:
BluetoothError.openingL2CAPChannelFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
@available(iOS 11, OSX 10.14, tvOS 11, watchOS 4, *) public func openL2CAPChannel(PSM: CBL2CAPPSM) -> Single<CBL2CAPChannel>Parameters
PSMPSM(Protocol/Service Multiplexer) of the channelReturn Value
Singlethat emitsCBL2CAPChannelwhen channel has opened - 
                  
                  
Function used to receive service with given identifier. It’s taken from cache if it’s available, or directly by
discoverServicescallObservable can ends with following errors:
RxError.noElementsBluetoothError.servicesDiscoveryFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func service(with identifier: ServiceIdentifier) -> Single<Service>Parameters
identifierUnique identifier of Service
Return Value
Singlewhich emitsnextevent, when specified service has been found. - 
                  
                  
Function used to receive characteristic with given identifier. If it’s available it’s taken from cache. Otherwise - directly by
discoverCharacteristicscallObservable can ends with following errors:
RxError.noElementsBluetoothError.characteristicsDiscoveryFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func characteristic(with identifier: CharacteristicIdentifier) -> Single<Characteristic>Parameters
identifierUnique identifier of Characteristic, that has information about service which characteristic belongs to.
Return Value
Singlewhich emitsnextevent, when specified characteristic has been found. - 
                  
                  
Function used to receive descriptor with given identifier. If it’s available it’s taken from cache. Otherwise - directly by
discoverDescriptorcallObservable can ends with following errors:
RxError.noElementsBluetoothError.descriptorsDiscoveryFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func descriptor(with identifier: DescriptorIdentifier) -> Single<Descriptor>Parameters
identifierUnique identifier of Descriptor, that has information about characteristic which descriptor belongs to.
Return Value
Singlewhich emitsnextevent, when specified descriptor has been found. - 
                  
                  
Function that allow to observe writes that happened for characteristic.
Observable can ends with following errors:
BluetoothError.characteristicWriteFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func observeWrite(for identifier: CharacteristicIdentifier) -> Observable<Characteristic>Parameters
identifierIdentifier of characteristic of which value writes should be observed.
Return Value
Observable that emits
nextwithCharacteristicinstance every time when write has happened. It’s infinite stream, so.completeis never called. - 
                  
                  
Function that triggers write of data to characteristic. Write is called after subscribtion to
Observableis made. Behavior of this function strongly depends on CBCharacteristicWriteType, so be sure to check this out before usage of the method.WithResponse- Observable emitsnextwithCharacteristicinstance write was confirmed without any errors. Immediately after thatcompleteis called. If any problem has happened, errors are emitted.WithoutResponse- Observable emitsnextwithCharacteristicinstance once write was called. Immediately after that.completeis called. Result of this call is not checked, so as a user you are not sure if everything completed successfully. Errors are not emitted
Observable can ends with following errors:
BluetoothError.characteristicWriteFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func writeValue(_ data: Data, for identifier: CharacteristicIdentifier, type: CBCharacteristicWriteType) -> Single<Characteristic>Parameters
dataData that’ll be written written to
CharacteristicinstanceforCharacteristicWithIdentifierunique identifier of characteristic, which also holds information about service characteristic belongs to.
typeType of write operation. Possible values:
.withResponse,.withoutResponseReturn Value
Observable that emition depends on
CBCharacteristicWriteTypepassed to the function call. Behavior is following: - 
                  
                  
Function that allow to observe value updates for
Characteristicinstance.Observable can ends with following errors:
BluetoothError.characteristicReadFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func observeValueUpdate(for identifier: CharacteristicIdentifier) -> Observable<Characteristic>Parameters
identifierunique identifier of characteristic, which also holds information about service that characteristic belongs to.
Return Value
Observable that emits
nextwithCharacteristicinstance every time when value has changed. It’s infinite stream, so.completeis never called. - 
                  
                  
Function that triggers read of current value of the
Characteristicinstance. Read is called after subscription toObservableis made.Observable can ends with following errors:
BluetoothError.characteristicReadFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func readValue(for identifier: CharacteristicIdentifier) -> Single<Characteristic>Parameters
identifierunique identifier of characteristic, which also holds information about service that characteristic belongs to.
Return Value
Observable which emits
nextwith given characteristic when value is ready to read. Immediately after that.completeis emitted. - 
                  
                  
Setup characteristic notification in order to receive callbacks when given characteristic has been changed. Returned observable will emit
Characteristicon every notification change. It is possible to setup more observables for the same characteristic and the lifecycle of the notification will be shared among them.Notification is automaticaly unregistered once this observable is unsubscribed
This is infinite stream of values.
Observable can ends with following errors:
BluetoothError.characteristicReadFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func observeValueUpdateAndSetNotification(for identifier: CharacteristicIdentifier) -> Observable<Characteristic>Parameters
characteristicCharacteristicfor notification setup.Return Value
ObservableemittingCharacteristicwhen given characteristic has been changed. - 
                  
                  
Function that triggers descriptors discovery for characteristic
Observable can ends with following errors:
BluetoothError.descriptorsDiscoveryFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func discoverDescriptors(for identifier: CharacteristicIdentifier) -> Single<[Descriptor]>Parameters
identifierunique identifier of descriptor, which also holds information about characteristic that descriptor belongs to.
Return Value
Singlethat emitsnextwith array ofDescriptorinstances, once they’re discovered. - 
                  
                  
Function that allow to observe writes that happened for descriptor.
Observable can ends with following errors:
BluetoothError.descriptorWriteFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func observeWrite(for identifier: DescriptorIdentifier) -> Observable<Descriptor>Parameters
identifierunique identifier of descriptor, which also holds information about characteristic that descriptor belongs to.
Return Value
Observable that emits
nextwithDescriptorinstance every time when write has happened. It’s infinite stream, so.completeis never called. - 
                  
                  
Function that triggers write of data to descriptor. Write is called after subscribtion to
Observableis made.Observable can ends with following errors:
BluetoothError.descriptorWriteFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func writeValue(_ data: Data, for identifier: DescriptorIdentifier) -> Single<Descriptor>Parameters
dataDatathat’ll be written toDescriptorinstanceidentifierunique identifier of descriptor, which also holds information about characteristic that descriptor belongs to.
Return Value
Singlethat emitsnextwithDescriptorinstance, once value is written successfully. - 
                  
                  
Function that allow to observe value updates for
Descriptorinstance.Observable can ends with following errors:
BluetoothError.descriptorReadFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func observeValueUpdate(for identifier: DescriptorIdentifier) -> Observable<Descriptor>Parameters
identifierunique identifier of descriptor, which also holds information about characteristic that descriptor belongs to.
Return Value
Observable that emits
nextwithDescriptorinstance every time when value has changed. It’s infinite stream, so.completeis never called. - 
                  
                  
Function that triggers read of current value of the
Descriptorinstance. Read is called after subscription toObservableis made.Observable can ends with following errors:
BluetoothError.descriptorReadFailedBluetoothError.peripheralDisconnectedBluetoothError.destroyedBluetoothError.bluetoothUnsupportedBluetoothError.bluetoothUnauthorizedBluetoothError.bluetoothPoweredOffBluetoothError.bluetoothInUnknownStateBluetoothError.bluetoothResetting
Declaration
Swift
public func readValue(for identifier: DescriptorIdentifier) -> Single<Descriptor>Parameters
identifierDescriptorto read value fromReturn Value
Observable which emits
nextwith given descriptor when value is ready to read. Immediately after that.completeis emitted. 
View on GitHub
        Peripheral Class Reference