Service
public class Service
extension Service: Equatable
Service is a class implementing ReactiveX which wraps CoreBluetooth functions related to interaction with CBService
-
Intance of CoreBluetooth service class
Declaration
Swift
public let service: CBService
-
Peripheral to which this service belongs
Declaration
Swift
public let peripheral: Peripheral
-
True if service is primary service
Declaration
Swift
public var isPrimary: Bool { get }
-
Service’s UUID
Declaration
Swift
public var uuid: CBUUID { get }
-
Service’s included services
Declaration
Swift
public var includedServices: [Service]? { get }
-
Service’s characteristics
Declaration
Swift
public var characteristics: [Characteristic]? { get }
-
Function that triggers characteristics discovery for specified Services and identifiers. Discovery is called after subscribtion to
Observable
is made.Observable can ends with following errors:
BluetoothError.characteristicsDiscoveryFailed
BluetoothError.peripheralDisconnected
BluetoothError.destroyed
BluetoothError.bluetoothUnsupported
BluetoothError.bluetoothUnauthorized
BluetoothError.bluetoothPoweredOff
BluetoothError.bluetoothInUnknownState
BluetoothError.bluetoothResetting
Declaration
Swift
public func discoverCharacteristics(_ characteristicUUIDs: [CBUUID]?) -> Single<[Characteristic]>
Parameters
identifiers
Identifiers 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.Return Value
Single
that emitsnext
with array ofCharacteristic
instances, once they’re discovered. If not all requested characteristics are discovered,RxError.noElements
error is emmited. -
Function that triggers included services discovery for specified services. Discovery is called after subscribtion to
Observable
is made.Observable can ends with following errors:
BluetoothError.includedServicesDiscoveryFailed
BluetoothError.peripheralDisconnected
BluetoothError.destroyed
BluetoothError.bluetoothUnsupported
BluetoothError.bluetoothUnauthorized
BluetoothError.bluetoothPoweredOff
BluetoothError.bluetoothInUnknownState
BluetoothError.bluetoothResetting
Declaration
Swift
public func discoverIncludedServices(_ includedServiceUUIDs: [CBUUID]?) -> Single<[Service]>
Parameters
includedServiceUUIDs
Identifiers 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.Return Value
Single
that emitsnext
with array ofService
instances, once they’re discovered. If not all requested services are discovered,RxError.noElements
error is emmited.