Continuing move to both OO interface and consolidation of commands into Subsystem, Command rather than all discrete commands.

This commit is contained in:
2026-01-26 13:42:28 -06:00
parent 152e0c2d80
commit 4e0035bea6
5 changed files with 374 additions and 188 deletions

View File

@@ -39,38 +39,102 @@ public:
///
bool IsOnline();
/// @brief Power on and off commands
///
typedef enum {
avrPowerOff,
avrPowerOn,
} AVRPower_T;
eOn = 0,
eOff,
eStandby
} AVROnOff_E;
typedef enum {
eVolumeUp,
eVolumeDown,
eMuteOn,
eMuteOff
} AVRVolume_E;
typedef enum {
eOSDOff,
eOSDShort,
eOSDFull
} AVROSDScreen_E;
typedef enum {
eSleepOff,
eSleep120,
eSleep90,
eSleep60,
eSleep30
} AVRSleep_E;
typedef enum {
eOnMatrix,
eESESOff,
eAuto,
eDiscrete
} AVREX_ES_E;
typedef enum {
eEffectOn,
eStereo
} AVREffect_E;
typedef enum {
eFM,
eAM
} AVRTunerBand_E;
typedef enum {
e1,
e2,
e3,
e4,
e5,
e6, e7, e8
} AVRPresetNum_E;
typedef enum {
eA,
eB,
eC,
eD,
eE,
eF
} AVR_PresetPage_E;
typedef enum {
ePhono,
eCD,
eTuner,
eCDR,
eMD_Tape,
eDVD,
eDTV,
eCable,
eSat,
eVCR1,
eVCR2_DVR,
eVCR3,
eV_Aux,
} AVRInput_E;
typedef enum {
cmdZone1,
cmdZone2,
cmdZone3,
cmdSpeakerSetB,
cmdNightMode,
cmdTrigControl1,
cmdTrigControl2
} AVRSubsystem_E;
/// @brief Send the power command
/// @param cmd
/// @return true
///
bool Power(AVRPower_T cmd);
bool Power(AVROnOff_E cmd);
// MasterVolumeButton
// Issues volume up and down commands to the AVR.
//
typedef enum {
avrVolumeUp,
avrVolumeDown,
} AVRVolumeButton_T;
bool MasterVolumeButton(AVRVolumeButton_T cmd);
// Mute, UnMute
typedef enum {
avrMute,
avrUnMute,
} AVRMute_T;
/// @brief Mute and Unmute
/// @param mute is avrMute or avrUnMute
/// @return true
bool Mute(AVRMute_T mute);
bool VolumeButton(AVRVolume_E cmd);
typedef enum {
mtModelInfo,
@@ -92,6 +156,14 @@ public:
///
void ReportAllStatus();
/// @brief This is public to start, maybe forever because it offers the generic capability
/// @param p the message to send
/// @param len of the message
/// @return true
bool ProcessSerialQueue(const void *p = NULL, uint16_t len = NULL);
private:
uint32_t sentAtTime_ms;
@@ -112,8 +184,9 @@ private:
}
// Each DT is the hex-character from the stream
//
//
//
// This could be simplified to uint8_t DT[138]
//
typedef struct {
uint8_t DT0; // * Baud Rate '@'
uint8_t DT1; // * Receive Buffer 'E'
@@ -292,7 +365,9 @@ private:
SerialQueue_T serialQueue[SERIALQUEUESIZE];
int serialQueueCount = 0;
bool ProcessSerialQueue(const void *p = NULL, uint16_t len = NULL);
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
bool IsSanityCheckOK();
void MessageHandlerSanityCheck();
@@ -305,6 +380,7 @@ private:
void PCMessage(const char *msg, int len, uint8_t **src, const char *(fncHelper)(uint8_t val) = NULL);
bool ProcessReportResponse(const uint8_t *szBuffer, uint32_t len);
void MessageReport(const char *prefix, const void *buf, size_t len = 0);
bool CheckTheChecksum(const uint8_t *szBuffer, uint32_t num);
uint16_t Hex2Dec(const uint8_t *p, int dig);