ACS Audio Jack iOS Library  1.0.0
ACRAudioJackReader Class Reference

The ACRAudioJackReader class represents ACS audio jack readers. More...

#import <ACRAudioJackReader.h>

Inheritance diagram for ACRAudioJackReader:

Instance Methods

(id) - initWithMute:
 Returns an initialized ACRAudioJackReader object with mute option. More...
 
(void) - reset
 Resets the reader. More...
 
(void) - resetWithCompletion:
 Resets the reader using completion handler. More...
 
(BOOL) - sleep
 Sets the reader to sleep. More...
 
(BOOL) - getFirmwareVersion
 Gets the firmware version. More...
 
(BOOL) - getStatus
 Gets the status. More...
 
(BOOL) - setSleepTimeout:
 Sets the sleep timeout. More...
 
(void) - authenticateWithMasterKey:length:
 Authenticates the reader. More...
 
(void) - authenticateWithMasterKey:length:completion:
 Authenticates the reader using completion handler. More...
 
(BOOL) - getCustomId
 Gets the custom ID from the reader. More...
 
(BOOL) - setCustomId:length:
 Sets the custom ID to the reader. More...
 
(BOOL) - getDeviceId
 Gets the device ID from the reader. More...
 
(BOOL) - setMasterKey:length:
 Sets the master key to the reader. More...
 
(BOOL) - setAesKey:length:
 Sets the AES key to the reader. More...
 
(BOOL) - getDukptOption
 Gets the DUKPT option from the reader. More...
 
(BOOL) - setDukptOption:
 Sets the DUKPT option to the reader. More...
 
(BOOL) - initializeDukptWithIksn:iksnLength:ipek:ipekLength:
 Initializes DUKPT to the reader. More...
 
(BOOL) - getTrackDataOption
 Gets the track data option from the reader. More...
 
(BOOL) - setTrackDataOption:
 Sets the track data option to the reader. More...
 
(BOOL) - piccPowerOnWithTimeout:cardType:
 Powers on the PICC. More...
 
(BOOL) - piccTransmitWithTimeout:commandApdu:length:
 Transmits the command APDU to the PICC. More...
 
(BOOL) - piccPowerOff
 Powers off the PICC. More...
 
(BOOL) - setPiccRfConfig:length:
 Sets the PICC RF configuration. More...
 
(NSData *) - powerCardWithAction:slotNum:timeout:error:
 Performs the power action on the card. More...
 
(ACRCardProtocol- setProtocol:slotNum:timeout:error:
 Sets the protocol. More...
 
(NSData *) - transmitApdu:slotNum:timeout:error:
 Transmits the APDU. More...
 
(NSData *) - transmitApdu:length:slotNum:timeout:error:
 Transmits the APDU. More...
 
(NSData *) - transmitControlCommand:controlCode:slotNum:timeout:error:
 Transmits the control command. More...
 
(NSData *) - transmitControlCommand:length:controlCode:slotNum:timeout:error:
 Transmits the control command. More...
 
(void) - updateCardStateWithSlotNumber:timeout:error:
 Updates the card state. More...
 
(NSData *) - getAtrWithSlotNumber:
 Gets the ATR string. More...
 
(ACRCardState- getCardStateWithSlotNumber:
 Gets the card state. More...
 
(ACRCardProtocol- getProtocolWithSlotNumber:
 Gets the active protocol. More...
 
(BOOL) - sendCommand:length:
 Sends a command to the reader. More...
 
(NSData *) - createFrame:length:
 Creates a frame. More...
 
(BOOL) - sendFrame:
 Sends a frame to the reader. More...
 
(BOOL) - verifyData:length:
 Verifies the data using CRC16 checksum. More...
 

Properties

BOOL mute
 YES to mute the audio output, otherwise NO. More...
 
id< ACRAudioJackReaderDelegate > delegate
 The delegate object specified to receive the audio jack reader events. More...
 

Detailed Description

The ACRAudioJackReader class represents ACS audio jack readers.

Author
Godfrey Chung
Version
1.0, 27 Mar 2013

Method Documentation

◆ authenticateWithMasterKey:length:()

- (void) authenticateWithMasterKey: (const uint8_t *)  masterKey
length: (NSUInteger)  length 

Authenticates the reader.

Parameters
masterKeythe master key.
lengththe master key length must be 16 bytes.

◆ authenticateWithMasterKey:length:completion:()

- (void) authenticateWithMasterKey: (const uint8_t *)  masterKey
length: (NSUInteger)  length
completion: (void(^)(NSInteger))  completion 

Authenticates the reader using completion handler.

Parameters
masterKeythe master key.
lengththe master key length must be 16 bytes.
completionthe block object to be executed when the authentication ends. The block has no return value and takes a single NSInteger argument for an error code.

◆ createFrame:length:()

- (NSData *) createFrame: (const void *)  buffer
length: (NSUInteger)  length 

Creates a frame.

Parameters
bufferthe buffer.
lengththe buffer length.
Returns
the frame data.

◆ getAtrWithSlotNumber:()

- (NSData *) getAtrWithSlotNumber: (NSUInteger)  slotNum

Gets the ATR string.

Parameters
slotNumthe slot number.
Returns
the ATR string.

◆ getCardStateWithSlotNumber:()

- (ACRCardState) getCardStateWithSlotNumber: (NSUInteger)  slotNum

Gets the card state.

Parameters
slotNumthe slot number.
Returns
the card state. See ACRCardState.

◆ getCustomId()

- (BOOL) getCustomId

Gets the custom ID from the reader.

Returns
YES if the request is queued successfully, otherwise NO.

◆ getDeviceId()

- (BOOL) getDeviceId

Gets the device ID from the reader.

Returns
YES if the request is queued successfully, otherwise NO.

◆ getDukptOption()

- (BOOL) getDukptOption

Gets the DUKPT option from the reader.

Returns
YES if the request is queued successfully, otherwise NO.

◆ getFirmwareVersion()

- (BOOL) getFirmwareVersion

Gets the firmware version.

Returns
YES if the request is queued successfully, otherwise NO.

◆ getProtocolWithSlotNumber:()

- (ACRCardProtocol) getProtocolWithSlotNumber: (NSUInteger)  slotNum

Gets the active protocol.

Parameters
slotNumthe slot number.
Returns
the active protocol. See ACRCardProtocol.

◆ getStatus()

- (BOOL) getStatus

Gets the status.

Returns
YES if the request is queued successfully, otherwise NO.

◆ getTrackDataOption()

- (BOOL) getTrackDataOption

Gets the track data option from the reader.

Returns
YES if the request is queued successfully, otherwise NO.

◆ initializeDukptWithIksn:iksnLength:ipek:ipekLength:()

- (BOOL) initializeDukptWithIksn: (const uint8_t *)  iksn
iksnLength: (NSUInteger)  iksnLength
ipek: (const uint8_t *)  ipek
ipekLength: (NSUInteger)  ipekLength 

Initializes DUKPT to the reader.

In order to proceed this operation, your reader must be authenticated.

Parameters
iksnthe initial key serial number (IKSN).
iksnLengththe IKSN length must be 10 bytes.
ipekthe initial PIN encryption key (IPEK).
ipekLengththe IPEK length must be 16 bytes.
Returns
YES if the request is queued successfully, otherwise NO.
See also
- authenticateWithMasterKey:length:
- authenticateWithMasterKey:length:completion:

◆ initWithMute:()

- (id) initWithMute: (BOOL)  mute

Returns an initialized ACRAudioJackReader object with mute option.

Parameters
muteYES to mute the audio output, otherwise NO.
Returns
an initialized ACRAudioJackReader object.

◆ piccPowerOff()

- (BOOL) piccPowerOff

Powers off the PICC.

Returns
YES if the request is queued successfully, otherwise NO.

◆ piccPowerOnWithTimeout:cardType:()

- (BOOL) piccPowerOnWithTimeout: (NSUInteger)  timeout
cardType: (NSUInteger)  cardType 

Powers on the PICC.

Parameters
timeoutthe timeout value in seconds.
cardTypethe card type. See ACRPiccCardType. It can be combined with OR operation.
Returns
YES if the request is queued successfully, otherwise NO.

◆ piccTransmitWithTimeout:commandApdu:length:()

- (BOOL) piccTransmitWithTimeout: (NSUInteger)  timeout
commandApdu: (const uint8_t *)  commandApdu
length: (NSUInteger)  length 

Transmits the command APDU to the PICC.

Parameters
timeoutthe timeout value in seconds.
commandApduthe command APDU.
lengththe command APDU length.
Returns
YES if the request is queued successfully, otherwise NO.

◆ powerCardWithAction:slotNum:timeout:error:()

- (NSData *) powerCardWithAction: (ACRCardPowerAction action
slotNum: (NSUInteger)  slotNum
timeout: (NSTimeInterval)  timeout
error: (NSError **)  errorPtr 

Performs the power action on the card.

Parameters
actionthe action to be performed on the card. See ACRCardPowerAction.
slotNumthe slot number.
timeoutthe maximum time to wait in seconds.
errorPtrif there is an error, upon return contains an NSError object that describes the problem.
Returns
the ATR string if cold reset or warm reset succeeds, otherwise nil.

◆ reset()

- (void) reset

Resets the reader.

◆ resetWithCompletion:()

- (void) resetWithCompletion: (void(^)(void))  completion

Resets the reader using completion handler.

Parameters
completionthe block object to be executed when the reset ends.

◆ sendCommand:length:()

- (BOOL) sendCommand: (const void *)  buffer
length: (NSUInteger)  length 

Sends a command to the reader.

Parameters
bufferthe buffer.
lengththe buffer length.
Returns
YES if the request is queued successfully, otherwise NO.

◆ sendFrame:()

- (BOOL) sendFrame: (NSData *)  frameData

Sends a frame to the reader.

Parameters
frameDatathe frame data.
Returns
YES if the request is queued successfully, otherwise NO.

◆ setAesKey:length:()

- (BOOL) setAesKey: (const uint8_t *)  aesKey
length: (NSUInteger)  length 

Sets the AES key to the reader.

In order to proceed this operation, your reader must be authenticated.

Parameters
aesKeythe AES key.
lengththe AES key length must be 16 bytes.
Returns
YES if the request is queued successfully, otherwise NO.
See also
- authenticateWithMasterKey:length:
- authenticateWithMasterKey:length:completion:

◆ setCustomId:length:()

- (BOOL) setCustomId: (const uint8_t *)  customId
length: (NSUInteger)  length 

Sets the custom ID to the reader.

In order to proceed this operation, your reader must be authenticated.

Parameters
customIdthe custom ID.
lengththe custom ID length must be 10 bytes.
Returns
YES if the request is queued successfully, otherwise NO.
See also
- authenticateWithMasterKey:length:
- authenticateWithMasterKey:length:completion:

◆ setDukptOption:()

- (BOOL) setDukptOption: (BOOL)  enabled

Sets the DUKPT option to the reader.

In order to proceed this operation, your reader must be authenticated.

Parameters
enabledset to true to enable DUKPT. Otherwise, set to false.
Returns
YES if the request is queued successfully, otherwise NO.
See also
- authenticateWithMasterKey:length:
- authenticateWithMasterKey:length:completion:

◆ setMasterKey:length:()

- (BOOL) setMasterKey: (const uint8_t *)  masterKey
length: (NSUInteger)  length 

Sets the master key to the reader.

In order to proceed this operation, your reader must be authenticated.

Parameters
masterKeythe master key.
lengththe master key length must be 16 bytes.
Returns
YES if the request is queued successfully, otherwise NO.
See also
- authenticateWithMasterKey:length:
- authenticateWithMasterKey:length:completion:

◆ setPiccRfConfig:length:()

- (BOOL) setPiccRfConfig: (const uint8_t *)  rfConfig
length: (NSUInteger)  length 

Sets the PICC RF configuration.

Parameters
rfConfigthe RF configuration. The length must be 19 bytes.
lengththe RF configuration length.
Returns
YES if the request is queued successfully, otherwise NO.

◆ setProtocol:slotNum:timeout:error:()

- (ACRCardProtocol) setProtocol: (ACRCardProtocol preferredProtocols
slotNum: (NSUInteger)  slotNum
timeout: (NSTimeInterval)  timeout
error: (NSError **)  errorPtr 

Sets the protocol.

Parameters
preferredProtocolsthe preferred protocols. It can be combined with OR operation. For example, ACRProtocolT0 | ACRProtocolT1.
slotNumthe slot number.
timeoutthe maximum time to wait in seconds.
errorPtrif there is an error, upon return contains an NSError object that describes the problem.
Returns
the active protocol. Either ACRProtocolT0 or ACRProtocolT1 if the operation succeeds, otherwise ACRProtocolUndefined.

◆ setSleepTimeout:()

- (BOOL) setSleepTimeout: (NSUInteger)  timeout

Sets the sleep timeout.

Parameters
timeoutthe timeout value in seconds.
Returns
YES if the request is queued successfully, otherwise NO.

◆ setTrackDataOption:()

- (BOOL) setTrackDataOption: (ACRTrackDataOption option

Sets the track data option to the reader.

In order to proceed this operation, your reader must be authenticated.

Parameters
optionthe track data option. See ACRTrackDataOptionEncryptedTrack1, ACRTrackDataOptionEncryptedTrack2, ACRTrackDataOptionMaskedTrack1 and ACRTrackDataOptionMaskedTrack2. It can be combined with OR operation.
Returns
YES if the request is queued successfully, otherwise NO.
See also
- authenticateWithMasterKey:length:
- authenticateWithMasterKey:length:completion:

◆ sleep()

- (BOOL) sleep

Sets the reader to sleep.

Returns
YES if the request is queued successfully, otherwise NO.

◆ transmitApdu:length:slotNum:timeout:error:()

- (NSData *) transmitApdu: (const uint8_t *)  command
length: (NSUInteger)  length
slotNum: (NSUInteger)  slotNum
timeout: (NSTimeInterval)  timeout
error: (NSError **)  errorPtr 

Transmits the APDU.

Parameters
commandthe command APDU.
lengththe command APDU length.
slotNumthe slot number.
timeoutthe maximum time to wait in seconds.
errorPtrif there is an error, upon return contains an NSError object that describes the problem.
Returns
the response APDU if the operation succeeds, otherwise nil.

◆ transmitApdu:slotNum:timeout:error:()

- (NSData *) transmitApdu: (NSData *)  command
slotNum: (NSUInteger)  slotNum
timeout: (NSTimeInterval)  timeout
error: (NSError **)  errorPtr 

Transmits the APDU.

Parameters
commandthe command APDU.
slotNumthe slot number.
timeoutthe maximum time to wait in seconds.
errorPtrif there is an error, upon return contains an NSError object that describes the problem.
Returns
the response APDU if the operation succeeds, otherwise nil.

◆ transmitControlCommand:controlCode:slotNum:timeout:error:()

- (NSData *) transmitControlCommand: (NSData *)  command
controlCode: (NSUInteger)  controlCode
slotNum: (NSUInteger)  slotNum
timeout: (NSTimeInterval)  timeout
error: (NSError **)  errorPtr 

Transmits the control command.

Parameters
commandthe control command.
controlCodethe control code.
slotNumthe slot number.
timeoutthe maximum time to wait in seconds.
errorPtrif there is an error, upon return contains an NSError object that describes the problem.
Returns
the control response if the operation succeeds, otherwise nil.

◆ transmitControlCommand:length:controlCode:slotNum:timeout:error:()

- (NSData *) transmitControlCommand: (const uint8_t *)  command
length: (NSUInteger)  length
controlCode: (NSUInteger)  controlCode
slotNum: (NSUInteger)  slotNum
timeout: (NSTimeInterval)  timeout
error: (NSError **)  errorPtr 

Transmits the control command.

Parameters
commandthe control command.
lengththe control command length.
controlCodethe control code.
slotNumthe slot number.
timeoutthe maximum time to wait in seconds.
errorPtrif there is an error, upon return contains an NSError object that describes the problem.
Returns
the control response if the operation succeeds, otherwise nil.

◆ updateCardStateWithSlotNumber:timeout:error:()

- (void) updateCardStateWithSlotNumber: (NSUInteger)  slotNum
timeout: (NSTimeInterval)  timeout
error: (NSError **)  errorPtr 

Updates the card state.

Parameters
slotNumthe slot number.
timeoutthe maximum time to wait in seconds.
errorPtrif there is an error, upon return contains an NSError object that describes the problem.

◆ verifyData:length:()

- (BOOL) verifyData: (const void *)  buffer
length: (NSUInteger)  length 

Verifies the data using CRC16 checksum.

The checksum is located at the last 2 bytes of data.

Parameters
bufferthe buffer.
lengththe buffer length.
Returns
YES if the checksum is correct, otherwise NO.

Property Documentation

◆ delegate

- (id<ACRAudioJackReaderDelegate>) delegate
readwritenonatomicweak

The delegate object specified to receive the audio jack reader events.

◆ mute

- (BOOL) mute
readwriteatomic

YES to mute the audio output, otherwise NO.


The documentation for this class was generated from the following file: