Add the low level driver.
This commit is contained in:
808
AVR Working Controller/AVRDriver.cpp
Normal file
808
AVR Working Controller/AVRDriver.cpp
Normal file
@@ -0,0 +1,808 @@
|
|||||||
|
#include <memory.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "AVRDriver.h"
|
||||||
|
|
||||||
|
#define LONGESTTEXT 160
|
||||||
|
|
||||||
|
// SendToRS232 (SendCallBack)
|
||||||
|
// <------------------------------------------------------+<---------+
|
||||||
|
// A A
|
||||||
|
// Notifications (NotifyCallBack) | |
|
||||||
|
// <------------------------------------------------+ | |
|
||||||
|
// A | |
|
||||||
|
// +----------------------+ | | |
|
||||||
|
// -------------->| ::AVRDriver | | | |
|
||||||
|
// | (*NotifyCallBack) | | | |
|
||||||
|
// | (*SendCallBack) | | | |
|
||||||
|
// +----------------------+ | | |
|
||||||
|
// | | |
|
||||||
|
// +----------------------+ +-----------------+ |
|
||||||
|
// ------------->| Tick |-->| | |
|
||||||
|
// | | | | |
|
||||||
|
// +----------------------+ | internal | |
|
||||||
|
// | logic | |
|
||||||
|
// Rx RS-232 msg +----------------------+ | | |
|
||||||
|
// ------------->| HandleMessage() |-->| | |
|
||||||
|
// | | | | |
|
||||||
|
// +----------------------+ | | |
|
||||||
|
// | | |
|
||||||
|
// Cmd to AVR +----------------------+ | | |
|
||||||
|
// ------------->| AVRCommand(subsys, |-->| | |
|
||||||
|
// | func,cmd,arg) | | | |
|
||||||
|
// +----------------------+ +-----------------+ |
|
||||||
|
// |
|
||||||
|
// +----------------------+ | | |
|
||||||
|
// ------------->| SendOSDMessage() |-->| | |
|
||||||
|
// | | | | |
|
||||||
|
// +----------------------+ +-----------------+ |
|
||||||
|
// |
|
||||||
|
// +----------------------+ |
|
||||||
|
// ------------->| SendMessageToSerial()|-------------------------->+
|
||||||
|
// | Raw Message Send |
|
||||||
|
// +----------------------+
|
||||||
|
//
|
||||||
|
|
||||||
|
AVRDriver::AVRDriver(
|
||||||
|
NotifyCallBack notifyCB, ///<! used to notify of internal events
|
||||||
|
SendCallBack sendCB ///<! used to send to the RS-232 interface
|
||||||
|
) {
|
||||||
|
NotifyHost = notifyCB;
|
||||||
|
RS232Send = sendCB;
|
||||||
|
state = stPoweringUp;
|
||||||
|
}
|
||||||
|
|
||||||
|
AVRDriver::~AVRDriver() {
|
||||||
|
FreeSendQueue();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t AVRDriver::GetTick() {
|
||||||
|
return lastTick_ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
AVRDriver::AVRState_T AVRDriver::Tick(uint32_t now_ms) {
|
||||||
|
if (!bFirstTickInitialized) {
|
||||||
|
bFirstTickInitialized = true;
|
||||||
|
firstTick_ms = now_ms;
|
||||||
|
}
|
||||||
|
lastTick_ms = now_ms;
|
||||||
|
uint32_t elapsed_ms = now_ms - sentAtTime_ms;
|
||||||
|
char buf[LONGESTTEXT] = "";
|
||||||
|
|
||||||
|
if (oldState != state) {
|
||||||
|
(*NotifyHost)(mtState, NULL, state);
|
||||||
|
}
|
||||||
|
oldState = state;
|
||||||
|
switch (state) {
|
||||||
|
default:
|
||||||
|
case AVRState_T::stPoweringUp:
|
||||||
|
readyResponsReceived = false;
|
||||||
|
AVRCommand(sysCommand, fncReady, eOn);
|
||||||
|
sentAtTime_ms = now_ms;
|
||||||
|
readyTries++;
|
||||||
|
state = stAwaitingReadyResponse;
|
||||||
|
break;
|
||||||
|
case stAwaitingReadyResponse:
|
||||||
|
if (readyResponsReceived) {
|
||||||
|
state = stReady;
|
||||||
|
} else if (elapsed_ms > RETRY_INTERVAL_ms) {
|
||||||
|
if (readyTries > MAXTRIES) {
|
||||||
|
// fail
|
||||||
|
state = stFailed;
|
||||||
|
} else {
|
||||||
|
state = stPoweringUp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case AVRState_T::stInitializing:
|
||||||
|
break;
|
||||||
|
case AVRState_T::stRetryInitializing:
|
||||||
|
break;
|
||||||
|
case AVRState_T::stAwaitingResponse:
|
||||||
|
if (commandResponseReceived) {
|
||||||
|
state = stReady;
|
||||||
|
} else if (elapsed_ms > RETRY_INTERVAL_ms) {
|
||||||
|
SendMessageToSerial();
|
||||||
|
state = stAwaitingResponse;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case AVRState_T::stReady:
|
||||||
|
SendMessageToSerial();
|
||||||
|
break;
|
||||||
|
case AVRState_T::stFailed:
|
||||||
|
(*NotifyHost)(mtFailed, "State = Failed", 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_t rCmd;
|
||||||
|
uint8_t configOffset; // offset into the Config DT0 - DT155 array, or 0xFF for no action
|
||||||
|
uint8_t numToTransfer; // number of bytes to transfer into the Config array, or 0 for no action
|
||||||
|
bool showAll; // true to call ShowAllStatusInfo after processing
|
||||||
|
} MessageHandler_T;
|
||||||
|
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
static const MessageHandler_T MessageHandler[] = {
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// | | | |
|
||||||
|
// | | | |
|
||||||
|
// | | | |
|
||||||
|
// | | | |
|
||||||
|
{ 0x00, 7, 1, 1 },
|
||||||
|
{ 0x01, 0, 0, 0 },
|
||||||
|
{ 0x10, 31, 1, 1 },
|
||||||
|
{ 0x11, 32, 1, 1 },
|
||||||
|
{ 0x12, 33, 1, 1 },
|
||||||
|
{ 0x13, 34, 1, 1 },
|
||||||
|
{ 0x14, 35, 1, 1 },
|
||||||
|
{ 0x15, 38, 1, 1 },
|
||||||
|
{ 0x16, 43, 1, 1 },
|
||||||
|
{ 0x20, 8, 0, 1 },
|
||||||
|
{ 0x21, 9, 1, 1 },
|
||||||
|
{ 0x22, 11, 1, 1 },
|
||||||
|
{ 0x23, 12, 1, 1 },
|
||||||
|
{ 0x24, 13, 1, 1 },
|
||||||
|
{ 0x25, 14, 1, 1 },
|
||||||
|
{ 0x26, 15, 2, 1 },
|
||||||
|
{ 0x27, 17, 2, 1 },
|
||||||
|
{ 0x28, 19, 2, 1 },
|
||||||
|
{ 0x29, 25, 1, 1 },
|
||||||
|
{ 0x2A, 26, 1, 1 },
|
||||||
|
{ 0x2B, 23, 1, 1 },
|
||||||
|
{ 0x2C, 24, 1, 1 },
|
||||||
|
{ 0x2D, 22, 1, 1 },
|
||||||
|
{ 0x2E, 29, 1, 1 },
|
||||||
|
{ 0x2F, 30, 1, 1 },
|
||||||
|
{ 0x30, 0, 0, 0 },
|
||||||
|
{ 0x31, 0, 0, 0 },
|
||||||
|
{ 0x32, 0, 0, 0 },
|
||||||
|
{ 0x33, 0, 0, 0 },
|
||||||
|
{ 0x34, 36, 1, 1 },
|
||||||
|
{ 0x35, 37, 1, 1 },
|
||||||
|
{ 0x36, 39, 1, 1 },
|
||||||
|
{ 0x37, 0, 0, 0 },
|
||||||
|
{ 0x38, 0, 0, 0 },
|
||||||
|
{ 0x39, 0, 0, 0 },
|
||||||
|
{ 0x3A, 42, 1, 1 },
|
||||||
|
{ 0x3B, 44, 1, 1 },
|
||||||
|
{ 0x3C, 45, 1, 1 },
|
||||||
|
{ 0x3D, 104, 0, 0 },
|
||||||
|
{ 0x3E, 46, 1, 1 },
|
||||||
|
{ 0x3F, 47, 1, 1 },
|
||||||
|
|
||||||
|
{ 0x40, 48, 2, 1 },
|
||||||
|
{ 0x41, 50, 2, 1 },
|
||||||
|
{ 0x42, 52, 2, 1 },
|
||||||
|
{ 0x43, 54, 2, 1 },
|
||||||
|
{ 0x44, 56, 2, 1 },
|
||||||
|
{ 0x45, 58, 2, 1 },
|
||||||
|
{ 0x46, 60, 2, 1 },
|
||||||
|
{ 0x47, 62, 2, 1 },
|
||||||
|
{ 0x48, 64, 2, 1 },
|
||||||
|
{ 0x49, 66, 2, 1 },
|
||||||
|
{ 0x4A, 0, 0, 0 },
|
||||||
|
|
||||||
|
{ 0x50, 0, 0, 0 },
|
||||||
|
{ 0x51, 74, 2, 1 },
|
||||||
|
{ 0x52, 76, 2, 1 },
|
||||||
|
{ 0x53, 78, 2, 1 },
|
||||||
|
{ 0x54, 0, 0, 0 },
|
||||||
|
{ 0x55, 0, 0, 0 },
|
||||||
|
|
||||||
|
{ 0x60, 84, 1, 1 },
|
||||||
|
{ 0x61, 85, 1, 1 },
|
||||||
|
{ 0x62, 87, 2, 1 },
|
||||||
|
{ 0x63, 89, 1, 1 },
|
||||||
|
{ 0x64, 91, 1, 1 },
|
||||||
|
{ 0x65, 92, 1, 1 },
|
||||||
|
{ 0x66, 93, 0, 0 },
|
||||||
|
{ 0x67, 0, 0, 0 },
|
||||||
|
{ 0x68, 95, 1, 1 },
|
||||||
|
{ 0x69, 90, 1, 1 },
|
||||||
|
{ 0x6A, 136, 1, 1 },
|
||||||
|
{ 0x6B, 0, 0, 0 },
|
||||||
|
{ 0x70, 96, 1, 1 },
|
||||||
|
{ 0x71, 97, 1, 1 },
|
||||||
|
{ 0x72, 98, 1, 1 },
|
||||||
|
{ 0x73, 99, 1, 1 },
|
||||||
|
{ 0x74, 100, 1, 1 },
|
||||||
|
{ 0x75, 101, 1, 1 },
|
||||||
|
{ 0x76, 134, 1, 1 },
|
||||||
|
|
||||||
|
{ 0x78, 102, 1, 1 },
|
||||||
|
{ 0x79, 103, 1, 1 },
|
||||||
|
{ 0x7A, 133, 1, 1 },
|
||||||
|
{ 0x7B, 0, 0, 0 },
|
||||||
|
{ 0x7E, 135, 1, 1 },
|
||||||
|
|
||||||
|
{ 0x80, 105, 1, 1 },
|
||||||
|
{ 0x81, 0, 0, 0 },
|
||||||
|
{ 0x82, 27, 1, 1 },
|
||||||
|
|
||||||
|
{ 0x90, 0, 0, 0 },
|
||||||
|
{ 0x91, 0, 0, 0 },
|
||||||
|
{ 0x92, 0, 0, 0 },
|
||||||
|
{ 0x93, 0, 0, 0 },
|
||||||
|
{ 0x94, 0, 0, 0 },
|
||||||
|
{ 0x95, 0, 0, 0 },
|
||||||
|
{ 0x96, 0, 0, 0 },
|
||||||
|
{ 0x97, 0, 0, 0 },
|
||||||
|
{ 0x98, 0, 0, 0 },
|
||||||
|
{ 0x99, 0, 0, 0 },
|
||||||
|
{ 0x9A, 0, 0, 0 },
|
||||||
|
|
||||||
|
{ 0xA1, 0, 0, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t AVRDriver::ProcessResponse(const uint8_t *buffer, uint16_t len) {
|
||||||
|
const uint8_t *p = buffer;
|
||||||
|
uint8_t offsetChanged = 0;
|
||||||
|
(void)len;
|
||||||
|
//char buf[LONGESTTEXT];
|
||||||
|
|
||||||
|
|
||||||
|
//uint8_t type = (uint8_t)Hex2Dec(p + 1, 1);
|
||||||
|
//uint8_t guard = (uint8_t)Hex2Dec(p + 2, 1);
|
||||||
|
uint8_t rcmd = (uint8_t)Hex2Dec(p + 3, 2);
|
||||||
|
//uint8_t rdat = (uint8_t)Hex2Dec(p + 5, 2);
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
for (int i = 0; i < sizeof(MessageHandler) / sizeof(MessageHandler[0]); i++) {
|
||||||
|
if (MessageHandler[i].rCmd == rcmd) {
|
||||||
|
found = true;
|
||||||
|
if (MessageHandler[i].numToTransfer == 1) {
|
||||||
|
memcpy(&avrStatus.config.DT0 + MessageHandler[i].configOffset, p + 6, 1);
|
||||||
|
}
|
||||||
|
if (MessageHandler[i].numToTransfer == 2) {
|
||||||
|
memcpy(&avrStatus.config.DT0 + MessageHandler[i].configOffset, p + 5, 2);
|
||||||
|
}
|
||||||
|
offsetChanged = MessageHandler[i].configOffset;
|
||||||
|
break; // no need to scan more
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//if (!found && NotifyHost) {
|
||||||
|
// sprintf_s(buf, LONGESTTEXT, "***** type: %X, guard: %X, cmd: %02X, data: %02X", type, guard, rcmd, rdat);
|
||||||
|
// (*NotifyHost)(mtInfo, buf, (uint32_t)strlen(buf));
|
||||||
|
//}
|
||||||
|
return offsetChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Given a response string, typically of the form:
|
||||||
|
/// [02] .... [03] // Command Responses from the AVR
|
||||||
|
/// [11] .... [03] // Commands to
|
||||||
|
/// [12] .... [03]
|
||||||
|
/// [14] ............ [03]
|
||||||
|
///
|
||||||
|
/// @param buffer contains the message
|
||||||
|
/// @param len of the message
|
||||||
|
/// @return 0 if none, or the index into the main status array that was updated
|
||||||
|
///
|
||||||
|
uint8_t AVRDriver::HandleMessage(const uint8_t *buffer, uint16_t len) {
|
||||||
|
uint8_t offsetChanged = 0;
|
||||||
|
|
||||||
|
(*NotifyHost)(mtRcvdMsg, buffer, len);
|
||||||
|
switch (state) {
|
||||||
|
case stAwaitingReadyResponse:
|
||||||
|
switch (buffer[0]) {
|
||||||
|
case 0x02: // STX <msg> ETX
|
||||||
|
commandResponseReceived = true;
|
||||||
|
(*NotifyHost)(mtStatusMsg, buffer, len);
|
||||||
|
break;
|
||||||
|
case 0x11: // DC1 <msg> ETX
|
||||||
|
// AVR does not send any DC1 messages, these are for commands to the AVR
|
||||||
|
break;
|
||||||
|
case 0x12: // DC2 <msg> ETX
|
||||||
|
if (CheckTheChecksum(buffer, len)) {
|
||||||
|
if (len == 21) { // Short message when power is off
|
||||||
|
memcpy(&avrStatus.header, &buffer[1], sizeof(AVR_StatusHeader_T));
|
||||||
|
len = Hex2Dec(&avrStatus.header.length[0], 2);
|
||||||
|
memcpy(&avrStatus.config.DT0, &buffer[9], len); // Copy bits of the config
|
||||||
|
avrStatus.headerValid = true;
|
||||||
|
offsetChanged = 0xFF; // @TODO Bad hack for 'everything' changed
|
||||||
|
} else if (len == 150) { // Long message when power is on
|
||||||
|
memcpy(&avrStatus.header, &buffer[1], sizeof(AVR_StatusHeader_T));
|
||||||
|
len = Hex2Dec(&avrStatus.header.length[0], 2);
|
||||||
|
memcpy(&avrStatus.config.DT0, &buffer[9], len); // Copy the config
|
||||||
|
avrStatus.headerValid = true;
|
||||||
|
avrStatus.configValid = true;
|
||||||
|
offsetChanged = 0xFF; // @TODO Bad hack for 'everything' changed
|
||||||
|
} else {
|
||||||
|
(*NotifyHost)(mtErrRxLength, NULL, len);
|
||||||
|
}
|
||||||
|
readyResponsReceived = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x14: // DC4 <extended response> ETX
|
||||||
|
// DecodeExtendedResponse(buffer, len); // once I figure out what is in here...
|
||||||
|
(*NotifyHost)(mtExtendedResp, buffer, len);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case stAwaitingResponse:
|
||||||
|
offsetChanged = ProcessResponse(buffer, len);
|
||||||
|
commandResponseReceived = true;
|
||||||
|
(*NotifyHost)(mtParamUpdated, NULL, offsetChanged);
|
||||||
|
break;
|
||||||
|
case stReady:
|
||||||
|
switch (buffer[0]) {
|
||||||
|
case 0x02: // STX <msg> ETX
|
||||||
|
offsetChanged = ProcessResponse(buffer, len);
|
||||||
|
commandResponseReceived = true;
|
||||||
|
(*NotifyHost)(mtParamUpdated, NULL, offsetChanged);
|
||||||
|
break;
|
||||||
|
case 0x11: // DC1 <msg> ETX
|
||||||
|
break;
|
||||||
|
case 0x12: // DC2 <msg> ETX
|
||||||
|
if (CheckTheChecksum(buffer, len)) {
|
||||||
|
if (len == 21) { // Short message when power is off
|
||||||
|
memcpy(&avrStatus.header, &buffer[1], sizeof(AVR_StatusHeader_T));
|
||||||
|
len = Hex2Dec(&avrStatus.header.length[0], 2);
|
||||||
|
memcpy(&avrStatus.config.DT0, &buffer[9], len); // Copy bits of the config
|
||||||
|
avrStatus.headerValid = true;
|
||||||
|
offsetChanged = 0xFF; // @TODO Bad hack for 'everything' changed
|
||||||
|
} else if (len == 150) { // Long message when power is on
|
||||||
|
memcpy(&avrStatus.header, &buffer[1], sizeof(AVR_StatusHeader_T));
|
||||||
|
len = Hex2Dec(&avrStatus.header.length[0], 2);
|
||||||
|
memcpy(&avrStatus.config.DT0, &buffer[9], len); // Copy the config
|
||||||
|
avrStatus.headerValid = true;
|
||||||
|
avrStatus.configValid = true;
|
||||||
|
offsetChanged = 0xFF; // @TODO Bad hack for 'everything' changed
|
||||||
|
} else {
|
||||||
|
(*NotifyHost)(mtErrRxLength, NULL, len);
|
||||||
|
}
|
||||||
|
readyResponsReceived = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x14: // DC4 <extended response> ETX
|
||||||
|
// DecodeExtendedResponse(buffer, len); // once I figure out what is in here...
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return offsetChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool AVRDriver::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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SendMessageToSerial("\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");
|
||||||
|
SendMessageToSerial(msg, 7);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool AVRDriver::SendMessageToSerial(const void *msg, uint16_t len) {
|
||||||
|
const char *p = (const char *)msg;
|
||||||
|
bool retVal = false; // assume fail
|
||||||
|
static bool freshData = false;
|
||||||
|
|
||||||
|
if (p && len) {
|
||||||
|
if (serialQueueCount < SERIALQUEUESIZE) {
|
||||||
|
(*NotifyHost)(mtXmtdMsg, msg, len);
|
||||||
|
serialQueue[serialQueueCount].messageToSend = (uint8_t *)malloc(len + 1);
|
||||||
|
if (serialQueue[serialQueueCount].messageToSend) {
|
||||||
|
memcpy(serialQueue[serialQueueCount].messageToSend, p, len);
|
||||||
|
*(serialQueue[serialQueueCount].messageToSend + len) = '\0';
|
||||||
|
serialQueue[serialQueueCount].len = len;
|
||||||
|
serialQueueCount++;
|
||||||
|
retVal = true;
|
||||||
|
freshData = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (serialQueueCount) {
|
||||||
|
if ((*RS232Send)((const uint8_t *)serialQueue[0].messageToSend, serialQueue[0].len)) {
|
||||||
|
--serialQueueCount;
|
||||||
|
free(serialQueue[0].messageToSend);
|
||||||
|
serialQueue[0].messageToSend = NULL;
|
||||||
|
for (int i = 0; i < serialQueueCount; i++) {
|
||||||
|
serialQueue[i] = serialQueue[i + 1];
|
||||||
|
}
|
||||||
|
retVal = true;
|
||||||
|
}
|
||||||
|
state = stAwaitingResponse;
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MessageTable_T MessageTable[] = {
|
||||||
|
// System Commands
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncReady, AVRArg_T::eOn, "\x11" "000" "\x03", 5 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncReportEnable, AVRArg_T::eOn, "\x02" "20000" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncReportEnable, AVRArg_T::eOff, "\x02" "20001" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncReportDelay, AVRArg_T::e0ms, "\x02" "20100" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncReportDelay, AVRArg_T::e50ms, "\x02" "20101" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncReportDelay, AVRArg_T::e100ms, "\x02" "20102" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncReportDelay, AVRArg_T::e150ms, "\x02" "20103" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncReportDelay, AVRArg_T::e200ms, "\x02" "20104" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncReportDelay, AVRArg_T::e250ms, "\x02" "20105" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncReportDelay, AVRArg_T::e300ms, "\x02" "20106" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncReportDelay, AVRArg_T::e350ms, "\x02" "20107" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncReportDelay, AVRArg_T::e400ms, "\x02" "20108" "\x03", 7 },
|
||||||
|
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncRequest, AVRArg_T::eTuningFreq, "\x02" "22000" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncRequest, AVRArg_T::eMainVolDB, "\x02" "22001" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncRequest, AVRArg_T::eZone2VolDB, "\x02" "22002" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncRequest, AVRArg_T::eInputName, "\x02" "22003" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncRequest, AVRArg_T::eZone2InputName, "\x02" "22004" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncRequest, AVRArg_T::eZoneXVolDB, "\x02" "22005" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncRequest, AVRArg_T::eZoneXInputName, "\x02" "22006" "\x03", 7 },
|
||||||
|
|
||||||
|
// System Commands with variable data
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eMasterVol, "\x02" "230xx" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eZone2Vol, "\x02" "231xx" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eMainLRBal, "\x02" "232xx" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eMainLevel, "\x02" "233xx" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eZone3Vol, "\x02" "234xx" "\x03", 7 },
|
||||||
|
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eMainLevelR, "\x02" "240xx" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eMainLevelL, "\x02" "241xx" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eCenterLevel, "\x02" "242xx" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eRearR, "\x02" "243xx" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eRearL, "\x02" "244xx" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eFrontR, "\x02" "245xx" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eFrontL, "\x02" "246xx" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eSurBackR, "\x02" "247xx" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eSurBackL, "\x02" "248xx" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eSwfr1, "\x02" "249xx" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::sysCommand, AVRFunction_T::fncSetValue, AVRArg_T::eSwfr2, "\x02" "24Axx" "\x03", 7 },
|
||||||
|
|
||||||
|
// Operation Commands
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncPower, AVRArg_T::eOn, "\x02" "07A1D" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncPower, AVRArg_T::eOff, "\x02" "07A1E" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncVolume, AVRArg_T::eUp, "\x02" "07A1A" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncVolume, AVRArg_T::eDown, "\x02" "07A1B" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncMute, AVRArg_T::eOn, "\x02" "07EA2" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncMute, AVRArg_T::eOff, "\x02" "07EA3" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncOSD, AVRArg_T::eOSDOff, "\x02" "07EB0" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncOSD, AVRArg_T::eOSDShort, "\x02" "07EB1" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncOSD, AVRArg_T::eOSDFull, "\x02" "07EB2" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncNightModeOnOff, AVRArg_T::eOn, "\x02" "07E9B" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncNightModeOnOff, AVRArg_T::eOff, "\x02" "07E9C" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncSleep, AVRArg_T::eSleepOff, "\x02" "07EB3" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncSleep, AVRArg_T::eSleep120, "\x02" "07EB4" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncSleep, AVRArg_T::eSleep90, "\x02" "07EB5" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncSleep, AVRArg_T::eSleep60, "\x02" "07EB6" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncSleep, AVRArg_T::eSleep30, "\x02" "07EB7" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncSpeakerAOnOff, AVRArg_T::eOn, "\x02" "07EAB" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncSpeakerAOnOff, AVRArg_T::eOff, "\x02" "07EAC" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncSpeakerBOnOff, AVRArg_T::eOn, "\x02" "07EAD" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncSpeakerBOnOff, AVRArg_T::eOff, "\x02" "07EAE" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncDC1TrigControl, AVRArg_T::eZone1, "\x02" "07E32" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncDC1TrigControl, AVRArg_T::eZone2, "\x02" "07E33" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncDC1TrigControl, AVRArg_T::eZone3, "\x02" "07E31" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncDualMono, AVRArg_T::eDualMain, "\x02" "07E93" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncDualMono, AVRArg_T::eDualSub, "\x02" "07E94" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncDualMono, AVRArg_T::eDualAll, "\x02" "07E95" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncDC1TrigControl, AVRArg_T::eZone1, "\x02" "07E96" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncDC1TrigControl, AVRArg_T::eZone2, "\x02" "07E97" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncDC1TrigControl, AVRArg_T::eZone3, "\x02" "07E9F" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncDC1TrigControl, AVRArg_T::eZoneOR, "\x02" "07E98" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncSpeakerBZone, AVRArg_T::eZone1, "\x02" "07E28" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncSpeakerBZone, AVRArg_T::eZone2, "\x02" "07E29" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncZone2SpeakerOnOff, AVRArg_T::eOn, "\x02" "07E99" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subMain, AVRFunction_T::fncZone2SpeakerOnOff, AVRArg_T::eOff, "\x02" "07E9A" "\x03", 7 },
|
||||||
|
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioBand, AVRArg_T::eFM, "\x02" "07EBC" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioBand, AVRArg_T::eAM, "\x02" "07EBD" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioTune, AVRArg_T::eUp, "\x02" "07EBE" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioTune, AVRArg_T::eDown, "\x02" "07EBF" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetPage, AVRArg_T::eA, "\x02" "07AE0" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetPage, AVRArg_T::eB, "\x02" "07AE1" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetPage, AVRArg_T::eC, "\x02" "07AE2" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetPage, AVRArg_T::eD, "\x02" "07AE3" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetPage, AVRArg_T::eE, "\x02" "07AE4" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetNumber, AVRArg_T::e1, "\x02" "07AE5" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetNumber, AVRArg_T::e2, "\x02" "07AE6" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetNumber, AVRArg_T::e3, "\x02" "07AE7" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetNumber, AVRArg_T::e4, "\x02" "07AE8" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetNumber, AVRArg_T::e5, "\x02" "07AE9" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetNumber, AVRArg_T::e6, "\x02" "07AEA" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetNumber, AVRArg_T::e7, "\x02" "07AEB" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetNumber, AVRArg_T::e8, "\x02" "07AEC" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetMemory, AVRArg_T::eA, "\x02" "07E2B" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetMemory, AVRArg_T::eB, "\x02" "07E2C" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetMemory, AVRArg_T::eC, "\x02" "07E2D" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetMemory, AVRArg_T::eD, "\x02" "07E2E" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetMemory, AVRArg_T::eE, "\x02" "07E2F" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetMemory, AVRArg_T::eF, "\x02" "07E20" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetRecall, AVRArg_T::eA, "\x02" "07E35" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetRecall, AVRArg_T::eB, "\x02" "07E36" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetRecall, AVRArg_T::eC, "\x02" "07E37" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetRecall, AVRArg_T::eD, "\x02" "07E38" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetRecall, AVRArg_T::eE, "\x02" "07E39" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subRadio, AVRFunction_T::fncRadioPresetRecall, AVRArg_T::eF, "\x02" "07E3A" "\x03", 7 },
|
||||||
|
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fnc6ChInput, AVRArg_T::eOn, "\x02" "07EA4" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fnc6ChInput, AVRArg_T::eOff, "\x02" "07EA5" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncInputMode, AVRArg_T::eInpAuto, "\x02" "07EA6" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncInputMode, AVRArg_T::eDD_RF, "\x02" "07EA7" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncInputMode, AVRArg_T::eDTS, "\x02" "07EA8" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncInputMode, AVRArg_T::eDigital, "\x02" "07EA9" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncInputMode, AVRArg_T::eAnalog, "\x02" "07EAA" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncInputMode, AVRArg_T::eAAC, "\x02" "07E3B" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncEx_EsOnOff, AVRArg_T::eOnMatrix, "\x02" "07EB8" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncEx_EsOnOff, AVRArg_T::eESESOff, "\x02" "07EB9" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncEx_EsOnOff, AVRArg_T::eAuto, "\x02" "07E7C" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncEx_EsOnOff, AVRArg_T::eDiscrete, "\x02" "07E7D" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncEffect, AVRArg_T::eEffectOn, "\x02" "07E27" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncEffect, AVRArg_T::eStereo, "\x02" "07EE0" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Hall_A, "\x02" "07EE1" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Hall_B, "\x02" "07EE2" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Hall_C, "\x02" "07EE3" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Hall_USA, "\x02" "07EE4" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Hall_E, "\x02" "07EE5" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Live_Concert, "\x02" "07EE6" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Tokyo, "\x02" "07EE7" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Freiburg, "\x02" "07EE8" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Royaumont, "\x02" "07EE9" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Village_Gate, "\x02" "07EEA" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Village_Vanguard, "\x02" "07EEB" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::The_Bottom_Line, "\x02" "07EEC" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::The_Roxy_Theater, "\x02" "07EED" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Warehouse_Loft, "\x02" "07EEE" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Arena, "\x02" "07EEF" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Disco, "\x02" "07EF0" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Party, "\x02" "07EF1" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Game, "\x02" "07EF2" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Stereo_6_8Ch, "\x02" "07EFF" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Pop_Rock, "\x02" "07EF3" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::DJ, "\x02" "07EF4" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Opera, "\x02" "07EF5" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Pavillion, "\x02" "07EF6" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Mono_Movie, "\x02" "07EF7" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Variety_Sports, "\x02" "07EF8" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Spectacre, "\x02" "07EF9" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Sci_Fi, "\x02" "07EFA" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Adventure, "\x02" "07EFB" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::General, "\x02" "07EFC" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Normal, "\x02" "07EFD" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Enhanced, "\x02" "07EFE" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::PLII_Movie, "\x02" "07E67" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::PLII_Music, "\x02" "07E68" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Neo_6_Movie, "\x02" "07E69" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Neo_6_Music, "\x02" "07E6A" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Direct_2Ch, "\x02" "07EC1" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::Stereo_2Ch, "\x02" "07EC0" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::THX_Ultra_PL, "\x02" "07EC2" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::THX_Music, "\x02" "07EC3" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::THX_Ultra_PL2, "\x02" "07EC7" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncDSPSoundScape, AVRArg_T::THX_Ultra_NEO6, "\x02" "07EC8" "\x03", 7 },
|
||||||
|
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncVolumeMemory, AVRArg_T::eA, "\x02" "07E6B" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncVolumeMemory, AVRArg_T::eB, "\x02" "07E6C" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncVolumeMemory, AVRArg_T::eC, "\x02" "07E6D" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncVolumeMemory, AVRArg_T::eD, "\x02" "07E6E" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncVolumeMemory, AVRArg_T::eE, "\x02" "07E6F" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncVolumeMemory, AVRArg_T::eF, "\x02" "07E60" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncVolumeRecall, AVRArg_T::eA, "\x02" "07E75" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncVolumeRecall, AVRArg_T::eB, "\x02" "07E76" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncVolumeRecall, AVRArg_T::eC, "\x02" "07E77" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncVolumeRecall, AVRArg_T::eD, "\x02" "07E78" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncVolumeRecall, AVRArg_T::eE, "\x02" "07E79" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subAudio, AVRFunction_T::fncVolumeRecall, AVRArg_T::eF, "\x02" "07E7A" "\x03", 7 },
|
||||||
|
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncPower, AVRArg_T::eOn, "\x02" "07E7E" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncPower, AVRArg_T::eOff, "\x02" "07E7F" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncInput, AVRArg_T::ePhono, "\x02" "07A14" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncInput, AVRArg_T::eCD, "\x02" "07A15" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncInput, AVRArg_T::eTuner, "\x02" "07A16" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncInput, AVRArg_T::eCDR, "\x02" "07A19" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncInput, AVRArg_T::eMD_Tape, "\x02" "07AC9" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncInput, AVRArg_T::eDVD, "\x02" "07AC1" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncInput, AVRArg_T::eDTV, "\x02" "07A54" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncInput, AVRArg_T::eCable, "\x02" "07AC0" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncInput, AVRArg_T::eSat, "\x02" "07ACA" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncInput, AVRArg_T::eVCR1, "\x02" "07A0F" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncInput, AVRArg_T::eVCR2_DVR, "\x02" "07A13" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncInput, AVRArg_T::eVCR3, "\x02" "07AC8" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncInput, AVRArg_T::eV_Aux, "\x02" "07A55" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncDC1OnOff, AVRArg_T::eOn, "\x02" "07E73" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncDC1OnOff, AVRArg_T::eOff, "\x02" "07E74" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncDC2OnOff, AVRArg_T::eOn, "\x02" "07E3E" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone1, AVRFunction_T::fncDC2OnOff, AVRArg_T::eOff, "\x02" "07E3F" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncVolume, AVRArg_T::eUp, "\x02" "07ADA" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncVolume, AVRArg_T::eDown, "\x02" "07ADB" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncMute, AVRArg_T::eOn, "\x02" "07EA0" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncMute, AVRArg_T::eOff, "\x02" "07EA1" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncInput, AVRArg_T::ePhono, "\x02" "07AD0" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncInput, AVRArg_T::eCD, "\x02" "07AD1" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncInput, AVRArg_T::eTuner, "\x02" "07AD2" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncInput, AVRArg_T::eCDR, "\x02" "07AD4" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncInput, AVRArg_T::eMD_Tape, "\x02" "07ACF" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncInput, AVRArg_T::eDVD, "\x02" "07ACD" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncInput, AVRArg_T::eDTV, "\x02" "07AD9" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncInput, AVRArg_T::eCable, "\x02" "07ACC" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncInput, AVRArg_T::eSat, "\x02" "07ACB" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncInput, AVRArg_T::eVCR1, "\x02" "07AD6" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncInput, AVRArg_T::eVCR2_DVR, "\x02" "07AD7" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncInput, AVRArg_T::eVCR3, "\x02" "07ACE" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncInput, AVRArg_T::eV_Aux, "\x02" "07AD8" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncPower, AVRArg_T::eOn, "\x02" "07EBA" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncPower, AVRArg_T::eOff, "\x02" "07EBB" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncVolumeMemory, AVRArg_T::eA, "\x02" "07E87" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncVolumeMemory, AVRArg_T::eB, "\x02" "07E88" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncVolumeMemory, AVRArg_T::eC, "\x02" "07E89" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncVolumeMemory, AVRArg_T::eD, "\x02" "07E8A" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncVolumeMemory, AVRArg_T::eE, "\x02" "07E8B" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncVolumeMemory, AVRArg_T::eF, "\x02" "07E8C" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncVolumeRecall, AVRArg_T::eA, "\x02" "07E8D" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncVolumeRecall, AVRArg_T::eB, "\x02" "07E8E" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncVolumeRecall, AVRArg_T::eC, "\x02" "07E8F" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncVolumeRecall, AVRArg_T::eD, "\x02" "07E90" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncVolumeRecall, AVRArg_T::eE, "\x02" "07E91" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncVolumeRecall, AVRArg_T::eF, "\x02" "07E92" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncDC1OnOff, AVRArg_T::eOn, "\x02" "07E71" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncDC1OnOff, AVRArg_T::eOff, "\x02" "07E72" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncDC2OnOff, AVRArg_T::eOn, "\x02" "07E3C" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone2, AVRFunction_T::fncDC2OnOff, AVRArg_T::eOff, "\x02" "07E3D" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncPower, AVRArg_T::eOn, "\x02" "07AED" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncPower, AVRArg_T::eStandby, "\x02" "07AEE" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncMute, AVRArg_T::eOn, "\x02" "07E26" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncMute, AVRArg_T::eOff, "\x02" "07E66" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncVolume, AVRArg_T::eUp, "\x02" "07AFD" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncVolume, AVRArg_T::eDown, "\x02" "07AFE" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncInput, AVRArg_T::ePhono, "\x02" "07AF1" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncInput, AVRArg_T::eCD, "\x02" "07AF2" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncInput, AVRArg_T::eTuner, "\x02" "07AF3" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncInput, AVRArg_T::eCDR, "\x02" "07AF5" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncInput, AVRArg_T::eMD_Tape, "\x02" "07AF4" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncInput, AVRArg_T::eDVD, "\x02" "07AFC" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncInput, AVRArg_T::eDTV, "\x02" "07AF6" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncInput, AVRArg_T::eCable, "\x02" "07AF7" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncInput, AVRArg_T::eSat, "\x02" "07AF8" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncInput, AVRArg_T::eVCR1, "\x02" "07AF9" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncInput, AVRArg_T::eVCR2_DVR, "\x02" "07AFA" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncInput, AVRArg_T::eVCR3, "\x02" "07AFB" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncInput, AVRArg_T::eV_Aux, "\x02" "07AF0" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncVolumeMemory, AVRArg_T::eA, "\x02" "07E20" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncVolumeMemory, AVRArg_T::eB, "\x02" "07E21" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncVolumeMemory, AVRArg_T::eC, "\x02" "07E22" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncVolumeMemory, AVRArg_T::eD, "\x02" "07E23" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncVolumeMemory, AVRArg_T::eE, "\x02" "07E24" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncVolumeMemory, AVRArg_T::eF, "\x02" "07E25" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncVolumeRecall, AVRArg_T::eA, "\x02" "07E60" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncVolumeRecall, AVRArg_T::eB, "\x02" "07E61" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncVolumeRecall, AVRArg_T::eC, "\x02" "07E62" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncVolumeRecall, AVRArg_T::eD, "\x02" "07E63" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncVolumeRecall, AVRArg_T::eE, "\x02" "07E64" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncVolumeRecall, AVRArg_T::eF, "\x02" "07E65" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncDC1OnOff, AVRArg_T::eOn, "\x02" "07E83" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncDC1OnOff, AVRArg_T::eOff, "\x02" "07E84" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncDC2OnOff, AVRArg_T::eOn, "\x02" "07E85" "\x03", 7 },
|
||||||
|
{ AVRSubsystem_T::subZone3, AVRFunction_T::fncDC2OnOff, AVRArg_T::eOff, "\x02" "07E86" "\x03", 7 },
|
||||||
|
};
|
||||||
|
|
||||||
|
uint16_t AVRDriver::GetMessageTableSize() {
|
||||||
|
return sizeof(MessageTable) / sizeof(MessageTable_T);
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageTable_T *AVRDriver::GetMessageTableRecord(uint16_t i) {
|
||||||
|
if (i < sizeof(MessageTable) / sizeof(MessageTable_T)) {
|
||||||
|
return &MessageTable[i];
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AVRDriver::AVRCommand(AVRSubsystem_T subsystem,
|
||||||
|
AVRFunction_T function,
|
||||||
|
AVRArg_T arg,
|
||||||
|
uint8_t variableData) {
|
||||||
|
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;
|
||||||
|
const char *p = strchr(MessageTable[i].Message, 'x');
|
||||||
|
if (p) {
|
||||||
|
char hexBuf[3] = "";
|
||||||
|
char *bigBuf = (char *)malloc(MessageTable[i].MessageLen + 1);
|
||||||
|
if (bigBuf) {
|
||||||
|
memcpy(bigBuf, MessageTable[i].Message, MessageTable[i].MessageLen);
|
||||||
|
char *pWr = (char *)strchr(bigBuf, 'x');
|
||||||
|
Inject2ASCIIHexCharsAt(pWr, variableData);
|
||||||
|
SendMessageToSerial(bigBuf, MessageTable[i].MessageLen);
|
||||||
|
free(bigBuf);
|
||||||
|
} else {
|
||||||
|
(*NotifyHost)(mtErrMalloc, NULL, MessageTable[i].MessageLen + 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
SendMessageToSerial(MessageTable[i].Message, MessageTable[i].MessageLen);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
(*NotifyHost)(mtErrNotFound, NULL, (subsystem << 16) | (function << 8) | (arg));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AVRDriver::Inject2ASCIIHexCharsAt(char *p, uint8_t val) {
|
||||||
|
const char *hex = "0123456789ABCDEF";
|
||||||
|
*p++ = hex[(val >> 4)];
|
||||||
|
*p = hex[(val & 0x0F)];
|
||||||
|
}
|
||||||
|
|
||||||
|
void AVRDriver::FreeSendQueue() {
|
||||||
|
for (int i = 0; i < serialQueueCount; i++) {
|
||||||
|
if (serialQueue[0].messageToSend) {
|
||||||
|
free(serialQueue[0].messageToSend);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool AVRDriver::CheckTheChecksum(const uint8_t *szBuffer, uint32_t num) {
|
||||||
|
uint8_t sum = 0;
|
||||||
|
for (uint16_t i = 1; i < num - 3; i++) {
|
||||||
|
sum += szBuffer[i];
|
||||||
|
}
|
||||||
|
uint8_t cksum = (uint8_t)Hex2Dec(&szBuffer[num - 3], 2);
|
||||||
|
return (sum == cksum);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hex2Dec
|
||||||
|
//
|
||||||
|
// All responses are pretty much Hex-ASCII, so
|
||||||
|
// we sometimes want to convert it to decimal
|
||||||
|
// This takes a buffer and converts the specified
|
||||||
|
// number of characters.
|
||||||
|
//
|
||||||
|
uint16_t AVRDriver::Hex2Dec(const uint8_t *p, int dig) {
|
||||||
|
uint16_t x = 0;
|
||||||
|
while (dig--) {
|
||||||
|
if (*p >= '0' && *p <= '9')
|
||||||
|
x = x * 16 + *p - '0';
|
||||||
|
else if (*p >= 'a' && *p <= 'f')
|
||||||
|
x = x * 16 + 0x0a + *p - 'a';
|
||||||
|
else if (*p >= 'A' && *p <= 'F')
|
||||||
|
x = x * 16 + 0x0a + *p - 'A';
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
578
AVR Working Controller/AVRDriver.h
Normal file
578
AVR Working Controller/AVRDriver.h
Normal file
@@ -0,0 +1,578 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
/// @brief Commands are directed to a specific SubSystem of the AVReceiver.
|
||||||
|
typedef enum {
|
||||||
|
sysCommand, // even with power off
|
||||||
|
subMain, // after power is on
|
||||||
|
subRadio,
|
||||||
|
subAudio,
|
||||||
|
subZone1,
|
||||||
|
subZone2,
|
||||||
|
subZone3,
|
||||||
|
subsystemCount
|
||||||
|
} AVRSubsystem_T;
|
||||||
|
|
||||||
|
/// @brief Functions with a specific subsystem are the target of a command
|
||||||
|
typedef enum {
|
||||||
|
fncPower,
|
||||||
|
fncVolume,
|
||||||
|
fncMute,
|
||||||
|
fncVolumeMemory,
|
||||||
|
fncVolumeRecall,
|
||||||
|
fncSpeakerAOnOff,
|
||||||
|
fncSpeakerBOnOff,
|
||||||
|
fncSpeakerBZone,
|
||||||
|
fncZone2SpeakerOnOff,
|
||||||
|
fncNightModeOnOff,
|
||||||
|
fncEffect,
|
||||||
|
fncDSPSoundScape,
|
||||||
|
fncInput,
|
||||||
|
fncRadioBand,
|
||||||
|
fncRadioTune,
|
||||||
|
fncRadioPresetPage,
|
||||||
|
fncRadioPresetNumber,
|
||||||
|
fncRadioPresetMemory,
|
||||||
|
fncRadioPresetRecall,
|
||||||
|
fncSleep,
|
||||||
|
fncOSD,
|
||||||
|
fnc6ChInput,
|
||||||
|
fncEx_EsOnOff,
|
||||||
|
fncInputMode,
|
||||||
|
fncDualMono,
|
||||||
|
fncDC1TrigControl,
|
||||||
|
fncDC2TrigControl,
|
||||||
|
fncDC1OnOff,
|
||||||
|
fncDC2OnOff,
|
||||||
|
fncReady,
|
||||||
|
fncReportEnable,
|
||||||
|
fncReportDelay,
|
||||||
|
fncRequest,
|
||||||
|
fncSetValue,
|
||||||
|
fncFunctionCount
|
||||||
|
} AVRFunction_T;
|
||||||
|
|
||||||
|
/// @brief and the command applied to that function are captured here
|
||||||
|
typedef enum {
|
||||||
|
eOn = 0, ///<! Anything that takes an On, Off, or Standby command
|
||||||
|
eOff,
|
||||||
|
eStandby,
|
||||||
|
eUp, ///<! Volume and Radio tuning accept up and down
|
||||||
|
eDown,
|
||||||
|
eMuteOn, ///<! Volume accepts a mute on and mute off
|
||||||
|
eMuteOff,
|
||||||
|
eFM, ///<! The radio band can be selected
|
||||||
|
eAM,
|
||||||
|
eA, ///<! Preset Groups
|
||||||
|
eB,
|
||||||
|
eC,
|
||||||
|
eD,
|
||||||
|
eE,
|
||||||
|
eF,
|
||||||
|
e1, ///<! Preset Numbers within a group
|
||||||
|
e2,
|
||||||
|
e3,
|
||||||
|
e4,
|
||||||
|
e5,
|
||||||
|
e6,
|
||||||
|
e7,
|
||||||
|
e8,
|
||||||
|
eSleepOff, ///<! System Sleep can be initiated
|
||||||
|
eSleep120,
|
||||||
|
eSleep90,
|
||||||
|
eSleep60,
|
||||||
|
eSleep30,
|
||||||
|
ePhono, ///<! The input can be selected
|
||||||
|
eCD,
|
||||||
|
eTuner,
|
||||||
|
eCDR,
|
||||||
|
eMD_Tape,
|
||||||
|
eDVD,
|
||||||
|
eDTV,
|
||||||
|
eCable,
|
||||||
|
eSat,
|
||||||
|
eVCR1,
|
||||||
|
eVCR2_DVR,
|
||||||
|
eVCR3,
|
||||||
|
eV_Aux,
|
||||||
|
eOSDOff, ///<! The On Screen Display can be controlled
|
||||||
|
eOSDShort,
|
||||||
|
eOSDFull,
|
||||||
|
eOnMatrix, ///<! I don't know what this does
|
||||||
|
eESESOff,
|
||||||
|
eAuto,
|
||||||
|
eDiscrete, ///<! Or this
|
||||||
|
eEffectOn,
|
||||||
|
eStereo,
|
||||||
|
eMain, ///<! Some systems commands target a zone
|
||||||
|
eZone1,
|
||||||
|
eZone2,
|
||||||
|
eZone3,
|
||||||
|
eZoneOR,
|
||||||
|
Hall_A, ///<! Overall sound presence can be selected
|
||||||
|
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,
|
||||||
|
eInpAuto, ///<! Not sure about this thing
|
||||||
|
eDD_RF,
|
||||||
|
eDTS,
|
||||||
|
eDigital,
|
||||||
|
eAnalog,
|
||||||
|
eAAC,
|
||||||
|
eDualMain, ///<! and again not sure
|
||||||
|
eDualSub,
|
||||||
|
eDualAll,
|
||||||
|
|
||||||
|
e0ms, ///<! Response delays to the commands can be set
|
||||||
|
e50ms,
|
||||||
|
e100ms,
|
||||||
|
e150ms,
|
||||||
|
e200ms,
|
||||||
|
e250ms,
|
||||||
|
e300ms,
|
||||||
|
e350ms,
|
||||||
|
e400ms,
|
||||||
|
|
||||||
|
eTuningFreq, ///<! There are a number of additional commands
|
||||||
|
eMainVolDB,
|
||||||
|
eZone2VolDB,
|
||||||
|
eInputName,
|
||||||
|
eZone2InputName,
|
||||||
|
eZoneXVolDB,
|
||||||
|
eZoneXInputName,
|
||||||
|
eMasterVol,
|
||||||
|
eZone2Vol,
|
||||||
|
eMainLRBal,
|
||||||
|
eMainLevel,
|
||||||
|
eZone3Vol,
|
||||||
|
|
||||||
|
eMainLevelR,
|
||||||
|
eMainLevelL,
|
||||||
|
eCenterLevel,
|
||||||
|
eRearR,
|
||||||
|
eRearL,
|
||||||
|
eFrontR,
|
||||||
|
eFrontL,
|
||||||
|
eSurBackR,
|
||||||
|
eSurBackL,
|
||||||
|
eSwfr1,
|
||||||
|
eSwfr2,
|
||||||
|
|
||||||
|
eARGCount
|
||||||
|
} AVRArg_T;
|
||||||
|
|
||||||
|
|
||||||
|
/// @brief AVRMessageType_T
|
||||||
|
///
|
||||||
|
/// Indicates the type of message being sent to the status change callback
|
||||||
|
///
|
||||||
|
typedef enum {
|
||||||
|
mtState, ///<! State machine state
|
||||||
|
mtInfo, ///<! General purpose information (chunks of information that might be useful in a small scroll region)
|
||||||
|
mtModelInfo, ///<! Model information
|
||||||
|
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...
|
||||||
|
mtRcvdMsg, ///<! The byte stream of a received message (one packet at a time) suitable for a hex display
|
||||||
|
mtXmtdMsg, ///<! The byte stream of a message being sent suitable for a hex display
|
||||||
|
mtStatusMsg, ///<! The status message, suitable for showing a status update
|
||||||
|
mtOperationResp,///<! Operation Response to some command
|
||||||
|
mtParamUpdated, ///<! A parameter was updated
|
||||||
|
mtErrNotFound, ///<! Command Not Found (and3 bytes packed into 'param'
|
||||||
|
mtExtendedResp, ///<! Extended protocol response to an extended protocol command
|
||||||
|
mtErrRxLength, ///<! The received message (from the AVR) had an unexpected length
|
||||||
|
mtErrMalloc, ///<! Memory allocation error
|
||||||
|
mtFailed, ///<! Failed to establish contact
|
||||||
|
} AVRMessageType_T;
|
||||||
|
|
||||||
|
/// @brief The Message table maps the valid combinations of subsystem, function, and command (argument)
|
||||||
|
///
|
||||||
|
typedef const struct {
|
||||||
|
AVRSubsystem_T subsystem; ///<! the subystem target for the command
|
||||||
|
AVRFunction_T function; ///<! the function within the subsystem
|
||||||
|
AVRArg_T arg; ///<! the actual command to apply
|
||||||
|
const char *Message; ///<! the message to send to the AVR for this command
|
||||||
|
uint16_t MessageLen; ///<! the length of the message to send
|
||||||
|
} MessageTable_T;
|
||||||
|
|
||||||
|
/// NotifyCallBack
|
||||||
|
///
|
||||||
|
/// @brief Notify the host of an event
|
||||||
|
///
|
||||||
|
/// 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] message is usually the [ASCII] byte stream, or NULL
|
||||||
|
/// @param[in] attrib is the strlen(message), or for other types, it may be a value
|
||||||
|
/// @returns true of the message was accepted
|
||||||
|
///
|
||||||
|
typedef bool (*NotifyCallBack)(AVRMessageType_T type, const void *message, uint32_t attrib);
|
||||||
|
|
||||||
|
/// SendCallBack
|
||||||
|
///
|
||||||
|
/// @brief Send a message to RS-232 Interface
|
||||||
|
///
|
||||||
|
/// This is used to send a message to the AVR via the RS-232 Channel that
|
||||||
|
/// is provided by the host
|
||||||
|
///
|
||||||
|
/// @param[in] message is the message to send which is null terminated
|
||||||
|
/// @param[in] len is the length of the message (seems redundant but it avoids buffer overruns)
|
||||||
|
/// @returns true if the message was accepted for sending
|
||||||
|
///
|
||||||
|
typedef bool (*SendCallBack)(const uint8_t *message, uint32_t len);
|
||||||
|
|
||||||
|
|
||||||
|
class AVRDriver
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AVRDriver(
|
||||||
|
NotifyCallBack notifyCB = NULL, ///<! used to notify the host of internal events
|
||||||
|
SendCallBack sendCB = NULL ///<! used to send to the RS-232 interface
|
||||||
|
);
|
||||||
|
|
||||||
|
~AVRDriver();
|
||||||
|
|
||||||
|
/// @brief internal operating states of the AVR interface
|
||||||
|
typedef enum {
|
||||||
|
stPoweringUp, ///<! powering up
|
||||||
|
stAwaitingReadyResponse, ///<! waiting for the special ready response
|
||||||
|
stInitializing, ///<! initializing
|
||||||
|
stRetryInitializing, ///<! retrying initialization
|
||||||
|
stReady, ///<! ready for commands
|
||||||
|
stAwaitingResponse, ///<! waiting for a response to a command
|
||||||
|
stFailed, ///<! failed to establish contact
|
||||||
|
stMaxStates ///<! maximum states
|
||||||
|
} AVRState_T;
|
||||||
|
|
||||||
|
/// @brief Call this periodically so timed activities can be handled.
|
||||||
|
///
|
||||||
|
/// Every 1 or even 50 to 100 msec is ok.
|
||||||
|
///
|
||||||
|
/// @param[in] milliseconds since the program started
|
||||||
|
/// @returns the current state of the AVR interface
|
||||||
|
///
|
||||||
|
AVRState_T Tick(uint32_t millisec);
|
||||||
|
|
||||||
|
uint32_t GetTick();
|
||||||
|
|
||||||
|
/// @brief When the system receives something from the device, give it to this function to handle it
|
||||||
|
/// @param buffer
|
||||||
|
/// @param len
|
||||||
|
/// @return 0 if none, or the index into the main status array that was updated
|
||||||
|
///
|
||||||
|
uint8_t HandleMessage(const uint8_t *buffer, uint16_t len);
|
||||||
|
|
||||||
|
/// @brief The primary 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 argument(s)
|
||||||
|
///
|
||||||
|
/// @param[in] subsystem: Main | Zone 1 | Zone 2 | Zone 3
|
||||||
|
/// @param[in] function : Power, Speaker, Volume, etc.
|
||||||
|
/// @param[in] arg: on/off, etc.
|
||||||
|
/// @param[in] variableData is for those functions where it needs to integrate variable value, such as setting the volume directly
|
||||||
|
/// @return true if accepted
|
||||||
|
///
|
||||||
|
bool AVRCommand(AVRSubsystem_T subsystem,
|
||||||
|
AVRFunction_T function,
|
||||||
|
AVRArg_T arg,
|
||||||
|
uint8_t variableData = 0);
|
||||||
|
|
||||||
|
|
||||||
|
/// SendMessageToSerial
|
||||||
|
///
|
||||||
|
/// @brief This the public interface where received serial data is sent to get a command to the AVR
|
||||||
|
/// @param[in] p the message to send
|
||||||
|
/// @param[in] len of the message
|
||||||
|
/// @return true
|
||||||
|
///
|
||||||
|
bool SendMessageToSerial(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);
|
||||||
|
|
||||||
|
/// Hex2Dec
|
||||||
|
///
|
||||||
|
/// @brief a handy little conversion utility
|
||||||
|
///
|
||||||
|
/// @param p is a pointer to an ASCII-HEX string
|
||||||
|
/// @param dig is the number of digits to convert
|
||||||
|
/// @return converted value
|
||||||
|
///
|
||||||
|
uint16_t Hex2Dec(const uint8_t *p, int dig);
|
||||||
|
|
||||||
|
/// @brief For iterating over the message table
|
||||||
|
/// @return the number of records in the table
|
||||||
|
///
|
||||||
|
uint16_t GetMessageTableSize();
|
||||||
|
|
||||||
|
/// @brief a method to get a handle to a specific record
|
||||||
|
/// @param i
|
||||||
|
/// @return a pointer to the record
|
||||||
|
///
|
||||||
|
MessageTable_T *GetMessageTableRecord(uint16_t i);
|
||||||
|
|
||||||
|
|
||||||
|
/// Each DT is the hex-character from the stream
|
||||||
|
///
|
||||||
|
/// This could be simplified to uint8_t DT[138] except for the loss of the comments
|
||||||
|
///
|
||||||
|
typedef struct {
|
||||||
|
uint8_t DT0; // * Baud Rate '@'
|
||||||
|
uint8_t DT1; // * Receive Buffer 'E'
|
||||||
|
uint8_t DT2; // * Receive Buffer '0'
|
||||||
|
uint8_t DT3; // * '1'
|
||||||
|
uint8_t DT4; // * Command Timeout '9'
|
||||||
|
uint8_t DT5; // * '0'
|
||||||
|
uint8_t DT6; // * '0'
|
||||||
|
uint8_t DT7; // * System '0':Ok, '1':Busy
|
||||||
|
uint8_t DT8; // * Power 0:Off, 1:On
|
||||||
|
uint8_t DT9; // Input 0: Phono, 1:CD, 2:Tuner, 3:CD-R, 4:MD-Tape, 5:DVD, 6:D-TV, 7:Cbl, 9:VCR1, A:VCR2
|
||||||
|
uint8_t DT10; // 6ch input 0:Off, 1:On
|
||||||
|
uint8_t DT11; // Input Mode 0:AUTO, 2:DTS, 4:Analog, 5:Analog Only
|
||||||
|
uint8_t DT12; // Audio Mute 0:Off, 1:On
|
||||||
|
uint8_t DT13; // Zone2 Input 0: PHONO / 1: CD / 2: TUNER / 3: CD-R / 4: MD-TAPE / 5: DVD / 6: D-TV-LD / 7: CBL-SAT / 9: VCR1 / A: VCR2-DVR / C: V-AUX
|
||||||
|
uint8_t DT14; // Zone2 Mute 0: OFF / 1: ON
|
||||||
|
uint8_t DT15; // Master Volume Upper 4 bit
|
||||||
|
uint8_t DT16; // Master Volume Lower 4 bit
|
||||||
|
uint8_t DT17; // Zone2 Volume Upper 4 bit
|
||||||
|
uint8_t DT18; // Zone2 Volume Lower 4 bit
|
||||||
|
uint8_t DT19; // Program Upper 4 bit
|
||||||
|
uint8_t DT20; // Program Lower 4 bit
|
||||||
|
uint8_t DT21; // Effect 0: OFF / 1: ON
|
||||||
|
uint8_t DT22; // 6.1/ES key status 0: OFF / 1: MATRIX ON / 2: DISCRETE ON / 3: AUTO
|
||||||
|
uint8_t DT23; // OSD* 0: FULL / 1: SHORT / 2: OFF
|
||||||
|
uint8_t DT24; // Sleep 0: 120 / 2: 90 / 3: 60 / 4: 30 / 5: OFF
|
||||||
|
uint8_t DT25; // Tuner Page 0: Page A / 1: Page B / 2: Page C / 3: Page D / 4: PageE
|
||||||
|
uint8_t DT26; // Tuner No. 0: No.1 / 1: No.2 / 2: No.3 / 3: No.4 / 4: No.5 / 5: No.6 / 6: No.7 / 7: No.8
|
||||||
|
uint8_t DT27; // Night mode 0: OFF / 1: ON
|
||||||
|
uint8_t DT28; // Care
|
||||||
|
uint8_t DT29; // Speaker relay A 0: OFF / 1: ON
|
||||||
|
uint8_t DT30; // Speaker relay B 0: OFF / 1: ON
|
||||||
|
uint8_t DT31; // Playback 0: 6ch input / 1: Analog / 2: PCM / 3: DD*(except 2.0) / 4: DD(2.0) / 5: DD.Karaoke / 6: DD.EX / 7: DTS / 8: DTS-ES / 9: Other DIGITAL / A: DTS Analog Mute / B: DTS ES Discrete
|
||||||
|
uint8_t DT32; // Fs 0: Analog / 1: 32kHz / 2: 44.1kHz / 3: 48kiHz / 4: 64kHz / 5: 88.2kHz / 6: 96kHz / 7: Unknown B: DTS 96/24
|
||||||
|
uint8_t DT33; // EX/ES playback 0: OFF / 1: MATRIX ON / 2: DISCRETE ON
|
||||||
|
uint8_t DT34; // Thr / Bypass 0: Normal / 1: Bypass
|
||||||
|
uint8_t DT35; // RED dts 0: Release / 1: Wait
|
||||||
|
uint8_t DT36; // Head Phone 0: OFF / 1: ON
|
||||||
|
uint8_t DT37; // TUNER BAND 0: FM / 1: AM
|
||||||
|
uint8_t DT38; // TUNER TUNED 0: NOT TUNED / 1: TUNED
|
||||||
|
uint8_t DT39; // DC1 Control Out 0: LOW / 1: HIGH
|
||||||
|
|
||||||
|
uint8_t DT40; // Don’t care
|
||||||
|
uint8_t DT41; // Don't Care
|
||||||
|
uint8_t DT42; // 0-2 DC1 TRG Ctrl. 0: Zone1 / 1: Zone2 / 2: Zone1&2
|
||||||
|
uint8_t DT43; // 0/1 dts 96/24 0: OFF / 1: ON
|
||||||
|
uint8_t DT44; // 0-2 DC2 TRG Ctrl. 0: Zone1 / 1: Zone2 / 2: Zone1&2
|
||||||
|
uint8_t DT45; // 0/1 DC2 Trigger 0: LOW / 1: HIGH
|
||||||
|
uint8_t DT46; // SP B set 0: Zone1 / 1: Zone2
|
||||||
|
uint8_t DT47; // Zone 2 SP out 0: OFF / 1: ON
|
||||||
|
uint8_t DT48; // MAIN R Upper 4bit
|
||||||
|
uint8_t DT49; // Lower 4bit
|
||||||
|
uint8_t DT50; // MAIN L Upper 4bit
|
||||||
|
uint8_t DT51; // Lower 4bit
|
||||||
|
uint8_t DT52; // CENTER Upper 4bit
|
||||||
|
uint8_t DT53; // Lower 4bit
|
||||||
|
uint8_t DT54; // REAR R Upper 4bit
|
||||||
|
uint8_t DT55; // Lower 4bit
|
||||||
|
uint8_t DT56; // REAR L Upper 4bit
|
||||||
|
uint8_t DT57; // Lower 4bit
|
||||||
|
uint8_t DT58; // SUR BACK Upper 4bit
|
||||||
|
uint8_t DT59; // R Lower 4bit
|
||||||
|
uint8_t DT60; // SUR BACK Upper 4bit
|
||||||
|
uint8_t DT61; // L Lower 4bit
|
||||||
|
uint8_t DT62; // FRONT R Upper 4bit
|
||||||
|
uint8_t DT63; // Lower 4bit
|
||||||
|
uint8_t DT64; // FRONT L Upper 4bit
|
||||||
|
uint8_t DT65; // Lower 4bit
|
||||||
|
uint8_t DT66; // SWFR 1 Upper 4bit
|
||||||
|
uint8_t DT67; // Lower 4bit
|
||||||
|
uint8_t DT68; // Don't Care
|
||||||
|
uint8_t DT69; // Don't Care
|
||||||
|
uint8_t DT70; // Don't Care
|
||||||
|
uint8_t DT71; // Don't Care
|
||||||
|
uint8_t DT72; // Don't Care
|
||||||
|
uint8_t DT73; // Don't Care
|
||||||
|
uint8_t DT74; // LFE Lvl. SP Upper 4bit
|
||||||
|
uint8_t DT75; // Lower 4bit
|
||||||
|
uint8_t DT76; // LFE Lvl. HP Upper 4bit
|
||||||
|
uint8_t DT77; // Lower 4bit
|
||||||
|
uint8_t DT78; // Audio Delay Upper 4bit
|
||||||
|
uint8_t DT79; // Lower 4bit
|
||||||
|
|
||||||
|
uint8_t DT80; // Don't Care
|
||||||
|
uint8_t DT81; // Don't Care
|
||||||
|
uint8_t DT82; // Don't Care
|
||||||
|
uint8_t DT83; // Don't Care
|
||||||
|
uint8_t DT84; // Input mode set 0: AUTO / 1: LAST
|
||||||
|
uint8_t DT85; // Dimmer 0: -4 / 1: -3 / 2: -2 / 3: -1 / 4: 0
|
||||||
|
uint8_t DT86; // OSD Message
|
||||||
|
uint8_t DT87; // OSD shift Upper 4bit
|
||||||
|
uint8_t DT88; // Lower 4bit
|
||||||
|
uint8_t DT89; // Glay back 0: OFF / 1: AUTO
|
||||||
|
uint8_t DT90; // Video conversion 0: OFF / 1: ON
|
||||||
|
uint8_t DT91; // D. Range SP 0: MAX / 1: STD / 2: MIN
|
||||||
|
uint8_t DT92; // HP 0: MAX / 1: STD / 2: MIN
|
||||||
|
uint8_t DT93; // Zone 2 vol. Out
|
||||||
|
uint8_t DT94; // Don't Care
|
||||||
|
uint8_t DT95; // Memory guard 0: OFF / 1: ON
|
||||||
|
uint8_t DT96; // SP set Center 0: Large / 1: Small / 2: None
|
||||||
|
uint8_t DT97; // Main 0: Large / 1: Small
|
||||||
|
uint8_t DT98; // Rear L/R 0: Large / 1: Small / 2: None
|
||||||
|
uint8_t DT99; // Rear CT 0: Large / 1: Small / 2: None
|
||||||
|
uint8_t DT100; // Front 0: Yes / 1: None
|
||||||
|
uint8_t DT101; // LFE/BASS 0: SWFR / 1: Main / 2: Both
|
||||||
|
uint8_t DT102; // 6CH Center 0: Center / 1: Main
|
||||||
|
uint8_t DT103; // SWFR 0: SWFR / 1: Main
|
||||||
|
uint8_t DT104; // Main level 0: Normal / 1: -10dB
|
||||||
|
uint8_t DT105; // Test mode 0: OFF / 1: Dolby / 2: DTS
|
||||||
|
uint8_t DT106; // Don't Care
|
||||||
|
uint8_t DT107; // LVL 6CH MAIN L Upper 4bit
|
||||||
|
uint8_t DT108; // Lower 4bit
|
||||||
|
uint8_t DT109; // MAIN R Upper 4bit
|
||||||
|
uint8_t DT110; // Lower 4bit
|
||||||
|
uint8_t DT111; // CENTER Upper 4bit
|
||||||
|
uint8_t DT112; // Lower 4bit
|
||||||
|
uint8_t DT113; // SL Upper 4bit
|
||||||
|
uint8_t DT114; // Lower 4bit
|
||||||
|
uint8_t DT115; // SR Upper 4bit
|
||||||
|
uint8_t DT116; // Lower 4bit
|
||||||
|
uint8_t DT117; // SBL Upper 4bit
|
||||||
|
uint8_t DT118; // Lower 4bit
|
||||||
|
uint8_t DT119; // SBR Upper 4bit
|
||||||
|
uint8_t DT120; // Lower 4bit
|
||||||
|
uint8_t DT121; // FRONT L Upper 4bit
|
||||||
|
uint8_t DT122; // Lower 4bit
|
||||||
|
uint8_t DT123; // FRONT R Upper 4bit
|
||||||
|
uint8_t DT124; // Lower 4bit
|
||||||
|
uint8_t DT125; // SWFR Upper 4bit
|
||||||
|
uint8_t DT126; // Lower 4bit
|
||||||
|
uint8_t DT127; // 0 - C Z3 Input
|
||||||
|
uint8_t DT128; // 0/1 Z3 Mute
|
||||||
|
uint8_t DT129; // 0 - F Z3 Volume Upper 4bit
|
||||||
|
|
||||||
|
uint8_t DT130; // 0 - F Lower 4bit
|
||||||
|
uint8_t DT131; // Don't Care
|
||||||
|
uint8_t DT132; // MULTI_CH SELECT 00:6CH / 01:8CH TUNER / 02: 8CH CD / 04: 8CH CD-R / 05: 8CH DVD / 06: DTV / 07: 8CH CBL/SAT / 09: 8CH VCR1 / 0A: VCR2/DVR / 0C: VAUX
|
||||||
|
uint8_t DT133; // MULTI_CH SURROUND to 00: Surround / 01: Main
|
||||||
|
uint8_t DT134; // SP SET SW1 00: L-R / 01: F-R / 02: NONE
|
||||||
|
uint8_t DT135; // SP SET CROSSOVER 00: 40Hz / 01: 60Hz / 02: 80Hz / 03: 90Hz / 04: 100Hz / 05: 110Hz / 06: 120Hz / 07: 160Hz / 08: 200Hz
|
||||||
|
uint8_t DT136; // COMPONENT OSD 00: OFF / 01: ON
|
||||||
|
uint8_t DT137; // PB/SB SELECT 00: PR / 01: SB
|
||||||
|
|
||||||
|
uint8_t DT138[100]; // From here on is just buffer in case it sends more data
|
||||||
|
} AVR_Configuration_T;
|
||||||
|
|
||||||
|
/// @brief prefix for the large received messages
|
||||||
|
typedef struct {
|
||||||
|
uint8_t type[5]; ///<! Model ID of the AVR
|
||||||
|
uint8_t version; ///<! Version of the A-Z
|
||||||
|
uint8_t length[2]; ///<! the length (1 - 255) following
|
||||||
|
} AVR_StatusHeader_T;
|
||||||
|
|
||||||
|
/// @brief the privately maintained status of the AVR
|
||||||
|
typedef struct {
|
||||||
|
bool headerValid; ///<! a short received message only makes the header valid
|
||||||
|
bool configValid; ///<! a longer received message updates everything in the config
|
||||||
|
AVR_StatusHeader_T header; ///<! the header block
|
||||||
|
AVR_Configuration_T config; ///<! the rest of the data
|
||||||
|
} AVR_Status_T;
|
||||||
|
|
||||||
|
/// @brief a method to get the status of the AVR
|
||||||
|
/// @return the status
|
||||||
|
///
|
||||||
|
const AVR_Status_T *GetAVRStatusData() {
|
||||||
|
return &avrStatus;
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
NotifyCallBack NotifyHost;
|
||||||
|
SendCallBack RS232Send;
|
||||||
|
|
||||||
|
private:
|
||||||
|
AVRState_T state = stPoweringUp;
|
||||||
|
AVRState_T oldState = stMaxStates;
|
||||||
|
|
||||||
|
bool bFirstTickInitialized = false;
|
||||||
|
uint32_t firstTick_ms = 0; // basically the time when the program started
|
||||||
|
uint32_t lastTick_ms = 0; // @TODO instead of this, offer a way for the class to get the current time
|
||||||
|
uint32_t sentAtTime_ms = 0;
|
||||||
|
|
||||||
|
AVR_Status_T avrStatus = { 0 };
|
||||||
|
bool commandResponseReceived = false; // a response to the last command was received
|
||||||
|
bool readyResponsReceived = false; // the special system ready response was received
|
||||||
|
int readyTries = 0;
|
||||||
|
#define RETRY_INTERVAL_ms 1000
|
||||||
|
#define MAXTRIES 5
|
||||||
|
|
||||||
|
#define SERIALQUEUESIZE 5
|
||||||
|
typedef struct {
|
||||||
|
uint8_t *messageToSend;
|
||||||
|
uint16_t len;
|
||||||
|
} SerialQueue_T;
|
||||||
|
|
||||||
|
SerialQueue_T serialQueue[SERIALQUEUESIZE] = { 0 };
|
||||||
|
int serialQueueCount = 0;
|
||||||
|
|
||||||
|
/// @brief Process a message which is likely to update the main status array
|
||||||
|
/// @param buffer
|
||||||
|
/// @param len
|
||||||
|
/// @return the index into the main status array that was changed, or 0 if none
|
||||||
|
///
|
||||||
|
uint8_t ProcessResponse(const uint8_t *buffer, uint16_t len);
|
||||||
|
|
||||||
|
void Inject2ASCIIHexCharsAt(char *p, uint8_t val);
|
||||||
|
|
||||||
|
bool CheckTheChecksum(const uint8_t *szBuffer, uint32_t num);
|
||||||
|
void FreeSendQueue();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
Reference in New Issue
Block a user