For the complete documentation index, see llms.txt. This page is also available as Markdown.
Page cover

MTSCRA Functions - 1 - 10

To develop an iOS app using the MTSCRA SDK, follow the setup steps in section 2 How to Set Up the MTSCRA SDK, then create an instance of the MTSCRA object in your software project, then call the functions described in this chapter to communicate with the device. For sample code that demonstrates MTSCRA Demo how to use these functions, see the contents of the folder included with the SDK.

Generally, these functions will run in one of two modes:

  • Asynchronous functions will return data using the event handlers (callback functions) defined in section 5 MTSCRA Delegate Methods.

  • Synchronous functions will return requested data immediately in the function’s return value. If the requested data is not available immediately, synchronous calls will generally block until a specified wait time has elapsed.

Most calls that wait for input from the user will run in the asynchronous mode.

getSDKVersion

This function retrieves the SDK revision number.

(NSString *) getSDKVersion 

Parameters: None

Return Value: String containing the SDK revision number.

startScanningForPeripherals

This function retrieves a list of available Bluetooth LE devices. After calling this function to locate the device you wish to connect to, use setAddress to tell the library which device you want to connect to. Use stopScanningForPeripherals to stop the scan.

(void)startScanningForPeripherals

Parameters: None

Return Value: An array of peripherals

stopScanningForPeripherals

This function stops the scanning of available Bluetooth LE devices.

Parameters: None

Return Value: None

setAddress

This function sets device’s address for Bluetooth LE devices.

address Parameters:

Parameter

Description

address

Address of the Bluetooth LE device to communicate with

Return Value: None

openDevice

This function opens a connection to the device.

To use this function to connect to a Bluetooth LE device, the app should follow these steps:

  • Call startScanningForPeripherals to find the device you want to connect to.

  • Call setAddress to tell the library which device you want to connect to.

  • Make sure your app’s bleReaderStateUpdated function most recent status is was OK .

  • Call openDevice.

After calling this function, call isDeviceOpened to make sure the device was successfully opened.

Parameters: None Return Value:

  • YES = Success

  • NO = Error

closeDevice

This function closes the connection to the currently opened device. After calling this function, call isDeviceOpened to make sure the device was successfully closed.

Parameters: None

Return Value:

  • YES = Success

  • NO = Error

isDeviceConnected

This function reports whether any compatible devices are connected to the host.

Parameters: None

Return Value:

  • YES = host is connected to a device

  • NO = host is not connected to a device

isDeviceOpened

This function retrieves device opened status, which changes on successful completion of a call to startScanningForPeripherals or closeDevice.

  • (BOOL) isDeviceOpened

Parameters: None Return Value:

  • YES = Device is opened

  • NO = Device is not opened

sendCommandToDevice

This function sends a direct command to device. See D99875475 MagneSafe V5 Programmer’s Reference (Commands) for details about available commands and syntax.

Parameter

Parameter

Description

pData

Command to send to the device. For example, pass command string

“C10206C20503C30100” to call the Discovery command.

Return Value:

  • 0 = Success

  • 9 = Error

  • 15 = Busy

getResponseData

This function retrieves card data from a string separated by ‘|’ after a cardholder swipes a card. The host software should call it in response to the trackDataReadyNotification callback.

Parameters: None

Return Value:

A null terminated hex string for Card Data, Field separated by ‘|’.NULL value for failed.

Fields:

Device ID, Device Serial Number, Card Swipe Status, CardEncode Type, Track 1 Decode Status, Track 2 Decode Status, Track 3 Decode Status, MagnePrint Status, Track 1 Length, Track 2 Length, Track 3 Length, Masked Track 1 Length, Masked Track 2 Length, Masked Track 3 Length, MagnePrint Length, Card Data, Masked Card Data, DUKPT Session ID, DUKPT Key Serial Number, First Name, Last Name, PAN, Month, Year, Track 1 Data, Track 2 Data, Track 3 Data, Masked Track 1 Data, Masked Track 2 Data, Masked Track 3 Data, MagnePrint Data

Last updated