# Configuration and Connectivity

This guide covers how to manage application versions, handle specific compilation variants, and verify the communication link between your Host System and the Pinpad device.

## Application versioning

The application follows a semantic versioning format and a specific internal convention to ensure build traceability and OS compatibility.

### Versioning format

The versioning follows the format **X.Y.Z-rc**:

* **X (Major Version)**: Main software version.
* **Y (Minor Version)**: Addition of new functionalities.
* **Z (Revision)**: Code revisions or bug fixes.
* **rc**: Stands for "release candidate."

### Versioning convention

To update the version, modify the `versionCode` and `versionName` in the `build.gradle.kts(:app)` file. This project requires the **`versionCode`** (an integer used by Android) to match the **`versionName`** with all non-numeric characters removed.

> **Example**: If `versionName` is "1.9.8-rc", the `versionCode` must be **198**.

## Compilation variants

The Pinpad Getnet project uses compilation variants to enable or disable functional logic at compile time via specific flags.

### Flag definitions

* **`RemoveFlagScreen`**: When **TRUE**, it **activates** the "Remove Card" (Retire Tarjeta) screen upon transaction completion.
* **`EmvSpecialTags`**: When **TRUE**, enables the transmission of EMV tags `9F1A`, `5F2A`, and `5F34` in the cryptogram responses.
* **`ChangeYDL`**: When **TRUE**, the error screen during a remote download (YDL) remains visible indefinitely until manually dismissed. In this mode, the screen displays granular details including the failed package number, byte volume, and file path.

### Variant mapping table

Select the variant corresponding to your required flag combination:

| Variant | Bits | ChangeYDL | EmvSpecialTags | RemoveFlagScreen |
| ------- | ---- | --------- | -------------- | ---------------- |
| **F00** | 000  | FALSE     | FALSE          | FALSE            |
| **F01** | 001  | FALSE     | FALSE          | TRUE             |
| **F02** | 010  | FALSE     | TRUE           | FALSE            |
| **F03** | 011  | FALSE     | TRUE           | TRUE             |
| **F04** | 100  | TRUE      | FALSE          | FALSE            |
| **F05** | 101  | TRUE      | FALSE          | TRUE             |
| **F06** | 110  | TRUE      | TRUE           | FALSE            |
| **F07** | 111  | TRUE      | TRUE           | TRUE             |

### Compiling variants

1. Open the **Build Variants** tool window in Android Studio (**View > Tool Windows > Build Variants**).
2. Select the desired variant (e.g., `F03Debug`).
3. To generate all debug APKs simultaneously, run `./gradlew assembleDebug` in the terminal. Note that for production environments, `assembleRelease` is used.

## Connectivity check (echo test)

The **Y0I** (Echo Request) command verifies the serial link and retrieves technical identifiers from the terminal without changing the UI state.

### Request \[Host]

The Host must send the following payload:

| Field       | Value     | Attribute | Description                             |
| ----------- | --------- | --------- | --------------------------------------- |
| **`<STX>`** | 02h       | 1 H       | Start of Message                        |
| **\[CID]**  | “Y0I”     | 3 ANS     | Command Identifier                      |
| **`<ETX>`** | 03h       | 1 H       | End of Message                          |
| **\{LRC\}**   | Algorithm | 1 H       | Error Check (See Integrity & Checksums) |

A minimal Echo request frame would look as follows:

```text
<STX>Y0I<ETX>#
```

### Response \[Pinpad]

If functional, the Pinpad returns its hardware and software metadata, separated by **`<FS>`** (Field Separators - 1Ch).

| Field      | Attribute | Description                             |
| ---------- | --------- | --------------------------------------- |
| **\[CID]** | 3 ANS     | Command Identifier (“Y0I”)              |
| **\[OWN]** | 15 ANS    | Pinpad owner (“GETNET”)                 |
| **`<FS>`** | 1 H       | Field Separator                         |
| **\[VEN]** | 1..15 ANS | Manufacturer ID (Retrieved from device) |
| **`<FS>`** | 1 H       | Field Separator                         |
| **\[MOD]** | 1..15 ANS | Pinpad model (e.g., “N750P”)            |
| **`<FS>`** | 1 H       | Field Separator                         |
| **\[VOS]** | 1..15 ANS | OS version (e.g., “Android 12”)         |
| **`<FS>`** | 1 H       | Field Separator                         |
| **\[SOF]** | 1..15 ANS | Software version (e.g., “1.9.7-rc”)     |
| **`<FS>`** | 1 H       | Field Separator                         |
| **\[NSF]** | 1..15 ANS | Device Serial Number                    |

A successful response frame would resemble the following:

```text
<ACK><STX>Y0IGETNET<FS>newland<FS>N750P<FS>Android 12<FS>1.9.7-rc<FS>NDB400005172<ETX>g
```

## Next steps

With connectivity verified and the build system configured, you can proceed to:

1. [**Architecture & Core Concepts**](https://docs.globalgetnet.com/en/products/in-store-payments/host-to-host?doc=h2h-system-architecture\&section=qkgon7kvze04x46w47u75f1n): Understand the internal modules like `HandlerCommands` and `Transaction`.
2. [**Security & PIN Model**](https://docs.globalgetnet.com/en/products/in-store-payments/host-to-host?doc=h2h-security-and-pin-model\&section=qkgon7kvze04x46w47u75f1n): Learn about RSA key generation and DUKPT injection.