> For the complete documentation index, see [llms.txt](https://developer.magtek.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.magtek.com/sdks-and-tools/universal-sdk-documentation/android/ideviceconfiguration.md).

# IDeviceConfiguration

Create an instance of the IDeviceConfiguration using getDeviceConfiguration(). Then use the function calls described in this chapter.

Generally, these functions will run in one of two modes:

* Asynchronous functions return data in the event handlers in section.
* Synchronous functions return data in the return value. If the data is not available immediately, the call will block until a wait time has elapsed.

## deleteFile

This function deletes a file from the device.

**Copy**

```java
int IDeviceConfiguration.deleteFile(byte[] fileID);
```

**Parameter**

* **fileID**\
  Byte array for the file ID. For DynaFlex, use a 4-byte file id. 0x02000000 = Custom idle page image 1

  0x02000001 = Custom idle page image 2 0x02000002 = Custom idle page image 3 0x02000003 = Custom idle page image 4

**Return Value:**

Returns 0 if the asynchronous update operation started. Otherwise, returns a non 0 value.

## getChallengeToken

This function retrieves a challenge token from the device. A challenge token consists of a random nonce or timestamp. A challenge token must be used within the time allowed by the device (generally 5 minutes) of being issued. Only one token can be active at a time. Attempts to use a token for requests other than the one specified will cause the token to be revoked/erased.

**Copy**

```java
byte[] IDeviceConfiguration.getChallengeToken(byte[] data);
```

**Parameter**

* **data**\
  Byte array containing the request ID to be protected.

**Return Value:**

Returns a byte array containing the challenge token.

## getConfigInfo

This function retrieves device configuration information.

**Copy**

```java
byte[]IDeviceConfiguration.getConfigInfo(
    byte configType,
    byte[] data);
```

**Parameter**

* **configType**\
  Type of configuration. For DynaFlex, this is the function ID.
* **data**\
  Configuration data to be sent to the device. For DynaFlex, this is the OID.

**Return Value:**

Returns an array of bytes containing the configuration information.

## getDeviceInfo

This function retrieves device specific information.

**Copy**

```java
String IDeviceConfiguration.getDeviceInfo(InfoType infoType);
```

**Parameter**

* **infoType**\
  Enumerated information type.

**Return Value:**

Returns a string value device information.

## getFile

This function retrieves device specific information.

**Copy**

```java
int IDeviceConfiguration.getFile( byte[] fileID, IConfigurationCallback callback);
```

**Parameter**

* **fileID**\
  Byte array for the file ID. For DynaFlex, use a 4-byte file id.
* **callback**\
  Name of a class or structure that implements the IConfigurationCallback Delegates events.

**Return Value:**

Returns a string value device information.

## getKeyInfo

This function retrieves key information.

**Copy**

```java
byte[]IDeviceConfiguration.getKeyInfo(
    byte keyType,
    byte[] data);
```

**Parameter**

* **keyType**\
  Type of key. For DynaFlex, use 0.
* **data**\
  Key data to be sent to the device. For DynaFlex, this is the 2-byte key slot number.

**Return Value:**

Returns an array of bytes containing the key information.

## sendFile

This function sends a file to the device.

**Copy**

```java
int IDeviceConfiguration.sendFile(
    byte[] fileID,
    byte[] data, IConfigurationCallback callback);
```

**Parameter**

* **fileID**\
  Byte array for the file ID. For DynaFlex, use a 4-byte file id.
* **data**\
  File contents to be sent to the device.
* **callback**\
  Name of a class or structure that implements the IConfigurationCallback Delegates events.

**Return Value:**

Returns 0 if the asynchronous update operation started. Otherwise, returns a non 0 value.

## sendImage

This function sends an image to the device.

**Copy**

```java
int IDeviceConfiguration.sendImage(
    byte imageID,
    byte[] data,
    IConfigurationCallback callback);
```

**Parameter**

* **imageID**\
  Value for the image ID. For DynaFlex, use:

  1, 2, 3, or 4
* **data**\
  File contents to be sent to the device.

  Images must be BMP format, 160KB or smaller with no compression, maximum 320px by 240px, with color depth 16 color, 256 color, 16-bit color, 24-bit color. Images smaller than the maximum size are centered on the display. Note images at full screen size must be 16-bit color or lower to meet the size requirement.

  For details see *D998200383 DynaFlex Family Programmer's Manual (Commands)*.
* **callback**\
  Name of a class or structure that implements the IConfigurationCallback Delegates events.

**Return Value:**

Returns 0 if the asynchronous update operation started. Otherwise, returns a non 0 value.

## sendSecureFile

This function sends a file to the device using a secure command structure.

**Copy**

```java
int IDeviceConfiguration.sendSecureFile(
    byte[] fileID,
    byte[] data, IConfigurationCallback callback);
```

**Parameter**

* **fileID**\
  Byte array for the file ID. For DynaFlex, use a 4-byte file id.
* **data**\
  File contents to be sent to the device.
* **callback**\
  Name of a class or structure that implements the IConfigurationCallback Delegates events.

**Return Value:**

Returns 0 if the asynchronous update operation started. Otherwise, returns a non 0 value.

## setConfigInfo

This function sets device configuration information.

**Copy**

```java
int IDeviceConfiguration.setConfigInfo(
    byte configType,
    byte[] data, IConfigurationCallback callback);
```

**Parameter**

* **configType**\
  Type of configuration. For DynaFlex, this is the function ID.
* **data**\
  Configuration data to be sent to the device.
* **callback**\
  Name of a class or structure that implements the IConfigurationCallback Delegates events.

**Return Value:**

Returns 0 if the asynchronous configuration operation started. Otherwise, returns a non 0 value.

## setDisplayImage

This function sets which image is to be displayed when the device is idle.

**Copy**

```java
int IDeviceConfiguration.setDisplayImage(byte imageID);
```

**Parameter**

* **imageID**\
  Value for the image ID. For DynaFlex, use:

  0, 1, 2, 3, or 4

  Where 0 substitutes the “Welcome” screen.

**Return Value:**

Returns 0 if the asynchronous configuration operation started. Otherwise, returns a non 0 value.

## updateFirmware

This function updates the device firmware.

**Copy**

```java
int IDeviceConfiguration.updateFirmware(
    ushort firmwareType,
    byte[] data,
    IConfigurationCallback callback);
```

**Parameter**

* **firmwareType**\
  Type of firmware. For DynaFlex, use:

  1 - Main App
* **data**\
  Firmware image to be sent to the device.
* **callback**\
  Name of a class or structure that implements the IConfigurationCallback Delegates events.

**Return Value:**

Returns 0 if the asynchronous update operation started. Otherwise, returns a non 0 value.

## updateKeyInfo

This function updates key information in the device.

**Copy**

```java
int IDeviceConfiguration.updateKeyInfo(
    byte keyType,
    byte[] data,
    IConfigurationCallback callback);
```

**Parameter**

* **keyType**\
  Type of key.
* **data**\
  Key data to be sent to the device.
* **callback**\
  Name of a class or structure that implements the IConfigurationCallback Delegates events.

**Return Value:**

Returns 0 if the asynchronous update operation started. Otherwise, returns a non 0 value.


---

# 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://developer.magtek.com/sdks-and-tools/universal-sdk-documentation/android/ideviceconfiguration.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.
