Skip to content

Commit

Permalink
Merge pull request #6 from Karibash/release/1.1.0
Browse files Browse the repository at this point in the history
Release/1.1.0
  • Loading branch information
Karibash authored Jul 21, 2020
2 parents 5d46ca8 + 0dac719 commit bed281c
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

- [ ] NFCTagReaderSession
- [x] NFCFeliCaTag
- [ ] NFCMiFareTag
- [x] NFCMiFareTag
- [ ] NFCISO15693Tag
- [ ] NFCISO7816Tag
- [ ] NFCNDEFReaderSession
Expand Down
2 changes: 1 addition & 1 deletion RxCoreNFC.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "RxCoreNFC"
spec.version = "1.0.0"
spec.version = "1.1.0"
spec.summary = "Reactive extension for the CoreNFC."
spec.description = <<-DESC
Reactive extension for the CoreNFC.
Expand Down
20 changes: 18 additions & 2 deletions RxCoreNFC.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
E6A6ACC624C1D4C10069F67B /* RxNFCFeliCaRequestSystemCodeResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A6ACC524C1D4C10069F67B /* RxNFCFeliCaRequestSystemCodeResult.swift */; };
E6A6ACC824C1D5450069F67B /* RxNFCFeliCaResetModeResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A6ACC724C1D5450069F67B /* RxNFCFeliCaResetModeResult.swift */; };
E6A6ADD824C46CFA0069F67B /* RxNFCFeliCaSendFeliCaCommandResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A6ADD724C46CFA0069F67B /* RxNFCFeliCaSendFeliCaCommandResult.swift */; };
E6A6AE1024C5E1B60069F67B /* RxNFCMiFareSendMiFareCommandResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A6AE0F24C5E1B60069F67B /* RxNFCMiFareSendMiFareCommandResult.swift */; };
E6A6AE1224C6AB640069F67B /* RxNFCMiFareSendMiFareISO7816CommandResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A6AE1124C6AB640069F67B /* RxNFCMiFareSendMiFareISO7816CommandResult.swift */; };
E6BF06EC249C9D82007E84D3 /* RxCoreNFC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6BF06E2249C9D82007E84D3 /* RxCoreNFC.framework */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -75,6 +77,8 @@
E6A6ACC524C1D4C10069F67B /* RxNFCFeliCaRequestSystemCodeResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RxNFCFeliCaRequestSystemCodeResult.swift; sourceTree = "<group>"; };
E6A6ACC724C1D5450069F67B /* RxNFCFeliCaResetModeResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RxNFCFeliCaResetModeResult.swift; sourceTree = "<group>"; };
E6A6ADD724C46CFA0069F67B /* RxNFCFeliCaSendFeliCaCommandResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RxNFCFeliCaSendFeliCaCommandResult.swift; sourceTree = "<group>"; };
E6A6AE0F24C5E1B60069F67B /* RxNFCMiFareSendMiFareCommandResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RxNFCMiFareSendMiFareCommandResult.swift; sourceTree = "<group>"; };
E6A6AE1124C6AB640069F67B /* RxNFCMiFareSendMiFareISO7816CommandResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RxNFCMiFareSendMiFareISO7816CommandResult.swift; sourceTree = "<group>"; };
E6BF06E2249C9D82007E84D3 /* RxCoreNFC.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxCoreNFC.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E6BF06EB249C9D82007E84D3 /* RxCoreNFCTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RxCoreNFCTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -218,6 +222,7 @@
E6A6ADD524C302F80069F67B /* NFCMiFareTag */ = {
isa = PBXGroup;
children = (
E6A6AE0E24C5E1990069F67B /* Entity */,
E6A2A61B24A631B400282503 /* NFCMiFareTag+Rx.swift */,
);
path = NFCMiFareTag;
Expand All @@ -231,6 +236,15 @@
path = NFCTag;
sourceTree = "<group>";
};
E6A6AE0E24C5E1990069F67B /* Entity */ = {
isa = PBXGroup;
children = (
E6A6AE0F24C5E1B60069F67B /* RxNFCMiFareSendMiFareCommandResult.swift */,
E6A6AE1124C6AB640069F67B /* RxNFCMiFareSendMiFareISO7816CommandResult.swift */,
);
path = Entity;
sourceTree = "<group>";
};
E6BF06D8249C9D82007E84D3 = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -378,7 +392,9 @@
E6A2A61624A6275500282503 /* NFCISO7816Tag+Rx.swift in Sources */,
E6A6ADD824C46CFA0069F67B /* RxNFCFeliCaSendFeliCaCommandResult.swift in Sources */,
E6A2A60E24A377A300282503 /* RxNFCTagReaderSessionEvent.swift in Sources */,
E6A6AE1024C5E1B60069F67B /* RxNFCMiFareSendMiFareCommandResult.swift in Sources */,
E6A2A7F824C1646000282503 /* RxNFCFeliCaRequestServiceV2Result.swift in Sources */,
E6A6AE1224C6AB640069F67B /* RxNFCMiFareSendMiFareISO7816CommandResult.swift in Sources */,
E6A2A61A24A62D5400282503 /* RxNFCReaderError.swift in Sources */,
E6A6ACC824C1D5450069F67B /* RxNFCFeliCaResetModeResult.swift in Sources */,
E6A2A7F224C1619200282503 /* RxNFCFeliCaStatusFlag.swift in Sources */,
Expand Down Expand Up @@ -545,7 +561,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
MARKETING_VERSION = 1.1.0;
PRODUCT_BUNDLE_IDENTIFIER = karibash.RxCoreNFC;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -577,7 +593,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
MARKETING_VERSION = 1.1.0;
PRODUCT_BUNDLE_IDENTIFIER = karibash.RxCoreNFC;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// RxNFCMiFareSendMiFareCommandResult.swift
// RxCoreNFC
//
// Created by Karibash on 2020/07/20.
// Copyright © 2020 Karibash. All rights reserved.
//

import Foundation

@available(iOS 13.0, *)
public struct RxNFCMiFareSendMiFareCommandResult {
let data: Data
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// RxNFCMiFareSendMiFareISO7816CommandResult.swift
// RxCoreNFC
//
// Created by Karibash on 2020/07/21.
// Copyright © 2020 Karibash. All rights reserved.
//

import Foundation

@available(iOS 13.0, *)
public struct RxNFCMiFareSendMiFareISO7816CommandResult {
let data: Data
let sw1: UInt8
let sw2: UInt8
}
46 changes: 46 additions & 0 deletions Sources/NFCMiFareTag/NFCMiFareTag+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,50 @@ import RxSwift

@available(iOS 13.0, *)
extension ObservableType where Element == NFCMiFareTag {

// MARK: - Commands -

/// Sends a native MiFare command to the tag.
/// - Important: For NFCMiFareFamily.ultralight commands, you must calculate a 2-byte CRC value and append it to the end of the command data.
/// - Parameter commandPacket: A MiFare command.
/// - Returns: An NSData object containing the tag's response data for the command.
public func sendMiFareCommand(commandPacket: Data) -> Observable<RxNFCMiFareSendMiFareCommandResult> {
flatMap { tag in
Single.create { observer in
tag.sendMiFareCommand(commandPacket: commandPacket) { data, error in
if error != nil {
observer(.error(error!))
} else {
observer(.success(RxNFCMiFareSendMiFareCommandResult(
data: data
)))
}
}
return Disposables.create()
}
}
}

/// Sends an ISO 7816 command APDU to the tag and receives a response APDU.
/// - Parameter apdu: An ISO 7816-4 command APDU object.
/// - Returns: An APDU response and command processing status byte.
public func sendMiFareISO7816Command(apdu: NFCISO7816APDU) -> Observable<RxNFCMiFareSendMiFareISO7816CommandResult> {
flatMap { tag in
Single.create { observer in
tag.sendMiFareISO7816Command(apdu) { data, sw1, sw2, error in
if error != nil {
observer(.error(error!))
} else {
observer(.success(RxNFCMiFareSendMiFareISO7816CommandResult(
data: data,
sw1: sw1,
sw2: sw2
)))
}
}
return Disposables.create()
}
}
}

}

0 comments on commit bed281c

Please sign in to comment.