Classes

The following classes are available globally.

  • CentralManager is a class implementing ReactiveX API which wraps all Core Bluetooth Manager’s functions allowing to discover, connect to remote peripheral devices and more. You can start using this class by discovering available services of nearby peripherals. Before calling any public CentralManager‘s functions you should make sure that Bluetooth is turned on and powered on. It can be done by calling and observing returned value of observeState() and then chaining it with scanForPeripherals(_:options:):

    centralManager.observeState
        .startWith(centralManager.state)
        .filter { $0 == .poweredOn }
        .take(1)
        .flatMap { centralManager.scanForPeripherals(nil) }
    

    As a result you will receive ScannedPeripheral which contains Peripheral object, AdvertisementData and peripheral’s RSSI registered during discovery. You can then establishConnection(_:options:) and do other operations.

    Seealso

    Peripheral
    See more

    Declaration

    Swift

    public class CentralManager
  • Descriptor is a class implementing ReactiveX which wraps CoreBluetooth functions related to interaction with CBDescriptor Descriptors provide more information about a characteristic’s value.

    See more

    Declaration

    Swift

    public class Descriptor
  • 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.

    See more

    Declaration

    Swift

    public class Peripheral
  • Represents instance of scanned peripheral - containing it’s advertisment data, rssi and peripheral itself. To perform further actions peripheral instance variable can be used ia. to maintain connection.

    See more

    Declaration

    Swift

    public class ScannedPeripheral