ACS Audio Jack iOS Library  1.0.0
ACRAudioJackReader.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Advanced Card Systems Ltd. All Rights Reserved.
3  *
4  * This software is the confidential and proprietary information of Advanced
5  * Card Systems Ltd. ("Confidential Information"). You shall not disclose such
6  * Confidential Information and shall use it only in accordance with the terms
7  * of the license agreement you entered into with ACS.
8  */
9 
10 #import <Foundation/Foundation.h>
11 
16 
20 };
21 
26 
32 };
33 
37 typedef enum {
38 
43 
47 enum {
48 
52  ACRProtocolUndefined = 0x00000000,
53 
57  ACRProtocolT0 = 0x00000001,
58 
62  ACRProtocolT1 = 0x00000002,
63 
67  ACRProtocolRaw = 0x00010000,
68 
73 
77  ACRProtocolDefault = 0x80000000,
78 
83  ACRProtocolOptimal = 0x00000000
84 };
85 
89 typedef NSUInteger ACRCardProtocol;
90 
94 typedef enum {
95 
100 
105 
111 
117 
123 
128 
134 } ACRCardState;
135 
139 enum {
140 
145 
150 };
151 
153 enum {
154 
157 
160 
163 
166 };
167 
169 typedef NSUInteger ACRTrackDataOption;
170 
171 @class ACRResult;
172 @class ACRStatus;
173 @class ACRTrackData;
174 @protocol ACRAudioJackReaderDelegate;
175 
181 @interface ACRAudioJackReader : NSObject
182 
186 @property BOOL mute;
187 
191 @property (nonatomic, weak) id<ACRAudioJackReaderDelegate> delegate;
192 
200 - (id)initWithMute:(BOOL)mute;
201 
205 - (void)reset;
206 
211 - (void)resetWithCompletion:(void (^)(void))completion;
212 
218 - (BOOL)sleep;
219 
225 - (BOOL)getFirmwareVersion;
226 
232 - (BOOL)getStatus;
233 
240 - (BOOL)setSleepTimeout:(NSUInteger)timeout;
241 
247 - (void)authenticateWithMasterKey:(const uint8_t *)masterKey length:(NSUInteger)length;
248 
257 - (void)authenticateWithMasterKey:(const uint8_t *)masterKey length:(NSUInteger)length completion:(void (^)(NSInteger))completion;
258 
264 - (BOOL)getCustomId;
265 
276 - (BOOL)setCustomId:(const uint8_t *)customId length:(NSUInteger)length;
277 
283 - (BOOL)getDeviceId;
284 
295 - (BOOL)setMasterKey:(const uint8_t *)masterKey length:(NSUInteger)length;
296 
307 - (BOOL)setAesKey:(const uint8_t *)aesKey length:(NSUInteger)length;
308 
314 - (BOOL)getDukptOption;
315 
325 - (BOOL)setDukptOption:(BOOL)enabled;
326 
339 - (BOOL)initializeDukptWithIksn:(const uint8_t *)iksn iksnLength:(NSUInteger)iksnLength ipek:(const uint8_t *)ipek ipekLength:(NSUInteger)ipekLength;
340 
346 - (BOOL)getTrackDataOption;
347 
361 - (BOOL)setTrackDataOption:(ACRTrackDataOption)option;
362 
371 - (BOOL)piccPowerOnWithTimeout:(NSUInteger)timeout cardType:(NSUInteger)cardType;
372 
381 - (BOOL)piccTransmitWithTimeout:(NSUInteger)timeout commandApdu:(const uint8_t *)commandApdu length:(NSUInteger)length;
382 
388 - (BOOL)piccPowerOff;
389 
397 - (BOOL)setPiccRfConfig:(const uint8_t *)rfConfig length:(NSUInteger)length;
398 
410 - (NSData *)powerCardWithAction:(ACRCardPowerAction)action slotNum:(NSUInteger)slotNum timeout:(NSTimeInterval)timeout error:(NSError **)errorPtr;
411 
425 - (ACRCardProtocol)setProtocol:(ACRCardProtocol)preferredProtocols slotNum:(NSUInteger)slotNum timeout:(NSTimeInterval)timeout error:(NSError **)errorPtr;
426 
437 - (NSData *)transmitApdu:(NSData *)command slotNum:(NSUInteger)slotNum timeout:(NSTimeInterval)timeout error:(NSError **)errorPtr;
438 
450 - (NSData *)transmitApdu:(const uint8_t *)command length:(NSUInteger)length slotNum:(NSUInteger)slotNum timeout:(NSTimeInterval)timeout error:(NSError **)errorPtr;
451 
463 - (NSData *)transmitControlCommand:(NSData *)command controlCode:(NSUInteger)controlCode slotNum:(NSUInteger)slotNum timeout:(NSTimeInterval)timeout error:(NSError **)errorPtr;
464 
477 - (NSData *)transmitControlCommand:(const uint8_t *)command length:(NSUInteger)length controlCode:(NSUInteger)controlCode slotNum:(NSUInteger)slotNum timeout:(NSTimeInterval)timeout error:(NSError **)errorPtr;
478 
486 - (void)updateCardStateWithSlotNumber:(NSUInteger)slotNum timeout:(NSTimeInterval)timeout error:(NSError **)errorPtr;
487 
493 - (NSData *)getAtrWithSlotNumber:(NSUInteger)slotNum;
494 
500 - (ACRCardState)getCardStateWithSlotNumber:(NSUInteger)slotNum;
501 
507 - (ACRCardProtocol)getProtocolWithSlotNumber:(NSUInteger)slotNum;
508 
516 - (BOOL)sendCommand:(const void *)buffer length:(NSUInteger)length;
517 
524 - (NSData *)createFrame:(const void *)buffer length:(NSUInteger)length;
525 
532 - (BOOL)sendFrame:(NSData *)frameData;
533 
542 - (BOOL)verifyData:(const void *)buffer length:(NSUInteger)length;
543 
544 @end
545 
550 @protocol ACRAudioJackReaderDelegate <NSObject>
551 @optional
552 
557 - (void)readerDidReset:(ACRAudioJackReader *)reader;
558 
564 - (void)reader:(ACRAudioJackReader *)reader didNotifyResult:(ACRResult *)result;
565 
571 - (void)reader:(ACRAudioJackReader *)reader didSendFirmwareVersion:(NSString *)firmwareVersion;
572 
578 - (void)reader:(ACRAudioJackReader *)reader didSendStatus:(ACRStatus *)status;
579 
584 - (void)readerDidNotifyTrackData:(ACRAudioJackReader *)reader;
585 
591 - (void)reader:(ACRAudioJackReader *)reader didSendTrackData:(ACRTrackData *)trackData;
592 
599 - (void)reader:(ACRAudioJackReader *)reader didSendRawData:(const uint8_t *)rawData length:(NSUInteger)length;
600 
606 - (void)reader:(ACRAudioJackReader *)reader didAuthenticate:(NSInteger)errorCode;
607 
614 - (void)reader:(ACRAudioJackReader *)reader didSendCustomId:(const uint8_t *)customId length:(NSUInteger)length;
615 
622 - (void)reader:(ACRAudioJackReader *)reader didSendDeviceId:(const uint8_t *)deviceId length:(NSUInteger)length;
623 
629 - (void)reader:(ACRAudioJackReader *)reader didSendDukptOption:(BOOL)enabled;
630 
639 - (void)reader:(ACRAudioJackReader *)reader didSendTrackDataOption:(ACRTrackDataOption)option;
640 
647 - (void)reader:(ACRAudioJackReader *)reader didSendPiccAtr:(const uint8_t *)atr length:(NSUInteger)length;
648 
655 - (void)reader:(ACRAudioJackReader *)reader didSendPiccResponseApdu:(const uint8_t *)responseApdu length:(NSUInteger)length;
656 
657 @end
This is the mask of ISO defined transmission protocols.
Definition: ACRAudioJackReader.h:72
Success.
Definition: ACRAudioJackReader.h:17
T=1 is the active protocol.
Definition: ACRAudioJackReader.h:62
Cycle power and reset the card.
Definition: ACRAudioJackReader.h:40
ISO14443 Type B.
Definition: ACRAudioJackReader.h:28
The ACRAudioJackReader class represents ACS audio jack readers.
Definition: ACRAudioJackReader.h:181
Control code for sending APDU to the reader.
Definition: ACRAudioJackReader.h:149
Timeout.
Definition: ACRAudioJackReader.h:19
BOOL getDeviceId()
Gets the device ID from the reader.
ACRCardState
Card state.
Definition: ACRAudioJackReader.h:94
BOOL sleep()
Sets the reader to sleep.
Enable the masked track 2 data.
Definition: ACRAudioJackReader.h:165
Enable the encrypted track 2 data.
Definition: ACRAudioJackReader.h:159
The library is unaware of the current state of the reader.
Definition: ACRAudioJackReader.h:99
BOOL piccPowerOff()
Powers off the PICC.
Use the default transmission parameters or card clock frequency.
Definition: ACRAudioJackReader.h:77
NSUInteger ACRCardProtocol
Card protocol.
Definition: ACRAudioJackReader.h:89
Raw is the active protocol.
Definition: ACRAudioJackReader.h:67
Enable the masked track 1 data.
Definition: ACRAudioJackReader.h:162
T=0 is the active protocol.
Definition: ACRAudioJackReader.h:57
FeliCa 424kbps.
Definition: ACRAudioJackReader.h:30
The ACRStatus class represents the status.
Definition: ACRStatus.h:17
Use optimal transmission parameters or card clock frequency.
Definition: ACRAudioJackReader.h:83
ACRAuthError
Authentication error.
Definition: ACRAudioJackReader.h:15
There is no card in the reader.
Definition: ACRAudioJackReader.h:104
BOOL getTrackDataOption()
Gets the track data option from the reader.
BOOL getDukptOption()
Gets the DUKPT option from the reader.
ACRPiccCardType
PICC card type.
Definition: ACRAudioJackReader.h:25
id< ACRAudioJackReaderDelegate > delegate
The delegate object specified to receive the audio jack reader events.
Definition: ACRAudioJackReader.h:191
There is no active protocol.
Definition: ACRAudioJackReader.h:52
The card has been reset and specific communication protocols have been established.
Definition: ACRAudioJackReader.h:133
NSUInteger ACRTrackDataOption
Track data option.
Definition: ACRAudioJackReader.h:169
Failure.
Definition: ACRAudioJackReader.h:18
FeliCa 212kbps.
Definition: ACRAudioJackReader.h:29
Power is being provided to the card, but the library is unaware of the mode of the card...
Definition: ACRAudioJackReader.h:122
There is a card in the reader, but it has not been moved into position for use.
Definition: ACRAudioJackReader.h:110
BOOL getStatus()
Gets the status.
The ACRResult class represents the result.
Definition: ACRResult.h:35
ACRCardPowerAction
Card power action.
Definition: ACRAudioJackReader.h:37
Enable the encrypted track 1 data.
Definition: ACRAudioJackReader.h:156
BOOL getFirmwareVersion()
Gets the firmware version.
BOOL getCustomId()
Gets the custom ID from the reader.
Control code for sending escape command to the reader.
Definition: ACRAudioJackReader.h:144
BOOL mute
YES to mute the audio output, otherwise NO.
Definition: ACRAudioJackReader.h:186
ISO14443 Type A.
Definition: ACRAudioJackReader.h:27
Force a reset on the card.
Definition: ACRAudioJackReader.h:41
The ACRTrackData class represents the track data after swiping a card from the reader.
Definition: ACRTrackData.h:39
Power down the card.
Definition: ACRAudioJackReader.h:39
The card has been reset and is awaiting PTS negotiation.
Definition: ACRAudioJackReader.h:127
void reset()
Resets the reader.
Auto RATS.
Definition: ACRAudioJackReader.h:31
There is a card in the reader in position for use.
Definition: ACRAudioJackReader.h:116