namespace TuneBoss.Core.Protocol; /// /// TuneBoss hardware command bytes. /// public static class Commands { // ── Data Link layer ───────────────────────────────────────────────────── public const byte DL_ACK = 0x11; public const byte DL_NAK_HDR = 0x12; public const byte DL_NAK_DATA = 0x13; public const byte DL_NAK_OVF = 0x14; // Rx buffer overflow — use smaller packet public const byte DL_NAK_TIMEOUT = 0x15; // ── Transport layer ────────────────────────────────────────────────────── public const byte TL_POSTED = 0x01; // Requires ACK from device public const byte TL_NONPOSTED = 0x02; // No ACK; device returns a data packet public const byte TL_NP_RETURN = 0x03; // Return packet for TL_NONPOSTED public const byte TL_STREAMING = 0x04; // Streaming; no ACK/NAK required public const byte DL_PING_NOREPLY = 0x21; // Host connectivity test; device ignores // ── App commands — Non-Posted ──────────────────────────────────────────── public const byte APP_UNLOCK = 0x30; // Password + current date at byte 4 public const byte APP_LOCK = 0x31; public const byte APP_MEMRD_SEQ = 0x32; // Legacy: 8-bit len @ b1, 16-bit addr @ b2-3 public const byte APP_UNLOCK2 = 0x33; // Basic ECU unlock (GEN3) public const byte APP_MEMWR_SEQ = 0x34; // Legacy: 8-bit len @ b1, 16-bit addr @ b2-3 public const byte APP_FIRSTUSE = 0x35; public const byte APP_FLASH_WR = 0x36; public const byte APP_READ_INFO = 0x37; // Read ECU info / keepalive public const byte APP_CHANGE_PWD = 0x38; public const byte APP_IMMOBILIZER = 0x3A; public const byte APP_READ_DEBUG = 0x3D; public const byte APP_UPGRADE_MOD = 0x3E; public const byte APP_MEM_INFO = 0x40; // Reserved / ignore for now // ── App commands — Table read ──────────────────────────────────────────── public const byte APP_MEMRD_2D = 0x41; // 2D tables (tuner) public const byte APP_MEMRD_SUBT = 0x42; // Subtables public const byte APP_MEMRD_1D = 0x43; // 1D tables public const byte APP_MEMRD_MISC = 0x44; // Misc values + device info public const byte APP_MEMRD_2D_USER = 0x45; // 2D user tables (GEN3 basic ECU) // ── App commands — Table write ─────────────────────────────────────────── public const byte APP_MEMWR_2D = 0x49; public const byte APP_MEMWR_SUBT = 0x4A; public const byte APP_MEMWR_1D = 0x4B; public const byte APP_MEMWR_MISC = 0x4C; public const byte APP_MEMWR_2D_USER = 0x4D; // GEN3 basic ECU // ── App response codes ─────────────────────────────────────────────────── public const byte APP_CMD_SUCCESS = 0x51; public const byte APP_CMD_FAIL = 0x52; public const byte APP_CMD_INV = 0x53; public const byte APP_MEMADDR_INV = 0x54; // Invalid read/write address public const byte APP_MEMLEN_OVF = 0x55; // Length too large for Tx/Rx buffer public const byte APP_MEMADDR_LOCK = 0x56; // Address locked (basic ECU) public const byte APP_TUNER_LOCK = 0x57; // Command locked by tuner // ── App commands — Diagnostics streaming ──────────────────────────────── public const byte APP_MONITORING = 0x70; // Streaming diagnostics frame public const byte APP_MON_START = 0x71; public const byte APP_MON_STOP = 0x72; // ── App commands — Tuner lock domain ──────────────────────────────────── public const byte APP_UNLOCK_TUNER = 0x60; // Same usage model as APP_UNLOCK public const byte APP_NEW_PWD_TUNER = 0x61; // Change tuner password (null×16 = disable) public const byte APP_RST_PWD_TUNER = 0x62; // Reset tuner password (0x55×16 = disable + reset tables) public const byte APP_ENCRYPT_READ = 0x63; public const byte APP_ENCRYPT_WRITE = 0x64; public const byte APP_RESET_SETTINGS = 0x65; // ── App commands — Special ─────────────────────────────────────────────── public const byte APP_ERASE_ALL = 0xF0; public const byte APP_LOCKED = 0xFF; }