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

# loadplugin.cpp

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

`#include "`[loadplugin.h](/s-adk-5.1-programmers-guide/loadplugin_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 <string.h>` `#include <string>` `#include <dlfcn.h>` `#include <stdio.h>` `#include <stdlib.h>` `#include "`[madk\_pp\_protocol.h](/s-adk-5.1-programmers-guide/madk__pp__protocol_8h_source.md)`"` `#include "`[\_logf.h](/s-adk-5.1-programmers-guide/__logf_8h_source.md)`"` `#include "`[sdi\_tags.h](/s-adk-5.1-programmers-guide/src_2sdi__tags_8h_source.md)`"` `#include "common/callback.h"` `#include "`[sys.h](/s-adk-5.1-programmers-guide/sys_8h_source.md)`"` `#include "epp/counterTop.h"` `#include "card_dt.h"` `#include "`[msr.h](/s-adk-5.1-programmers-guide/msr_8h_source.md)`"` `#include "msr/msr.h"` `#include "vcl_client.h"`

Include dependency graph for loadplugin.cpp:

![](/files/0N3t0L6Fg8urDA3jHZry)

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

|         |                                                                                                                |
| ------- | -------------------------------------------------------------------------------------------------------------- |
| Macros  |                                                                                                                |
| #define | [SET\_RESULT](#ae27eea42be89a6e50555732afafcfb8f)(sw1, sw2)   { rsp\[0] = sw1; rsp\[1] = sw2; \*rspSize = 2; } |

|                                                                                                              |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Functions                                                                                                    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| const vector< [SDIPluginCtx](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin_ctx.md) \* > & | [loadPlugins](#a6be6ae1436dfd4046cd1932d4ef660f4) (bool reload)                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| const vector< [SDIPluginCtx](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin_ctx.md) \* > & | [getLoadedPlugins](#a4f3977607630c58a3dccba35c3de9615) ()                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [SDIPlugin](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin.md) \*                          | [getPlugin](#a206221de659eaea0b9c26cfcb96bc049) (int pluginID)                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| void                                                                                                         | [storePluginMsrData](#aeba42accf97dbdbf6607ca2abec9e83b) ([MSR\_TrackData4](/s-adk-5.1-programmers-guide/readme/files/dir_b259c67979486db4cd1816234700c14a/dir_699851f087f6e6136e28f04fc8a16e7d/msr__common_8h.md#struct_m_s_r___track_data4) \&tracks, [MSR\_DecodedData4](/s-adk-5.1-programmers-guide/readme/files/dir_b259c67979486db4cd1816234700c14a/dir_699851f087f6e6136e28f04fc8a16e7d/msr__common_8h.md#struct_m_s_r___decoded_data4) \&decoded)                                                                              |
| void                                                                                                         | [registerPlugin](#a9d5f8efae300809ef2582ef2d30b8d38) ([SDIPluginCtx](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin_ctx.md) \*p)                                                                                                                                                                                                                                                                                                                                                                                      |
| [SDIPluginCtx](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin_ctx.md) \*                   | [unregisterPlugin](#a9466acd3b9b72635116b8b57c1420fb1) (const string \&filename)                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| void                                                                                                         | [handlePluginCmd](#aedeb718f16bf12b0642776c0f92cb209) (unsigned short msgBufSize, unsigned char \*msg, unsigned short msgSize, unsigned short rspBufSize, unsigned char \*rsp, unsigned short \*rspSize)                                                                                                                                                                                                                                                                                                                                |
| void                                                                                                         | [broadcastTriggerLocal](#ab48067ad9c7284b0560e8390c9ac1944) ([SDIPlugin::SDITrigger](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin.md#a82c0da164c73dfba432f58136b1d3dab) triggerID, csd\_data \&message, vector< struct [bcTriggerResult](/s-adk-5.1-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/loadplugin_8h.md#structbc_trigger_result) > \&results)                                                                                                 |
| void                                                                                                         | [broadcastTrigger](#a0f98b5c2f8e38daf732d4a7403c9e898) ([SDIPlugin::SDITrigger](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin.md#a82c0da164c73dfba432f58136b1d3dab) triggerID, csd\_data \&message, vector< struct [bcTriggerResult](/s-adk-5.1-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/loadplugin_8h.md#structbc_trigger_result) > \&results)                                                                                                      |
| int                                                                                                          | [executeSingleTrigger](#abe54f620b7267559920a8f6f8f0c3705) ([SDIPlugin::SDITrigger](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin.md#a82c0da164c73dfba432f58136b1d3dab) triggerID, unsigned char \*msg, unsigned short msgSize, unsigned short resBufSize, unsigned char \*res, unsigned short \*resSize)                                                                                                                                                                                                            |
| [SDIPlugin](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin.md) \*                          | [pluginInstalledForTrigger](#a4a24ab51f8a1f35a6d9b09fdc4639f4a) ([SDIPlugin::SDITrigger](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin.md#a82c0da164c73dfba432f58136b1d3dab) triggerID)                                                                                                                                                                                                                                                                                                                              |
| int                                                                                                          | [executeSequencialTrigger](#ac3f6ed9f939661a29c9a91ccb603e767) ([SDIPlugin::SDITrigger](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin.md#a82c0da164c73dfba432f58136b1d3dab) triggerID, [PLUGIN\_READ\_TYPE](/s-adk-5.1-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/loadplugin_8h.md#a87d5b69b03a93be2f94ede88b3675e79) readType, unsigned char \*msg, unsigned short msgSize, unsigned short resBufSize, unsigned char \*res, unsigned short \*resSize) |

|                                                                                                      |                                               |
| ---------------------------------------------------------------------------------------------------- | --------------------------------------------- |
| Variables                                                                                            |                                               |
| vector< [SDIPluginCtx](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin_ctx.md) \* > | [plugins](#ac05523f594f474b2718c180c15fc11de) |

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

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

\#define SET\_RESULT

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

### broadcastTrigger() <a href="#a0f98b5c2f8e38daf732d4a7403c9e898" id="a0f98b5c2f8e38daf732d4a7403c9e898"></a>

void broadcastTrigger

### broadcastTriggerLocal() <a href="#ab48067ad9c7284b0560e8390c9ac1944" id="ab48067ad9c7284b0560e8390c9ac1944"></a>

void broadcastTriggerLocal

### executeSequencialTrigger() <a href="#ac3f6ed9f939661a29c9a91ccb603e767" id="ac3f6ed9f939661a29c9a91ccb603e767"></a>

int executeSequencialTrigger

### executeSingleTrigger() <a href="#abe54f620b7267559920a8f6f8f0c3705" id="abe54f620b7267559920a8f6f8f0c3705"></a>

int executeSingleTrigger

### getLoadedPlugins() <a href="#a4f3977607630c58a3dccba35c3de9615" id="a4f3977607630c58a3dccba35c3de9615"></a>

const vector\\<[SDIPluginCtx](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin_ctx.md) \\\*\\>& getLoadedPlugins

return the list of loaded and registered SDI plugins

#### Returns

list of loaded and registered SDI plugins as vector (storing instances of class [SDIPluginCtx](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin_ctx.md))

### getPlugin() <a href="#a206221de659eaea0b9c26cfcb96bc049" id="a206221de659eaea0b9c26cfcb96bc049"></a>

[SDIPlugin](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin.md)\\\* getPlugin

### handlePluginCmd() <a href="#aedeb718f16bf12b0642776c0f92cb209" id="aedeb718f16bf12b0642776c0f92cb209"></a>

void handlePluginCmd

### loadPlugins() <a href="#a6be6ae1436dfd4046cd1932d4ef660f4" id="a6be6ae1436dfd4046cd1932d4ef660f4"></a>

const vector\\<[SDIPluginCtx](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin_ctx.md) \\\*\\>& loadPlugins

loads the SDI plugins from the SDI plugin folders and register them to the list of loaded SDI plugins. SDI plugin folders are the following:

1. Internal home lib directory
2. External plugin directory (Android only).

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>If a plugin in external plugin directory is found and has the same name as an plugin from home lib directory, the external plugin is preferred.</p></div>

   If mode flag \`reload\` is set true (default), all plugins are loaded or reloaded. If the flag is set to false, only the those plugins are loaded, which are not yet registered in the list of loaded SDI plugins. \*\*Parameters\*\*

   \[in] **reload** set to true (default), to unload already registered plugins, before they get loaded

   #### Returns

   list of loaded and registered SDI plugins as vector (storing instances of class [SDIPluginCtx](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin_ctx.md))

### pluginInstalledForTrigger() <a href="#a4a24ab51f8a1f35a6d9b09fdc4639f4a" id="a4a24ab51f8a1f35a6d9b09fdc4639f4a"></a>

[SDIPlugin](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin.md)\\\* pluginInstalledForTrigger

checks for installed/loaded plugins, which support a specific trigger specified by `triggerID`.

**Parameters**

\[in] **triggerID** trigger ID to check plugins, if the trigger is supported

#### Returns

poniter to the first found plugin object if there is at least one plugin, which supports trigger `triggerID`, else false.

### registerPlugin() <a href="#a9d5f8efae300809ef2582ef2d30b8d38" id="a9d5f8efae300809ef2582ef2d30b8d38"></a>

void registerPlugin

register a loaded plugin to the list of SDI plugins. If the plugin is not valid or not loaded, this function does nothing. If a plugin with the same plugin file name, was already registered, the old plugin is unregistered and unloaded, before the new plugin is added.

**Parameters**

\[in] **p** new plugin to register in list of loaded SDI plugins

### storePluginMsrData() <a href="#aeba42accf97dbdbf6607ca2abec9e83b" id="aeba42accf97dbdbf6607ca2abec9e83b"></a>

void storePluginMsrData

### unregisterPlugin() <a href="#a9466acd3b9b72635116b8b57c1420fb1" id="a9466acd3b9b72635116b8b57c1420fb1"></a>

[SDIPluginCtx](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin_ctx.md)\\\* unregisterPlugin

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

### plugins <a href="#ac05523f594f474b2718c180c15fc11de" id="ac05523f594f474b2718c180c15fc11de"></a>

vector\\<[SDIPluginCtx](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin_ctx.md) \\\*\\> plugins

registration list storing the loaded plugins (instances of class [SDIPluginCtx](/s-adk-5.1-programmers-guide/readme/annotated/class_s_d_i_plugin_ctx.md)) as vector


---

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