From 49b4f1210f05405a325391c51328bf90eab826af Mon Sep 17 00:00:00 2001 From: Karibash Date: Tue, 14 Jul 2020 13:28:46 +0900 Subject: [PATCH] Add FeliCa tag reset mode commands --- Sources/NFCTagReader/NFCFeliCaTag+Rx.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Sources/NFCTagReader/NFCFeliCaTag+Rx.swift b/Sources/NFCTagReader/NFCFeliCaTag+Rx.swift index d48acb8..a0eeda9 100644 --- a/Sources/NFCTagReader/NFCFeliCaTag+Rx.swift +++ b/Sources/NFCTagReader/NFCFeliCaTag+Rx.swift @@ -23,6 +23,9 @@ public typealias RxNFCFelicaReadWithoutEncryptionResponse = (statusFlag1: Int, s @available(iOS 13.0, *) public typealias RxNFCFelicaRequestSpecificationVersionResponse = (statusFlag1: Int, statusFlag2: Int, basicVersion: Data, optionVersion: Data) +@available(iOS 13.0, *) +public typealias RxNFCFelicaResetModeResponse = (statusFlag1: Int, statusFlag2: Int) + // MARK: - Extensions - @available(iOS 13.0, *) @@ -150,4 +153,19 @@ extension ObservableType where Element == NFCFeliCaTag { } } + public func resetMode() -> Observable { + flatMap { tag in + Single.create { observer in + tag.resetMode { statusFlag1, statusFlag2, error in + if error != nil { + observer(.error(error!)) + } else { + observer(.success((statusFlag1, statusFlag2))) + } + } + return Disposables.create() + } + } + } + }