Major step in the new AVR interface to send commands. It compiles, but is untested. The old code and function remains active.

This commit is contained in:
2026-01-28 17:18:59 -06:00
parent e2829f648d
commit a83bc28a8d
5 changed files with 534 additions and 63 deletions

View File

@@ -261,7 +261,7 @@ unsigned long Hex2Dec(uint8_t *p, int dig);
//void ShowAllStatusInfo(); //void ShowAllStatusInfo();
void GetAndSendCustomMessage(); void GetAndSendCustomMessage();
void GetAndSendOSDMessage();
bool UserWantsToExitCanSniff = false; bool UserWantsToExitCanSniff = false;
DWORD progStartTime_ms; DWORD progStartTime_ms;
@@ -532,7 +532,7 @@ void ProcessWindowsMessage(void) {
} }
} }
#if 0
// EmitBuffer // EmitBuffer
// //
// Emits the provided buffer to the console, translating non-printable // Emits the provided buffer to the console, translating non-printable
@@ -579,6 +579,7 @@ void EmitBuffer(const char *prefix, const uint8_t *buf, size_t len = 0, bool app
//Console_ScrollBottomRegion(); //Console_ScrollBottomRegion();
} }
} }
#endif
#if 0 #if 0
void EchoSerialRecv(const uint8_t *pMsg) { void EchoSerialRecv(const uint8_t *pMsg) {
@@ -838,11 +839,7 @@ void ProcessKeyboard(void) {
avr->Power(AVRInterface::AVROnOff_E::eOff); avr->Power(AVRInterface::AVROnOff_E::eOff);
break; break;
case 'O': case 'O':
avr->ProcessSerialQueue("\x02" "21000" "\x03", 7); GetAndSendOSDMessage();
avr->ProcessSerialQueue("\x02" "3Test" "\x03", 7);
avr->ProcessSerialQueue("\x02" "3 Mes" "\x03", 7);
avr->ProcessSerialQueue("\x02" "3sage" "\x03", 7);
avr->ProcessSerialQueue("\x02" "3 WOW" "\x03", 7);
break; break;
case ':': case ':':
GetAndSendCustomMessage(); GetAndSendCustomMessage();
@@ -902,6 +899,28 @@ void HexUppercase(char *p) {
} }
} }
void GetAndSendOSDMessage() {
char buf[MAXTEXTLEN];
Console_ScrollBottomRegion();
Console_ScrollBottomRegion();
Console_WriteAt(0, -2, "Enter OSD string to send: |________________|\rEnter OSD string to send: |");
gets_s(buf, sizeof(buf));
if (strlen(buf) == 0) {
return;
} else if (strlen(buf) > 16) {
Console_WriteAt(0, -1, " Invalid. String must be 16 chars or less");
Console_ScrollBottomRegion();
} else {
Console_ScrollBottomRegion();
if (avr->AVRSendOSDMessage(buf)) {
// success
} else {
Console_WriteAt(0, -1, " Failed to send OSD message, Invalid chars perhaps.");
Console_ScrollBottomRegion();
}
}
}
void GetAndSendCustomMessage() { void GetAndSendCustomMessage() {
char buf[20]; char buf[20];
char msg[30]; char msg[30];
@@ -916,7 +935,7 @@ void GetAndSendCustomMessage() {
} else { } else {
Console_ScrollBottomRegion(); Console_ScrollBottomRegion();
sprintf_s(msg, sizeof(msg), "\x02%s\x03", buf); sprintf_s(msg, sizeof(msg), "\x02%s\x03", buf);
avr->ProcessSerialQueue(msg, strlen(msg)); avr->ProcessSerialQueue(msg, (uint16_t)strlen(msg));
} }
} }
@@ -974,6 +993,8 @@ void InformationUpdate(AVRInterface::AVRMessageType_T type, const char *msg) {
} }
} }
/******************************************************/ /******************************************************/
/* m a i n ( ) */ /* m a i n ( ) */
/******************************************************/ /******************************************************/

View File

@@ -14,6 +14,10 @@
#define LONGESTTEXT 150 #define LONGESTTEXT 150
using AVRSubsys = AVRInterface::AVRSubsystem_E;
using AVRFunc = AVRInterface::AVRFunction_E;
//using AVRArg = AVRInterface::AVRArgument_U;
typedef enum { typedef enum {
eReady, eReady,
ePowerOn, ePowerOn,
@@ -241,7 +245,9 @@ void AVRInterface::MessageReport(const char *prefix, const void *buf, size_t len
*pTxtAppend = 0; // Keep it null-terminated *pTxtAppend = 0; // Keep it null-terminated
i++; i++;
} else if (*p == '\r') { } else if (*p == '\r') {
(*ReportInformation)(mtInfo, txtBuf); if (ReportInformation) { // Guard it
(*ReportInformation)(mtInfo, txtBuf);
}
txtBuf[0] = 0; // clear it txtBuf[0] = 0; // clear it
} else if (*p == '\n') { } else if (*p == '\n') {
// skip it // skip it
@@ -252,7 +258,9 @@ void AVRInterface::MessageReport(const char *prefix, const void *buf, size_t len
} }
if ((i & 3) == 0) { if ((i & 3) == 0) {
if (strlen(txtBuf) > 100) { if (strlen(txtBuf) > 100) {
(*ReportInformation)(mtInfo, txtBuf); if (ReportInformation) { // Guard it
(*ReportInformation)(mtInfo, txtBuf);
}
sprintf_s(txtBuf, LONGESTTEXT, " "); // new line sprintf_s(txtBuf, LONGESTTEXT, " "); // new line
pTxtAppend = txtBuf + strlen(txtBuf); pTxtAppend = txtBuf + strlen(txtBuf);
} else { } else {
@@ -264,20 +272,26 @@ void AVRInterface::MessageReport(const char *prefix, const void *buf, size_t len
p++; p++;
} }
if (strlen(txtBuf)) { if (strlen(txtBuf)) {
(*ReportInformation)(mtInfo, txtBuf); if (ReportInformation) { // Guard it
(*ReportInformation)(mtInfo, txtBuf);
}
} }
} }
void AVRInterface::Tick(uint32_t now_ms) { void AVRInterface::Tick(uint32_t now_ms) {
if (!bFirstTickInitialized) {
bFirstTickInitialized = true;
firstTick_ms = now_ms;
}
lastTick_ms = now_ms; lastTick_ms = now_ms;
uint32_t elapsed_ms = now_ms - sentAtTime_ms; uint32_t elapsed_ms = now_ms - sentAtTime_ms;
char buf[LONGESTTEXT] = ""; char buf[LONGESTTEXT] = "";
if (oldState != state && ReportInformation) { if (oldState != state && ReportInformation) {
oldState = state;
(*ReportInformation)(mtStatus, StateText[state]); (*ReportInformation)(mtStatus, StateText[state]);
} }
oldState = state;
switch (state) { switch (state) {
default: default:
case AVRState_T::stPoweringUp: case AVRState_T::stPoweringUp:
@@ -433,15 +447,11 @@ bool AVRInterface::Power(AVROnOff_E cmd) {
return true; return true;
} }
bool AVRInterface::VolumeButton(AVRVolume_E cmd) { bool AVRInterface::VolumeButton(AVRUpDown_E cmd) {
switch (cmd) { switch (cmd) {
case eVolumeUp: case eUp:
break; break;
case eVolumeDown: case eDown:
break;
case eMuteOn:
break;
case eMuteOff:
break; break;
default: default:
return false; return false;
@@ -451,7 +461,36 @@ bool AVRInterface::VolumeButton(AVRVolume_E cmd) {
bool AVRInterface::RegisterInformationCallback(void(*StatusChangeCallback)(AVRMessageType_T type, const char *msg)) { bool AVRInterface::RegisterInformationCallback(void(*StatusChangeCallback)(AVRMessageType_T type, const char *msg)) {
ReportInformation = StatusChangeCallback; ReportInformation = StatusChangeCallback;
return false; return true;
}
bool AVRInterface::AVRSendOSDMessage(const char *pMsg) {
const char valid[] = " !#%&()*+,-.0123456789:<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_abcdefghijklmnopqrstuvwxyz";
char buf[17] = { 0 };
if (strlen(pMsg) <= 16) {
for (size_t i = 0; i < 16; i++) {
if (*pMsg == '\0') {
buf[i] = ' ';
} else if (strchr(valid, *pMsg)) {
buf[i] = *pMsg++;
} else {
return false; // Invalid character
}
}
ProcessSerialQueue("\x02" "21000" "\x03", 7); // Start the OSD message
char msg[8];
for (int i = 0; i < 16; i += 4) {
strcpy_s(msg, sizeof(msg), "\x02"); // Each chunk
strcat_s(msg, sizeof(msg), "3");
strncat_s(msg, sizeof(msg), &buf[i], 4);
strcat_s(msg, sizeof(msg), "\x03");
ProcessSerialQueue(msg, 7);
}
return true;
} else {
return false;
}
} }
bool AVRInterface::ProcessSerialQueue(const void *msg, uint16_t len) { bool AVRInterface::ProcessSerialQueue(const void *msg, uint16_t len) {
@@ -561,8 +600,10 @@ bool AVRInterface::ProcessReportResponse(const uint8_t *szBuffer, uint32_t len)
memcpy(&avrStatus.config.DT0 + MessageHandlers[i].configOffset, &szBuffer[5], 2); memcpy(&avrStatus.config.DT0 + MessageHandlers[i].configOffset, &szBuffer[5], 2);
} }
if (MessageHandlers[i].TextFormatter && MessageHandlers[i].fncValueToText) { if (MessageHandlers[i].TextFormatter && MessageHandlers[i].fncValueToText) {
sprintf_s(buf, LONGESTTEXT, MessageHandlers[i].TextFormatter, MessageHandlers[i].fncValueToText(rdat)); if (ReportInformation) { // Guard it
(*ReportInformation)(mtInfo, buf); sprintf_s(buf, LONGESTTEXT, MessageHandlers[i].TextFormatter, MessageHandlers[i].fncValueToText(rdat));
(*ReportInformation)(mtInfo, buf);
}
} }
if (MessageHandlers[i].showAll) { if (MessageHandlers[i].showAll) {
showAllFlag = true; // ShowAllStatusInfo(); showAllFlag = true; // ShowAllStatusInfo();
@@ -570,7 +611,7 @@ bool AVRInterface::ProcessReportResponse(const uint8_t *szBuffer, uint32_t len)
break; // no need to scan more break; // no need to scan more
} }
} }
if (!found) { if (!found && ReportInformation) {
sprintf_s(buf, LONGESTTEXT, "***** type: %X, guard: %X, cmd: %02X, data: %02X", type, guard, rcmd, rdat); sprintf_s(buf, LONGESTTEXT, "***** type: %X, guard: %X, cmd: %02X, data: %02X", type, guard, rcmd, rdat);
(*ReportInformation)(mtInfo, buf); (*ReportInformation)(mtInfo, buf);
//Console_Write(buf); //Console_Write(buf);
@@ -637,16 +678,267 @@ void AVRInterface::PCMessage(const char *msg, int len, uint8_t **src, const char
msg, msg,
p p
); );
(*ReportInformation)(mtStream, outBuf); if (ReportInformation) { // Guard it
(*ReportInformation)(mtStream, outBuf);
}
} }
typedef const struct {
AVRInterface::AVRSubsystem_E subsystem;
AVRInterface::AVRFunction_E function;
AVRInterface::AVRArg_T arg;
const char *Message;
uint16_t MessageLen;
// Helper?
} 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 },
};
bool AVRInterface::AVRCommand(AVRInterface::AVRSubsystem_E subsystem,
AVRInterface::AVRFunction_E function,
AVRArg_T arg) {
bool found = false;
for (int i = 0; i < sizeof(MessageTable) / sizeof(MessageTable_T); i++) {
if (MessageTable[i].subsystem == subsystem && MessageTable[i].function == function and MessageTable[i].arg == arg) {
found = true;
ProcessSerialQueue(MessageTable[i].Message, MessageTable[i].MessageLen);
break;
}
}
if (!found) {
// then what?
}
return true;
}
/// ReportAllStatus /// ReportAllStatus
/// ///
/// This emits (via a callback) all the status, in DT0 to DT137 order. /// This emits (via a callback) all the status, in DT0 to DT137 order.
/// You cannot rearrange the sequence to make grouping more logical. /// You cannot rearrange the sequence to make grouping more logical.
/// ///
void AVRInterface::ReportAllStatus() { void AVRInterface::ReportAllStatus() {
if (avrStatus.headerValid) { if (avrStatus.headerValid && ReportInformation) {
char buf[LONGESTTEXT]; char buf[LONGESTTEXT];
sprintf_s(buf, LONGESTTEXT, "Model ID: %c%c%c%c%c, ver: %c\n", avrStatus.header.type[0], avrStatus.header.type[1], sprintf_s(buf, LONGESTTEXT, "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.type[2], avrStatus.header.type[3], avrStatus.header.type[4],

View File

@@ -46,11 +46,14 @@ public:
} AVROnOff_E; } AVROnOff_E;
typedef enum { typedef enum {
eVolumeUp, eUp,
eVolumeDown, eDown,
} AVRUpDown_E;
typedef enum {
eMuteOn, eMuteOn,
eMuteOff eMuteOff
} AVRVolume_E; } AVRMute_E;
typedef enum { typedef enum {
eOSDOff, eOSDOff,
@@ -89,7 +92,9 @@ public:
e3, e3,
e4, e4,
e5, e5,
e6, e7, e8 e6,
e7,
e8
} AVRPresetNum_E; } AVRPresetNum_E;
typedef enum { typedef enum {
@@ -99,7 +104,7 @@ public:
eD, eD,
eE, eE,
eF eF
} AVR_PresetPage_E; } AVRPresetPage_E;
typedef enum { typedef enum {
ePhono, ePhono,
@@ -118,51 +123,213 @@ public:
} AVRInput_E; } AVRInput_E;
typedef enum { typedef enum {
cmdZone1, eMain,
cmdZone2, eZone1,
cmdZone3, eZone2,
cmdSpeakerSetB, eZone3,
cmdNightMode, eZoneOR
cmdTrigControl1,
cmdTrigControl2
} AVRSubsystem_E; } AVRSubsystem_E;
typedef enum {
Hall_A,
Hall_B,
Hall_C,
Hall_USA,
Hall_E,
Live_Concert,
Tokyo,
Freiburg,
Royaumont,
Village_Gate,
Village_Vanguard,
The_Bottom_Line,
The_Roxy_Theater,
Warehouse_Loft,
Arena,
Disco,
Party,
Game,
Stereo_6_8Ch,
Pop_Rock,
DJ,
Opera,
Pavillion,
Mono_Movie,
Variety_Sports,
Spectacre,
Sci_Fi,
Adventure,
General,
Normal,
Enhanced,
PLII_Movie,
PLII_Music,
Neo_6_Movie,
Neo_6_Music,
Direct_2Ch,
Stereo_2Ch,
THX_Ultra_PL,
THX_Music,
THX_Ultra_PL2,
THX_Ultra_NEO6
} AVRDSPProg_E;
typedef enum {
eInpAuto,
eDD_RF,
eDTS,
eDigital,
eAnalog,
eAAC
} AVRInputMode_E;
typedef enum {
eDualMain,
eDualSub,
eDualAll
} AVRDualMono_E;
typedef enum {
fncPower,
fncVolume,
fncMute,
fncVolumeMemory,
fncVolumeRecall,
fncSpeakerAOnOff,
fncSpeakerBOnOff,
fncSpeakerBZone,
fncZone2SpeakerOnOff,
fncNightModeOnOff,
fncEffect,
fncInput,
fncRadioBand,
fncRadioTune,
fncRadioPresetPage,
fncRadioPresetNumber,
fncRadioPresetMemory,
fncRadioPresetRecall,
fncDSPProgram,
fncSleep,
fncOSD,
fnc6ChInput,
fncEx_EsOnOff,
fncInputMode,
fncDualMono,
fncDC1TrigControl,
fncDC2TrigControl,
fncDC1OnOff,
fncDC2OnOff,
} AVRFunction_E;
typedef union {
AVROnOff_E onOff;
AVRUpDown_E volume;
AVRMute_E mute;
AVRPresetPage_E volumeMemory;
AVRPresetPage_E volumeRecall;
AVROnOff_E speakerA;
AVROnOff_E speakerB;
AVRSubsystem_E speakerBZone;
AVROnOff_E zone2Speaker;
AVROnOff_E nightMode;
AVRInput_E input;
AVRTunerBand_E band;
AVRUpDown_E tune;
AVRPresetPage_E presetPage;
AVRPresetNum_E presetNumber;
AVRPresetPage_E presetMemory;
AVRPresetPage_E presetRecall;
AVRDSPProg_E program;
AVRSleep_E sleep;
AVROSDScreen_E osd;
AVROnOff_E sixChInput;
AVREX_ES_E ex_es;
AVRInputMode_E inputMode;
AVRDualMono_E dualMono;
AVRSubsystem_E dc1TrigControl;
AVRSubsystem_E dc2TrigControl;
AVROnOff_E dc1OnOff;
AVROnOff_E dc2OnOff;
char *pMessage;
} AVRArgument_UX;
typedef uint32_t AVRArg_T;
/// @brief The single command path to control the AVR
///
/// This lets you send a command to the AVR using this single interface, by choosing
/// the AVR Subsystem of interest, the Function of interest, and passing an argument.
///
/// @param[in] subsystem: Main | Zone 1 | Zone 2 | Zone 3
/// @param[in] function : Power, Speaker, Volume, etc.
/// @param[in] arg: on/off, etc.
/// @return
bool AVRCommand(AVRInterface::AVRSubsystem_E subsystem,
AVRInterface::AVRFunction_E function,
AVRArg_T arg);
/// @brief Send the power command /// @brief Send the power command
/// @param cmd /// @param cmd
/// @return true /// @return true
/// ///
bool Power(AVROnOff_E cmd); bool Power(AVROnOff_E cmd);
bool VolumeButton(AVRUpDown_E cmd);
bool VolumeButton(AVRVolume_E cmd); /// @brief AVRMessageType_T
///
/// Indicates the type of message being sent to the status change callback
///
typedef enum { typedef enum {
mtModelInfo, mtModelInfo, ///<! Model information
mtStatus, // Special State machine status mtStatus, ///<! Special State machine status (possibly useful in a dedicate place on the UI)
mtInfo, // General purpose information mtInfo, ///<! General purpose information (chunks of information that might be useful in a small scroll region)
mtStreamStart, // Stream start mtStreamStart, ///<! Stream start of the status, each chunk is a generally a same-length string, totaling 100s of bytes.
mtStream, // Status stream that word-wraps... mtStream, ///<! Status stream that word-wraps...
} AVRMessageType_T; } AVRMessageType_T;
/// @brief StatusChangeCallback
///
/// This is the function prototype for the status change callback from the AVR interface.
/// This can be used to interpret, or more commonly to display, various types of status information.
///
/// @param[in] type is the type of message being sent
/// @param[in] msg is the text message
///
typedef void (*StatusChangeCallback)(AVRMessageType_T type, const char *msg);
/// @brief allows the host to register a callback for status changes /// @brief allows the host to register a callback for status changes
/// ///
/// the callback information is text /// the callback information is always text
/// ///
/// @param StatusChangeCallback /// @param[in] cb is the callback function, or register NULL to unregister
/// @return /// @return true always
bool RegisterInformationCallback(void (*StatusChangeCallback)(AVRMessageType_T type, const char * msg)); ///
bool RegisterInformationCallback(StatusChangeCallback cb);
/// @brief This will loop through the DT array and report the status of everything /// ReportAllStatus
///
/// @brief This will loop through the DT array and report the status of everything via the registered callback
/// ///
void ReportAllStatus(); void ReportAllStatus();
/// ProcessSerialQueue
///
/// @brief This is public to start, maybe forever because it offers the generic capability /// @brief This is public to start, maybe forever because it offers the generic capability
/// @param p the message to send /// @param[in] p the message to send
/// @param len of the message /// @param[in] len of the message
/// @return true /// @return true
///
bool ProcessSerialQueue(const void *p = NULL, uint16_t len = NULL); bool ProcessSerialQueue(const void *p = NULL, uint16_t len = NULL);
/// AVRSendOSDMessage
///
/// @brief Send a text message to the AVR for display on the connected TV
/// @param[in] msg is a text string, which must not exceed 16 characters in length, is null terminated
/// and is restricted to the following characters:
/// " !#%&()*+,-.0123456789:<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_abcdefghijklmnopqrstuvwxyz"
/// @return true if the message was accepted for sending, false if it is too long or has invalid characters.
///
bool AVRSendOSDMessage(const char *msg);
private: private:
uint32_t sentAtTime_ms; uint32_t sentAtTime_ms;
@@ -365,6 +532,7 @@ private:
SerialQueue_T serialQueue[SERIALQUEUESIZE]; SerialQueue_T serialQueue[SERIALQUEUESIZE];
int serialQueueCount = 0; int serialQueueCount = 0;
bool bFirstTickInitialized;
uint32_t firstTick_ms; // basically the time when the program started uint32_t firstTick_ms; // basically the time when the program started
uint32_t lastTick_ms; // @TODO instead of this, offer a way for the class to get the current time uint32_t lastTick_ms; // @TODO instead of this, offer a way for the class to get the current time

View File

@@ -35,16 +35,6 @@ void Console_Init(short Width, short Height, short bottomScrollHeight) {
newSize.X = consoleWidth; // columns newSize.X = consoleWidth; // columns
newSize.Y = consoleHeight; // rows newSize.Y = consoleHeight; // rows
// Step 1: Shrink window if needed before shrinking buffer
SMALL_RECT tempWindow = csbi.srWindow;
tempWindow.Right = tempWindow.Left + (newSize.X - 1);
tempWindow.Bottom = tempWindow.Top + (newSize.Y - 1);
if (!SetConsoleWindowInfo(hStdout, TRUE, &tempWindow)) {
fprintf(stderr, "Error: Unable to temporarily resize window. Code: %lu\n", GetLastError());
exit(1);
}
// Step 2: Set new buffer size // Step 2: Set new buffer size
if (!SetConsoleScreenBufferSize(hStdout, newSize)) { if (!SetConsoleScreenBufferSize(hStdout, newSize)) {
fprintf(stderr, "Error: Unable to set console buffer size. Code: %lu\n", GetLastError()); fprintf(stderr, "Error: Unable to set console buffer size. Code: %lu\n", GetLastError());