 ///     .flatMap { centralManager.add(myService) }
 ///     .flatMap { centralManager.startAdvertising(myAdvertisementData) }
 /// ```
-/// As a result your peripheral will start advertising. To stop advertising simply dispose it:
+/// As a result, your peripheral will start advertising. To stop advertising simply dispose it:
 /// ```
 /// disposable.dispose()
 /// ```


    // MARK: Services

    /// Function that triggers `CBPeripheralManager.add(_:)` method and waits for
    /// delegate `CBPeripheralManagerDelegate.peripheralManager(_:didAdd:error:)` result.
    /// If it will receive non nil error in result than `Observable` will emit `BluetoothError.addingServiceFailed` error.
    /// Add method is called after subscription to `Observable` is made.
    /// - Parameter service: `Characteristic` to read value from
    /// - Returns: `Single` which emits `next` with given characteristic when value is ready to read.

import CoreBluetooth
import RxSwift

/// 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
/// by `observeState()`, observing it's value and then chaining it with `add(_:)` with `startAdvertising(_:)`:
/// ```
/// let disposable = centralManager.observeState
///     .startWith(centralManager.state)
