Continue OO migration
This commit is contained in:
@@ -244,7 +244,7 @@ static int serialQueueCount = 0;
|
||||
// @param[in] len is the count of bytes in the message
|
||||
// @returns false if the queue (which is a fixed size) is full.
|
||||
//
|
||||
bool ProcessSerialQueue(const uint8_t *p = NULL, uint16_t len = 0);
|
||||
//bool ProcessSerialQueue(const uint8_t *p = NULL, uint16_t len = 0);
|
||||
|
||||
|
||||
// ProcessSerialReceive
|
||||
@@ -295,12 +295,12 @@ const UserCmd_T UserCommands[] = {
|
||||
{ 'm', "Vol 1 UnMute", {"\x02" "07EA3" "\x03", 7} },
|
||||
{ 'O', "OSD Test Message", },
|
||||
{ 'T', "Tuning freq rqst", {"\x02" "22000" "\x03", 7} },
|
||||
{ 'Y', "Main Vol rqst", {"\x02" "22001" "\x03", 7} },
|
||||
{ 'Y', "Zone 1 Vol rqst", {"\x02" "22001" "\x03", 7} },
|
||||
{ 'y', "Zone 2 Vol rqst", {"\x02" "22002" "\x03", 7} },
|
||||
{ 'U', "Input Name rqst", {"\x02" "22003" "\x03", 7} },
|
||||
{ 'u', "Zone 2 Name rqst", {"\x02" "22004" "\x03", 7} },
|
||||
{ 'I', "Zone 2 Vol rqst", {"\x02" "22005" "\x03", 7} },
|
||||
{ 'i', "Zone 2 Name rqst", {"\x02" "22006" "\x03", 7} },
|
||||
{ 'U', "Zone 1 Input rqst", {"\x02" "22003" "\x03", 7} },
|
||||
{ 'u', "Zone 2 Input rqst", {"\x02" "22004" "\x03", 7} },
|
||||
{ 'I', "Zone 3 Vol rqst", {"\x02" "22005" "\x03", 7} },
|
||||
{ 'i', "Zone 3 Input rqst", {"\x02" "22006" "\x03", 7} },
|
||||
//{ 'J', "Dual Mono - Main", {"\x02" "07E93" "\x03", 7} },
|
||||
//{ 'K', "Dual Mono - Sub", {"\x02" "07E94" "\x03", 7} },
|
||||
//{ 'L', "Dual Mono - All", {"\x02" "07E95" "\x03", 7} },
|
||||
@@ -601,6 +601,7 @@ bool SerialSend(const uint8_t *p, uint16_t len) {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool ProcessSerialQueue(const uint8_t *p, uint16_t len) {
|
||||
bool retVal = false; // assume fail
|
||||
static bool freshData = false;
|
||||
@@ -629,7 +630,7 @@ bool ProcessSerialQueue(const uint8_t *p, uint16_t len) {
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void EmitSpinner() {
|
||||
static int x = 0;
|
||||
@@ -669,7 +670,7 @@ void EmitRuntimeHelp() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// PCMessage
|
||||
//
|
||||
// Various responses need to be formatted and shown on screen
|
||||
@@ -700,7 +701,7 @@ static void PCMessage(const char *msg, int len, uint8_t **src, const char * (fnc
|
||||
Console_AdvanceToNextLineIfNotRoomFor(26);
|
||||
Console_Write(outBuf);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
@@ -837,11 +838,11 @@ void ProcessKeyboard(void) {
|
||||
avr->Power(AVRInterface::AVROnOff_E::eOff);
|
||||
break;
|
||||
case 'O':
|
||||
ProcessSerialQueue((const uint8_t *)"\x02" "21000" "\x03", 7);
|
||||
ProcessSerialQueue((const uint8_t *)"\x02" "3Test" "\x03", 7);
|
||||
ProcessSerialQueue((const uint8_t *)"\x02" "3 Mes" "\x03", 7);
|
||||
ProcessSerialQueue((const uint8_t *)"\x02" "3sage" "\x03", 7);
|
||||
ProcessSerialQueue((const uint8_t *)"\x02" "3 WOW" "\x03", 7);
|
||||
avr->ProcessSerialQueue("\x02" "21000" "\x03", 7);
|
||||
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;
|
||||
case ':':
|
||||
GetAndSendCustomMessage();
|
||||
@@ -888,6 +889,19 @@ void ProcessKeyboard(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
void HexUppercase(char *p) {
|
||||
const char *hex = "0123456789ABCDEF";
|
||||
while (*p) {
|
||||
if (*p >= 'a' && *p <= 'f')
|
||||
*p = *p - 'a' + 'A';
|
||||
if (NULL == strchr(hex, *p)) {
|
||||
*p = '\0';
|
||||
return;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
void GetAndSendCustomMessage() {
|
||||
char buf[20];
|
||||
char msg[30];
|
||||
@@ -895,9 +909,15 @@ void GetAndSendCustomMessage() {
|
||||
Console_ScrollBottomRegion();
|
||||
Console_WriteAt(0, -2, "Enter Hex string to send: ");
|
||||
gets_s(buf, sizeof(buf));
|
||||
Console_ScrollBottomRegion();
|
||||
sprintf_s(msg, sizeof(msg), "\x02%s\x03", buf);
|
||||
avr->ProcessSerialQueue(msg, strlen(msg));
|
||||
HexUppercase(buf);
|
||||
if (strlen(buf) != 5) {
|
||||
Console_WriteAt(0, -1, " Invalid. String must be exactly 5 HEX chars");
|
||||
Console_ScrollBottomRegion();
|
||||
} else {
|
||||
Console_ScrollBottomRegion();
|
||||
sprintf_s(msg, sizeof(msg), "\x02%s\x03", buf);
|
||||
avr->ProcessSerialQueue(msg, strlen(msg));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1036,7 +1056,7 @@ int __cdecl main(int argc, char *argv[]) {
|
||||
//HandleMessage(anyRcvdMsg.message, anyRcvdMsg.len);
|
||||
}
|
||||
|
||||
ProcessSerialQueue();
|
||||
//ProcessSerialQueue();
|
||||
ProcessWindowsMessage();
|
||||
} while (!UserWantsToExitCanSniff);
|
||||
DetachSerialPort();
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user