Del (a lot!)
This commit is contained in:
@@ -27,40 +27,40 @@ int CAvReceiver::Start()
|
||||
}
|
||||
|
||||
|
||||
int CAvReceiver::SpeakerBToggleSwitchPressed(bool state)
|
||||
int CAvReceiver::Zone2ToggleSwitchPressed(bool state)
|
||||
{
|
||||
|
||||
QByteArray SpkrState;
|
||||
SpkrState.clear();
|
||||
QByteArray ZoneState;
|
||||
ZoneState.clear();
|
||||
|
||||
if(state)
|
||||
{
|
||||
SpkrState.append((char)0x01);
|
||||
ZoneState.append((char)0x01);
|
||||
}
|
||||
else
|
||||
{
|
||||
SpkrState.append((char)0x00);
|
||||
ZoneState.append((char)0x00);
|
||||
}
|
||||
return mNetworkInterface->SendMasterCtrlCommand(AV_RECEIVER_INTERFACE_SET_SPEAKERB_REQUEST,SpkrState);
|
||||
return mNetworkInterface->SendMasterCtrlCommand(AV_RECEIVER_INTERFACE_SET_ZONE2_REQUEST,ZoneState);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int CAvReceiver::SpeakerAToggleSwitchPressed(bool state)
|
||||
int CAvReceiver::MainUnitToggleSwitchPressed(bool state)
|
||||
{
|
||||
|
||||
QByteArray SpkrState;
|
||||
SpkrState.clear();
|
||||
QByteArray ZoneState;
|
||||
ZoneState.clear();
|
||||
|
||||
if(state)
|
||||
{
|
||||
SpkrState.append((char)0x01);
|
||||
ZoneState.append((char)0x01);
|
||||
}
|
||||
else
|
||||
{
|
||||
SpkrState.append((char)0x00);
|
||||
ZoneState.append((char)0x00);
|
||||
}
|
||||
return mNetworkInterface->SendMasterCtrlCommand(AV_RECEIVER_INTERFACE_SET_SPEAKERA_REQUEST,SpkrState);
|
||||
return mNetworkInterface->SendMasterCtrlCommand(AV_RECEIVER_INTERFACE_SET_MAIN_ZONE_REQUEST,ZoneState);
|
||||
|
||||
}
|
||||
|
||||
@@ -71,6 +71,11 @@ void CAvReceiver::PollTimerExpired()
|
||||
|
||||
int CAvReceiver::ReceiverGeneralStatusReceived(QByteArray StatusData)
|
||||
{
|
||||
mReceiverStatus.FromByteArray(StatusData);
|
||||
mReceiverGui->UpdateReceiverStatus(mReceiverStatus);
|
||||
QDataStream Strm(&StatusData,QIODevice::ReadOnly | QIODevice::Unbuffered);
|
||||
Strm.device()->seek(0);
|
||||
|
||||
Strm >> mReceiverStatus;
|
||||
Strm >> mZone2Status;
|
||||
mReceiverGui->UpdateReceiverStatus(mReceiverStatus, mZone2Status);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ public:
|
||||
|
||||
int Start();
|
||||
|
||||
int SpeakerBToggleSwitchPressed(bool state);
|
||||
int SpeakerAToggleSwitchPressed(bool state);
|
||||
int Zone2ToggleSwitchPressed(bool state);
|
||||
int MainUnitToggleSwitchPressed(bool state);
|
||||
int ReceiverGeneralStatusReceived(QByteArray StatusData);
|
||||
|
||||
CAvReceiverNetworkCtrlInterface *mNetworkInterface;
|
||||
@@ -27,6 +27,7 @@ public:
|
||||
|
||||
private:
|
||||
CAvReceiverMainStatus mReceiverStatus;
|
||||
CAvReceiverMainStatus mZone2Status;
|
||||
|
||||
public slots:
|
||||
void PollTimerExpired();
|
||||
|
||||
@@ -20,8 +20,6 @@ QByteArray CAvReceiverMainStatus::ToByteArray()
|
||||
Strm << mIsMute;
|
||||
Strm << mInput;
|
||||
Strm << mProgram;
|
||||
Strm << mSpeakerAState;
|
||||
Strm << mSpeakerBState;
|
||||
|
||||
Strm << mDataValid;
|
||||
Strm << mReceiverOnline;
|
||||
@@ -41,8 +39,6 @@ int CAvReceiverMainStatus::FromByteArray(QByteArray Data)
|
||||
Strm >> mIsMute;
|
||||
Strm >> mInput;
|
||||
Strm >> mProgram;
|
||||
Strm >> mSpeakerAState;
|
||||
Strm >> mSpeakerBState;
|
||||
|
||||
Strm >> mDataValid;
|
||||
Strm >> mReceiverOnline;
|
||||
@@ -50,3 +46,29 @@ int CAvReceiverMainStatus::FromByteArray(QByteArray Data)
|
||||
return RET_OK;
|
||||
|
||||
}
|
||||
QDataStream &operator<<(QDataStream &out, const CAvReceiverMainStatus &source)
|
||||
{
|
||||
out << source.mMainPwrStatus
|
||||
<< source.mMainSleepStatus
|
||||
<< source.mMainVolume
|
||||
<< source.mIsMute
|
||||
<< source.mInput
|
||||
<< source.mProgram
|
||||
<< source.mDataValid
|
||||
<< source.mReceiverOnline;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, CAvReceiverMainStatus &dest)
|
||||
{
|
||||
in >> dest.mMainPwrStatus
|
||||
>> dest.mMainSleepStatus
|
||||
>> dest.mMainVolume
|
||||
>> dest.mIsMute
|
||||
>> dest.mInput
|
||||
>> dest.mProgram
|
||||
>> dest.mDataValid
|
||||
>> dest.mReceiverOnline;
|
||||
return in;
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@ public:
|
||||
bool mIsMute;
|
||||
QString mInput;
|
||||
QString mProgram;
|
||||
bool mSpeakerAState;
|
||||
bool mSpeakerBState;
|
||||
|
||||
bool mDataValid;
|
||||
bool mReceiverOnline;
|
||||
|
||||
};
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const CAvReceiverMainStatus &source);
|
||||
QDataStream &operator>>(QDataStream &in, CAvReceiverMainStatus &dest);
|
||||
#endif // AVRECEIVERDATA_H
|
||||
|
||||
@@ -9,8 +9,8 @@ CAvReceiverGui::CAvReceiverGui(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->mSpkBCheckBox,SIGNAL(toggled(bool)),this,SLOT(SpeakerBRadioClicked(bool)));
|
||||
connect(ui->mSpkACheckBox,SIGNAL(toggled(bool)),this,SLOT(SpeakerARadioClicked(bool)));
|
||||
connect(ui->mSpkBCheckBox,SIGNAL(clicked(bool)),this,SLOT(SpeakerBRadioClicked(bool)));
|
||||
connect(ui->mSpkACheckBox,SIGNAL(clicked(bool)),this,SLOT(SpeakerARadioClicked(bool)));
|
||||
}
|
||||
|
||||
CAvReceiverGui::~CAvReceiverGui()
|
||||
@@ -20,29 +20,31 @@ CAvReceiverGui::~CAvReceiverGui()
|
||||
|
||||
void CAvReceiverGui::SpeakerBRadioClicked(bool checked)
|
||||
{
|
||||
mProgramHandle->SpeakerBToggleSwitchPressed(checked);
|
||||
mProgramHandle->Zone2ToggleSwitchPressed(checked);
|
||||
}
|
||||
|
||||
void CAvReceiverGui::SpeakerARadioClicked(bool checked)
|
||||
{
|
||||
mProgramHandle->SpeakerAToggleSwitchPressed(checked);
|
||||
mProgramHandle->MainUnitToggleSwitchPressed(checked);
|
||||
}
|
||||
|
||||
int CAvReceiverGui::UpdateReceiverStatus(CAvReceiverMainStatus Status)
|
||||
int CAvReceiverGui::UpdateReceiverStatus(CAvReceiverMainStatus Status, CAvReceiverMainStatus Zone2Status)
|
||||
{
|
||||
QString StatusText;
|
||||
|
||||
StatusText.clear();
|
||||
StatusText += "Receiver Status:\n\n";
|
||||
StatusText += "Main Receiver Status:\n\n";
|
||||
|
||||
StatusText += "Power: ";
|
||||
if(Status.mMainPwrStatus == true)
|
||||
{
|
||||
StatusText += "ON\n";
|
||||
ui->mSpkACheckBox->setChecked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusText += "OFF\n";
|
||||
ui->mSpkACheckBox->setChecked(false);
|
||||
}
|
||||
|
||||
StatusText += "Mute: ";
|
||||
@@ -75,20 +77,17 @@ int CAvReceiverGui::UpdateReceiverStatus(CAvReceiverMainStatus Status)
|
||||
StatusText +=Status.mProgram;
|
||||
StatusText += "\n";
|
||||
|
||||
StatusText += "Zone A: ";
|
||||
if(Status.mSpeakerAState == true)
|
||||
{
|
||||
StatusText += "ON\n";
|
||||
ui->mSpkACheckBox->setChecked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusText += "OFF\n";
|
||||
ui->mSpkACheckBox->setChecked(false);
|
||||
}
|
||||
ui->mRcvrStatusLabel->setText(StatusText);
|
||||
|
||||
StatusText += "Zone B: ";
|
||||
if(Status.mSpeakerBState == true)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
StatusText = "Zone2 Status\n\n";
|
||||
|
||||
StatusText += "Power: ";
|
||||
if(Zone2Status.mMainPwrStatus == true)
|
||||
{
|
||||
StatusText += "ON\n";
|
||||
ui->mSpkBCheckBox->setChecked(true);
|
||||
@@ -99,6 +98,38 @@ int CAvReceiverGui::UpdateReceiverStatus(CAvReceiverMainStatus Status)
|
||||
ui->mSpkBCheckBox->setChecked(false);
|
||||
}
|
||||
|
||||
StatusText += "Mute: ";
|
||||
if(Zone2Status.mIsMute == true)
|
||||
{
|
||||
StatusText += "ON\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusText += "OFF\n";
|
||||
}
|
||||
|
||||
ui->mRcvrStatusLabel->setText(StatusText);
|
||||
StatusText += "Main sleep: ";
|
||||
if(Zone2Status.mMainSleepStatus == true)
|
||||
{
|
||||
StatusText += "ON\n";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusText += "OFF\n";
|
||||
}
|
||||
|
||||
StatusText += "Volume: ";
|
||||
StatusText += QString("%1").arg(Zone2Status.mMainVolume);
|
||||
StatusText +="\n";
|
||||
StatusText += "Input: ";
|
||||
StatusText +=Zone2Status.mInput;
|
||||
StatusText += "\n";
|
||||
StatusText += "Program: ";
|
||||
StatusText +=Zone2Status.mProgram;
|
||||
StatusText += "\n";
|
||||
|
||||
ui->mZone2StatusLabel->setText(StatusText);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
|
||||
CAvReceiver *mProgramHandle;
|
||||
|
||||
int UpdateReceiverStatus(CAvReceiverMainStatus Status);
|
||||
int UpdateReceiverStatus(CAvReceiverMainStatus Status, CAvReceiverMainStatus Zone2Status);
|
||||
|
||||
private:
|
||||
Ui::CAvReceiverGui *ui;
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
<widget class="QLabel" name="mRcvrStatusLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>110</y>
|
||||
<x>50</x>
|
||||
<y>130</y>
|
||||
<width>181</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
@@ -42,27 +42,40 @@
|
||||
<widget class="QCheckBox" name="mSpkBCheckBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>570</x>
|
||||
<y>130</y>
|
||||
<x>280</x>
|
||||
<y>110</y>
|
||||
<width>70</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Speaker B</string>
|
||||
<string>Zone 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="mSpkACheckBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>570</x>
|
||||
<y>160</y>
|
||||
<x>50</x>
|
||||
<y>110</y>
|
||||
<width>70</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Speaker A</string>
|
||||
<string>Main Zone</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="mZone2StatusLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>140</y>
|
||||
<width>171</width>
|
||||
<height>191</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@@ -39,7 +39,7 @@ int CAvReceiverNetworkCtrlInterface::DeviceFrameReceived(int TargetDeviceID, int
|
||||
break;
|
||||
}
|
||||
|
||||
case AV_RECEIVER_INTERFACE_SET_SPEAKERB_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_RESPONSE:
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ int CAvReceiverNetworkCtrlInterface::DeviceFrameReceived(int TargetDeviceID, int
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_GENERAL_STATUS_REQUEST:
|
||||
case AV_RECEIVER_INTERFACE_SET_MAIN_POWER_REQUEST:
|
||||
case AV_RECEIVER_INTERFACE_SET_SPEAKERB_REQUEST:
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_REQUEST:
|
||||
case AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_REQUEST:
|
||||
default:
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user