diff --git a/AVR Working Controller/AVR.cpp b/AVR Working Controller/AVR.cpp index 656906f..d2eadac 100644 --- a/AVR Working Controller/AVR.cpp +++ b/AVR Working Controller/AVR.cpp @@ -25,6 +25,7 @@ CSerialPort avrPort; int avrOnPort = COM_NO_PORT; // Serial Port 1, 2, ... taking note that some USB adapters can be up toward channel 11, 12, ... unsigned avrBaud = 9600; +bool verboseMode = false; const uint32_t retryInterval = 1000; // ms AVRInterface *avr; @@ -201,11 +202,10 @@ AVR_Status_T avrStatus; typedef enum { EXIT_OK = 0, - EXIT_IllegalOption = 1, - EXIT_ConfigError = 2, - EXIT_UserESC = 3, - EXIT_UserQ = 4, - EXIT_ExternalQ = 5 + EXIT_IllegalOption, + EXIT_InternalSanityCheckFail, + EXIT_ExternalQuit, + EXIT_AbnormalError, } ExitCode; constexpr auto MAXTEXTLEN = 512; @@ -263,8 +263,8 @@ unsigned long Hex2Dec(uint8_t *p, int dig); void GetAndSendCustomMessage(); void GetAndSendOSDMessage(); -bool UserWantsToExitCanSniff = false; -DWORD progStartTime_ms; +bool UserExitRequested = false; +bool SystemExitRequested = false; typedef struct { const char *pMsg; @@ -337,166 +337,10 @@ void UserCommandsSanityCheck() { } if (fail) { printf("***** UserCommandsSanityCheck: Errors found in UserCommands table\n"); - exit(EXIT_ConfigError); + exit(EXIT_InternalSanityCheckFail); } } -#if 0 -// rCmd: 2-ASCII Hex Bytes converted to uint8_t -// configOffset: offset into avrStatus.config.DTxx -// numToTransfer: number of bytes to transfer from message to config (0 = none) -// show all status -// fncHelper: optional function to call upon receipt -// -const MessageHandler_T MessageHandlers[] = { - // - // Configuration Map for Response Messages - // - // +--------------------------- rCmd - // | +----------------------- DT Block Offset - // | | +-------------------- Number of Bytes to transfer into the DT Block - // | | | +----------------- Force a 'show all' status screen update - // | | | | - // | | | | +-------- sprintf format string for the following Helper - // | | | | | +--- Helper to convert numeric value to text - // | | | | | | - { 0x00, 7, 1, 1, "System Report: %s", BusyToText }, - { 0x01, 0, 0, 0, "Warning Report: %s", WarnToText }, - { 0x10, 31, 1, 1, "Playback Report: %s", PlaybackToText }, - { 0x11, 32, 1, 1, "Fs Report: %s", FsToText }, -- - { 0x12, 33, 1, 1, "Ex/Ex: %s", OffMatrixDiscreteText }, // EX/EX -- - { 0x13, 34, 1, 1, "Thr Bypass: %s", OffOnText }, // Thr / Bypass -- - { 0x14, 35, 1, 1, "RED dts: %s", ReleaseWaitText}, // RED dts -- - { 0x15, 38, 1, 1, "Tuner tuned: %s", NotTunedTunedText}, // Tuner tuned -- - { 0x16, 43, 1, 1, "DTS 96/24: %s", OffOnText}, // Dts 96/24 - { 0x20, 8, 0, 1, "Zone Power: %s", ZonePower }, - { 0x21, 9, 1, 1, "Input: %s", InputText}, // Input Source - { 0x22, 11, 1, 1, "Input Mode: %s", InputModeText}, // Input Mode - { 0x23, 12, 1, 1, "Mute: %s", OffOnText }, - { 0x24, 13, 1, 1, "Zone 2 Input: %s", InputText}, // Zone 2 Input Source - { 0x25, 14, 1, 1, "Zone 2 Mute: %s", OffOnText }, - { 0x26, 15, 2, 1, "Volume: %s", VolumeDB }, - { 0x27, 17, 2, 1, "Zone 2 Vol: %s", VolumeDB}, // Zone 2 Vol - { 0x28, 19, 2, 1, "Program: %s", ProgramName }, // Program -- - { 0x29, 25, 1, 1, "Tuner Page: %s", PresetLabelText}, // Tuner Page -- - { 0x2A, 26, 1, 1, "Tuner Preset: %s", PresetNumberText}, // Tuner Preset Number -- - { 0x2B, 23, 1, 1, "OSD: %s", OSDFullShortOffText}, // OSD -- - { 0x2C, 24, 1, 1, "Sleep: %s", SleepTimerText}, // Sleep Timer -- - { 0x2D, 22, 1, 1, "EX/ES(Key): %s", OffMatrixDiscreteAutoText}, // EX/ES(Key) - { 0x2E, 29, 1, 1, "SP Relay A: ", OffOnText}, // Speaker Relay A - { 0x2F, 30, 1, 1, "SP Relay B: ", OffOnText}, // Speaker Relay B - { 0x30, 0, 0, 0, "Home Preset:%s", PresetLabelText }, // Preset A, B, ... F - { 0x31, 0, 0, 0, "Home Memory:%s", PresetLabelText }, // Preset A, B, ... F - { 0x32, 0, 0, 0, "Home Vol Preset: %s", PresetLabelText }, // Preset A, B, ... F - { 0x33, 0, 0, 0, "Home Vol Memory: %s", PresetLabelText }, // Preset A, B, ... F - { 0x34, 36, 1, 1, "Headphone: %s", OffOnText }, -- - { 0x35, 37, 1, 1, "FM/AM: %s", FMAMText }, -- - { 0x36, 39, 1, 1, "DC1 Trigger Out: %s", OffOnText }, -- - { 0x37, 0, 0, 0, "Home Zone 2 Vol Preset: %s", PresetLabelText }, - { 0x38, 0, 0, 0, "Home Zone 2 Vol: %s", PresetLabelText }, - { 0x39, 0, 0, 0, "Dual Mono: %s", MainSubAllText }, - { 0x3A, 42, 1, 1, "DC1 Trigger Control: %s", WhichZoneText }, -- - { 0x3B, 44, 1, 1, "DC2 Trigger Control: %s", WhichZoneText }, -- - { 0x3C, 45, 1, 1, "DC2 Trigger Out: %s", OffOnText }, -- - { 0x3D, 104, 0, 0, "Main Level: %s", Norm10dbDownText }, - { 0x3E, 46, 1, 1, "SP B Set: %s", Zone1Zone2Text }, - { 0x3F, 47, 1, 1, "Zone 2 Speaker: %s", OffOnText }, - - { 0x40, 48, 2, 1, "Level Main R: %s", PM10dbText }, -- - { 0x41, 50, 2, 1, "Level Main L: %s", PM10dbText }, -- - { 0x42, 52, 2, 1, "Level Center: %s", PM10dbText }, -- - { 0x43, 54, 2, 1, "Level Rear R: %s", PM10dbText }, -- - { 0x44, 56, 2, 1, "Level Rear L: %s", PM10dbText }, -- - { 0x45, 58, 2, 1, "Level Sur Back R: %s", PM10dbText }, -- - { 0x46, 60, 2, 1, "Level Sur Back L: %s", PM10dbText }, -- - { 0x47, 62, 2, 1, "Level Front R: %s", PM10dbText }, -- - { 0x48, 64, 2, 1, "Level Front L: %s", PM10dbText }, -- - { 0x49, 66, 2, 1, "Level Swfr 1: %s", PM10dbText }, -- - { 0x4A, 0, 0, 0, "Level Swfr 2: %s", PM10dbText }, - - { 0x50, 0, 0, 0, "Main L/R Bal: %s", BalanceText }, - { 0x51, 74, 2, 1, "LFE Level SP: %s", M20P0dbText }, -- - { 0x52, 76, 2, 1, "LFE Level HP: %s", M20P0dbText }, -- - { 0x53, 78, 2, 1, "Audio Delay: %s", ZeroTo160msText }, -- - { 0x54, 0, 0, 0, "SP Delay Center: %s", ZeroTo5msText }, - { 0x55, 0, 0, 0, "SP Delay Rear CT: %s", ZeroTo30msText }, - - { 0x60, 84, 1, 1, "Input Mode: %s", AutoLastText }, -- - { 0x61, 85, 1, 1, "Dimmer: %s", M4To0Text }, -- - { 0x62, 87, 2, 1, "OSD Shift: %s", M5toP5Text }, -- - { 0x63, 89, 1, 1, "Gray Back: %s", OffAutoText }, -- - { 0x64, 91, 1, 1, "Dynamic Range SP: %s", MaxStdMinText }, -- - { 0x65, 92, 1, 1, "Dynamic Range HP: %s", MaxStdMinText }, -- - { 0x66, 93, 0, 0, "Zone 2 Vol out: %s", VarFixText }, -- - { 0x67, 0, 0, 0, "Zone 2 Mode: %s", Mode1Mode2Text }, - { 0x68, 95, 1, 1, "Mem Guard: %s", OffOnText }, - { 0x69, 90, 1, 1, "Video Conv: %s", OffOnText }, - { 0x6A, 136, 1, 1, "Comp OSD: %s", OffOnText }, - { 0x6B, 0, 0, 0, "Zone 3 Vol out: %s", VarFixText }, - { 0x70, 96, 1, 1, "Center Sp Size: %s", LSNText }, - { 0x71, 97, 1, 1, "Main Sp Size: %s", LSNText }, - { 0x72, 98, 1, 1, "Rear LR Sp Size: %s", LSNText }, - { 0x73, 99, 1, 1, "Sur Back Size: %s", LLSSNText }, - { 0x74, 100, 1, 1, "Front Sp: %s", YesNoneText }, - { 0x75, 101, 1, 1, "LFE Bass Out: %s", SwfrMainBothText }, -- - { 0x76, 134, 1, 1, "SW1: %s", LrFrNoneText }, - - { 0x78, 102, 1, 1, "6 Ch Center: %s", CenterMainText }, - { 0x79, 103, 1, 1, "6 Ch Swfr: %s", SwfrMainText }, - { 0x7A, 133, 1, 1, "6 Ch Surround: %s", SurrMainText }, - { 0x7B, 0, 0, 0, "Multi Ch Select: %s", SixEightText }, - { 0x7E, 135, 1, 1, "SW Crossover", CrossOverText }, - - { 0x80, 105, 1, 1, "Test Mode: %s", OffDolbyDspText }, -- - { 0x81, 0, 0, 0, "Analog Special: %s", OffOn2OnMultiText }, - { 0x82, 27, 1, 1, "Night Mode: %s", OffOnText }, -- - - { 0x90, 0, 0, 0, "Multi Ch Level Main R: %s" , M10P10dbText }, -- - { 0x91, 0, 0, 0, "Multi Ch Level Main L: %s" , M10P10dbText }, -- - { 0x92, 0, 0, 0, "Multi Ch Level Center: %s" , M10P10dbText }, -- - { 0x93, 0, 0, 0, "Multi Ch Level Rear R: %s" , M10P10dbText }, -- - { 0x94, 0, 0, 0, "Multi Ch Level Rear L: %s" , M10P10dbText }, -- - { 0x95, 0, 0, 0, "Multi Ch Level Sur B R: %s", M10P10dbText }, -- - { 0x96, 0, 0, 0, "Multi Ch Level Sur B L: %s", M10P10dbText }, -- - { 0x97, 0, 0, 0, "Multi Ch Level Front R: %s", M10P10dbText }, -- - { 0x98, 0, 0, 0, "Multi Ch Level Front L: %s", M10P10dbText }, -- - { 0x99, 0, 0, 0, "Multi Ch Level Swfr 1: %s" , M20P0dbText }, -- - { 0x9A, 0, 0, 0, "Multi Ch Level Swfr 2: %s" , M20P0dbText }, - - { 0xA1, 0, 0, 0, "Zone 3 Mute: %s\n", OffOnText }, -- -}; - -void MessageHandlerSanityCheck() { - uint8_t usedCommands[256] = { 0 }; - uint8_t blockOffset[256] = { 0 }; - - bool fail = false; - // Ensure that the MessageHandlers table is correct - for (int i = 0; i < sizeof(MessageHandlers) / sizeof(MessageHandlers[0]); i++) { - usedCommands[MessageHandlers[i].rCmd]++; - if (usedCommands[MessageHandlers[i].rCmd] > 1) { - printf("***** MessageHandler entry %d has duplicate rCmd of 0x%02X\n", i, MessageHandlers[i].rCmd); - fail = true; - } - blockOffset[MessageHandlers[i].configOffset]++; - if (MessageHandlers[i].configOffset != 0 && blockOffset[MessageHandlers[i].configOffset] > 1) { - printf("***** MessageHandler entry %d has duplicate configOffset of %d\n", i, MessageHandlers[i].configOffset); - fail = true; - } - - if (MessageHandlers[i].numToTransfer > 2) { - printf("***** MessageHandler entry %d has invalid numToTransfer of %d\n", i, MessageHandlers[i].numToTransfer); - } - if (MessageHandlers[i].configOffset + MessageHandlers[i].numToTransfer > sizeof(AVR_Configuration_T)) { - printf("***** MessageHandler entry %d has invalid configOffset of %d\n", i, MessageHandlers[i].configOffset); - } - } - if (fail) { - printf("***** MessageHandler table sanity check failed. Exiting.\n"); - exit(EXIT_ConfigError); - } -} -#endif int CS_KeyHit() { int h = _kbhit(); @@ -512,10 +356,13 @@ BOOL WINAPI ControlIntercept(DWORD CtrlType) { switch (CtrlType) { case CTRL_C_EVENT: case CTRL_CLOSE_EVENT: + UserExitRequested = true; + return FALSE; + break; case CTRL_BREAK_EVENT: case CTRL_LOGOFF_EVENT: case CTRL_SHUTDOWN_EVENT: - UserWantsToExitCanSniff = true; + SystemExitRequested = true; return FALSE; default: return FALSE; @@ -528,66 +375,10 @@ void ProcessWindowsMessage(void) { bool msgReturn; msgReturn = PeekMessage(&msgx, NULL, WM_QUIT, WM_QUIT, PM_NOREMOVE); if (msgReturn == true && msgx.message == WM_QUIT) { - UserWantsToExitCanSniff = true; + SystemExitRequested = true; } } -#if 0 -// EmitBuffer -// -// Emits the provided buffer to the console, translating non-printable -// characters into hex codes enclosed in square brackets. -// -// Consider line-wrapping to align the next line -// -void EmitBuffer(const char *prefix, const uint8_t *buf, size_t len = 0, bool appendReturn = false) { - int i = 0; - const char *p = (const char *)buf; - uint32_t now_ms = timeGetTime(); - char txtBuf[MAXTEXTLEN] = ""; - - if (len == 0) len = strlen((const char *)buf); - sprintf_s(txtBuf, MAXTEXTLEN, "%7.3f: [%3d]%s", (float)(now_ms - progStartTime_ms)/1000.0f, (int)strlen(p), prefix); - Console_Write(txtBuf); - while (*p && ((unsigned)(p - (const char *)buf) < len)) { - if (isprint(*p)) { - putchar(*p); - i++; - } else if (*p == '\r') { - putchar('\n'); - Console_ScrollBottomRegion(); - } else if (*p == '\n') { - // skip it - } else { - printf("[%02X]", (unsigned char)*p); - } - if ((i & 3) == 0) { - if (Console_AdvanceToNextLineIfNotRoomFor(12, 1)) { - //Console_ScrollBottomRegion(); - printf(" "); // sized to get past the timestamp, length, and prefix - i = 0; - } else { - printf(" "); - } - } - p++; - } - if (appendReturn) { - Console_ScrollBottomRegion(); // putch('\r'); - } else { - //putch('\n'); - //Console_ScrollBottomRegion(); - } -} -#endif - -#if 0 -void EchoSerialRecv(const uint8_t *pMsg) { - Console_SetCursor(0, -1); - EmitBuffer("< ", pMsg); - Console_ScrollBottomRegion(); -} -#endif bool SerialSend(const uint8_t *p, uint16_t len) { bool retVal = false; @@ -602,36 +393,6 @@ bool SerialSend(const uint8_t *p, uint16_t len) { return retVal; } -#if 0 -bool ProcessSerialQueue(const uint8_t *p, uint16_t len) { - bool retVal = false; // assume fail - static bool freshData = false; - - if (p && len) { - if (serialQueueCount < SERIALQUEUESIZE) { - serialQueue[serialQueueCount].message = (uint8_t *)malloc(len); - if (serialQueue[serialQueueCount].message) { - memcpy(serialQueue[serialQueueCount].message, p, len); - serialQueue[serialQueueCount].len = len; - serialQueueCount++; - retVal = true; - freshData = true; - } - } - } - if (serialQueueCount) { - if (SerialSend((const uint8_t *)serialQueue[0].message, serialQueue[0].len)) { - --serialQueueCount; - free(serialQueue[0].message); - for (int i = 0; i < serialQueueCount; i++) { - serialQueue[i] = serialQueue[i + 1]; - } - retVal = true; - } - } - return retVal; -} -#endif void EmitSpinner() { static int x = 0; @@ -671,156 +432,6 @@ void EmitRuntimeHelp() { } } -#if 0 -// PCMessage -// -// Various responses need to be formatted and shown on screen -// The last param will allow resetting the column counter -// and pre and post-pending \n -// -static void PCMessage(const char *msg, int len, uint8_t **src, const char * (fncHelper)(uint8_t val) = NULL) { - char buf[MAXTEXTLEN] = ""; - const char *p = buf; - - if (fncHelper) { - // Get the binary value if we need it - uint8_t val = (uint8_t)Hex2Dec(*src, len); - p = (*fncHelper)(val); - *src += len; - } else { - // Create a string value when we need that - strncpy(buf, (char *)*src, len); // s/w - *src += len; - buf[len] = '\0'; - } - - char outBuf[MAXTEXTLEN] = ""; - sprintf_s(outBuf, MAXTEXTLEN, "%17s %-8s", - msg, - p - ); - Console_AdvanceToNextLineIfNotRoomFor(26); - Console_Write(outBuf); -} -#endif - - -#if 0 -void ShowAllStatusInfo(void) { - if (avrStatus.headerValid) { - bool priorState = Console_SetCursorVisibility(false); - Console_SetCursor(0, 2); - char buf[MAXTEXTLEN]; - sprintf_s(buf, MAXTEXTLEN, "Model ID: %c%c%c%c%c, ver: %c\n", avrStatus.header.type[0], avrStatus.header.type[1], - avrStatus.header.type[2], avrStatus.header.type[3], avrStatus.header.type[4], - avrStatus.header.version); - Console_Write(buf); - uint8_t *p = (uint8_t *)&avrStatus.config; - PCMessage("Baud Rate", 1, &p); - PCMessage("Rx Buffer", 2, &p); - PCMessage("Cmd Timeout", 3, &p); - PCMessage("Handshake", 1, &p); - PCMessage("Busy", 1, &p, BusyToText); - PCMessage("Power", 1, &p, OffOnText); - if (avrStatus.configValid) { - PCMessage("Input", 1, &p, InputText); - PCMessage("6 ch", 1, &p); - PCMessage("Inp mode", 1, &p); - PCMessage("Mute", 1, &p, OffOnText); - PCMessage("Zone 2", 1, &p, InputText); - PCMessage("Mute 2", 1, &p, OffOnText); - PCMessage("Volume", 2, &p, VolumeDB); - PCMessage("Volume 2", 2, &p, VolumeDB); - PCMessage("pgm", 2, &p); - PCMessage("effect", 1, &p, OffOnText); - PCMessage("6.1/es status", 1, &p); - PCMessage("OSD", 1, &p); - PCMessage("sleep", 1, &p); - PCMessage("Tuner Pg", 1, &p); - PCMessage("Tuner #", 1, &p); - PCMessage("Night", 1, &p, OffOnText); - PCMessage("?????", 1, &p); - PCMessage("Spkr A", 1, &p, OffOnText); - PCMessage("Spkr B", 1, &p, OffOnText); - PCMessage("Playback", 1, &p); - PCMessage("Fs", 1, &p); - PCMessage("Ex/Es", 1, &p); - PCMessage("Thr Bypass", 1, &p); - PCMessage("Red DTS", 1, &p); - PCMessage("Headph", 1, &p, OffOnText); - PCMessage("Tuner Band", 1, &p); - PCMessage("Tuner Tuned", 1, &p); - PCMessage("DC1 Control Out", 1, &p); - PCMessage("?????", 2, &p); - PCMessage("DC1 Trig Ctrl", 1, &p); - PCMessage("DTS 96/24", 1, &p, OffOnText); - PCMessage("DC2 Trig Ctrl", 1, &p); - PCMessage("DC2 Trig", 1, &p); - PCMessage("Spkr B Set", 1, &p); - PCMessage("Zone 2 SP out", 1, &p, OffOnText); - PCMessage("Main R", 2, &p); - PCMessage("Main L", 2, &p); - PCMessage("Center", 2, &p); - PCMessage("Rear R", 2, &p); - PCMessage("Rear L", 2, &p); - PCMessage("Sur Bk R", 2, &p); - PCMessage("Sur Bk L", 2, &p); - PCMessage("Front R", 2, &p); - PCMessage("Front L", 2, &p); - PCMessage("Sub", 2, &p); - PCMessage("?????", 6, &p); - PCMessage("LFE SP", 2, &p); - PCMessage("LFE HP", 2, &p); - PCMessage("Audio Delay", 2, &p); - PCMessage("?????", 4, &p); - PCMessage("Inp Mode Set", 1, &p); - PCMessage("Dimmer", 1, &p); - PCMessage("OSD Msg", 1, &p); - PCMessage("OSD Shift", 2, &p); - PCMessage("Gray Back", 1, &p); - PCMessage("Video Conv", 1, &p, OffOnText); - PCMessage("D Range SP", 1, &p); - PCMessage("D Range HP", 1, &p); - PCMessage("Zone 2 Vol out", 1, &p); - PCMessage("?????", 1, &p); - PCMessage("Memory Guard", 1, &p, OffOnText); - PCMessage("SP set center", 1, &p); - PCMessage("SP set main", 1, &p); - PCMessage("SP set rear L/R", 1, &p); - PCMessage("SP set rear ct", 1, &p); - PCMessage("SP set front", 1, &p); - PCMessage("SP set LFE/Bass", 1, &p); - PCMessage("6 ch center", 1, &p); - PCMessage("6 ch sub", 1, &p); - PCMessage("Main level", 1, &p); - PCMessage("Test Mode", 1, &p); - PCMessage("?????", 1, &p); - PCMessage("Lvl 6 ch main L", 2, &p); - PCMessage("Lvl 6 ch main R", 2, &p); - PCMessage("Lvl 6 ch center", 2, &p); - PCMessage("Lvl 6 ch sl", 2, &p); - PCMessage("Lvl 6 ch sr", 2, &p); - PCMessage("Lvl 6 ch sbl", 2, &p); - PCMessage("Lvl 6 ch sbr", 2, &p); - PCMessage("Lvl 6 ch front l", 2, &p); - PCMessage("Lvl 6 ch front r", 2, &p); - PCMessage("Lvl 6 ch swfr", 2, &p); - PCMessage("Zone 3 Inp", 1, &p); - PCMessage("Zone 3 Mute", 1, &p); - PCMessage("Zone 3 Vol", 2, &p); - PCMessage("?????", 1, &p); - PCMessage("MultiCh Select", 1, &p); - PCMessage("MultiCh Surround", 1, &p); - PCMessage("SP Set SW1", 1, &p); - PCMessage("SP Set Crossover", 1, &p); - PCMessage("Component OSD", 1, &p, OffOnText); - PCMessage("PB/SB Select", 1, &p); - } - printf("\n"); - Console_SetCursorVisibility(priorState); - } -} -#endif void ProcessKeyboard(void) { static uint32_t spin = 0; @@ -833,10 +444,10 @@ void ProcessKeyboard(void) { int c = CS_GetChar(); switch (c) { case 'P': - avr->Power(AVRInterface::AVROnOff_E::eOn); + avr->AVRCommand(AVRInterface::subMain, AVRInterface::fncPower, AVRInterface::eOn); break; case 'p': - avr->Power(AVRInterface::AVROnOff_E::eOff); + avr->AVRCommand(AVRInterface::subMain, AVRInterface::fncPower, AVRInterface::eOff); break; case 'O': GetAndSendOSDMessage(); @@ -852,7 +463,7 @@ void ProcessKeyboard(void) { //ShowAllStatusInfo(); break; case '\x1B': - UserWantsToExitCanSniff = true; + UserExitRequested = true; break; case 'S': avrPort.Set_RTS_State(TRUE); @@ -949,52 +560,85 @@ void GetProgName(char *name) { } strcpy_s(progname, MAXTEXTLEN, p); p = strrchr(progname, '.'); - if (0 == stricmp(p, ".exe")) { + if (p && 0 == stricmp(p, ".exe")) { *p = '\0'; } } +void InformationUpdate(AVRInterface::AVRMessageType_T type, const char *msg) { + char buf[MAXTEXTLEN] = ""; + if (verboseMode) { + switch (type) { + case AVRInterface::AVRMessageType_T::mtStatus: + sprintf_s(buf, MAXTEXTLEN, "AVR Status: %-60s", msg); + Console_WriteAt(0, 1, buf); + break; + case AVRInterface::AVRMessageType_T::mtInfo: + Console_WriteAt(0, -1, msg); + Console_ScrollBottomRegion(); + break; + case AVRInterface::AVRMessageType_T::mtModelInfo: + Console_WriteAt(0, 2, msg); + break; + case AVRInterface::AVRMessageType_T::mtStreamStart: + Console_SetCursor(0, 3); + // break; // fall through + case AVRInterface::AVRMessageType_T::mtStream: + Console_AdvanceToNextLineIfNotRoomFor(40); // @TODO hard-coded - ick + Console_Write(msg); + break; + default: + break; + } + } +} + void EmitCommandLineHelp() { - printf("%s [options] by Smartware Computing\n", progname); - printf(" options:\n"); - printf(" -C=X[,yyyy] Set to Com port X to baud rate yyyy\n"); - printf(" Defaults baud is %d\n", avrBaud); + printf("%s [Options] by Smartware Computing\n", progname); printf("\n"); + printf(" This program can control a Yamaha AVR RX-2400 receiver via the RS-232 port.\n"); + printf(" It may work for other similar models, and the API docs used to build this\n"); + printf(" showed commands not in the RX-2400, but they were implemented herein.\n"); + printf("\n"); + printf(" Options:\n"); + printf(" -SerialPort=X[,yyyy] Set to Com port X to baud rate yyyy.\n"); + printf(" Defaults baud is %d\n", avrBaud); + printf(" -Command=S,F,V Execute a command and exit (based on the numeric values):\n"); + printf(" S - Subsystem\n"); + printf(" F - Function\n"); + printf(" V - Value\n"); + printf(" Use the -ExportInfo command to see the values.\n"); + printf(" NOTE: Program will auto-exit after performing the command,\n"); + printf(" or after 5 seconds without obvious success.\n"); + printf(" -Verbose Shows progress during -Command operation.\n"); + printf(" NOTE: It is always verbose in interactive mode.\n"); + printf(" -ExportInfo Export AVR Control Parameters and exit.\n"); + printf("\n"); + printf(" Example: avr -SerialPort=2 -Command=0,0,0 (Turn Main Power On)\n"); + printf("\n"); + printf(" Exit Codes:\n"); + printf(" 0 = Normal exit\n"); + printf(" 1 = Illegal Option or unrecognized command\n"); + printf(" 2 = Program Internal Error - Table data failed santity check.\n"); + printf(" 3 = External Quit (e.g. Windows command to close).\n"); + printf(" 4 = Something very abnormal happened to cause exit.\n"); if (avrOnPort == COM_NO_PORT) { EnumerateComPorts(); } exit(EXIT_OK); } -void InformationUpdate(AVRInterface::AVRMessageType_T type, const char *msg) { - char buf[MAXTEXTLEN] = ""; - switch (type) { - case AVRInterface::AVRMessageType_T::mtStatus: - sprintf_s(buf, MAXTEXTLEN, "AVR Status: %-60s", msg); - Console_WriteAt(0, 1, buf); - break; - case AVRInterface::AVRMessageType_T::mtInfo: - Console_WriteAt(0, -1, msg); - Console_ScrollBottomRegion(); - break; - case AVRInterface::AVRMessageType_T::mtModelInfo: - Console_WriteAt(0, 2, msg); - break; - case AVRInterface::AVRMessageType_T::mtStreamStart: - Console_SetCursor(0, 3); - // break; // fall through - case AVRInterface::AVRMessageType_T::mtStream: - Console_AdvanceToNextLineIfNotRoomFor(40); // @TODO hard-coded - ick - Console_Write(msg); - break; - default: - break; +DWORD AppTime() { + static bool init = false; + static DWORD startTime = 0; + if (!init) { + init = true; + startTime = timeGetTime(); } + return timeGetTime() - startTime; } - - /******************************************************/ /* m a i n ( ) */ /******************************************************/ @@ -1017,23 +661,34 @@ int __cdecl main(int argc, char *argv[]) { short consoleWidth = 122; short consoleHeight = 80; short consoleScrollHeight = 30; + short consoleLeft = 15; + short consoleTop = 15; + int CommandToExecute[3] = { -1, -1, -1 }; - progStartTime_ms = timeGetTime(); // MessageHandlerSanityCheck(); // If the table is bad, we exit here + GetProgName(argv[0]); UserCommandsSanityCheck(); // If the table is bad, we exit here - Console_Init(consoleWidth, consoleHeight, consoleScrollHeight); + avr = new AVRInterface(SerialSend); + avr->RegisterInformationCallback(InformationUpdate); - GetProgName(argv[0]); - // Change the colors... - // SetConsoleTextAttribute(hStdout, FOREGROUND_RED | FOREGROUND_INTENSITY); for (int i = 1; i < argc; i++) { int param1, param2; - if (1 == sscanf_s(argv[i], "-C=%d", ¶m1)) { + if (1 == sscanf_s(argv[i], "-SerialPort=%d", ¶m1)) { avrOnPort = param1; - } else if (2 == sscanf_s(argv[i], "-C=%d,%d", ¶m1, ¶m2)) { + } else if (2 == sscanf_s(argv[i], "-SerialPort=%d,%d", ¶m1, ¶m2)) { avrOnPort = param1; avrBaud = param2; + } else if (3 == sscanf_s(argv[i], "-Command=%d,%d,%d", &CommandToExecute[0], &CommandToExecute[1], &CommandToExecute[2])) { + // After the port is open, execute this and exit + } else if (0 == strcmp(argv[i], "-Verbose")) { + verboseMode = true; + } else if (0 == strcmp(argv[i], "-ExportInfo")) { + bool saveVerbose = verboseMode; + verboseMode = true; + avr->ExportInformation(); + verboseMode = saveVerbose; + exit(EXIT_OK); } else { printf("***** Unrecognized command '%s' *****\n", argv[i]); EmitCommandLineHelp(); @@ -1042,30 +697,63 @@ int __cdecl main(int argc, char *argv[]) { } if (argc == 0 || avrOnPort == COM_NO_PORT) { EmitCommandLineHelp(); + exit(EXIT_OK); } - - Console_Cls(); - if (!SetConsoleCtrlHandler(ControlIntercept, TRUE)) { - printf("WARN: Cannot install Console Control Handler\n"); - } - + if (AttachToSerialPort()) { + if (CommandToExecute[0] != -1 && CommandToExecute[1] != -1 && CommandToExecute[2] != -1) { + DWORD refTime = AppTime(); + DWORD nowTime = AppTime(); + DWORD elapsedTime = nowTime - refTime; + AVRInterface::AVRState_T state = AVRInterface::stPoweringUp; + do { + state = avr->Tick(nowTime); + Sleep(10); // @TODO how long to wait should not be based on lucky timing + SerialQueue_T anyRcvdMsg = ProcessSerialReceive(); + if (anyRcvdMsg.len) { + avr->HandleMessage(anyRcvdMsg.message, anyRcvdMsg.len); + } + nowTime = AppTime(); + elapsedTime = nowTime - refTime; + } while ((elapsedTime < 5000) && (state != AVRInterface::stReady)); + + if (elapsedTime < 5000) { + avr->AVRCommand((AVRInterface::AVRSubsystem_T)CommandToExecute[0], + (AVRInterface::AVRFunction_E)CommandToExecute[1], + (AVRInterface::AVRArg_T)CommandToExecute[2]); + refTime = nowTime = AppTime(); + do { + Sleep(10); // @TODO how long to wait should not be based on lucky timing + nowTime = AppTime(); + SerialQueue_T anyRcvdMsg = ProcessSerialReceive(); + if (anyRcvdMsg.len) { + avr->HandleMessage(anyRcvdMsg.message, anyRcvdMsg.len); + } + state = avr->Tick(nowTime); + } while (((nowTime - refTime) < 5000) && (state != AVRInterface::stReady)); + } else { + printf("%u\n", elapsedTime); + } + DetachSerialPort(); + exit(EXIT_OK); + } + + verboseMode = true; // Always verbose when entering interactive mode + Console_Init(consoleLeft, consoleTop, consoleWidth, consoleHeight, consoleScrollHeight); + Console_Cls(); + if (!SetConsoleCtrlHandler(ControlIntercept, TRUE)) { + printf("WARN: Cannot install Console Control Handler\n"); + } + printf("AVR - a command shell utility for a Yamaha RX-2400 AVR by D.Smart "); printf("[COM%i at %i baud]", avrOnPort, avrBaud); Console_WriteAt(0, consoleHeight - consoleScrollHeight -1, "----------------------------------------"); - avr = new AVRInterface(SerialSend); - avr->RegisterInformationCallback(InformationUpdate); - do { - avr->Tick(timeGetTime()); + avr->Tick(AppTime()); ProcessKeyboard(); SerialQueue_T anyRcvdMsg = ProcessSerialReceive(); if (anyRcvdMsg.len) { - // Show to the user - //EchoSerialRecv(anyRcvdMsg.message); - - // Let the AVR interface handle it first bool showAllFlag = avr->HandleMessage(anyRcvdMsg.message, anyRcvdMsg.len); if (showAllFlag) { @@ -1073,18 +761,20 @@ int __cdecl main(int argc, char *argv[]) { avr->ReportAllStatus(); Console_SetCursorVisibility(priorState); } - // old way to parse the message - //HandleMessage(anyRcvdMsg.message, anyRcvdMsg.len); } - - //ProcessSerialQueue(); ProcessWindowsMessage(); - } while (!UserWantsToExitCanSniff); + } while (!UserExitRequested && !SystemExitRequested); DetachSerialPort(); } else { printf("Failed to attach to Serial Port on COM%i\n", avrOnPort); } - return(0); + if (UserExitRequested) { + exit(EXIT_OK); + } else if (SystemExitRequested) { + exit(EXIT_ExternalQuit); + } else { + exit(EXIT_AbnormalError); + } } void SetData(uint8_t *targ, const uint8_t *string, size_t len = 0) { @@ -1136,60 +826,6 @@ bool CheckTheChecksum(uint8_t *szBuffer, uint32_t num) { } -#if 0 -// ProcessReportResponse -// -// @param[in] szBuffer is the received message -// @param[in] len is the null terminated string length of the message -// -// Typical Message: -// '\x02' 'type' 'guard' 'rcmd0' 'rcmd1' 'rdat0' 'rdat1' '\x03' -// [0] [1] [2] [3] [4] [5] [6] [7] -// -void ProcessReportResponse(uint8_t *szBuffer, uint32_t len) { - // These don't have a checksum ... - // Example: [02] 4026 66[03] - // 4 - controlled by encoder - // 0 - guard status 0 = no guard - // 26 - master vol - // 66 - volume setting (-54.6db) - uint8_t type = (uint8_t)Hex2Dec(&szBuffer[1], 1); - uint8_t guard = (uint8_t)Hex2Dec(&szBuffer[2], 1); - uint8_t rcmd = (uint8_t)Hex2Dec(&szBuffer[3], 2); - uint8_t rdat = (uint8_t)Hex2Dec(&szBuffer[5], 2); - char buf[MAXTEXTLEN]; - (void)len; // not used - - bool found = false; - for (int i = 0; i < sizeof(MessageHandlers) / sizeof(MessageHandlers[0]); i++) { - if (MessageHandlers[i].rCmd == rcmd) { - found = true; - if (MessageHandlers[i].numToTransfer == 1) { - memcpy(&avrStatus.config.DT0 + MessageHandlers[i].configOffset, &szBuffer[6], 1); - } - if (MessageHandlers[i].numToTransfer == 2) { - memcpy(&avrStatus.config.DT0 + MessageHandlers[i].configOffset, &szBuffer[5], 2); - } - if (MessageHandlers[i].TextFormatter && MessageHandlers[i].fncValueToText) { - sprintf_s(buf, MAXTEXTLEN, MessageHandlers[i].TextFormatter, MessageHandlers[i].fncValueToText(rdat)); - Console_Write(buf); - Console_ScrollBottomRegion(); - } - if (MessageHandlers[i].showAll) { - ShowAllStatusInfo(); - } - } - } - if (!found) { - Console_SetCursor(0, -1); - sprintf_s(buf, MAXTEXTLEN, "***** type: %X, guard: %X, cmd: %02X, data: %02X", type, guard, rcmd, rdat); - Console_Write(buf); - Console_ScrollBottomRegion(); - } -} -#endif - - // HandleMessage // // Given a response string, typically of the form: @@ -1327,8 +963,9 @@ int AttachToSerialPort() { if (avrPort.Open(buf, avrBaud, 8, NOPARITY, ONESTOPBIT, Access)) { success = true; avrPort.Set_RTS_State(false); - Sleep(250); + Sleep(50); avrPort.Set_RTS_State(true); + Sleep(50); } } return success; diff --git a/AVR Working Controller/AVR.vcxproj.user b/AVR Working Controller/AVR.vcxproj.user index 38fc125..8dafd8a 100644 --- a/AVR Working Controller/AVR.vcxproj.user +++ b/AVR Working Controller/AVR.vcxproj.user @@ -1,7 +1,7 @@  - -C=2 + -SerialPort=2 -ExportInfo WindowsLocalDebugger \ No newline at end of file diff --git a/AVR Working Controller/AVRInterface.cpp b/AVR Working Controller/AVRInterface.cpp index 051b73f..8b49f1d 100644 --- a/AVR Working Controller/AVRInterface.cpp +++ b/AVR Working Controller/AVRInterface.cpp @@ -14,9 +14,9 @@ #define LONGESTTEXT 150 -using AVRSubsys = AVRInterface::AVRSubsystem_E; +using AVRSubsys = AVRInterface::AVRSubsystem_T; using AVRFunc = AVRInterface::AVRFunction_E; -//using AVRArg = AVRInterface::AVRArgument_U; +using AVRArg = AVRInterface::AVRArg_T; typedef enum { eReady, @@ -56,16 +56,6 @@ static const char * StateText[] = { "Unknown State" }; -static const Message_T AVRCommands[] = { - { eReady, "\x11" "000" "\x03", 5 }, - { ePowerOn, "\x02" "07A1D" "\x03", 7 }, - { ePowerOff,"\x02" "07A1E" "\x03", 7 }, - { eVolumeUp,"\x02" "07A1A" "\x03", 7 }, - { eVolumeDown,"\x02" "07A1B" "\x03", 7 }, - { eMute, "\x02" "07EA2" "\x03", 7 }, - { eUnMute, "\x02" "07EA3" "\x03", 7 }, -}; - // This is based on the longest thing from the MessageHandlers text field and the generated text // "MultiCh Surround" "Surround" const char *PCMessageFormat = "%18s %-20s"; @@ -208,16 +198,6 @@ AVRInterface::~AVRInterface() { } bool AVRInterface::IsSanityCheckOK() { - static bool checked = false; - if (!checked) { - checked = true; - if (sizeof(AVRCommands) / sizeof(Message_T) != AVRState_T::stMaxStates + 1) { - #ifdef _DEBUG - printf("AVRCommands array size mismatch!\n"); - #endif - return false; - } - } return true; } @@ -279,7 +259,7 @@ void AVRInterface::MessageReport(const char *prefix, const void *buf, size_t len } -void AVRInterface::Tick(uint32_t now_ms) { +AVRInterface::AVRState_T AVRInterface::Tick(uint32_t now_ms) { if (!bFirstTickInitialized) { bFirstTickInitialized = true; firstTick_ms = now_ms; @@ -296,7 +276,8 @@ void AVRInterface::Tick(uint32_t now_ms) { default: case AVRState_T::stPoweringUp: readyResponsReceived = false; - ProcessSerialQueue(AVRCommands[eReady].pMsg, AVRCommands[eReady].MsgLen); + AVRCommand(subMain, fncReady, eOn); + (*ReportInformation)(mtInfo, "Send Ready"); sentAtTime_ms = now_ms; readyTries++; state = stAwaitingReadyResponse; @@ -307,7 +288,7 @@ void AVRInterface::Tick(uint32_t now_ms) { } else if (elapsed_ms > RETRY_INTERVAL_ms) { if (readyTries > MAXTRIES) { // fail - + state = stFailed; } else { state = stPoweringUp; } @@ -329,6 +310,7 @@ void AVRInterface::Tick(uint32_t now_ms) { ProcessSerialQueue(); break; } + return state; } /// @brief Handle a just received message by parsing it @@ -434,30 +416,6 @@ bool AVRInterface::Initialize() { return true; } -bool AVRInterface::IsOnline() { - return true; -} -bool AVRInterface::Power(AVROnOff_E cmd) { - commandResponseReceived = false; - if (cmd == eOn) - ProcessSerialQueue(AVRCommands[ePowerOn].pMsg, AVRCommands[ePowerOn].MsgLen); - else - ProcessSerialQueue(AVRCommands[ePowerOff].pMsg, AVRCommands[ePowerOff].MsgLen); - state = stAwaitingResponse; - return true; -} - -bool AVRInterface::VolumeButton(AVRUpDown_E cmd) { - switch (cmd) { - case eUp: - break; - case eDown: - break; - default: - return false; - } - return true; -} bool AVRInterface::RegisterInformationCallback(void(*StatusChangeCallback)(AVRMessageType_T type, const char *msg)) { ReportInformation = StatusChangeCallback; @@ -540,7 +498,6 @@ bool AVRInterface::CheckTheChecksum(const uint8_t *szBuffer, uint32_t num) { sum += szBuffer[i]; } uint8_t cksum = (uint8_t)Hex2Dec(&szBuffer[num - 3], 2); - //printf("CheckSum: %02X v. %c%c\n", sum, szBuffer[num - 3], szBuffer[num - 2]); return (sum == cksum); } @@ -614,8 +571,6 @@ bool AVRInterface::ProcessReportResponse(const uint8_t *szBuffer, uint32_t len) if (!found && ReportInformation) { sprintf_s(buf, LONGESTTEXT, "***** type: %X, guard: %X, cmd: %02X, data: %02X", type, guard, rcmd, rdat); (*ReportInformation)(mtInfo, buf); - //Console_Write(buf); - //Console_ScrollBottomRegion(); } return showAllFlag; } @@ -684,7 +639,7 @@ void AVRInterface::PCMessage(const char *msg, int len, uint8_t **src, const char } typedef const struct { - AVRInterface::AVRSubsystem_E subsystem; + AVRInterface::AVRSubsystem_T subsystem; AVRInterface::AVRFunction_E function; AVRInterface::AVRArg_T arg; const char *Message; @@ -693,228 +648,233 @@ typedef const struct { } MessageTable_T; MessageTable_T MessageTable[] = { - { AVRSubsys::eMain, AVRFunc::fncVolume, AVRInterface::eUp, "\x02" "07A1A" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncVolume, AVRInterface::eDown, "\x02" "07A1B" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncMute, AVRInterface::eOn, "\x02" "07EA2" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncMute, AVRInterface::eOff, "\x02" "07EA3" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInput, AVRInterface::ePhono, "\x02" "07A14" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInput, AVRInterface::eCD, "\x02" "07A15" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInput, AVRInterface::eTuner, "\x02" "07A16" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInput, AVRInterface::eCDR, "\x02" "07A19" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInput, AVRInterface::eMD_Tape, "\x02" "07AC9" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInput, AVRInterface::eDVD, "\x02" "07AC1" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInput, AVRInterface::eDTV, "\x02" "07A54" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInput, AVRInterface::eCable, "\x02" "07AC0" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInput, AVRInterface::eSat, "\x02" "07ACA" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInput, AVRInterface::eVCR1, "\x02" "07A0F" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInput, AVRInterface::eVCR2_DVR, "\x02" "07A13" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInput, AVRInterface::eVCR3, "\x02" "07AC8" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInput, AVRInterface::eV_Aux, "\x02" "07A55" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fnc6ChInput, AVRInterface::eOn, "\x02" "07EA4" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fnc6ChInput, AVRInterface::eOff, "\x02" "07EA5" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInputMode, AVRInterface::eInpAuto, "\x02" "07EA6" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInputMode, AVRInterface::eDD_RF, "\x02" "07EA7" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInputMode, AVRInterface::eDTS, "\x02" "07EA8" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInputMode, AVRInterface::eDigital, "\x02" "07EA9" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInputMode, AVRInterface::eAnalog, "\x02" "07EAA" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncInputMode, AVRInterface::eAAC, "\x02" "07E3B" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncVolume, AVRInterface::eUp, "\x02" "07ADA" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncVolume, AVRInterface::eDown, "\x02" "07ADB" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncMute, AVRInterface::eOn, "\x02" "07EA0" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncMute, AVRInterface::eOff, "\x02" "07EA1" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncInput, AVRInterface::ePhono, "\x02" "07AD0" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncInput, AVRInterface::eCD, "\x02" "07AD1" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncInput, AVRInterface::eTuner, "\x02" "07AD2" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncInput, AVRInterface::eCDR, "\x02" "07AD4" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncInput, AVRInterface::eMD_Tape, "\x02" "07ACF" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncInput, AVRInterface::eDVD, "\x02" "07ACD" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncInput, AVRInterface::eDTV, "\x02" "07AD9" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncInput, AVRInterface::eCable, "\x02" "07ACC" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncInput, AVRInterface::eSat, "\x02" "07ACB" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncInput, AVRInterface::eVCR1, "\x02" "07AD6" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncInput, AVRInterface::eVCR2_DVR, "\x02" "07AD7" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncInput, AVRInterface::eVCR3, "\x02" "07ACE" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncInput, AVRInterface::eV_Aux, "\x02" "07AD8" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncPower, AVRInterface::eOn, "\x02" "07A1D" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncPower, AVRInterface::eOff, "\x02" "07A1E" "\x03", 7 }, - { AVRSubsys::eZone1, AVRFunc::fncPower, AVRInterface::eOn, "\x02" "07E7E" "\x03", 7 }, - { AVRSubsys::eZone1, AVRFunc::fncPower, AVRInterface::eOff, "\x02" "07E7F" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncPower, AVRInterface::eOn, "\x02" "07EBA" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncPower, AVRInterface::eOff, "\x02" "07EBB" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncPower, AVRInterface::eOn, "\x02" "07AED" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncPower, AVRInterface::eStandby, "\x02" "07AEE" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncMute, AVRInterface::eOn, "\x02" "07E26" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncMute, AVRInterface::eOff, "\x02" "07E66" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncVolume, AVRInterface::eUp, "\x02" "07AFD" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncVolume, AVRInterface::eDown, "\x02" "07AFE" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncInput, AVRInterface::ePhono, "\x02" "07AF1" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncInput, AVRInterface::eCD, "\x02" "07AF2" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncInput, AVRInterface::eTuner, "\x02" "07AF3" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncInput, AVRInterface::eCDR, "\x02" "07AF5" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncInput, AVRInterface::eMD_Tape, "\x02" "07AF4" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncInput, AVRInterface::eDVD, "\x02" "07AFC" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncInput, AVRInterface::eDTV, "\x02" "07AF6" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncInput, AVRInterface::eCable, "\x02" "07AF7" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncInput, AVRInterface::eSat, "\x02" "07AF8" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncInput, AVRInterface::eVCR1, "\x02" "07AF9" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncInput, AVRInterface::eVCR2_DVR, "\x02" "07AFA" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncInput, AVRInterface::eVCR3, "\x02" "07AFB" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncInput, AVRInterface::eV_Aux, "\x02" "07AF0" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncOSD, AVRInterface::eOSDOff, "\x02" "07EB0" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncOSD, AVRInterface::eOSDShort, "\x02" "07EB1" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncOSD, AVRInterface::eOSDFull, "\x02" "07EB2" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncSleep, AVRInterface::eSleepOff, "\x02" "07EB3" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncSleep, AVRInterface::eSleep120, "\x02" "07EB4" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncSleep, AVRInterface::eSleep90, "\x02" "07EB5" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncSleep, AVRInterface::eSleep60, "\x02" "07EB6" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncSleep, AVRInterface::eSleep30, "\x02" "07EB7" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEx_EsOnOff, AVRInterface::eOnMatrix, "\x02" "07EB8" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEx_EsOnOff, AVRInterface::eESESOff, "\x02" "07EB9" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEx_EsOnOff, AVRInterface::eAuto, "\x02" "07E7C" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEx_EsOnOff, AVRInterface::eDiscrete, "\x02" "07E7D" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncNightModeOnOff, AVRInterface::eOn, "\x02" "07E9B" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncNightModeOnOff, AVRInterface::eOff, "\x02" "07E9C" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::eEffectOn, "\x02" "07E27" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::eStereo, "\x02" "07EE0" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Hall_A, "\x02" "07EE1" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Hall_B, "\x02" "07EE2" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Hall_C, "\x02" "07EE3" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Hall_USA, "\x02" "07EE4" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Hall_E, "\x02" "07EE5" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Live_Concert, "\x02" "07EE6" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Tokyo, "\x02" "07EE7" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Freiburg, "\x02" "07EE8" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Royaumont, "\x02" "07EE9" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Village_Gate, "\x02" "07EEA" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Village_Vanguard, "\x02" "07EEB" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::The_Bottom_Line, "\x02" "07EEC" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::The_Roxy_Theater, "\x02" "07EED" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Warehouse_Loft, "\x02" "07EEE" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Arena, "\x02" "07EEF" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Disco, "\x02" "07EF0" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Party, "\x02" "07EF1" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Game, "\x02" "07EF2" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Stereo_6_8Ch, "\x02" "07EFF" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Pop_Rock, "\x02" "07EF3" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::DJ, "\x02" "07EF4" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Opera, "\x02" "07EF5" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Pavillion, "\x02" "07EF6" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Mono_Movie, "\x02" "07EF7" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Variety_Sports, "\x02" "07EF8" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Spectacre, "\x02" "07EF9" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Sci_Fi, "\x02" "07EFA" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Adventure, "\x02" "07EFB" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::General, "\x02" "07EFC" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Normal, "\x02" "07EFD" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Enhanced, "\x02" "07EFE" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::PLII_Movie, "\x02" "07E67" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::PLII_Music, "\x02" "07E68" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Neo_6_Movie, "\x02" "07E69" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Neo_6_Music, "\x02" "07E6A" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Direct_2Ch, "\x02" "07EC1" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::Stereo_2Ch, "\x02" "07EC0" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::THX_Ultra_PL, "\x02" "07EC2" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::THX_Music, "\x02" "07EC3" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::THX_Ultra_PL2, "\x02" "07EC7" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncEffect, AVRInterface::THX_Ultra_NEO6, "\x02" "07EC8" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetPage, AVRInterface::eA, "\x02" "07AE0" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetPage, AVRInterface::eB, "\x02" "07AE1" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetPage, AVRInterface::eC, "\x02" "07AE2" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetPage, AVRInterface::eD, "\x02" "07AE3" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetPage, AVRInterface::eE, "\x02" "07AE4" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetNumber, AVRInterface::e1, "\x02" "07AE5" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetNumber, AVRInterface::e2, "\x02" "07AE6" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetNumber, AVRInterface::e3, "\x02" "07AE7" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetNumber, AVRInterface::e4, "\x02" "07AE8" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetNumber, AVRInterface::e5, "\x02" "07AE9" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetNumber, AVRInterface::e6, "\x02" "07AEA" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetNumber, AVRInterface::e7, "\x02" "07AEB" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetNumber, AVRInterface::e8, "\x02" "07AEC" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioBand, AVRInterface::eFM, "\x02" "07EBC" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioBand, AVRInterface::eAM, "\x02" "07EBD" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioTune, AVRInterface::eUp, "\x02" "07EBE" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioTune, AVRInterface::eDown, "\x02" "07EBF" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncSpeakerAOnOff, AVRInterface::eOn, "\x02" "07EAB" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncSpeakerAOnOff, AVRInterface::eOff, "\x02" "07EAC" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncSpeakerBOnOff, AVRInterface::eOn, "\x02" "07EAD" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncSpeakerBOnOff, AVRInterface::eOff, "\x02" "07EAE" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetMemory, AVRInterface::eA, "\x02" "07E2B" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetMemory, AVRInterface::eB, "\x02" "07E2C" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetMemory, AVRInterface::eC, "\x02" "07E2D" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetMemory, AVRInterface::eD, "\x02" "07E2E" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetMemory, AVRInterface::eE, "\x02" "07E2F" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetMemory, AVRInterface::eF, "\x02" "07E20" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetRecall, AVRInterface::eA, "\x02" "07E35" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetRecall, AVRInterface::eB, "\x02" "07E36" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetRecall, AVRInterface::eC, "\x02" "07E37" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetRecall, AVRInterface::eD, "\x02" "07E38" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetRecall, AVRInterface::eE, "\x02" "07E39" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncRadioPresetRecall, AVRInterface::eF, "\x02" "07E3A" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncVolumeMemory, AVRInterface::eA, "\x02" "07E6B" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncVolumeMemory, AVRInterface::eB, "\x02" "07E6C" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncVolumeMemory, AVRInterface::eC, "\x02" "07E6D" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncVolumeMemory, AVRInterface::eD, "\x02" "07E6E" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncVolumeMemory, AVRInterface::eE, "\x02" "07E6F" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncVolumeMemory, AVRInterface::eF, "\x02" "07E60" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncVolumeRecall, AVRInterface::eA, "\x02" "07E75" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncVolumeRecall, AVRInterface::eB, "\x02" "07E76" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncVolumeRecall, AVRInterface::eC, "\x02" "07E77" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncVolumeRecall, AVRInterface::eD, "\x02" "07E78" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncVolumeRecall, AVRInterface::eE, "\x02" "07E79" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncVolumeRecall, AVRInterface::eF, "\x02" "07E7A" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncVolumeMemory, AVRInterface::eA, "\x02" "07E87" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncVolumeMemory, AVRInterface::eB, "\x02" "07E88" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncVolumeMemory, AVRInterface::eC, "\x02" "07E89" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncVolumeMemory, AVRInterface::eD, "\x02" "07E8A" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncVolumeMemory, AVRInterface::eE, "\x02" "07E8B" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncVolumeMemory, AVRInterface::eF, "\x02" "07E8C" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncVolumeRecall, AVRInterface::eA, "\x02" "07E8D" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncVolumeRecall, AVRInterface::eB, "\x02" "07E8E" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncVolumeRecall, AVRInterface::eC, "\x02" "07E8F" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncVolumeRecall, AVRInterface::eD, "\x02" "07E90" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncVolumeRecall, AVRInterface::eE, "\x02" "07E91" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncVolumeRecall, AVRInterface::eF, "\x02" "07E92" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncVolumeMemory, AVRInterface::eA, "\x02" "07E20" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncVolumeMemory, AVRInterface::eB, "\x02" "07E21" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncVolumeMemory, AVRInterface::eC, "\x02" "07E22" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncVolumeMemory, AVRInterface::eD, "\x02" "07E23" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncVolumeMemory, AVRInterface::eE, "\x02" "07E24" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncVolumeMemory, AVRInterface::eF, "\x02" "07E25" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncVolumeRecall, AVRInterface::eA, "\x02" "07E60" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncVolumeRecall, AVRInterface::eB, "\x02" "07E61" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncVolumeRecall, AVRInterface::eC, "\x02" "07E62" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncVolumeRecall, AVRInterface::eD, "\x02" "07E63" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncVolumeRecall, AVRInterface::eE, "\x02" "07E64" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncVolumeRecall, AVRInterface::eF, "\x02" "07E65" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncDC1TrigControl, AVRInterface::eZone1, "\x02" "07E32" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncDC1TrigControl, AVRInterface::eZone2, "\x02" "07E33" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncDC1TrigControl, AVRInterface::eZone3, "\x02" "07E31" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncDC1OnOff, AVRInterface::eOn, "\x02" "07E71" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncDC1OnOff, AVRInterface::eOff, "\x02" "07E72" "\x03", 7 }, - { AVRSubsys::eZone1, AVRFunc::fncDC1OnOff, AVRInterface::eOn, "\x02" "07E73" "\x03", 7 }, - { AVRSubsys::eZone1, AVRFunc::fncDC1OnOff, AVRInterface::eOff, "\x02" "07E74" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncDC1OnOff, AVRInterface::eOn, "\x02" "07E83" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncDC1OnOff, AVRInterface::eOff, "\x02" "07E84" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncDualMono, AVRInterface::eDualMain, "\x02" "07E93" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncDualMono, AVRInterface::eDualSub, "\x02" "07E94" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncDualMono, AVRInterface::eDualAll, "\x02" "07E95" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncDC1TrigControl, AVRInterface::eZone1, "\x02" "07E96" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncDC1TrigControl, AVRInterface::eZone2, "\x02" "07E97" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncDC1TrigControl, AVRInterface::eZone3, "\x02" "07E9F" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncDC1TrigControl, AVRInterface::eZoneOR, "\x02" "07E98" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncDC2OnOff, AVRInterface::eOn, "\x02" "07E3C" "\x03", 7 }, - { AVRSubsys::eZone2, AVRFunc::fncDC2OnOff, AVRInterface::eOff, "\x02" "07E3D" "\x03", 7 }, - { AVRSubsys::eZone1, AVRFunc::fncDC2OnOff, AVRInterface::eOn, "\x02" "07E3E" "\x03", 7 }, - { AVRSubsys::eZone1, AVRFunc::fncDC2OnOff, AVRInterface::eOff, "\x02" "07E3F" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncDC2OnOff, AVRInterface::eOn, "\x02" "07E85" "\x03", 7 }, - { AVRSubsys::eZone3, AVRFunc::fncDC2OnOff, AVRInterface::eOff, "\x02" "07E86" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncSpeakerBZone, AVRInterface::eZone1, "\x02" "07E28" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncSpeakerBZone, AVRInterface::eZone2, "\x02" "07E29" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncZone2SpeakerOnOff, AVRInterface::eOn, "\x02" "07E99" "\x03", 7 }, - { AVRSubsys::eMain, AVRFunc::fncZone2SpeakerOnOff, AVRInterface::eOff, "\x02" "07E9A" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncReady, AVRInterface::eOn, "\x11" "000" "\x03", 5 }, + { AVRSubsys::subMain, AVRFunc::fncPower, AVRInterface::eOn, "\x02" "07A1D" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncPower, AVRInterface::eOff, "\x02" "07A1E" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncVolume, AVRInterface::eUp, "\x02" "07A1A" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncVolume, AVRInterface::eDown, "\x02" "07A1B" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncMute, AVRInterface::eOn, "\x02" "07EA2" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncMute, AVRInterface::eOff, "\x02" "07EA3" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncOSD, AVRInterface::eOSDOff, "\x02" "07EB0" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncOSD, AVRInterface::eOSDShort, "\x02" "07EB1" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncOSD, AVRInterface::eOSDFull, "\x02" "07EB2" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncNightModeOnOff, AVRInterface::eOn, "\x02" "07E9B" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncNightModeOnOff, AVRInterface::eOff, "\x02" "07E9C" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncSleep, AVRInterface::eSleepOff, "\x02" "07EB3" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncSleep, AVRInterface::eSleep120, "\x02" "07EB4" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncSleep, AVRInterface::eSleep90, "\x02" "07EB5" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncSleep, AVRInterface::eSleep60, "\x02" "07EB6" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncSleep, AVRInterface::eSleep30, "\x02" "07EB7" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncSpeakerAOnOff, AVRInterface::eOn, "\x02" "07EAB" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncSpeakerAOnOff, AVRInterface::eOff, "\x02" "07EAC" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncSpeakerBOnOff, AVRInterface::eOn, "\x02" "07EAD" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncSpeakerBOnOff, AVRInterface::eOff, "\x02" "07EAE" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncDC1TrigControl, AVRInterface::eZone1, "\x02" "07E32" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncDC1TrigControl, AVRInterface::eZone2, "\x02" "07E33" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncDC1TrigControl, AVRInterface::eZone3, "\x02" "07E31" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncDualMono, AVRInterface::eDualMain, "\x02" "07E93" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncDualMono, AVRInterface::eDualSub, "\x02" "07E94" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncDualMono, AVRInterface::eDualAll, "\x02" "07E95" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncDC1TrigControl, AVRInterface::eZone1, "\x02" "07E96" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncDC1TrigControl, AVRInterface::eZone2, "\x02" "07E97" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncDC1TrigControl, AVRInterface::eZone3, "\x02" "07E9F" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncDC1TrigControl, AVRInterface::eZoneOR, "\x02" "07E98" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncSpeakerBZone, AVRInterface::eZone1, "\x02" "07E28" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncSpeakerBZone, AVRInterface::eZone2, "\x02" "07E29" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncZone2SpeakerOnOff, AVRInterface::eOn, "\x02" "07E99" "\x03", 7 }, + { AVRSubsys::subMain, AVRFunc::fncZone2SpeakerOnOff, AVRInterface::eOff, "\x02" "07E9A" "\x03", 7 }, + + { AVRSubsys::subRadio, AVRFunc::fncRadioBand, AVRInterface::eFM, "\x02" "07EBC" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioBand, AVRInterface::eAM, "\x02" "07EBD" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioTune, AVRInterface::eUp, "\x02" "07EBE" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioTune, AVRInterface::eDown, "\x02" "07EBF" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetPage, AVRInterface::eA, "\x02" "07AE0" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetPage, AVRInterface::eB, "\x02" "07AE1" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetPage, AVRInterface::eC, "\x02" "07AE2" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetPage, AVRInterface::eD, "\x02" "07AE3" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetPage, AVRInterface::eE, "\x02" "07AE4" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetNumber, AVRInterface::e1, "\x02" "07AE5" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetNumber, AVRInterface::e2, "\x02" "07AE6" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetNumber, AVRInterface::e3, "\x02" "07AE7" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetNumber, AVRInterface::e4, "\x02" "07AE8" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetNumber, AVRInterface::e5, "\x02" "07AE9" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetNumber, AVRInterface::e6, "\x02" "07AEA" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetNumber, AVRInterface::e7, "\x02" "07AEB" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetNumber, AVRInterface::e8, "\x02" "07AEC" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetMemory, AVRInterface::eA, "\x02" "07E2B" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetMemory, AVRInterface::eB, "\x02" "07E2C" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetMemory, AVRInterface::eC, "\x02" "07E2D" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetMemory, AVRInterface::eD, "\x02" "07E2E" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetMemory, AVRInterface::eE, "\x02" "07E2F" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetMemory, AVRInterface::eF, "\x02" "07E20" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetRecall, AVRInterface::eA, "\x02" "07E35" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetRecall, AVRInterface::eB, "\x02" "07E36" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetRecall, AVRInterface::eC, "\x02" "07E37" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetRecall, AVRInterface::eD, "\x02" "07E38" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetRecall, AVRInterface::eE, "\x02" "07E39" "\x03", 7 }, + { AVRSubsys::subRadio, AVRFunc::fncRadioPresetRecall, AVRInterface::eF, "\x02" "07E3A" "\x03", 7 }, + + { AVRSubsys::subAudio, AVRFunc::fnc6ChInput, AVRInterface::eOn, "\x02" "07EA4" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fnc6ChInput, AVRInterface::eOff, "\x02" "07EA5" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncInputMode, AVRInterface::eInpAuto, "\x02" "07EA6" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncInputMode, AVRInterface::eDD_RF, "\x02" "07EA7" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncInputMode, AVRInterface::eDTS, "\x02" "07EA8" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncInputMode, AVRInterface::eDigital, "\x02" "07EA9" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncInputMode, AVRInterface::eAnalog, "\x02" "07EAA" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncInputMode, AVRInterface::eAAC, "\x02" "07E3B" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncEx_EsOnOff, AVRInterface::eOnMatrix, "\x02" "07EB8" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncEx_EsOnOff, AVRInterface::eESESOff, "\x02" "07EB9" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncEx_EsOnOff, AVRInterface::eAuto, "\x02" "07E7C" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncEx_EsOnOff, AVRInterface::eDiscrete, "\x02" "07E7D" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncEffect, AVRInterface::eEffectOn, "\x02" "07E27" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncEffect, AVRInterface::eStereo, "\x02" "07EE0" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Hall_A, "\x02" "07EE1" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Hall_B, "\x02" "07EE2" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Hall_C, "\x02" "07EE3" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Hall_USA, "\x02" "07EE4" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Hall_E, "\x02" "07EE5" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Live_Concert, "\x02" "07EE6" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Tokyo, "\x02" "07EE7" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Freiburg, "\x02" "07EE8" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Royaumont, "\x02" "07EE9" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Village_Gate, "\x02" "07EEA" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Village_Vanguard, "\x02" "07EEB" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::The_Bottom_Line, "\x02" "07EEC" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::The_Roxy_Theater, "\x02" "07EED" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Warehouse_Loft, "\x02" "07EEE" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Arena, "\x02" "07EEF" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Disco, "\x02" "07EF0" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Party, "\x02" "07EF1" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Game, "\x02" "07EF2" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Stereo_6_8Ch, "\x02" "07EFF" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Pop_Rock, "\x02" "07EF3" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::DJ, "\x02" "07EF4" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Opera, "\x02" "07EF5" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Pavillion, "\x02" "07EF6" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Mono_Movie, "\x02" "07EF7" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Variety_Sports, "\x02" "07EF8" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Spectacre, "\x02" "07EF9" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Sci_Fi, "\x02" "07EFA" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Adventure, "\x02" "07EFB" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::General, "\x02" "07EFC" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Normal, "\x02" "07EFD" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Enhanced, "\x02" "07EFE" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::PLII_Movie, "\x02" "07E67" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::PLII_Music, "\x02" "07E68" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Neo_6_Movie, "\x02" "07E69" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Neo_6_Music, "\x02" "07E6A" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Direct_2Ch, "\x02" "07EC1" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::Stereo_2Ch, "\x02" "07EC0" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::THX_Ultra_PL, "\x02" "07EC2" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::THX_Music, "\x02" "07EC3" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::THX_Ultra_PL2, "\x02" "07EC7" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncDSPSoundScape, AVRInterface::THX_Ultra_NEO6, "\x02" "07EC8" "\x03", 7 }, + + { AVRSubsys::subAudio, AVRFunc::fncVolumeMemory, AVRInterface::eA, "\x02" "07E6B" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncVolumeMemory, AVRInterface::eB, "\x02" "07E6C" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncVolumeMemory, AVRInterface::eC, "\x02" "07E6D" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncVolumeMemory, AVRInterface::eD, "\x02" "07E6E" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncVolumeMemory, AVRInterface::eE, "\x02" "07E6F" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncVolumeMemory, AVRInterface::eF, "\x02" "07E60" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncVolumeRecall, AVRInterface::eA, "\x02" "07E75" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncVolumeRecall, AVRInterface::eB, "\x02" "07E76" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncVolumeRecall, AVRInterface::eC, "\x02" "07E77" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncVolumeRecall, AVRInterface::eD, "\x02" "07E78" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncVolumeRecall, AVRInterface::eE, "\x02" "07E79" "\x03", 7 }, + { AVRSubsys::subAudio, AVRFunc::fncVolumeRecall, AVRInterface::eF, "\x02" "07E7A" "\x03", 7 }, + + { AVRSubsys::subZone1, AVRFunc::fncPower, AVRInterface::eOn, "\x02" "07E7E" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncPower, AVRInterface::eOff, "\x02" "07E7F" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncInput, AVRInterface::ePhono, "\x02" "07A14" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncInput, AVRInterface::eCD, "\x02" "07A15" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncInput, AVRInterface::eTuner, "\x02" "07A16" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncInput, AVRInterface::eCDR, "\x02" "07A19" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncInput, AVRInterface::eMD_Tape, "\x02" "07AC9" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncInput, AVRInterface::eDVD, "\x02" "07AC1" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncInput, AVRInterface::eDTV, "\x02" "07A54" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncInput, AVRInterface::eCable, "\x02" "07AC0" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncInput, AVRInterface::eSat, "\x02" "07ACA" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncInput, AVRInterface::eVCR1, "\x02" "07A0F" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncInput, AVRInterface::eVCR2_DVR, "\x02" "07A13" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncInput, AVRInterface::eVCR3, "\x02" "07AC8" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncInput, AVRInterface::eV_Aux, "\x02" "07A55" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncDC1OnOff, AVRInterface::eOn, "\x02" "07E73" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncDC1OnOff, AVRInterface::eOff, "\x02" "07E74" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncDC2OnOff, AVRInterface::eOn, "\x02" "07E3E" "\x03", 7 }, + { AVRSubsys::subZone1, AVRFunc::fncDC2OnOff, AVRInterface::eOff, "\x02" "07E3F" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncVolume, AVRInterface::eUp, "\x02" "07ADA" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncVolume, AVRInterface::eDown, "\x02" "07ADB" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncMute, AVRInterface::eOn, "\x02" "07EA0" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncMute, AVRInterface::eOff, "\x02" "07EA1" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncInput, AVRInterface::ePhono, "\x02" "07AD0" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncInput, AVRInterface::eCD, "\x02" "07AD1" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncInput, AVRInterface::eTuner, "\x02" "07AD2" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncInput, AVRInterface::eCDR, "\x02" "07AD4" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncInput, AVRInterface::eMD_Tape, "\x02" "07ACF" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncInput, AVRInterface::eDVD, "\x02" "07ACD" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncInput, AVRInterface::eDTV, "\x02" "07AD9" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncInput, AVRInterface::eCable, "\x02" "07ACC" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncInput, AVRInterface::eSat, "\x02" "07ACB" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncInput, AVRInterface::eVCR1, "\x02" "07AD6" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncInput, AVRInterface::eVCR2_DVR, "\x02" "07AD7" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncInput, AVRInterface::eVCR3, "\x02" "07ACE" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncInput, AVRInterface::eV_Aux, "\x02" "07AD8" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncPower, AVRInterface::eOn, "\x02" "07EBA" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncPower, AVRInterface::eOff, "\x02" "07EBB" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncVolumeMemory, AVRInterface::eA, "\x02" "07E87" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncVolumeMemory, AVRInterface::eB, "\x02" "07E88" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncVolumeMemory, AVRInterface::eC, "\x02" "07E89" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncVolumeMemory, AVRInterface::eD, "\x02" "07E8A" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncVolumeMemory, AVRInterface::eE, "\x02" "07E8B" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncVolumeMemory, AVRInterface::eF, "\x02" "07E8C" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncVolumeRecall, AVRInterface::eA, "\x02" "07E8D" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncVolumeRecall, AVRInterface::eB, "\x02" "07E8E" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncVolumeRecall, AVRInterface::eC, "\x02" "07E8F" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncVolumeRecall, AVRInterface::eD, "\x02" "07E90" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncVolumeRecall, AVRInterface::eE, "\x02" "07E91" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncVolumeRecall, AVRInterface::eF, "\x02" "07E92" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncDC1OnOff, AVRInterface::eOn, "\x02" "07E71" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncDC1OnOff, AVRInterface::eOff, "\x02" "07E72" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncDC2OnOff, AVRInterface::eOn, "\x02" "07E3C" "\x03", 7 }, + { AVRSubsys::subZone2, AVRFunc::fncDC2OnOff, AVRInterface::eOff, "\x02" "07E3D" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncPower, AVRInterface::eOn, "\x02" "07AED" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncPower, AVRInterface::eStandby, "\x02" "07AEE" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncMute, AVRInterface::eOn, "\x02" "07E26" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncMute, AVRInterface::eOff, "\x02" "07E66" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncVolume, AVRInterface::eUp, "\x02" "07AFD" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncVolume, AVRInterface::eDown, "\x02" "07AFE" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncInput, AVRInterface::ePhono, "\x02" "07AF1" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncInput, AVRInterface::eCD, "\x02" "07AF2" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncInput, AVRInterface::eTuner, "\x02" "07AF3" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncInput, AVRInterface::eCDR, "\x02" "07AF5" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncInput, AVRInterface::eMD_Tape, "\x02" "07AF4" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncInput, AVRInterface::eDVD, "\x02" "07AFC" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncInput, AVRInterface::eDTV, "\x02" "07AF6" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncInput, AVRInterface::eCable, "\x02" "07AF7" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncInput, AVRInterface::eSat, "\x02" "07AF8" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncInput, AVRInterface::eVCR1, "\x02" "07AF9" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncInput, AVRInterface::eVCR2_DVR, "\x02" "07AFA" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncInput, AVRInterface::eVCR3, "\x02" "07AFB" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncInput, AVRInterface::eV_Aux, "\x02" "07AF0" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncVolumeMemory, AVRInterface::eA, "\x02" "07E20" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncVolumeMemory, AVRInterface::eB, "\x02" "07E21" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncVolumeMemory, AVRInterface::eC, "\x02" "07E22" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncVolumeMemory, AVRInterface::eD, "\x02" "07E23" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncVolumeMemory, AVRInterface::eE, "\x02" "07E24" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncVolumeMemory, AVRInterface::eF, "\x02" "07E25" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncVolumeRecall, AVRInterface::eA, "\x02" "07E60" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncVolumeRecall, AVRInterface::eB, "\x02" "07E61" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncVolumeRecall, AVRInterface::eC, "\x02" "07E62" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncVolumeRecall, AVRInterface::eD, "\x02" "07E63" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncVolumeRecall, AVRInterface::eE, "\x02" "07E64" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncVolumeRecall, AVRInterface::eF, "\x02" "07E65" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncDC1OnOff, AVRInterface::eOn, "\x02" "07E83" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncDC1OnOff, AVRInterface::eOff, "\x02" "07E84" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncDC2OnOff, AVRInterface::eOn, "\x02" "07E85" "\x03", 7 }, + { AVRSubsys::subZone3, AVRFunc::fncDC2OnOff, AVRInterface::eOff, "\x02" "07E86" "\x03", 7 }, }; -bool AVRInterface::AVRCommand(AVRInterface::AVRSubsystem_E subsystem, +bool AVRInterface::AVRCommand(AVRInterface::AVRSubsystem_T subsystem, AVRInterface::AVRFunction_E function, AVRArg_T arg) { bool found = false; @@ -926,11 +886,248 @@ bool AVRInterface::AVRCommand(AVRInterface::AVRSubsystem_E subsystem, } } if (!found) { - // then what? + char buf[LONGESTTEXT] = ""; + sprintf_s(buf, LONGESTTEXT, "AVRCommand(%d,%d,%d) is invalid.", subsystem, function, arg); + (*ReportInformation)(mtInfo, buf); } return true; } +void AVRInterface::ExportInformation() { + char buf[LONGESTTEXT] = ""; + typedef struct { + uint16_t value; + const char *helpText; + } ValuePurpose_T; + const ValuePurpose_T subsysList[] = { + { subMain, "Main Subsystem" }, + { subRadio, "Radio Control" }, + { subAudio, "Audio Control" }, + { subZone1, "Zone 1 Control" }, + { subZone2, "Zone 2 Control" }, + { subZone3, "Zone 3 Control" }, + }; + const ValuePurpose_T funcList[] = { + { fncReady, "Ready Check" }, + { fncPower, "Power" }, + { fncVolume, "Volume" }, + { fncMute, "Mute" }, + { fncVolumeMemory, "Volume Memory" }, + { fncVolumeRecall, "Volume Memory Recall" }, + { fncSpeakerAOnOff, "Speaker A" }, + { fncSpeakerBOnOff, "Speaker B" }, + { fncSpeakerBZone, "Speaker B Zone Assignment" }, + { fncZone2SpeakerOnOff, "Zone 2 Speaker" }, + { fncNightModeOnOff, "Night Mode Sound Level" }, + { fncEffect, "Effect " }, + { fncDSPSoundScape, "DSP Sound Scape" }, + { fncInput, "Input Selection" }, + { fncRadioBand, "Radio Band Selection" }, + { fncRadioTune, "Radio Tune" }, + { fncRadioPresetPage, "Radio Preset Page" }, + { fncRadioPresetNumber, "Radio Preset Number" }, + { fncRadioPresetMemory, "Radio Preset Memory" }, + { fncRadioPresetRecall, "Radio Preset Recall" }, + { fncSleep, "Sleep Timer" }, + { fncOSD, "On Screen Display Control" }, + { fnc6ChInput, "6 Channel Input mode" }, + { fncEx_EsOnOff, "EX / ES Mode" }, + { fncInputMode, "Input Mode" }, + { fncDualMono, "Dual Mono" }, + { fncDC1TrigControl, "DC1 Trigger Control" }, + { fncDC2TrigControl, "DC2 Trigger Control" }, + { fncDC1OnOff, "DC1" }, + { fncDC2OnOff, "DC2" }, + }; + const ValuePurpose_T valueList[] = { + { eOn, "On" }, + { eOff, "Off" }, + { eStandby, "Standby" }, + { eUp, "Up" }, + { eDown, "Down" }, + { eOSDOff, "Off" }, + { eOSDShort, "Short" }, + { eOSDFull, "Full" }, + { eSleepOff, "Off" }, + { eSleep120, "120" }, + { eSleep90, "90" }, + { eSleep60, "60" }, + { eSleep30, "30" }, + { eOnMatrix, "EX-ES Mode Matrix On" }, + { eESESOff, "EX-ES Mode Off" }, + { eAuto, "EX-ES Mode Auto" }, + { eDiscrete, "EX-ES Mode Discrete" }, + { eEffectOn, "Effect On" }, + { eStereo, "Effect Stereo" }, + { eFM, "FM Band" }, + { eAM, "AM Band" }, + { eA, "Group A" }, + { eB, "Group B" }, + { eC, "Group C" }, + { eD, "Group D" }, + { eE, "Group E" }, + { eF, "Group F" }, + { e1, "Preset 1" }, + { e2, "Preset 2" }, + { e3, "Preset 3" }, + { e4, "Preset 4" }, + { e5, "Preset 5" }, + { e6, "Preset 6" }, + { e7, "Preset 7" }, + { e8, "Preset 8" }, + { ePhono, "Phono" }, + { eCD, "CD" }, + { eTuner, "Tuner" }, + { eCDR, "CDR" }, + { eMD_Tape, "MD_Tape" }, + { eDVD, "DVD" }, + { eDTV, "DTV" }, + { eCable, "Cable" }, + { eSat, "Sat" }, + { eVCR1, "VCR1" }, + { eVCR2_DVR, "VCR2_DVR" }, + { eVCR3, "VCR3" }, + { eV_Aux, "V Aux" }, + + { Hall_A, "Hall A" }, + { Hall_B, "Hall B" }, + { Hall_C, "Hall C" }, + { Hall_USA, "Hall USA" }, + { Hall_E, "Hall E" }, + { Live_Concert, "Live Concert" }, + { Tokyo, "Tokyo" }, + { Freiburg, "Freiburg" }, + { Royaumont, "Royaumont" }, + { Village_Gate, "Village Gate" }, + { Village_Vanguard, "Village Vanguard" }, + { The_Bottom_Line, "The Bottom Line" }, + { The_Roxy_Theater, "The Roxy Theater" }, + { Warehouse_Loft, "Warehouse Loft" }, + { Arena, "Arena" }, + { Disco, "Disco" }, + { Party, "Party" }, + { Game, "Game" }, + { Stereo_6_8Ch, "Stereo 6/8Ch" }, + { Pop_Rock, "Pop/Rock" }, + { DJ, "DJ" }, + { Opera, "Opera" }, + { Pavillion, "Pavillion" }, + { Mono_Movie, "Mono/Movie" }, + { Variety_Sports, "Variety/Sports" }, + { Spectacre, "Spectacre" }, + { Sci_Fi, "Sci-Fi" }, + { Adventure, "Adventure" }, + { General, "General" }, + { Normal, "Normal" }, + { Enhanced, "Enhanced" }, + { PLII_Movie, "PLII Movie" }, + { PLII_Music, "PLII Music" }, + { Neo_6_Movie, "Neo 6 Movie" }, + { Neo_6_Music, "Neo 6 Music" }, + { Direct_2Ch, "Direct 2Ch" }, + { Stereo_2Ch, "Stereo 2Ch" }, + { THX_Ultra_PL, "THX Ultra PL" }, + { THX_Music, "THX Music" }, + { THX_Ultra_PL2, "THX Ultra PL2" }, + { THX_Ultra_NEO6, "THX Ultra NEO6" }, + + { eInpAuto, "Input Auto" }, + { eDD_RF, "Input DD/RF" }, + { eDTS, "Input DTS" }, + { eDigital, "Input Digital" }, + { eAnalog, "Input Analog" }, + { eAAC, "Input AAC" }, + + { eZone1, "Zone 1" }, + { eZone2, "Zone 2" }, + { eZone3, "Zone 3" }, + { eZoneOR, "Zone OR" }, + + { eDualMain, "Dual Main" }, + { eDualSub, "Dual Sub" }, + { eDualAll, "Dual All" }, + }; + ReportInformation(mtInfo, ""); + ReportInformation(mtInfo, "AVR Command Line Control uses 3 numeric parameters:"); + ReportInformation(mtInfo, " 1) Subsystem Identifier for the subsystem control"); + ReportInformation(mtInfo, " 2) Function Identifier valid for the subsystem"); + ReportInformation(mtInfo, " 3) Value Identifier valid for the subsystem and function"); + ReportInformation(mtInfo, ""); + ReportInformation(mtInfo, " NOTE: Most commands are unavailable when the system is off."); + ReportInformation(mtInfo, " "); + ReportInformation(mtInfo, ""); + sprintf_s(buf, LONGESTTEXT, "%8d: %-21s | %3d: %-28s | %3d: %-22s | %-13s", + 1, "Subsystem Identifier", 2, "Function Identifier", 3, "Value Identifier", "Stream" + ); + ReportInformation(mtInfo, buf); + sprintf_s(buf, LONGESTTEXT, " %2s: %-21s | %3s: %-28s | %3s: %22s | %13s", + "##", "#####################", "##", "############################", "##", "######################", "#############" + ); + ReportInformation(mtInfo, buf); + + AVRSubsystem_T refSub = subSubsystemCount; + AVRFunction_E refFnc = fncFunctionCount; + const char *pSubsystemText = NULL, *pFunctionText = NULL, *pValueText = NULL; + for (int i = 0; i < sizeof(MessageTable) / sizeof(MessageTable_T); i++) { + if (refSub != MessageTable[i].subsystem) { + refSub = MessageTable[i].subsystem; + for (int j = 0; j < sizeof(subsysList) / sizeof(ValuePurpose_T); j++) { + if (subsysList[j].value == refSub) { + pSubsystemText = subsysList[j].helpText; + break; + } else { + pSubsystemText = ""; + } + } + } else { + pSubsystemText = ""; + } + if (refFnc != MessageTable[i].function) { + refFnc = MessageTable[i].function; + for (int j = 0; j < sizeof(funcList) / sizeof(ValuePurpose_T); j++) { + if (funcList[j].value == refFnc) { + pFunctionText = funcList[j].helpText; + break; + } else { + pFunctionText = ""; + } + } + } else { + pFunctionText = ""; + } + // @TODO Probably all the enum values must be merged into one big enum list for this to work. + for (int j = 0; j < sizeof(valueList) / sizeof(ValuePurpose_T); j++) { + if (valueList[j].value == MessageTable[i].arg) { + pValueText = valueList[j].helpText; + break; + } else { + pValueText = ""; + } + } + sprintf_s(buf, LONGESTTEXT, "%8d: %-21s | %3d: %-28s | %3d: %-22s | %s", + refSub, pSubsystemText, + refFnc, pFunctionText, + MessageTable[i].arg, pValueText, + MessageToText(MessageTable[i].Message, MessageTable[i].MessageLen) + ); + ReportInformation(mtInfo, buf); + } +}; + + +const char *AVRInterface::MessageToText(const char *p, size_t len) { + static char privateBuffer[LONGESTTEXT] = ""; + char *pOut = privateBuffer; + for (int i = 0; i < len; i++) { + if (isprint(*p)) { + *pOut++ = *p++; + } else { + pOut += sprintf_s(pOut, LONGESTTEXT - strlen(privateBuffer), "[%02X]", *p++); + } + *pOut = '\0'; // keep it null terminated + } + return privateBuffer; +} /// ReportAllStatus /// diff --git a/AVR Working Controller/AVRInterface.h b/AVR Working Controller/AVRInterface.h index f830325..631da40 100644 --- a/AVR Working Controller/AVRInterface.h +++ b/AVR Working Controller/AVRInterface.h @@ -10,6 +10,27 @@ public: ~AVRInterface(); + /// @brief internal operating states of the AVR interface + typedef enum { + stPoweringUp, ///