> 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/readme/files/dir_30aba3d9bf6279a25d84abe4015711f7/dir_f7a957c8f5c8e80b5a8d4b37f193d419/dir_e8da2933844aa72825eccee783cf08f3/_file_download_8c.md).

# FileDownload.c

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

`#include <zlib.h>` `#include <libgen.h>` `#include <cJSON.h>` `#include "EventScheduler.h"` `#include "VHQDebug.h"` `#include "VHQDownloader.h"` `#include "VHQManager.h"` `#include "VHQIo.h"` `#include "VHQIoInternals.h"` `#include "VHQSecurity.h"` `#include "../inc/VHQConfig.h"` `#include "../inc/VHQFileNames.h"` `#include "VHQUtils.h"`

|         |                                                       |
| ------- | ----------------------------------------------------- |
| Macros  |                                                       |
| #define | [MAX\_CHAR](#a82acb32225c05e9aa4c524c40bc5852a)   255 |
| #define | [CHUNK](#a25022864dfc8ec428e7128282e57b136)   16384   |

|                |                                                                                                                                                                                                                                                                                                                                                  |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Functions      |                                                                                                                                                                                                                                                                                                                                                  |
| vhq\_result\_t | [VHQMAIN\_ProcessParameterUpdate](#aec8b120499ecebf6cb9e2ba1b815e06a) (char \*receiver, char \*pszDest, char \*additional\_info, uint32 additional\_info\_size, dl\_file\_dl\_type\_t eType)                                                                                                                                                     |
| vhq\_result\_t | [DownloadFile](#aa3414fa71d3b4e462fb315c03df25f47) (dl\_file\_method\_t eMethod, char \*pszDest, char \*pszDestFlash, dl\_file\_hash\_algo\_t eHashAlgo, char \*pszHash, char \*pszUrl, bool bMaintDl, uint32 filesize, event\_set\_id\_t event\_set\_id, event\_id\_t event\_id, uint32 \*dl\_duration, uint32 \*dl\_attempts, bool dl\_notify) |
| vhq\_result\_t | [ProcessDownloadFile](#ae39de27973e7d48f7dcc630a95b362a6) (char \*user, char \*pszFromDest, char \*pszToDest, dl\_file\_dl\_type\_t eType, VHQResponseSendMsg \*response, char \*receiver, event\_set\_id\_t event\_set\_id, event\_id\_t event\_id, bool compressionEnabled, uint32 \*si\_flag\_ptr)                                            |

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

Download file given URL

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

### CHUNK <a href="#a25022864dfc8ec428e7128282e57b136" id="a25022864dfc8ec428e7128282e57b136"></a>

\#define CHUNK   16384

### MAX\_CHAR <a href="#a82acb32225c05e9aa4c524c40bc5852a" id="a82acb32225c05e9aa4c524c40bc5852a"></a>

\#define MAX\_CHAR   255

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

### DownloadFile() <a href="#aa3414fa71d3b4e462fb315c03df25f47" id="aa3414fa71d3b4e462fb315c03df25f47"></a>

vhq\_result\_t DownloadFile

This function calls function to download a file from server and copies file from tmp to flash, if download completed.

**Parameters**

\[in] **eMethod** = file download method \[in] **pszDest** = partial download file name(tmp) \[out] **pszDestFlash** = full download file name(flash) \[in] **eHashAlgo** = hash algorithm \[in] **pszHash** = hash value \[in] **pszUser** = user \[in] **pszPw** = PW \[in] **pszUrl** = URL \[in] **bMaintDl** = TRUE, if maintenance download \[in] **filesize** = size of file to download \[in] **event\_set\_id** = event sed id of event \[in] **event\_id** = event ID of event \[out] **dl\_duration** = download duration \[out] **dl\_attempts** = number of download attempts \[in] **dl\_notify** = Download notifications

#### Returns

vhq\_result\_t VHQ\_SUCCESS, if success

### ProcessDownloadFile() <a href="#ae39de27973e7d48f7dcc630a95b362a6" id="ae39de27973e7d48f7dcc630a95b362a6"></a>

vhq\_result\_t ProcessDownloadFile

This function processes the download file.

**Parameters**

\[in] **user** = username \[in] **pszFromDest** = downloaded location \[in] **pszToDest** = copy to this destination \[in] **eType** = downloaded file type \[out] **response** = response to send to server \[in] **receiver** = receiver name of app \[in] **event\_set\_id** = event set ID of event \[in] **event\_id** = event ID of event \[in] **compressionEnabled** = TRUE, if compression enabled \[out] **si\_flag\_ptr** = pointer to SI flag

#### Returns

VHQ\_SUCCESS, if success; FALSE, otherwise

### VHQMAIN\_ProcessParameterUpdate() <a href="#aec8b120499ecebf6cb9e2ba1b815e06a" id="aec8b120499ecebf6cb9e2ba1b815e06a"></a>

vhq\_result\_t VHQMAIN\_ProcessParameterUpdate

This function processes a parameter update for application.

**Parameters**

\[in] **receiver** = receiver name. \[in] **pszDest** = downloaded file \[in] **additional\_info** = additional info \[in] **additional\_info\_size** = additional info size \[in] **eType** = type of downloaded file

#### Returns

VHQ\_SUCCESS, if success.


---

# 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/readme/files/dir_30aba3d9bf6279a25d84abe4015711f7/dir_f7a957c8f5c8e80b5a8d4b37f193d419/dir_e8da2933844aa72825eccee783cf08f3/_file_download_8c.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.
