> 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/sys_8cpp.md).

# sys.cpp

[Data Structures](#nested-classes) | [Macros](#define-members) | [Functions](#func-members)

`#include <stdio.h>` `#include <string.h>` `#include <stdlib.h>` `#include <pthread.h>` `#include <vector>` `#include <`[html/gui.h](/s-adk-5.1-programmers-guide/gui_8h_source.md)`>` `#include <`[sysinfo/mac.h](/s-adk-5.1-programmers-guide/mac_8h_source.md)`>` `#include <string>` `#include <sys/types.h>` `#include <sys/stat.h>` `#include <fcntl.h>` `#include <unistd.h>` `#include <pwd.h>` `#include <dlfcn.h>` `#include <`[libsecins.h](/s-adk-5.1-programmers-guide/libsecins_8h_source.md)`>` `#include <svcmgr/svc_utility.h>` `#include "`[sec.h](/s-adk-5.1-programmers-guide/sec_8h_source.md)`"` `#include "csd.h"` `#include "csd-version.h"` `#include <netinet/in.h>` `#include "epp/counterTop.h"` `#include <dirent.h>` `#include <svcsec.h>` `#include "`[sysinfo/sysinfo.h](/s-adk-5.1-programmers-guide/sysinfo_8h_source.md)`"` `#include "`[sysinfo/vfisyspm.h](/s-adk-5.1-programmers-guide/vfisyspm_8h_source.md)`"` `#include "`[sys.h](/s-adk-5.1-programmers-guide/sys_8h_source.md)`"` `#include "`[ped.h](/s-adk-5.1-programmers-guide/sdi_2src_2ped_8h_source.md)`"` `#include "`[emv/EMV\_CT\_Interface.h](/s-adk-5.1-programmers-guide/_e_m_v___c_t___interface_8h_source.md)`"` `#include "`[emv/EMV\_CT\_SerInterface.h](/s-adk-5.1-programmers-guide/_e_m_v___c_t___ser_interface_8h_source.md)`"` `#include "`[emv/E2E\_EMV\_CT\_Serialize.h](/s-adk-5.1-programmers-guide/_e2_e___e_m_v___c_t___serialize_8h_source.md)`"` `#include "`[emv/EMV\_CTLS\_Interface.h](/s-adk-5.1-programmers-guide/_e_m_v___c_t_l_s___interface_8h_source.md)`"` `#include "`[emv/EMV\_CTLS\_SerInterface.h](/s-adk-5.1-programmers-guide/_e_m_v___c_t_l_s___ser_interface_8h_source.md)`"` `#include "`[emv/E2E\_EMV\_CTLS\_Serialize.h](/s-adk-5.1-programmers-guide/_e2_e___e_m_v___c_t_l_s___serialize_8h_source.md)`"` `#include "`[btlv\_helper.h](/s-adk-5.1-programmers-guide/btlv__helper_8h_source.md)`"` `#include "emv.h"` `#include "emv_ctls.h"` `#include "version.h"` `#include "`[\_logf.h](/s-adk-5.1-programmers-guide/__logf_8h_source.md)`"` `#include "`[disp.h](/s-adk-5.1-programmers-guide/disp_8h_source.md)`"` `#include "`[msr.h](/s-adk-5.1-programmers-guide/msr_8h_source.md)`"` `#include "msr/msr.h"` `#include "`[ui.h](/s-adk-5.1-programmers-guide/ui_8h_source.md)`"` `#include "`[sec/libsec.h](/s-adk-5.1-programmers-guide/libsec_8h_source.md)`"` `#include "`[config.h](/s-adk-5.1-programmers-guide/config_8h_source.md)`"` `#include "config/sdi_sysconfig.h"` `#include "`[sdi\_tags.h](/s-adk-5.1-programmers-guide/src_2sdi__tags_8h_source.md)`"` `#include "data.h"` `#include "`[crypt.h](/s-adk-5.1-programmers-guide/crypt_8h_source.md)`"` `#include "`[loadplugin.h](/s-adk-5.1-programmers-guide/loadplugin_8h_source.md)`"` `#include "common/respVal.h"` `#include "`[main.h](/s-adk-5.1-programmers-guide/main_8h_source.md)`"` `#include "`[madk\_pp\_protocol.h](/s-adk-5.1-programmers-guide/madk__pp__protocol_8h_source.md)`"` `#include "`[pthreadutil.h](/s-adk-5.1-programmers-guide/pthreadutil_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 "`[hexutil.h](/s-adk-5.1-programmers-guide/sdi_2src_2hexutil_8h_source.md)`"` `#include "`[util.h](/s-adk-5.1-programmers-guide/sdi_2src_2util_8h_source.md)`"` `#include "`[sdikeyservice.h](/s-adk-5.1-programmers-guide/sdikeyservice_8h_source.md)`"` `#include "cardranges.h"` `#include "filterconfig.h"` `#include "`[sdi\_timer.h](/s-adk-5.1-programmers-guide/sdi__timer_8h_source.md)`"` `#include "`[sdi\_lang.h](/s-adk-5.1-programmers-guide/sdi__lang_8h_source.md)`"`

|                 |                                                                                         |
| --------------- | --------------------------------------------------------------------------------------- |
| Data Structures |                                                                                         |
| struct          | [UpdateContext](/s-adk-5.1-programmers-guide/readme/annotated/struct_update_context.md) |

|         |                                                                                                                                                                                                                   |
| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Macros  |                                                                                                                                                                                                                   |
| #define | [SECINS\_FORCE\_INSTALL](#ab48015210e330ca6e3f894cb7ac8b35c)   [SECINS\_BIT](/s-adk-5.1-programmers-guide/readme/files/dir_96abbd8654eb9deb39a2a49faed8dd31/libsecins_8h.md#a8785304d958ff2afa1a1558426060af6)(0) |
| #define | [SECINS\_FORCE\_REBOOT](#a7f5afd70f762155ff1036a0a8efde184)   [SECINS\_BIT](/s-adk-5.1-programmers-guide/readme/files/dir_96abbd8654eb9deb39a2a49faed8dd31/libsecins_8h.md#a8785304d958ff2afa1a1558426060af6)(2)  |
| #define | [SET\_RESULT](#ae27eea42be89a6e50555732afafcfb8f)(sw1, sw2)   { rsp\[0] = sw1; rsp\[1] = sw2; \*rspSize = 2; }                                                                                                    |
| #define | [MAX\_UPLOAD\_FILE\_SIZE](#a6168c25344a05918f9e55756eac5522e)   255                                                                                                                                               |

|                                                                                                                                                                                      |                                                                                                                                                                                                                                                |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Functions                                                                                                                                                                            |                                                                                                                                                                                                                                                |
| void                                                                                                                                                                                 | [setSW1SW2](#a2b1e62cbba20fe441f74365bab09c22c) (int result, unsigned char \*rsp)                                                                                                                                                              |
| bool                                                                                                                                                                                 | [sys\_internal\_android](#a914eb0ad5b455073caeed46e742f3cd2) ()                                                                                                                                                                                |
| bool                                                                                                                                                                                 | [vos\_sys8](#a7109ff8195a9046828f8120509022d76) ()                                                                                                                                                                                             |
| bool                                                                                                                                                                                 | [isHwModelName](#aadbe3a6553fce242b52a2655173897fe) (const char \*targetHwModelName)                                                                                                                                                           |
| bool                                                                                                                                                                                 | [checkBundleInstalled](#a3aeb676c0c19ca74396503eb1267f979) (const char \*bdlname)                                                                                                                                                              |
| bool                                                                                                                                                                                 | [handleSystemCmd](#afe8ab8c8d592d69c0b6d074f03081d3e) (unsigned long msgBufSize, unsigned char \*msg, unsigned long msgSize, unsigned short rspBufSize, unsigned char \*rsp, unsigned short \*rspSize)                                         |
| int                                                                                                                                                                                  | [check4Interrupt](#af8ff9f4a2125f866eda540eaf867197b) (void)                                                                                                                                                                                   |
| void                                                                                                                                                                                 | [setInterrupt](#a236d1705a845df2853614cbf8052583b) (enum [ExtserverResult](/s-adk-5.1-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/sys_8h.md#a0ee277aec4317de742cf8b2bd40af3a9) r) |
| int                                                                                                                                                                                  | [isCardRemoved](#a43801947261b861981e5f2c52e878fa0) (void)                                                                                                                                                                                     |
| const char \*                                                                                                                                                                        | [errText](#ae05a33a2f7e55688d36a0692fc795ffe) (int err)                                                                                                                                                                                        |
| void                                                                                                                                                                                 | [setDevice2Idle](#ac28a8edfbaded7c71c0e249ae70aba3b) (void)                                                                                                                                                                                    |
| void                                                                                                                                                                                 | [sysDisplayIdleScreen](#a968e55dee8f3b0ee8226f93667bb2a53) (unsigned mode, const char \*idletext)                                                                                                                                              |
| bool                                                                                                                                                                                 | [sysSetIdleScreenFinished](#a02ab2d39fc437b5924aed122a8adb57e) (unsigned long id)                                                                                                                                                              |
| void                                                                                                                                                                                 | [sysSetIdleScreenAdminMenu](#af85581548b99a07d923feb33e0297b5c) (bool on)                                                                                                                                                                      |
| bool                                                                                                                                                                                 | [sysSetIdleScreenLocked](#a9dc512dc0654bb4a1b9a113c6cdc9224) (bool lock, bool update\_screen)                                                                                                                                                  |
| enum [IdleLockType](/s-adk-5.1-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/sys_8h.md#acbca865bf1cc550151c765b4bb11dc7e) | [sysGetIdleScreenLocked](#af826b34d72f2718baf08d472448063bd) ()                                                                                                                                                                                |
| void                                                                                                                                                                                 | [sysResetUpdateContext](#a6777013b116ca3f41fc511143671ef8e) (void \*handle)                                                                                                                                                                    |

### MacroDefinition Documentation <a href="#macro-definition-documentation" id="macro-definition-documentation"></a>

### MAX\_UPLOAD\_FILE\_SIZE <a href="#a6168c25344a05918f9e55756eac5522e" id="a6168c25344a05918f9e55756eac5522e"></a>

\#define MAX\_UPLOAD\_FILE\_SIZE   255

### SECINS\_FORCE\_INSTALL <a href="#ab48015210e330ca6e3f894cb7ac8b35c" id="ab48015210e330ca6e3f894cb7ac8b35c"></a>

\#define SECINS\_FORCE\_INSTALL   [SECINS\_BIT](/s-adk-5.1-programmers-guide/readme/files/dir_96abbd8654eb9deb39a2a49faed8dd31/libsecins_8h.md#a8785304d958ff2afa1a1558426060af6)(0)

Ignore critical section and proceed with the install after killing the user apps.

### SECINS\_FORCE\_REBOOT <a href="#a7f5afd70f762155ff1036a0a8efde184" id="a7f5afd70f762155ff1036a0a8efde184"></a>

\#define SECINS\_FORCE\_REBOOT   [SECINS\_BIT](/s-adk-5.1-programmers-guide/readme/files/dir_96abbd8654eb9deb39a2a49faed8dd31/libsecins_8h.md#a8785304d958ff2afa1a1558426060af6)(2)

Directive from caller to reboot system. This directive is ignored in case of errors.

### SET\_RESULT <a href="#ae27eea42be89a6e50555732afafcfb8f" id="ae27eea42be89a6e50555732afafcfb8f"></a>

\#define SET\_RESULT

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

### check4Interrupt() <a href="#af8ff9f4a2125f866eda540eaf867197b" id="af8ff9f4a2125f866eda540eaf867197b"></a>

int check4Interrupt

Check if a SysAbort command is received or a Link interruption occurred

#### Returns

RESULT\_MOBILE\_ABORT if a SysAbort is received, RESULT\_NO\_LINK in case of link interrupt, else RESULT\_OK

### checkBundleInstalled() <a href="#a3aeb676c0c19ca74396503eb1267f979" id="a3aeb676c0c19ca74396503eb1267f979"></a>

bool checkBundleInstalled

check for installed bundle with name `bdlname`. String `bdlname` can be a regular expression.

**Parameters**

\[in] **bdlname** name of the bundle (or regex)

#### Returns

true if the bundle is installed, false in case that `bdlname` does not match an installed bundle

{% hint style="info" %}
This function works for VOS/VOS2 only. If invoked on other platforms it returns always false.
{% endhint %}

### errText() <a href="#ae05a33a2f7e55688d36a0692fc795ffe" id="ae05a33a2f7e55688d36a0692fc795ffe"></a>

const char\\\* errText

Return C-String of error ExtserverResult

#### Returns

C-String with error name, "UNKNOWN" for unknown error codes

### handleSystemCmd() <a href="#afe8ab8c8d592d69c0b6d074f03081d3e" id="afe8ab8c8d592d69c0b6d074f03081d3e"></a>

bool handleSystemCmd

Dispatch function to handle different system 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.

### isCardRemoved() <a href="#a43801947261b861981e5f2c52e878fa0" id="a43801947261b861981e5f2c52e878fa0"></a>

int isCardRemoved

Check if a Chip Card is removed

#### Returns

0 = Card inserted, 1 = Card removed

### isHwModelName() <a href="#aadbe3a6553fce242b52a2655173897fe" id="aadbe3a6553fce242b52a2655173897fe"></a>

bool isHwModelName

Check the Hardware Model Name of the device

**Parameters**

\[in] **targetHwModelName** target Hardware Model Name

#### Returns

true if the Hardware Model Name matches, false if the Hardware Model Name doesn't match

### setDevice2Idle() <a href="#ac28a8edfbaded7c71c0e249ae70aba3b" id="ac28a8edfbaded7c71c0e249ae70aba3b"></a>

void setDevice2Idle

Set the device into idle mode

### setInterrupt() <a href="#a236d1705a845df2853614cbf8052583b" id="a236d1705a845df2853614cbf8052583b"></a>

void setInterrupt

Make the check4Interrupt return not RESULT\_OK once.

### setSW1SW2() <a href="#a2b1e62cbba20fe441f74365bab09c22c" id="a2b1e62cbba20fe441f74365bab09c22c"></a>

void setSW1SW2

Map result to SW1/SW2

**Parameters**

\[in] **result** SDI result code \[in,out] **rsp** pointer to the response buffer

### sys\_internal\_android() <a href="#a914eb0ad5b455073caeed46e742f3cd2" id="a914eb0ad5b455073caeed46e742f3cd2"></a>

bool sys\_internal\_android

checks for device types, which run SDI server on Engage and the payment application on the internal Android device. A special internal network is used to connect both devices. Recently these are CM5, M440 and M424. Others like X10 or X8 shall not match, since payment application runs on Engage here.

#### Returns

true for internal android with payment application

### sysDisplayIdleScreen() <a href="#a968e55dee8f3b0ee8226f93667bb2a53" id="a968e55dee8f3b0ee8226f93667bb2a53"></a>

void sysDisplayIdleScreen

Display idle screen

**Parameters**

\[in] **mode** idle screen mode bit mask, see enum IdleScreenMode \[in] **idletext** optional text used in favor of standard or customer text

### sysGetIdleScreenLocked() <a href="#af826b34d72f2718baf08d472448063bd" id="af826b34d72f2718baf08d472448063bd"></a>

enum [IdleLockType](/s-adk-5.1-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/sys_8h.md#acbca865bf1cc550151c765b4bb11dc7e) sysGetIdleScreenLocked

Returns true, if idle screen was locked either by [sysSetIdleScreenLocked()](/s-adk-5.1-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/sys_8h.md#af0f2a2ccba88c6c9f0ee759172febaa0) or admin mode w/o admin menu was turned on by [sysSetIdleScreenAdminMenu()](/s-adk-5.1-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/sys_8h.md#af85581548b99a07d923feb33e0297b5c)

#### Returns

true, if idle screen is locked, else false

### sysResetUpdateContext() <a href="#a6777013b116ca3f41fc511143671ef8e" id="a6777013b116ca3f41fc511143671ef8e"></a>

void sysResetUpdateContext

Reset update context allocated for SW update with 20-14, 20-15, 20-16. The function is invoked by a thread at connection termination to abort a pending update which was started by command 20-14, but not completed with 20-15 and 20-16. SDI server supports multiple connections, which can use the update interface. With a started update with command 20-14 on one connection, the interface is locked for other connections. If a connection terminates, which obtains the update context (lock), the interface would be unaccessable for other connections. Therfore, this function will abort the started update and unlock the update interface, if the connection disturbes so that it can be used by other connection again.

**Parameters**

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

### sysSetIdleScreenAdminMenu() <a href="#af85581548b99a07d923feb33e0297b5c" id="af85581548b99a07d923feb33e0297b5c"></a>

void sysSetIdleScreenAdminMenu

Turn on the admin menu, if this was locked by admin mode (enabled by config). Next call of [sysDisplayIdleScreen()](/s-adk-5.1-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/sys_8h.md#ad2bc24707c477aa4c2cb1c4fb92855df) with mode Idle\_MenuEnabled then will display idle screen with menu/info softkey/keyhelpers.

{% hint style="info" %}
This function has no effect, if admin mode is disabled (not enabled by config).
{% endhint %}

### sysSetIdleScreenFinished() <a href="#a02ab2d39fc437b5924aed122a8adb57e" id="a02ab2d39fc437b5924aed122a8adb57e"></a>

bool sysSetIdleScreenFinished

Function called by idlescreen callback to signal the return of idlescreen

**Parameters**

\[in] **id** idlescreen ID forwarded by idlescreen callback

#### Returns

true, if the last idle screen has display the admin menu, (for active admin mode) else false is returned.

### sysSetIdleScreenLocked() <a href="#a9dc512dc0654bb4a1b9a113c6cdc9224" id="a9dc512dc0654bb4a1b9a113c6cdc9224"></a>

bool sysSetIdleScreenLocked

Lock/Unlock the idle screen and disable/enable softkeys/keyhelpers to access the menu. If locked, further subsequent calls of [sysDisplayIdleScreen()](/s-adk-5.1-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/sys_8h.md#ad2bc24707c477aa4c2cb1c4fb92855df) with mode `Idle_MenuEnabled` are suppressed and idle screen is displayed without softkeys/keyhelpers. Parameter `update_screen` (set to true) will replace an existing idle screen by a default idle screen by invoking function [sysDisplayIdleScreen()](/s-adk-5.1-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/sys_8h.md#ad2bc24707c477aa4c2cb1c4fb92855df) with or without option Idle\_MenuEnabled depending on the new lock state `lock`.

**Parameters**

**lock** new lock state: true/false to lock/unlock the idle screen **update\_screen** update an existing idle screen and enable/disable menu according new lock state

#### Returns

old lock state (before this function was called): true, if the idlescreen was already locked false, if the idlescreen was already unlocked

{% hint style="info" %}
This function does nothing, if SDI admin mode was enabled by configuration. The admin mode defines another behavior for locking the idle screen (e.g. it must be always unlocked by key combination or touch. Thus, internal calls of this function, will be ignored
{% endhint %}

### vos\_sys8() <a href="#a7109ff8195a9046828f8120509022d76" id="a7109ff8195a9046828f8120509022d76"></a>

bool vos\_sys8

returns true, if SDI server runs on V/OS as system user sys8

#### Returns

true if running as sys8 user


---

# 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/sys_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.
