> 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_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/ped_8cpp.md).

# ped.cpp

[Enumerations](#enum-members) | [Functions](#func-members) | [Variables](#var-members)

`#include <stdio.h>` `#include <string.h>` `#include <string>` `#include <stdlib.h>` `#include "unistd.h"` `#include "`[ped.h](/s-adk-5.1-programmers-guide/sdi_2src_2ped_8h_source.md)`"` `#include "`[\_logf.h](/s-adk-5.1-programmers-guide/__logf_8h_source.md)`"` `#include "`[sys.h](/s-adk-5.1-programmers-guide/sys_8h_source.md)`"` `#include "`[btlv\_helper.h](/s-adk-5.1-programmers-guide/btlv__helper_8h_source.md)`"` `#include "`[ui.h](/s-adk-5.1-programmers-guide/ui_8h_source.md)`"` `#include <pthread.h>` `#include "data.h"` `#include "`[sdi\_tags.h](/s-adk-5.1-programmers-guide/src_2sdi__tags_8h_source.md)`"` `#include "`[sdi\_lang.h](/s-adk-5.1-programmers-guide/sdi__lang_8h_source.md)`"` `#include "`[sdi\_text.h](/s-adk-5.1-programmers-guide/sdi__text_8h_source.md)`"` `#include "`[filesystem.h](/s-adk-5.1-programmers-guide/filesystem_8h_source.md)`"` `#include "`[pathutil.h](/s-adk-5.1-programmers-guide/pathutil_8h_source.md)`"` `#include "config/sdi_sysconfig.h"` `#include "`[pthreadutil.h](/s-adk-5.1-programmers-guide/pthreadutil_8h_source.md)`"` `#include "`[madk\_pp\_protocol.h](/s-adk-5.1-programmers-guide/madk__pp__protocol_8h_source.md)`"` `#include "`[util.h](/s-adk-5.1-programmers-guide/sdi_2src_2util_8h_source.md)`"` `#include "`[sec/libsec.h](/s-adk-5.1-programmers-guide/libsec_8h_source.md)`"` `#include "sys/time.h"` `#include "common/checkForTouchCoordinates.h"` `#include <svcsec.h>`

Include dependency graph for ped.cpp:

![](/files/WpPobjCHa3nNs4bSbSTt)

|              |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Enumerations |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| enum         | [PPIN\_ENTRY](#a7e5271615c82cb53d7930081c6c78eb0) { [PPIN\_IDLE](#a7e5271615c82cb53d7930081c6c78eb0a4fa988dd629cca8b9d3beaa760639667), [PPIN\_CALLBACK](#a7e5271615c82cb53d7930081c6c78eb0af2c1b5a4e6ba37fbb06001540f34896f), [PPIN\_POLLING](#a7e5271615c82cb53d7930081c6c78eb0a5b03d17c2d8839f88a710488158e57ce), [PPIN\_POLLING\_DONE](#a7e5271615c82cb53d7930081c6c78eb0ac8830ecf692ead2a6b96de78f4c2a64a) }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| enum         | <p><a href="#a84e8130fbf06d7905466b51ac9aa0a57">PPIN\_RESULT</a> {<br>  <a href="#a84e8130fbf06d7905466b51ac9aa0a57a3c80448ee3c13b64791063750f3c2585">PPIN\_DONE</a> = 0x000000, <a href="#a84e8130fbf06d7905466b51ac9aa0a57ad32fcb1c4144ec5ad26082449d23f22e">PPIN\_COLLECTING</a> = 0x010000, <a href="#a84e8130fbf06d7905466b51ac9aa0a57a9481a031a571e537c79cea5fb484b89d">PPIN\_DIGIT\_ENTERED</a> = 0x0100, <a href="#a84e8130fbf06d7905466b51ac9aa0a57af3705a5afd991ebc54f558356a1007b8">PPIN\_BACKSPACE\_ENTERED</a> = 0x0800,<br>  <a href="#a84e8130fbf06d7905466b51ac9aa0a57a93cc4a944a0f7dd46a303b9085061ce2">PPIN\_OK\_ENTERED</a> = 0x0D00, <a href="#a84e8130fbf06d7905466b51ac9aa0a57ae5f96f409873c4e821c353ecc7de6f02">PPIN\_CANCEL\_ENTERED</a> = 0x1B00, <a href="#a84e8130fbf06d7905466b51ac9aa0a57aa13af76806d750f88201e919e98d1925">PPIN\_DIGIT\_SELECTED</a> = 0xD100, <a href="#a84e8130fbf06d7905466b51ac9aa0a57a8df826cde163532bc777f01797bf9174">PPIN\_CANCEL\_SELECTED</a> = 0xD200,<br>  <a href="#a84e8130fbf06d7905466b51ac9aa0a57a9fdd5c6b47f3cd142e2c9de1291a3b8f">PPIN\_BACKSPACE\_SELECTED</a> = 0xD300, <a href="#a84e8130fbf06d7905466b51ac9aa0a57ac3136fce70b5f87b4eb5f3de171325af">PPIN\_ASTERISK\_SELECTED</a> = 0xD400, <a href="#a84e8130fbf06d7905466b51ac9aa0a57a4f631f28f7897ba3bbf07607add3772b">PPIN\_HASH\_SELECTED</a> = 0xD500, <a href="#a84e8130fbf06d7905466b51ac9aa0a57ac85fb535597b0c2ed946ec383ae08590">PPIN\_F1\_SELECTED</a> = 0xD600,<br>  <a href="#a84e8130fbf06d7905466b51ac9aa0a57adf1bc9f28a65d19c6faf2d68ad3e588c">PPIN\_F2\_SELECTED</a> = 0xD700, <a href="#a84e8130fbf06d7905466b51ac9aa0a57a28dd34ff079e1534fe4b9439d1df864c">PPIN\_F3\_SELECTED</a> = 0xD800, <a href="#a84e8130fbf06d7905466b51ac9aa0a57ad2be115a0024c071ea7cd21ff36c8f4a">PPIN\_F4\_SELECTED</a> = 0xD900, <a href="#a84e8130fbf06d7905466b51ac9aa0a57a0f2751e204567da01854c8e0f0425a82">PPIN\_OK\_SELECTED</a> = 0xDE00,<br>  <a href="#a84e8130fbf06d7905466b51ac9aa0a57a12fb502d27c361b12ff37e8d54339ce2">PPIN\_MULTITOUCH</a> = 0xDF00, <a href="#a84e8130fbf06d7905466b51ac9aa0a57a1963994479d0ba697da1c82edce0e208">PPIN\_UNDERFLOW</a> = 0xF800, <a href="#a84e8130fbf06d7905466b51ac9aa0a57ab89aa97c0e629cd91568346c98c65caa">PPIN\_OVERFLOW</a> = 0xF900, <a href="#a84e8130fbf06d7905466b51ac9aa0a57afd80070c266253383274e92ccc1e5c19">PPIN\_BYPASS</a> = 0xFC,<br>  <a href="#a84e8130fbf06d7905466b51ac9aa0a57aa42f3abdd29d1069f03e8e1aa26e8f5f">PPIN\_CANCEL</a> = 0xFD, <a href="#a84e8130fbf06d7905466b51ac9aa0a57a69e81fedc3912ad73e23df8aca4d4c17">PPIN\_TIMEOUT</a> = 0xFE, <a href="#a84e8130fbf06d7905466b51ac9aa0a57a916c1ad466f13765601d0b02edf775ab">PPIN\_ERROR</a> = 0xFF<br>}</p> |

|           |                                                                                                                                                                                                       |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Functions |                                                                                                                                                                                                       |
| bool      | [handlePedCmd](#a576b866745c7f8c53122bbb8b23bfed8) (unsigned short msgBufSize, unsigned char \*msg, unsigned short msgSize, unsigned short rspBufSize, unsigned char \*rsp, unsigned short \*rspSize) |
| bool      | [pedSetExtButton](#abb33c3404058f8446010977ace0907b8) ()                                                                                                                                              |
| void      | [pedReset](#a2cdc4bd6bf4da35073f47249ee9357c2) (void \*handle)                                                                                                                                        |

|                                                                                                              |                                                   |
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------- |
| Variables                                                                                                    |                                                   |
| [sdi::SdiLanguage](/s-adk-5.1-programmers-guide/readme/namespaces/namespacesdi/classsdi_1_1_sdi_language.md) | [trxLanguage](#af262dea06616f89b523133a1f8b97fdb) |
| unsigned char                                                                                                | [pinType](#a853c96033e0a366c1cd4b64a74652247)     |
| SDITrxData                                                                                                   | [sdiData](#aaaba1a94d121b39429bb3696a654492b)     |

### EnumerationType Documentation <a href="#enumeration-type-documentation" id="enumeration-type-documentation"></a>

### PPIN\_ENTRY <a href="#a7e5271615c82cb53d7930081c6c78eb0" id="a7e5271615c82cb53d7930081c6c78eb0"></a>

enum \[PPIN\_ENTRY]\(#a7e5271615c82cb53d7930081c6c78eb0)

|                     |   |
| ------------------- | - |
| Enumerator          |   |
| PPIN\_IDLE          |   |
| PPIN\_CALLBACK      |   |
| PPIN\_POLLING       |   |
| PPIN\_POLLING\_DONE |   |

### PPIN\_RESULT <a href="#a84e8130fbf06d7905466b51ac9aa0a57" id="a84e8130fbf06d7905466b51ac9aa0a57"></a>

enum \[PPIN\_RESULT]\(#a84e8130fbf06d7905466b51ac9aa0a57)

|                           |   |
| ------------------------- | - |
| Enumerator                |   |
| PPIN\_DONE                |   |
| PPIN\_COLLECTING          |   |
| PPIN\_DIGIT\_ENTERED      |   |
| PPIN\_BACKSPACE\_ENTERED  |   |
| PPIN\_OK\_ENTERED         |   |
| PPIN\_CANCEL\_ENTERED     |   |
| PPIN\_DIGIT\_SELECTED     |   |
| PPIN\_CANCEL\_SELECTED    |   |
| PPIN\_BACKSPACE\_SELECTED |   |
| PPIN\_ASTERISK\_SELECTED  |   |
| PPIN\_HASH\_SELECTED      |   |
| PPIN\_F1\_SELECTED        |   |
| PPIN\_F2\_SELECTED        |   |
| PPIN\_F3\_SELECTED        |   |
| PPIN\_F4\_SELECTED        |   |
| PPIN\_OK\_SELECTED        |   |
| PPIN\_MULTITOUCH          |   |
| PPIN\_UNDERFLOW           |   |
| PPIN\_OVERFLOW            |   |
| PPIN\_BYPASS              |   |
| PPIN\_CANCEL              |   |
| PPIN\_TIMEOUT             |   |
| PPIN\_ERROR               |   |

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

### handlePedCmd() <a href="#a576b866745c7f8c53122bbb8b23bfed8" id="a576b866745c7f8c53122bbb8b23bfed8"></a>

bool handlePedCmd

Dispatch function to handle different PED commands

**Parameters**

\[in] **msgBufSize** size of the input message buffer \[in] **msg** pointer to the input message buffer \[in] **msgSize** size of the input message \[in] **rspBufSize** maximum size of the response buffer \[in,out] **rsp** pointer to the response buffer \[in,out] **rspSize** pointer to the response message size

#### Returns

true if command was executed and rsp contains a response, false in case invocation is not allowed by a side command.

### pedReset() <a href="#a2cdc4bd6bf4da35073f47249ee9357c2" id="a2cdc4bd6bf4da35073f47249ee9357c2"></a>

void pedReset

Function invoked by a thread at connection termination to abort the PIN entry. SDI server supports multiple connections, which can use the PED interface. With activation of the PED interface with command 22-03 (Start PIN entry) on one connection, the interface is locked for other connections. If a connection terminates, which optains the PED lock, the interface would be unaccessable for other connections. Therfore, this function will abort the PIN entry and unlock the PED interface, if the connection disturbes so that it can be used by other connection again. Please note that this function works for a PIN Entry started by 22-03 (Start PIN entry). A PIN entry started with 22-01 (Get PIN) is not considered, but the PED lock is released after the user hast finished the PIN entry.

**Parameters**

\[in] **handle** handle of the terminating connection

### pedSetExtButton() <a href="#abb33c3404058f8446010977ace0907b8" id="abb33c3404058f8446010977ace0907b8"></a>

bool pedSetExtButton

Inform the VAULT about the Confirm button was pressed if PIN polling is active and Navigator Mode 2 is set

#### Returns

true if PIN polling is active and Navigator Mode 2 set, else false

### VariableDocumentation <a href="#variable-documentation" id="variable-documentation"></a>

### pinType <a href="#a853c96033e0a366c1cd4b64a74652247" id="a853c96033e0a366c1cd4b64a74652247"></a>

unsigned char pinType

### sdiData <a href="#aaaba1a94d121b39429bb3696a654492b" id="aaaba1a94d121b39429bb3696a654492b"></a>

SDITrxData sdiData

### trxLanguage <a href="#af262dea06616f89b523133a1f8b97fdb" id="af262dea06616f89b523133a1f8b97fdb"></a>

[sdi::SdiLanguage](/s-adk-5.1-programmers-guide/readme/namespaces/namespacesdi/classsdi_1_1_sdi_language.md) trxLanguage


---

# 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_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/ped_8cpp.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.
