# MTSCRA Function - 4.61 - 4.70

#### 4.61 sendExtendedCommandSync (EMV Device Only)

Send a synchronous extended command to device. Operation waits for the command to return.

```
(NSString) sendExtendedCommandSync:(NSString *)Command
```

Parameters:

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top"><p> </p><p>Command</p></td><td valign="top">Hexadecimal string of the byte array for the extended command. The first two bytes represent the value of the extended command. The next two bytes (most significant byte first) indicate the total length of the following data in bytes.</td></tr></tbody></table>

Return Value: String containing the response data of the command.

#### 4.62 setTimeout <a href="#id-4.62_settimeout" id="id-4.62_settimeout"></a>

Set the timeout in milliseconds for a sync command or sync extended command. Default value is 5000 milleseconds.

```
(void) setTimeout:(NSUInteger)timeoutMS
```

Parameters:

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">timeoutMS</td><td valign="top">Timeout in milliseconds.</td></tr></tbody></table>

Return Value: None.

#### 4.63 setTimeFrame <a href="#id-4.63_settimeframe" id="id-4.63_settimeframe"></a>

Set the time frame (delay) for run loop or background thread. Default value is 10 milliseconds.

```
(void) setTimeFrame:(unsigned int)ms.
```

Parameters:

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">ms</td><td valign="top">Time frame delay in milliseconds.</td></tr></tbody></table>

Return Value: None.

#### 4.64 enableDebugPrint <a href="#id-4.64_enabledebugprint" id="id-4.64_enabledebugprint"></a>

Enable the debug print from SDK. Default value is NO.

```
(void) enableDebugPrint:(BOOL)enabled.
```

Parameters:

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top"><p> </p><p>enabled</p></td><td valign="top">When set to true, the SDK prints debugging messages in the XCode debug console. Debug messages consist of data sent to and received from the device. This may include iAP2.</td></tr></tbody></table>

Return Value: None.

#### 4.65 updateFirmware <a href="#id-4.65_updatefirmware" id="id-4.65_updatefirmware"></a>

Updates the device firmware

```
(int) updateFirmware: (int) firmwareType Data : (NSData*) firmwareData;
```

Parameters:

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">firmwareType</td><td valign="top"><p>Type of firmware to update.</p><p>·         1 - Main Firmware</p></td></tr><tr><td valign="top">firmwareData</td><td valign="top">Firmware data.</td></tr></tbody></table>

Return Value:

* 0 = UPDATE\_FIRMWARE\_STARTED&#x20;
* 1 = UPDATE\_FIRMWARE\_SUCCESS
* 9 = UPDATE\_FIRMWARE\_ERROR
* 15 = UPDATE\_FIRMWARE\_NA

#### 4.66 sendNFCCommand <a href="#id-4.66_sendnfccommand" id="id-4.66_sendnfccommand"></a>

This function sends a command to an NFC tag type 2. The NFC tag must first be activated by calling startTransaction() with NFC enabled.

* (int) sendNFCCommand: (NSString\*) command lastCommand :(BOOL) lastCommand :encrypt : (BOOL) encrypt;

Parameters:

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top"><p> </p><p> </p><p> </p><p> </p><p> </p><p>command</p></td><td valign="top"><p>Command to send to the NFC tag.</p><p>·         Get Version</p><p>·         Read</p><p>·         Fast Read</p><p>·         Write</p><p>·         Compatibility Write</p><p>·         Read_Cnt</p><p>·         PWD_Auth</p><p>·         Read_Sig</p></td></tr><tr><td valign="top"><p> </p><p> </p><p> </p><p> </p><p> </p><p>lastCommand</p></td><td valign="top"><p>Determines if this is the last NFC command to complete the operation.</p><p>true = This is the last command. Device will provide a single beep after receiving a successful response from the NFC tag. To send subsequent commands, the NFC tag must be activated by calling startTransaction() with NFC enabled.</p><p>false = Expect more commands (Default).</p><p>Either set to true or false, if the NFC tag command fails, device will provide a double beep.</p></td></tr><tr><td valign="top"><p> </p><p>encrypt</p></td><td valign="top"><p>Determines if data returned is to be encrypted.</p><p>true = Encrypt data</p><p>false = Do not encrypt data (Default)</p></td></tr></tbody></table>

Return Value:

·         0 = Success

·         9 = Error

·         15 = Busy

#### 4.67 sendClassicNFCCommand <a href="#id-4.67_sendclassicnfccommand" id="id-4.67_sendclassicnfccommand"></a>

This function sends a command to a NFC Mifare Classic Tag type 2. The NFC tag must first be activated by calling startTransaction() with NFC enabled.

```
(int) sendClassicNFCCommand: (NSString*) command lastCommand :(BOOL) lastCommand encrypt : (BOOL) encrypt;
```

&#x20;Parameters:

<table data-header-hidden><thead><tr><th width="159.45458984375" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top"><p> </p><p> </p><p> </p><p> </p><p> </p><p>lastCommand</p></td><td valign="top"><p>Determines if this is the last NFC command to complete the operation.</p><p>true = This is the last command. Device will provide a single beep after receiving a successful response from the NFC tag. To send subsequent commands, the NFC tag must be activated by calling startTransaction() with NFC enabled.</p><p>false = Expect more commands (Default).</p><p>Either set to true or false, if the NFC tag command fails, device will provide a double beep.</p></td></tr><tr><td valign="top"><p> </p><p>encrypt</p></td><td valign="top"><p>Determines if data returned is to be encrypted.</p><p>true = Encrypt data</p><p>false = Do not encrypt data (Default)</p></td></tr></tbody></table>

Return Value:

* 0 = Success
* 9 = Error
* 15 = Busy

#### 4.68 sendDESFireNFCCommand <a href="#id-4.68_senddesfirenfccommand" id="id-4.68_senddesfirenfccommand"></a>

This function sends a command to an NFC Mifare DESFire Light Tag Type 4. The NFC tag must first be activated by calling startTransaction() with NFC enabled.

```
(int) sendDESFireNFCCommand: (NSString*) command lastCommand :(BOOL) lastCommand encrypt : (BOOL) encrypt;
```

Parameters:

<table data-header-hidden><thead><tr><th width="170.3636474609375" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">command</td><td valign="top">Command to send to the NFC tag. See DESFire Data Sheet (MF2DLHX0). Should follow ISO 7816-4 APDU format.</td></tr><tr><td valign="top"><p> </p><p> </p><p> </p><p> </p><p> </p><p>lastCommand</p></td><td valign="top"><p>Determines if this is the last NFC command to complete the operation.</p><p> </p><p>true = This is the last command. Device will provide a single beep after receiving a successful response from the NFC tag. To send subsequent commands, the NFC tag must be activated by calling startTransaction() with NFC enabled.</p><p> </p><p>false = Expect more commands (Default).</p><p>Either set to true or false, if the NFC tag command fails, device will provide a double beep.</p></td></tr><tr><td valign="top">encrypt</td><td valign="top"><p>Determines if data returned is to be encrypted.</p><p>true = Encrypt data</p><p>false = Do not encrypt data (Default)</p></td></tr></tbody></table>

Return Value:

* 0 = Success&#x20;
* 9 = Error
* 15 = Busy

#### 4.69 sendNFCCommandSync <a href="#id-4.69_sendnfccommandsync" id="id-4.69_sendnfccommandsync"></a>

This function sends a command to an NFC tag type 2. The NFC tag must first be activated by calling startTransaction() with NFC enabled.

```
(NSString*) sendNFCCommandSync: (NSString*) command lastCommand :(BOOL) lastCommand encrypt : (BOOL) encrypt;
```

Parameters:

<table data-header-hidden><thead><tr><th width="154.90911865234375" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top"><p> </p><p> </p><p> </p><p> </p><p> </p><p>command</p></td><td valign="top"><p>Command to send to the NFC tag.</p><p>·         Get Version</p><p>·         Read</p><p>·         Fast Read</p><p>·         Write</p><p>·         Compatibility Write</p><p>·         Read_Cnt</p><p>·         PWD_Auth</p><p>·         Read_Sig</p></td></tr><tr><td valign="top"><p> </p><p> </p><p> </p><p> </p><p> </p><p>lastCommand</p></td><td valign="top"><p>Determines if this is the last NFC command to complete the operation.</p><p>true = This is the last command. Device will provide a single beep after receiving a successful response from the NFC tag. To send subsequent commands, the NFC tag must be activated by calling startTransaction() with NFC enabled.</p><p>false = Expect more commands (Default).</p><p>Either set to true or false, if the NFC tag command fails, device will provide a double beep.</p></td></tr><tr><td valign="top"><p> </p><p>encrypt</p></td><td valign="top"><p>Determines if data returned is to be encrypted.</p><p>true = Encrypt data</p><p>false = Do not encrypt data (Default)</p></td></tr></tbody></table>

Return Value:

·         Extended response of the NFC command.

#### 4.70 sendNFCCommandAsync <a href="#id-4.70_sendnfccommandasync" id="id-4.70_sendnfccommandasync"></a>

This function sends a command to an NFC tag type 2. The NFC tag must first be activated by calling startTransaction() with NFC enabled.

```
(int) sendNFCCommandAsync: (NSString*) command lastCommand :(BOOL) lastCommand encrypt : (BOOL) encrypt response : (void (^)(NSString*)) response;
```

Parameters:

<table data-header-hidden><thead><tr><th width="161.272705078125" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top"><p> </p><p> </p><p> </p><p> </p><p>command</p></td><td valign="top"><p>Command to send to the NFC tag.</p><p>·         Get Version</p><p>·         Read</p><p>·         Fast Read</p><p>·         Write</p><p>·         Compatibility Write</p><p>·         Read_Cnt</p><p>·         PWD_Auth</p><p>·         Read_Sig</p></td></tr><tr><td valign="top"><p> </p><p> </p><p> </p><p> </p><p> </p><p>lastCommand</p></td><td valign="top"><p>Determines if this is the last NFC command to complete the operation.</p><p> </p><p>true = This is the last command. Device will provide a single beep after receiving a successful response from the NFC tag. To send subsequent commands, the NFC tag must be activated by calling startTransaction() with NFC enabled.</p><p>false = Expect more commands (Default).</p><p>Either set to true or false, if the NFC tag command fails, device will provide a double beep.</p></td></tr><tr><td valign="top"><p> </p><p>encrypt</p></td><td valign="top"><p>Determines if data returned is to be encrypted.</p><p>true = Encrypt data</p><p>false = Do not encrypt data (Default)</p></td></tr><tr><td valign="top">response</td><td valign="top">Callback to receive the response.</td></tr></tbody></table>

Return Value:

* 0 = Success&#x20;
* 9 = Error
* 15 = Busy


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.magtek.com/hardware/card-readers/magnetic-stripe-readers/idynamo-5-gen-iii/documentation/developers-manuals/secure-card-reader-authenticators-sdk-programmers-manual-ios/mtscra-functions/mtscra-function-4.61-4.70.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
