# Centiqs Email Watchdog 0.3.0 beta

Windows 7/10/11 backup watchdog for Centiqs Email Order Receiver.

It checks the same order mailbox over IMAP in **read-only** mode and uses **headers only**:
UID, Message-ID, From, Subject, and Date. It does not mark messages read, archive, delete,
reply, or print the customer order.

## Requirements

- Windows 7, Windows 10, or Windows 11
- Portable ZIP: no separate Java install required
- Lite ZIP: Java 8 or newer installed
- Internet access from the Windows PC
- Gmail/IMAP app password for the same order inbox

## Start

1. Extract the ZIP.
2. Preferred: run `install-watchdog.bat` once to install it like a normal Windows user app.
3. Portable fallback: run `run-watchdog.bat` directly.
4. On the `Home` tab, enter the code from the Android receiver and click `Import with Transfer Code`.
5. Click `Test Setup`.
6. Use `General Settings` only for simple store options such as startup, timing, tablet address, printer warning, and store hours.

## Language

The app opens in English by default and does not show a language switch unless an additional
language is enabled. In `General Settings`, enable `Offer Simplified Chinese` to show the
English/中文 toggle on the Home screen.

## Defaults

- Mailbox check: every 60 seconds
- Yellow warning: order-looking email older than 3 minutes
- Red alert: order-looking email older than 5 minutes
- Alert repeat: every 10 minutes
- Scan latest: 50 inbox emails
- Thermal warning ticket: off by default

## Alerts

When a possible missed order is found, the watchdog shows a compact always-on-top alert banner
with `Open` and `Dismiss` buttons. It does not take over the whole screen or automatically open
the full watchdog window.

The watchdog escalates automatically using the configured timing:

- First warning: on-screen banner, beep, tray notification.
- Urgent warning: red status and repeated staff warning.
- Printed backup warning: optional thermal ticket after the configured delay.
- Tablet offline: uses the same escalation path even when no delayed order email is found.

Warnings clear automatically when the mailbox is OK again and the tablet is reachable. Staff do
not need to dismiss old alerts manually after the issue is resolved.

Transfer Codes may be entered with or without the dash. Extra spaces are ignored.

## Updates

Use `Check for Update` to see whether a newer watchdog is published. If one is available,
click `Download Update`. Installed copies download, replace the installed app files, and restart
automatically. Portable copies download the ZIP to the Windows Downloads folder and open that
folder.

## Store Hours

The watchdog should follow the same store hours as the Android receiver.

Preferred setup is Transfer Code import from the Android receiver. It imports the Android/admin
weekly schedule automatically.

The Transfer Code package is encrypted before upload. The server stores only ciphertext, and the
Windows watchdog decrypts it locally using the Transfer Code.

The optional receiver license key can also sync store hours from the receiver server. This is not
a separate watchdog license and the watchdog still runs without it.

When synced, the watchdog uses the Android/admin weekly schedule. Manual open/close fields are
only a fallback until Transfer Code import is complete.

## Optional Thermal Warning Ticket

Enable only if staff want a printed backup warning. The watchdog prints a short warning
ticket such as "Check tablet Wi-Fi / receiver app now." It does not print the customer
order.

## Start With Windows

Use either the in-app checkbox or run `install-startup-task.bat`.

The startup task runs at user logon. For first beta, this is a tray app, not a hidden
Windows service, so staff can see alerts and open settings.

## Updates and Crash Control

- `Check Updates` reads `https://receiver.centiqs.com/watchdog/latest.json`.
- Uncaught crashes are appended to `%USERPROFILE%\.centiqs-email-watchdog\last_crash.txt`.
- `Copy Crash Log` copies that crash log for support.
- The status panel shows whether a crash log exists.

## Local Files

Settings and heartbeat are stored under:

`%USERPROFILE%\.centiqs-email-watchdog`

The app password is encrypted locally with a key derived from the Windows user profile.
This is intended to prevent casual plaintext exposure, not to replace full-disk security.
