 
     // Disposable map for every transaction.
     private let transactions = DisposableMap<String>()
+
+    // Map of pending read operations.
+    private var pendingReads = Dictionary<Double, Int>()
 
     // MARK: Lifecycle -------------------------------------------------------------------------------------------------
 

    private func safeReadCharacteristicForDevice(_ characteristicObservable: Observable<Characteristic>,
                                                              transactionId: String,
                                                                    promise: SafePromise) {
        let disposable = characteristicObservable
            .flatMap { $0.readValue() }
            .subscribe(
                onNext: { characteristic in
                    promise.resolve(characteristic.asJSObject)

                onDisposed: { [weak self] in
                    self?.transactions.removeDisposable(transactionId)
                    BleError.cancelled().callReject(promise)
                    if let id = characteristicIdentifier {
                        let reads = self?.pendingReads[id] ?? 0
                        if reads > 0 {
                            self?.pendingReads[id] = reads - 1
                        }
                    }
                }
            )

