> For the complete documentation index, see [llms.txt](https://sandbox-docs.verifone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sandbox-docs.verifone.com/s-adk-5.1-programmers-guide/readme/files/dir_c2b6fb90cbe225a4c7f5c562006e9b78/dir_797c2eec9d33c0e51d543580c2b239ca/dir_fa87c044aa590573d847d8ba2d3b48c1/tec_8h.md).

# tec.h

[Macros](#define-members) | [Typedefs](#typedef-members) | [Functions](#func-members)

`#include "`[tec/tec\_common.h](/s-adk-5.1-programmers-guide/tec__common_8h_source.md)`"`

Include dependency graph for tec.h:

![](/files/rlwWFxa0vuywDpUqf28K)

This graph shows which files directly or indirectly include this file:

![](/files/wqdcxLjzOie3HrrMcvDl)

[Go to the source code of this file.](/s-adk-5.1-programmers-guide/tec_8h_source.md)

|         |                                                                                                                                                                                                        |
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Macros  |                                                                                                                                                                                                        |
| #define | [CTS\_NOTIFICATION\_CBK\_TYPE\_UX\_CARD\_INSERTED](/s-adk-5.1-programmers-guide/readme/modules/group___t_e_c___n_o_t_i_f_i_c_a_t_i_o_n___c_b_k___t_y_p_e.md#ga131e9251b6b4f9c9c7a187c07f12820a)   0x01 |

|                 |                                                                    |
| --------------- | ------------------------------------------------------------------ |
| Typedefs        |                                                                    |
| typedef void(\* | [cts\_Callback](#adbb62b791d8135bcd7edca85fcef33a5)) (void \*data) |

|           |                                                                                                                                                                                                                                                             |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Functions |                                                                                                                                                                                                                                                             |
| int       | [cts\_SetOptions](#aa237be1f0249503d0b959d3800f1ee34) (const unsigned char \*options, unsigned char options\_len)                                                                                                                                           |
| int       | [cts\_StartSelection](#ac6699fe32fc23e90713eb617e9ff25e7) (unsigned char supportedTechnologies, unsigned short timeout\_sec, [cts\_Callback](#adbb62b791d8135bcd7edca85fcef33a5) cbf, void \*cb\_data, unsigned char \*options, unsigned char options\_len) |
| int       | [cts\_StopSelection](#acaf2d75d1b584ae97ff9ee4da47cee38) (void)                                                                                                                                                                                             |
| int       | [cts\_WaitSelection](#aee5b104d8ad6e85feddb685379cdbf0c) (unsigned char \*usedTechnology, unsigned char \*dataBuffer, unsigned short \*dataBufferLength, unsigned short timeout\_msec)                                                                      |
| int       | [cts\_RemoveTechnologies](#a8569782d27f43e5d88cef3575a5d12c6) (unsigned char technologies)                                                                                                                                                                  |
| int       | [cts\_AddTechnologies](#aa60922ab5b40a033ac85a36e8022cafa) (unsigned char technologies, unsigned char \*options, unsigned char options\_len)                                                                                                                |
| int       | [cts\_WaitCardRemoval](#a8db288b6803c1fba534d94a99f1b646b) ([cts\_Callback](#adbb62b791d8135bcd7edca85fcef33a5) cbf, void \*cb\_data)                                                                                                                       |
| int       | [cts\_WaitCardRemoval2](#a92ab7780df1f8150c6d8a9b3ab3163bf) (unsigned short timeout\_sec)                                                                                                                                                                   |
| void      | [cts\_SetNotificationCallback](#ada083dc0f484d99ab24df79ed5f145c9) (int type, [cts\_Callback](#adbb62b791d8135bcd7edca85fcef33a5) cbf, void \*cb\_data)                                                                                                     |

### DetailedDescription <a href="#detailed-description" id="detailed-description"></a>

Interface definitions for libtec. This file defines the API for the technology selection library.

#### Author

Thomas Buening, GSS

### TypedefDocumentation <a href="#typedef-documentation" id="typedef-documentation"></a>

### cts\_Callback <a href="#adbb62b791d8135bcd7edca85fcef33a5" id="adbb62b791d8135bcd7edca85fcef33a5"></a>

typedef void(\\\* cts\_Callback) (void \\\*data)

Type of function that is called after technology selection has been finished (see [cts\_StartSelection()](#ac6699fe32fc23e90713eb617e9ff25e7)) or removed (see [cts\_WaitCardRemoval()](#a8db288b6803c1fba534d94a99f1b646b)).

**Parameters**

\[in] **data** : Data pointer provided by the application.

### FunctionDocumentation <a href="#function-documentation" id="function-documentation"></a>

### cts\_AddTechnologies() <a href="#aa60922ab5b40a033ac85a36e8022cafa" id="aa60922ab5b40a033ac85a36e8022cafa"></a>

int cts\_AddTechnologies

This function adds technologies to currently running technology selection. This can be useful to adapt to an interface with separated "enable" functions for each technology. Restrictions:

* Adding [CTS\_CTLS](/s-adk-5.1-programmers-guide/readme/modules/group___t_e_c___t_e_c_h_n_o_l_o_g_i_e_s.md#ga56e64c2a97c61e8cb043de2852986a3a) is not allowed in case one of these options set: [CTS\_PURE\_CARD\_DETECTION](/s-adk-5.1-programmers-guide/readme/modules/group___t_e_c___s_t_a_r_t___o_p_t_i_o_n_s.md#gaeff0a0e1b335597ea1ec0781f15edb08), [CTS\_NFC\_ENABLE](/s-adk-5.1-programmers-guide/readme/modules/group___t_e_c___s_t_a_r_t___o_p_t_i_o_n_s.md#gaafe9099680a56edd52a1258a797efa07), [CTS\_VAS\_ENABLE](/s-adk-5.1-programmers-guide/readme/modules/group___t_e_c___s_t_a_r_t___o_p_t_i_o_n_s.md#ga4678a7752f0337b236971dcd370edf93)
* No support for Contact synchronous cards ([CTS\_OPTION\_TAG\_SYNC\_CARD\_TYPE](/s-adk-5.1-programmers-guide/readme/modules/group___t_e_c___o_p_t_i_o_n___t_a_g_s.md#ga10f9930ac821ef5f612690b2201f94e3))

**Parameters**

\[in] **technologies** : technologies to add to running technology selection: combination of TEC technology code, any additional bits are reserved for future use and are currently ignored. Supplying none of TEC technology code is allowed. In this case this function does actually nothing. \[in] **options** : data pointer for future use \[in] **options\_len** : length of options.

#### Returns

\[unsupported block]

### cts\_RemoveTechnologies() <a href="#a8569782d27f43e5d88cef3575a5d12c6" id="a8569782d27f43e5d88cef3575a5d12c6"></a>

int cts\_RemoveTechnologies

This function removes technologies from currently running technology selection. This can be useful to remove contact and magstripe technologies after the application was informed by EMV-ADK that a ctls retap scenario is running.

**Parameters**

\[in] **technologies** : technologies to remove from running technology selection: combination of TEC technology code, any additional bits are reserved for future use and are currently ignored. Supplying none of TEC technology code is allowed. In this case this function does actually nothing.

#### Returns

\[unsupported block]

### cts\_SetNotificationCallback() <a href="#ada083dc0f484d99ab24df79ed5f145c9" id="ada083dc0f484d99ab24df79ed5f145c9"></a>

void cts\_SetNotificationCallback

Set notification callback function

**Parameters**

\[in] **type** : one of Notification callback types \[in] **cbf** : Callback function, may be NULL. \[in] **cb\_data** : Data pointer that is passed on to the callback function cbf, may be NULL.

### cts\_SetOptions() <a href="#aa237be1f0249503d0b959d3800f1ee34" id="aa237be1f0249503d0b959d3800f1ee34"></a>

int cts\_SetOptions

Set additional options. This function must not be called while technology selection is running.

**Parameters**

\[in] **options** : data pointer, TLV format, see TEC option tags \[in] **options\_len** : length of options

#### Returns

\[unsupported block]

### cts\_StartSelection() <a href="#ac6699fe32fc23e90713eb617e9ff25e7" id="ac6699fe32fc23e90713eb617e9ff25e7"></a>

int cts\_StartSelection

This function starts an asynchronous card reader monitoring. The monitoring ends if

* magstripe card is swiped or inserted
* or chip card is inserted
* or contactless card is tapped
* or the timeout occurs
* or [cts\_StopSelection()](#acaf2d75d1b584ae97ff9ee4da47cee38) is called
* or error occurred.

**Parameters**

\[in] **supportedTechnologies** : supported technologies: combination of TEC technology code, any additional bits are reserved for future use and are currently ignored. Supplying none of TEC technology code is allowed. In this case cts\_WaitSelection() will never return CTS\_OK or CTS\_NO\_CHIP of course. \[in] **timeout\_sec** : main timeout in seconds to wait for card insertion/swipe/tap, min=0 (makes no sense), max=65535s, infinite timeout not possible; if this timeout expires while a timeout defined in options\[6..7] or options\[8..9] is running, latter timeouts have higher priority, they are not aborted. \[in] **cbf** : callback function that is called when technology selection has been finished, that means a (positive or negative) result != CTS\_IN\_PROGRESS can be obtained with cts\_WaitSelection(), may be NULL.The following APIs are not allowed to be called while the callback function is still in progress:cts\_SetTraceCallback()cts\_SetOptions()cts\_StartSelection()cts\_RemoveTechnologies()cts\_WaitCardRemoval()cts\_WaitCardRemoval2()cts\_StopSelection() \[in] **cb\_data** : data pointer that is passed on to the callback function, may be NULL. \[in] **options** : data pointer:options\[0..1]: see TEC start optionsoptions\[2..3]: reserved.options\[4]: CT ICC optionsPassed as options to EMV\_CT\_SmartDetect() and EMV\_CT\_SmartReset()options\[5]: CTLS ICC optionsPassed as options to EMV\_CTLS\_SmartReset()options\[6..7]: MSR after CTLS timeout2-byte binary parameter in big-endian format. min = 0x0000, max = 0xFFFF = 65535ms.Time in milliseconds to wait for MSR-Data after CTLS has been detected."0x0000" means "do not wait for MSR after CTLS detection".If CTS\_MSR\_AFTER\_CTLS\_FAIL set: wait for MSR after CTLS transaction only if that failed.options\[8..9]: UX30x only: MSR timeout after card insertion2-byte binary parameter in big-endian format. min = 0x0000, max = 0xFFFF = 65535ms.For hints about UX hybrid reader handling see Special behavior on hybrid readers (UX30x) .Two different meanings depending if CTS\_CHIP is set in TEC technology code :CTS\_CHIP is set.Time in milliseconds to wait for MSR-Data after a card without chip or with broken chip was inserted."0x0000" means "do not wait for MSR-Data after card insertion and report CTS\_NO\_CHIP immediately".CTS\_CHIP is disabled.Time window in milliseconds for reading MSR-Data after card was inserted."0x0000" means wait for MSR-Data after card insertion until technology selection finishes.If MSR-Data is not read during this time window:MSR\_Deactivate() shall be called,technology selection shall be terminated andcts\_WaitSelection() shall return the value CTS\_UX\_MSRDATA\_NOT\_AVAILABLE\_TIMEOUToptions\[10..11]: CTLS timeout after VASOnly relevant if CTS\_VAS\_ENABLE and CTS\_EMV\_CTLS\_TIMEOUT\_AFTER\_VAS are set.Permissible time window in milliseconds to perform an EMV contactless payment after either VAS\_DO\_PAY or VAS\_DO\_PAY\_DECRYPT\_REQ has been detected.2-byte binary parameter in big-endian format, min = 0x0000 = default value, max = 0xFFFF = 65535ms"0x0000" means "wait for a contactless payment until the main timeout 'timeout\_sec' expires".If value is non-zero and a contactless-payment-medium is not detected during this time window:technology selection shall be terminated andcts\_WaitSelection() shall return the value CTS\_CTLS\_EMV\_NO\_CARD. options\[12..15]: NFC technologiesPassed to NFC\_PT\_PollingFull() parameter pollReq.tech\_bitmap, 4 byte binary, big-endian, only relevant if CTS\_NFC\_ENABLE is set, may be NULL (default = {0}). \[in] **options\_len** : length of options.

#### Returns

\[unsupported block]

### cts\_StopSelection() <a href="#acaf2d75d1b584ae97ff9ee4da47cee38" id="acaf2d75d1b584ae97ff9ee4da47cee38"></a>

int cts\_StopSelection

This function stops a technology selection started via [cts\_StartSelection()](#ac6699fe32fc23e90713eb617e9ff25e7). It will be called by application if waiting for a card is canceled by user or ECR break. Keep in mind that the technology selection may not be stopped immediately. Call [cts\_WaitSelection()](#aee5b104d8ad6e85feddb685379cdbf0c) to wait for termination of technology selection. After [cts\_WaitSelection()](#aee5b104d8ad6e85feddb685379cdbf0c) returns != [CTS\_IN\_PROGRESS](/s-adk-5.1-programmers-guide/readme/modules/group___t_e_c___r_e_t_u_r_n___c_o_d_e_s.md#ga7ee2b62641a168354503adbb06508deb), it is safe to call [cts\_StartSelection()](#ac6699fe32fc23e90713eb617e9ff25e7) again.

#### Returns

\[unsupported block]

### cts\_WaitCardRemoval() <a href="#a8db288b6803c1fba534d94a99f1b646b" id="a8db288b6803c1fba534d94a99f1b646b"></a>

int cts\_WaitCardRemoval

This function registers callback for card removal. The function returns immediately with one of the return values stated below. The callback is invoked as soon as the inserted card is removed or immediately if no card is inserted. Keep in mind that the callback is only invoked once. If you want to be informed about the next card removal as well, call this function again, even from within the callback function. Attention: Do not call this function as long as other TEC/EMV functions are running and do not call other TEC/EMV functions until the callback has been invoked!

**Parameters**

\[in] **cbf** : callback function that is called when a card has been removed, must not be NULL. \[in] **cb\_data** : data pointer that is passed on to the callback function.

#### Returns

\[unsupported block]

### cts\_WaitCardRemoval2() <a href="#a92ab7780df1f8150c6d8a9b3ab3163bf" id="a92ab7780df1f8150c6d8a9b3ab3163bf"></a>

int cts\_WaitCardRemoval2

This function waits for card removal. The function does not return until card has been removed or timeout has occurred. Attention: Do not call this function as long as other TEC/EMV functions are running and do not call other TEC/EMV functions until the function has returned!

**Parameters**

\[in] **timeout\_sec** : timeout in seconds to wait for card removal.

#### Returns

\[unsupported block]

### cts\_WaitSelection() <a href="#aee5b104d8ad6e85feddb685379cdbf0c" id="aee5b104d8ad6e85feddb685379cdbf0c"></a>

int cts\_WaitSelection

This function waits for technology selection to finish.

**Parameters**

\[out] **usedTechnology** : technology that has been selected, only set if CTS\_OK is returned. See TEC technology code . If CTS\_DATA\_TLV is set dataBuffer is in TLV format (this is the case if NFC or VAS was detected). In certain circumstances ('MSR after CTLS timeout' is set; UX MSR enhancements not enabled) it is possible that usedTechnology contains more than one technology at once, see documentation. \[out] **dataBuffer** : reference to buffer for output data, only filled if CTS\_OK is returned.Recommended allocation size: 11264 bytes if NFC/VAS is used, else 256 bytesa) CTS\_DATA\_TLV is set in usedTechnology:contains tags, see TEC result data tags.b) CTS\_DATA\_TLV is not set in usedTechnology:If \*usedTechnology & CTS\_CHIP : contains ATR.If \*usedTechnology & CTS\_CTLS and CTS\_PURE\_CARD\_DETECTION was set as option to cts\_StartSelection() : contains card info delivered by EMV\_CTLS\_SmartReset().If \*usedTechnology & CTS\_CTLS and CTS\_PURE\_CARD\_DETECTION was not set : contains return value of EMV\_CTLS\_ContinueOffline(). \[in,out] **dataBufferLength** : buffer size for output data, return data length; if the size of dataBuffer is too small to hold the whole output data, no special error code is returned, the return code is as usual, but the output buffer will be empty, dataBufferLength is set to 0. If return value is != CTS\_OK, dataBufferLength is set to 0 to indicate that there is no data written in dataBuffer. \[in] **timeout\_msec** : timeout in milliseconds to wait for technology selection to finish, min=0, max=65535ms. If technology selection is not finished after this timeout has expired, CTS\_IN\_PROGRESS is returned. In this case cts\_WaitSelection() has to be called again. If a callback function is supplied to cts\_StartSelection(), setting a timeout != 0 is not allowed.

#### Returns

\[unsupported block]


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://sandbox-docs.verifone.com/s-adk-5.1-programmers-guide/readme/files/dir_c2b6fb90cbe225a4c7f5c562006e9b78/dir_797c2eec9d33c0e51d543580c2b239ca/dir_fa87c044aa590573d847d8ba2d3b48c1/tec_8h.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
