> 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/adk-5.0-programmers-guide/sdiprotocol_8h_source.md).

# sdiprotocol.h

[Go to the documentation of this file.](/adk-5.0-programmers-guide/readme/files/dir_fd97ec13bcecf864d0a2538bcb52d927/dir_36b98f307880f17766d73e6cc4503277/sdiprotocol_8h.md)

```cpp
 1 
 6 #ifndef _SDIPROTOCOL_H_
 7 #define _SDIPROTOCOL_H_
 8 
 9 #ifdef __cplusplus
 10 extern "C" {
 11 #endif
 12 
 16 #define SDI_PROTOCOL_ERR_IO -1 
 17 #define SDI_PROTOCOL_ERR_CONCURRENT_USE -2 
 18 #define SDI_PROTOCOL_ERR_CONNECT -3 
 19 #define SDI_PROTOCOL_ERR_OVERFLOW -4 
 20 #define SDI_PROTOCOL_ERR_PARAM -5 
 21 #define SDI_PROTOCOL_ERR_OTHER -6 
 22 #define SDI_PROTOCOL_ERR_NO_RECEIVE -7 
 23 
 26 
 30 #define SDI_PROTOCOL_INIT_OPT_TRACE_EMV_CBK 0x01 
 31 #define SDI_PROTOCOL_INIT_OPT_TRACE_SYSLOG 0x02 
 32 #define SDI_PROTOCOL_INIT_OPT_TRACE_ADK_LOG 0x04 
 33 
 35 
 36  /*****************************************************************************
 37  * SDI_ProtocolInit
 38  *****************************************************************************/
 62  int SDI_ProtocolInit(unsigned options, const char *settings);
 63 
 64  /*****************************************************************************
 65  * SDI_Send
 66  *****************************************************************************/
 76  int SDI_Send(const unsigned char *data, int dataLength);
 77 
 78  /*****************************************************************************
 79  * SDI_Receive
 80  *****************************************************************************/
 90  int SDI_Receive(unsigned char *responseBuffer, int responseBufferSize);
 91 
 92  /*****************************************************************************
 93  * SDI_SendReceive
 94  *****************************************************************************/
 106  int SDI_SendReceive(const unsigned char *data, int dataLength, unsigned char *responseBuffer, int responseBufferSize);
 107 
 117  unsigned char* SDI_GetStoredResponse(unsigned *dataLen);
 118 
 119  /*****************************************************************************
 120  * SDI_Disconnect
 121  *****************************************************************************/
 129  int SDI_Disconnect(void);
 130 
 132  typedef void (*SDI_DATA_AVAILABLE_CALLBACK_TYPE)(void *context);
 133 
 134  /*****************************************************************************
 135  * SDI_SetDataAvailableCallback
 136  *****************************************************************************/
 144  int SDI_SetDataAvailableCallback(SDI_DATA_AVAILABLE_CALLBACK_TYPE cb, void *context);
 145 
 153  typedef void (*SDI_CALLBACK_TYPE)(unsigned char *dataIn, unsigned short sizeIn, unsigned char *dataOut, unsigned short *sizeOut, void *context);
 154 
 155  /***************************************************************************************
 156  * SDI_SetSdiCallback
 157  ****************************************************************************************/
 163  int SDI_SetSdiCallback(SDI_CALLBACK_TYPE cb, void *context);
 164 
 170  typedef void (*CARD_DETECTED_CALLBACK_TYPE)(unsigned char *dataIn, unsigned short sizeIn, void *context);
 171 
 172  /***************************************************************************************
 173  * SDI_SetCardDetectedCallback
 174  ****************************************************************************************/
 180  int SDI_SetCardDetectedCallback(CARD_DETECTED_CALLBACK_TYPE cb, void *context);
 181 
 182  /***************************************************************************************
 183  * SDI_SendSysAbort
 184  ****************************************************************************************/
 190  void SDI_SendSysAbort(void);
 191 
 192  /***************************************************************************************
 193  * SDI_SendExternalButton
 194  ****************************************************************************************/
 199  void SDI_SendExternalButton(void);
 200 
 204  typedef void (*EOF_DETECTED_CALLBACK_TYPE)(void *context);
 205 
 206  /***************************************************************************************
 207  * SDI_SetEOFDetectedCallback
 208  ****************************************************************************************/
 215  int SDI_SetEOFDetectedCallback(EOF_DETECTED_CALLBACK_TYPE cb, void *context);
 216 
 217  /***************************************************************************************
 218  * SDI_SetLoggingCallback
 219  ****************************************************************************************/
 227  int SDI_SetLoggingCallback(void (*cb)(const char*, void*), void* context);
 228 
 229 
 230 #ifdef __cplusplus
 231 }
 232 #endif
 233 
 234 #endif // _SDIPROTOCOL_H_
```


---

# 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/adk-5.0-programmers-guide/sdiprotocol_8h_source.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.
