================================================================
  Cloud Printer Device MQTT Config Tool  —  User Guide
================================================================

1. Overview
-----------
This tool writes MQTT connection parameters to a printer or cloud box
via USB, enabling the device to automatically connect to the specified
MQTT Broker for cloud messaging.

Supported device types:
  - Printer    — Written via ESC command protocol
  - Cloud Box  — Written via SW proprietary frame protocol


================================================================
2. Tab Descriptions
================================================================

┌─────────────────────────────────────────────────────────────┐
│  Tab 1 : Printer Alibaba Cloud                              │
└─────────────────────────────────────────────────────────────┘
Use case : Connect a printer to Alibaba Cloud IoT Platform.

Parameters:
  ProductKey      Product Key from Alibaba Cloud IoT console (Product Details)
  DeviceName      Device name (used as SN), also written as device identity
  DeviceSecret    Device secret key for MQTT authentication
  URL             MQTT Broker domain
                  (e.g. xxx.iot-as-mqtt.cn-shanghai.aliyuncs.com)
  MQTT Port       Port number, default 1883
  Instance type   Select "New Instance" for the new shared instance
  sub_topic       Subscribe topic suffix; full topic:
                  /${ProductKey}/${DeviceName}/user/<suffix>
  pub_topic       Publish topic suffix; full topic:
                  /${ProductKey}/${DeviceName}/user/<suffix>


┌─────────────────────────────────────────────────────────────┐
│  Tab 2 : Printer Self-hosted                                │
└─────────────────────────────────────────────────────────────┘
Use case : Connect a printer to a self-hosted or third-party MQTT
           Broker (e.g. EMQX, Mosquitto, HiveMQ, etc.).

Parameters:
  clientID / SN   Client ID and device SN written to firmware
                  (recommended: use the device's unique serial number)
  domain / IP     MQTT Broker domain name or IP address
  port            Port number, default 1883; typically 8883 when TLS enabled
  username        MQTT login username
  password        MQTT login password
  sub_topic       Subscribe topic (full path)
  pub_topic       Publish topic (full path)
  TLS             TLS encryption switch
                    Disable TLS — value 0, plaintext, port usually 1883
                    Enable TLS  — value 1, encrypted, port usually 8883
  Clean Session   Offline message policy
                    Clear offline messages — value 0
                    Keep offline messages  — value 1


┌─────────────────────────────────────────────────────────────┐
│  Tab 3 : Printer Tencent Cloud                              │
└─────────────────────────────────────────────────────────────┘
Use case : Connect a printer to Tencent Cloud IoT Hub.

Parameters:
  ProductKey      Tencent Cloud Product ID (from IoT Hub console)
  DeviceName      Device name, also written as SN to firmware
  DeviceSecret    Device key (PSK)
  MQTT Port       Port number, default 1883
  sub_topic       Subscribe topic (full path)
  pub_topic       Publish topic (full path)


┌─────────────────────────────────────────────────────────────┐
│  Tab 4 : Box Self-hosted                                    │
└─────────────────────────────────────────────────────────────┘
Use case : Connect a cloud box to a self-hosted or third-party MQTT Broker.
Protocol : SW proprietary frame protocol (0x53 0x57 header),
           max JSON payload 255 bytes

Parameters (same fields as Tab 2; difference is target device = cloud box):
  clientID / SN   Client ID and device SN written to cloud box
  domain / IP     MQTT Broker domain name or IP address
  port            Port number, default 1883
  username        MQTT login username
  password        MQTT login password
  sub_topic       Subscribe topic (full path)
  pub_topic       Publish topic (full path)
  TLS             TLS encryption switch
                    Disable TLS — value 0
                    Enable TLS  — value 1
  Clean Session   Offline message policy
                    Keep offline messages  — value 0
                    Clear offline messages — value 1


┌─────────────────────────────────────────────────────────────┐
│  Tab 5 : Box Alibaba                                        │
└─────────────────────────────────────────────────────────────┘
Use case : Connect a cloud box to Alibaba Cloud IoT Platform.
Protocol : SW proprietary frame protocol (0x53 0x57 header)

Parameters (same fields as Tab 1; difference is target device = cloud box):
  ProductKey      Alibaba Cloud Product Key
  DeviceName      Device name, also written as SN to cloud box
  DeviceSecret    Device secret key
  URL             MQTT Broker domain
  MQTT Port       Port number, default 1883
  Instance type   Instance type selection
  sub_topic       Subscribe topic suffix
  pub_topic       Publish topic suffix


================================================================
3. How to Use
================================================================

1. Connect the printer or cloud box to the PC via USB and power it on.
2. Select the appropriate Tab based on device type and cloud platform.
3. Fill in all required parameters.
4. Click "Write to printer" or "Write to cloud box" to write.
5. The status bar shows "Success!" in green when writing is complete.
6. Optionally click "Self-test page" to print a self-test report
   and verify the written information.


================================================================
4. System Requirements
================================================================

  OS       : Windows 7 / 8 / 10 / 11 (64-bit)
  Runtime  : No additional runtime or driver installation required
             (standalone single-file executable)
  USB      : Uses the system built-in WinUSB / printer class driver


================================================================
5. Language Switch
================================================================

A language dropdown is provided in the upper-right corner of the UI:
  English — All UI text displayed in English
  中文    — All UI text displayed in Simplified Chinese

The interface refreshes immediately upon switching.

================================================================
