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 ofobserveStateWithInitialValue()
and then chaining it withscanForPeripherals(_:options:)
:let disposable = centralManager.observeStateWithInitialValue() .filter { $0 == .poweredOn } .take(1) .flatMap { centralManager.scanForPeripherals(nil) }
As a result you will receive
ScannedPeripheral
which containsPeripheral
object,AdvertisementData
and peripheral’s RSSI registered during discovery. You can thenestablishConnection(_:options:)
and do other operations. You can also simply stop scanning with just disposing it:disposable.dispose()
Seealso
Peripheral
Declaration
Swift
public class CentralManager : ManagerType
-
Characteristic is a class implementing ReactiveX which wraps CoreBluetooth functions related to interaction with CBCharacteristic
See moreDeclaration
Swift
public class Characteristic
extension Characteristic: 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.
See moreDeclaration
Swift
public class Descriptor
extension Descriptor: Equatable
-
RxBluetoothKit specific logging class which gives access to its settings.
See moreDeclaration
Swift
public class RxBluetoothKitLog : ReactiveCompatible
-
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 moreDeclaration
Swift
public class Peripheral
extension Peripheral: Equatable
-
PeripheralManager is a class implementing ReactiveX API which wraps all the Core Bluetooth Peripheral’s functions, that allow to advertise, to publish L2CAP channels and more. You can start using this class by adding services and starting advertising. Before calling any public
PeripheralManager
‘s functions you should make sure that Bluetooth is turned on and powered on. It can be done byobserveStateWithInitialValue()
, observing it’s value and then chaining it withadd(_:)
andstartAdvertising(_:)
:let disposable = centralManager.observeStateWithInitialValue() .filter { $0 == .poweredOn } .take(1) .flatMap { centralManager.add(myService) } .flatMap { centralManager.startAdvertising(myAdvertisementData) }
As a result, your peripheral will start advertising. To stop advertising simply dispose it:
See moredisposable.dispose()
Declaration
Swift
public class PeripheralManager : ManagerType
-
Represents instance of scanned peripheral - containing it’s advertisment data, rssi and peripheral itself. To perform further actions
See moreperipheral
instance variable can be used ia. to maintain connection.Declaration
Swift
public class ScannedPeripheral