Del (a lot!)

This commit is contained in:
2022-12-11 13:50:51 -05:00
parent a69e88c091
commit 17e753c365
27 changed files with 1060 additions and 292 deletions
+19 -14
View File
@@ -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;
}
+3 -2
View File
@@ -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();
+26 -4
View File
@@ -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;
}
+2 -2
View File
@@ -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
+51 -20
View File
@@ -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;
}
+1 -1
View File
@@ -19,7 +19,7 @@ public:
CAvReceiver *mProgramHandle;
int UpdateReceiverStatus(CAvReceiverMainStatus Status);
int UpdateReceiverStatus(CAvReceiverMainStatus Status, CAvReceiverMainStatus Zone2Status);
private:
Ui::CAvReceiverGui *ui;
+21 -8
View File
@@ -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:
{
+74 -2
View File
@@ -137,6 +137,40 @@ int CChalet::RequestDeviceWifiParams()
int CChalet::RequestFirmwareVersion()
{
mNetworkInterface->SendMasterCtrlCommand(CHALET_INTERFACE_GET_FIRMWARE_VERSION_REQUEST,QByteArray());
return RET_OK;
}
int CChalet::RequestClearCommStats()
{
mNetworkInterface->SendMasterCtrlCommand(CHALET_INTERFACE_CLEAR_COMMS_STATS_REQUEST,QByteArray());
return RET_OK;
}
int CChalet::RequestWifiStatus()
{
mNetworkInterface->SendMasterCtrlCommand(CHALET_INTERFACE_GET_WIFI_STATUS_REQUEST,QByteArray());
return RET_OK;
}
int CChalet::WifiStatusReceived(QByteArray Data)
{
quint32 Add = 0;
char byte;
byte = Data.at(1);
Add += (quint32)(byte & 0x000000FF);
Add <<= 8;
byte = Data.at(2);
Add += (quint32)(byte & 0x000000FF);
Add <<= 8;
byte = Data.at(3);
Add += (quint32)(byte & 0x000000FF);
Add <<= 8;
byte = Data.at(4);
Add += (quint32)(byte & 0x000000FF);
QHostAddress IP = QHostAddress(Add);
mChaletGui->UpdateDeviceWifiStatus(Data[0],IP);
return RET_OK;
}
int CChalet::DeviceWiFiParamsReceived(QByteArray *Data)
@@ -170,7 +204,22 @@ int CChalet::DeviceWiFiParamsReceived(QByteArray *Data)
Add += (quint32)(byte & 0x000000FF);
QHostAddress Gateway = QHostAddress(Add);
mChaletGui->UpdateDeviceWiFiParameters(IP, Gateway);
QString APName, APPassword;
quint8 APNameLenght, APPasswordLenght;
bool UseDHCP = false;
if(Data->size() > 9)
{
if(Data->at(8) == 1)
UseDHCP = true;
APNameLenght = Data->at(9);
APPasswordLenght = Data->at(10);
APName = QString(Data->mid(11,APNameLenght));
APPassword = QString(Data->mid(11+APNameLenght,APPasswordLenght));
}
mChaletGui->UpdateDeviceWiFiParameters(IP, Gateway,APName,APPassword,UseDHCP);
return RET_OK;
}
@@ -179,10 +228,17 @@ int CChalet::DeviceFirmwareVersionReceived(QByteArray Data)
mChaletGui->UpdateFirmwareVersion(Data);
}
int CChalet::SetDeviceWifiParams(QString IP, QString Gateway)
int CChalet::SetDeviceWifiParams(QString IP, QString Gateway, bool UseDHCP, QString APName, QString APPwd)
{
QHostAddress DeviceIP;
QHostAddress DeviceGateway;
quint8 APNameLength, APPwdLength;
if(APName.length() > 64)
return RET_ERROR;
if(APPwd.length() > 64)
return RET_ERROR;
if(DeviceIP.setAddress(IP) == false)
{
@@ -226,6 +282,22 @@ int CChalet::SetDeviceWifiParams(QString IP, QString Gateway)
Buffer[4] = byte;
Address >>= 8;
if(UseDHCP)
{
Buffer[8] = 1;
}
else
{
Buffer[8] = 0;
}
Buffer.append(APName.length());
Buffer.append(APPwd.length());
Buffer.append(APName);
Buffer.append(APPwd);
mNetworkInterface->SendMasterCtrlCommand(CHALET_INTERFACE_WIFI_SET_DEVICE_PARAMS_REQUEST,Buffer);
return RET_OK;
+4 -1
View File
@@ -34,9 +34,12 @@ public:
int RequestChaletLogs(QDate StartDate);
int RequestDeviceWifiParams();
int DeviceWiFiParamsReceived(QByteArray *Data);
int SetDeviceWifiParams(QString IP, QString Gateway);
int SetDeviceWifiParams(QString IP, QString Gateway, bool UseDHCP, QString APName, QString APPwd);
int RequestFirmwareVersion();
int DeviceFirmwareVersionReceived(QByteArray Data);
int RequestClearCommStats();
int RequestWifiStatus();
int WifiStatusReceived(QByteArray Data);
signals:
+4 -1
View File
@@ -48,7 +48,10 @@ QDataStream &operator>>(QDataStream &in, CChaletMainStatus &dest)
>> dest.mThisStatusDateTime
>> dest.mLastLoraStatus
>> dest.mStatusToggleBit
>> dest.mChaletTemperature;
>> dest.mChaletTemperature
>> dest.mTotalNbChaletRxCmds
>> dest.mTotalMasterTxCmds
>> dest.mMasterLostRequestCount;
return in;
}
+4
View File
@@ -58,6 +58,10 @@ public:
float mLostRequestPercentage;
int mTotalNbChaletRxCmds;
int mTotalMasterTxCmds;
int mMasterLostRequestCount;
};
QDataStream &operator>>(QDataStream &in, CChaletMainStatus &dest);
+93 -22
View File
@@ -39,6 +39,8 @@ CChaletGui::CChaletGui(QWidget *parent) :
connect(ui->mStartTerminalShellBtn,SIGNAL(clicked(bool)),this,SLOT(StartTerminalShellBtnClicked()));
connect(mGetFimwVersionButtonColorTimer,SIGNAL(timeout()),this,SLOT(GetFirmwVersionBtnColorTimerExpired()));
connect(mGetWifiParamsButtonColorTimer,SIGNAL(timeout()),this,SLOT(GetWifiParamsBtnColorTimerExpired()));
connect(ui->mResetCommStatsBtn,SIGNAL(clicked(bool)),this,SLOT(ResetCommStatsBtnClicked()));
connect(ui->mGetWifiStatusBtn,SIGNAL(clicked(bool)),this,SLOT(GetModuleWifiStatusBtnClicked()));
mBatteryPlotWidget = new QCustomPlot(ui->mPlotWidget);
mBatteryPlotWidget->resize(ui->mPlotWidget->size());
@@ -77,6 +79,21 @@ CChaletGui::CChaletGui(QWidget *parent) :
mFirmVersionDefaultBtnPal = ui->mGetFirmwareVersionBtn->palette();
mWifiDefaultBtnPal = ui->mGetFirmwareVersionBtn->palette();
mChaletLastLostReqCount = 0;
ui->mWiFiModuleStatusLabel->setText("Unknown");
ui->mInverterRlyStatusLabel->setText("Unknown");
ui->mCurrentSensorStateLbl->setText("Current Sensor: Unknown state");
ui->mBatteryVoltageLabel->setText("Battery Voltage: Unknown");
ui->mBatterySOCLabel->setText("Battery SOC: Unknown");
ui->mSolarPanelCurrentLabel->setText("Raw Solar Panel Current: Unknown");
ui->mSolarPanelCurrentCnvLbl->setText("Solar Panel Current (A): Unknown");
ui->mLostReqPercentLbl->setText("N/A");
ui->mTotalRxTxRequestsLbl->setText("Chalet Rx req: ??");
ui->mChaletTemperatureLbl->setText("Temperature: -100)");
}
CChaletGui::~CChaletGui()
@@ -102,15 +119,16 @@ int CChaletGui::UpdateChaletStatus(CChaletMainStatus Status)
pal.setColor(QPalette::WindowText,QColor(Qt::red));
ui->mChaletOnlineStatusLbl->setPalette(pal);
ui->mWiFiModuleStatusLabel->setText("Unknown");
ui->mInverterRlyStatusLabel->setText("Unknown");
ui->mCurrentSensorStateLbl->setText("Current Sensor: Unknown state");
ui->mBatteryVoltageLabel->setText("Battery Voltage: Unknown");
ui->mBatterySOCLabel->setText("Battery SOC: Unknown");
ui->mSolarPanelCurrentLabel->setText("Raw Solar Panel Current: Unknown");
ui->mSolarPanelCurrentCnvLbl->setText("Solar Panel Current (A): Unknown");
ui->mLostReqPercentLbl->setText("N/A");
ui->mChaletTemperatureLbl->setText("Temperature: -100)");
// ui->mWiFiModuleStatusLabel->setText("Unknown");
// ui->mInverterRlyStatusLabel->setText("Unknown");
// ui->mCurrentSensorStateLbl->setText("Current Sensor: Unknown state");
// ui->mBatteryVoltageLabel->setText("Battery Voltage: Unknown");
// ui->mBatterySOCLabel->setText("Battery SOC: Unknown");
// ui->mSolarPanelCurrentLabel->setText("Raw Solar Panel Current: Unknown");
// ui->mSolarPanelCurrentCnvLbl->setText("Solar Panel Current (A): Unknown");
// ui->mLostReqPercentLbl->setText("N/A");
// ui->mTotalRxTxRequestsLbl->setText("Chalet Rx req: ??");
// ui->mChaletTemperatureLbl->setText("Temperature: -100)");
return RET_OK;
@@ -207,12 +225,11 @@ int CChaletGui::UpdateChaletStatus(CChaletMainStatus Status)
QString Voltage = QString("Battery Voltage: %1").arg(Status.mBatteryVoltage);
ui->mBatteryVoltageLabel->setText(Voltage);
QString Current = QString("Raw Solar Panel Current: %1").arg(Status.mBatteryCurrent);
QString Current = QString("Raw Solar Panel Current: %1").arg(Status.mBatteryCurrent - 2);
ui->mSolarPanelCurrentLabel->setText(Current);
float ConvertedCurrent = (float)Status.mBatteryCurrent * (3.3/1023); //*0.080645; // 3.3/(1023*0.04) = 0.080645;
ConvertedCurrent -= (3.3/2);
ConvertedCurrent *= 25;
float ConvertedCurrent = (float)(Status.mBatteryCurrent - 2) * (3.3/1023); //*0.080645; // 3.3/(1023*0.04) = 0.080645;
ConvertedCurrent /= 0.08;
QString CnvCurrent = QString("Solar Panel Current (A): %1").arg(ConvertedCurrent);
ui->mSolarPanelCurrentCnvLbl->setText(CnvCurrent);
@@ -225,6 +242,16 @@ int CChaletGui::UpdateChaletStatus(CChaletMainStatus Status)
ui->mLostReqPercentLbl->setText(Percent);
QString ChaletRxCnt = QString("Chalet Rx req: %1, Master Tx cmds: %2, Master lost reqs: %3").arg(Status.mTotalNbChaletRxCmds).arg(Status.mTotalMasterTxCmds).arg(Status.mMasterLostRequestCount);
ui->mTotalRxTxRequestsLbl->setText(ChaletRxCnt);
if(mChaletLastLostReqCount != Status.mMasterLostRequestCount)
{
QString ChaletLostReqStats = QString("Master --> Chalet: %1\nChalet --> Master: %2").arg((Status.mTotalMasterTxCmds-Status.mTotalNbChaletRxCmds)).arg(Status.mMasterLostRequestCount-(Status.mTotalMasterTxCmds-Status.mTotalNbChaletRxCmds));
ui->mLostReqsStatsLbl->setText(ChaletLostReqStats);
}
mChaletLastLostReqCount = Status.mMasterLostRequestCount;
if(Status.mStatusToggleBit != LastToggle)
{
LastToggle = Status.mStatusToggleBit;
@@ -346,20 +373,24 @@ void CChaletGui::RebootCPUButtonClicked()
void CChaletGui::GetDeviceWiFiParamsButtonClicked(bool state)
{
mProgramHandle->RequestDeviceWifiParams();
}
void CChaletGui::SetDeviceWiFiParamsButtonClicked(bool state)
{
if(mProgramHandle->SetDeviceWifiParams(ui->mWiFiIPAddressEditBx->text(),ui->mWiFiGatewayAddressEditBx->text()) == RET_ERROR)
{
QMessageBox::critical(this,"IP error","Invalid IP address");
}
}
void CChaletGui::UpdateDeviceWiFiParameters(QHostAddress IP, QHostAddress Gateway)
bool UseDHCP = ui->mDHCPEnableChkBx->isChecked();
if(mProgramHandle->SetDeviceWifiParams(ui->mWiFiIPAddressEditBx->text(),ui->mWiFiGatewayAddressEditBx->text(),UseDHCP,ui->mWifiAccessPtNameEditBx->text(),ui->mWifiPasswordEditBx->text()) == RET_ERROR)
{
QMessageBox::critical(this,"IP error","Invalid IP address");
}
}
void CChaletGui::UpdateDeviceWiFiParameters(QHostAddress IP, QHostAddress Gateway, QString APName, QString APPassword, bool UseDHCP)
{
ui->mWiFiIPAddressEditBx->setText(IP.toString());
ui->mWiFiGatewayAddressEditBx->setText(Gateway.toString());
ui->mWifiAccessPtNameEditBx->setText(APName);
ui->mWifiPasswordEditBx->setText(APPassword);
ui->mDHCPEnableChkBx->setChecked(UseDHCP);
QPalette pal = ui->mWiFiGetRemoteSettingsBtn->palette();
pal.setColor(QPalette::Button, QColor(Qt::green));
@@ -375,6 +406,14 @@ void CChaletGui::RebootCPUButtonClicked()
mProgramHandle->RequestFirmwareVersion();
}
void CChaletGui::ResetCommStatsBtnClicked()
{
mChaletLastLostReqCount = 0;
QString ChaletLostReqStats = QString("Master --> Chalet: 0\nChalet --> Master: 0");
ui->mLostReqsStatsLbl->setText(ChaletLostReqStats);
mProgramHandle->RequestClearCommStats();
}
void CChaletGui::UpdateFirmwareVersion(QByteArray Version)
{
QString VersionString(Version);
@@ -391,17 +430,43 @@ void CChaletGui::RebootCPUButtonClicked()
}
void CChaletGui::UpdateDeviceWifiStatus(char WifiState, QHostAddress IP)
{
QString Txt = QString("Module IP Address: %1").arg(IP.toString());
ui->mModuleIPAddressLbl->setText(Txt);
mModuleIPAddress = IP;
}
void CChaletGui::StartSyslogShellBtnClicked()
{
//system("c:\\progra~1\\putty\\putty.exe -load \"0-ChaletDuino_Syslog\"");
// QProcess Putty;
QProcess::startDetached("c:\\progra~1\\putty\\putty.exe -load \"0-ChaletDuino_Syslog\"");
//QProcess::startDetached("c:\\progra~1\\putty\\putty.exe -load \"0-ChaletDuino_Syslog\"");
if(mModuleIPAddress.isNull() || mModuleIPAddress.isBroadcast())
{
QProcess::startDetached("c:\\progra~1\\putty\\putty.exe -load \"0-ChaletDuino_Syslog\"");
}
else
{
QString Proc = QString("c:\\progra~1\\putty\\putty.exe -raw -P 87 %1").arg(mModuleIPAddress.toString());
QProcess::startDetached(Proc);
}
}
void CChaletGui::StartTerminalShellBtnClicked()
{
// system("c:\\program files\\putty\\putty.exe -load \"0-ChaletDuino_Terminal\"");
QProcess::startDetached("c:\\progra~1\\putty\\putty.exe -load \"0-ChaletDuino_Terminal\"");
// QProcess::startDetached("c:\\progra~1\\putty\\putty.exe -load \"0-ChaletDuino_Terminal\"");
if(mModuleIPAddress.isNull() || mModuleIPAddress.isBroadcast())
{
QProcess::startDetached("c:\\progra~1\\putty\\putty.exe -load \"0-ChaletDuino_Terminal\"");
}
else
{
QString Proc = QString("c:\\progra~1\\putty\\putty.exe -raw -P 85 %1").arg(mModuleIPAddress.toString());
QProcess::startDetached(Proc);
}
}
void CChaletGui::GetFirmwVersionBtnColorTimerExpired()
@@ -417,3 +482,9 @@ void CChaletGui::RebootCPUButtonClicked()
ui->mWiFiGetRemoteSettingsBtn->setPalette(mFirmVersionDefaultBtnPal);
ui->mWiFiGetRemoteSettingsBtn->update();
}
void CChaletGui::GetModuleWifiStatusBtnClicked()
{
ui->mModuleIPAddressLbl->setText("Module IP Address: ");
mProgramHandle->RequestWifiStatus();
}
+6 -1
View File
@@ -28,6 +28,8 @@ public:
int ChaletCommActivity();
QTimer *mGetWifiParamsButtonColorTimer, *mGetFimwVersionButtonColorTimer;
QPalette mFirmVersionDefaultBtnPal, mWifiDefaultBtnPal;
int mChaletLastLostReqCount;
QHostAddress mModuleIPAddress;
private:
Ui::CChaletGui *ui;
@@ -43,13 +45,16 @@ public slots:
void GetChaletLogsBtnClicked();
void GetDeviceWiFiParamsButtonClicked(bool);
void SetDeviceWiFiParamsButtonClicked(bool);
void UpdateDeviceWiFiParameters(QHostAddress IP,QHostAddress Gateway);
void UpdateDeviceWiFiParameters(QHostAddress IP,QHostAddress Gateway,QString APName, QString APPassword, bool UseDHCP);
void GetFirmwareVersionBtnClicked();
void UpdateFirmwareVersion(QByteArray Version);
void StartSyslogShellBtnClicked();
void StartTerminalShellBtnClicked();
void GetWifiParamsBtnColorTimerExpired();
void GetFirmwVersionBtnColorTimerExpired();
void ResetCommStatsBtnClicked();
void UpdateDeviceWifiStatus(char WifiState, QHostAddress IP);
void GetModuleWifiStatusBtnClicked();
};
+350 -119
View File
@@ -268,8 +268,8 @@
<widget class="QLabel" name="mLostReqPercentLbl">
<property name="geometry">
<rect>
<x>600</x>
<y>190</y>
<x>430</x>
<y>160</y>
<width>241</width>
<height>16</height>
</rect>
@@ -291,8 +291,8 @@
<widget class="QLabel" name="mChaletCommActivityLbl">
<property name="geometry">
<rect>
<x>600</x>
<y>170</y>
<x>430</x>
<y>140</y>
<width>47</width>
<height>16</height>
</rect>
@@ -304,8 +304,8 @@
<widget class="QLabel" name="mLasCommRequestReceivedLbl">
<property name="geometry">
<rect>
<x>600</x>
<y>150</y>
<x>430</x>
<y>120</y>
<width>301</width>
<height>16</height>
</rect>
@@ -317,7 +317,7 @@
<widget class="QDateEdit" name="mLogStartDateEdit">
<property name="geometry">
<rect>
<x>780</x>
<x>520</x>
<y>210</y>
<width>110</width>
<height>22</height>
@@ -327,7 +327,7 @@
<widget class="QPushButton" name="mGetChaletLogButton">
<property name="geometry">
<rect>
<x>900</x>
<x>640</x>
<y>210</y>
<width>75</width>
<height>23</height>
@@ -350,112 +350,193 @@
<string>Temperature:</string>
</property>
</widget>
<widget class="QLineEdit" name="mWiFiIPAddressEditBx">
<property name="geometry">
<rect>
<x>160</x>
<y>430</y>
<width>221</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>?</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QPushButton" name="mWiFiGetRemoteSettingsBtn">
<property name="geometry">
<rect>
<x>160</x>
<y>400</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>GET</string>
</property>
</widget>
<widget class="QPushButton" name="mWiFiSetRemoteSettingsBtn">
<property name="geometry">
<rect>
<x>250</x>
<y>400</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>SET</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>90</x>
<y>430</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>IP Address:</string>
</property>
</widget>
<widget class="QLineEdit" name="mWiFiGatewayAddressEditBx">
<property name="geometry">
<rect>
<x>160</x>
<y>460</y>
<width>221</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>?</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>90</x>
<y>460</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Gatweway:</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>80</x>
<y>370</y>
<x>70</x>
<y>380</y>
<width>321</width>
<height>131</height>
<height>231</height>
</rect>
</property>
<property name="title">
<string>WiFi parameters (stored in flash)</string>
</property>
<widget class="QLineEdit" name="mWifiAccessPtNameEditBx">
<property name="geometry">
<rect>
<x>80</x>
<y>110</y>
<width>221</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>?</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="mAccessPtNameLabel">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Access Pt:</string>
</property>
</widget>
<widget class="QLabel" name="mAccessPtPassLbl">
<property name="geometry">
<rect>
<x>10</x>
<y>140</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Password:</string>
</property>
</widget>
<widget class="QLineEdit" name="mWifiPasswordEditBx">
<property name="geometry">
<rect>
<x>80</x>
<y>140</y>
<width>221</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>?</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>IP Address:</string>
</property>
</widget>
<widget class="QLineEdit" name="mWiFiIPAddressEditBx">
<property name="geometry">
<rect>
<x>80</x>
<y>50</y>
<width>221</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>?</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Gatweway:</string>
</property>
</widget>
<widget class="QLineEdit" name="mWiFiGatewayAddressEditBx">
<property name="geometry">
<rect>
<x>80</x>
<y>80</y>
<width>221</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>?</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QCheckBox" name="mDHCPEnableChkBx">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>70</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>DHCP</string>
</property>
</widget>
<widget class="QPushButton" name="mWiFiGetRemoteSettingsBtn">
<property name="geometry">
<rect>
<x>70</x>
<y>180</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>GET</string>
</property>
</widget>
<widget class="QPushButton" name="mWiFiSetRemoteSettingsBtn">
<property name="geometry">
<rect>
<x>170</x>
<y>180</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>SET</string>
</property>
</widget>
</widget>
<widget class="QLabel" name="mSolarPanelCurrentCnvLbl">
<property name="geometry">
@@ -473,8 +554,8 @@
<widget class="QLabel" name="mFirmwareVersionLabel">
<property name="geometry">
<rect>
<x>180</x>
<y>520</y>
<x>510</x>
<y>590</y>
<width>231</width>
<height>20</height>
</rect>
@@ -491,8 +572,8 @@
<widget class="QPushButton" name="mGetFirmwareVersionBtn">
<property name="geometry">
<rect>
<x>90</x>
<y>520</y>
<x>420</x>
<y>590</y>
<width>75</width>
<height>23</height>
</rect>
@@ -504,8 +585,8 @@
<widget class="QPushButton" name="mStartTerminalShellBtn">
<property name="geometry">
<rect>
<x>60</x>
<y>590</y>
<x>420</x>
<y>620</y>
<width>75</width>
<height>23</height>
</rect>
@@ -517,8 +598,8 @@
<widget class="QPushButton" name="mStartSyslogShellBtn">
<property name="geometry">
<rect>
<x>150</x>
<y>590</y>
<x>510</x>
<y>620</y>
<width>75</width>
<height>23</height>
</rect>
@@ -527,6 +608,156 @@
<string>Syslog</string>
</property>
</widget>
<widget class="QLabel" name="mTotalRxTxRequestsLbl">
<property name="geometry">
<rect>
<x>430</x>
<y>180</y>
<width>521</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Chalet Rx Req :</string>
</property>
</widget>
<widget class="QPushButton" name="mResetCommStatsBtn">
<property name="geometry">
<rect>
<x>420</x>
<y>100</y>
<width>101</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Reset Comm Stats</string>
</property>
</widget>
<widget class="QLabel" name="mLostReqsStatsLbl">
<property name="geometry">
<rect>
<x>700</x>
<y>140</y>
<width>241</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>Master --&gt; Chalet: ??
Chalet --&gt; Master: ??</string>
</property>
</widget>
<widget class="QPushButton" name="mGetWifiStatusBtn">
<property name="geometry">
<rect>
<x>820</x>
<y>590</y>
<width>61</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>GET</string>
</property>
</widget>
<widget class="QLabel" name="mModuleIPAddressLbl">
<property name="geometry">
<rect>
<x>890</x>
<y>590</y>
<width>341</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Module IP Address:</string>
</property>
</widget>
<widget class="QGroupBox" name="mLoraIFGroupBox">
<property name="geometry">
<rect>
<x>890</x>
<y>20</y>
<width>541</width>
<height>201</height>
</rect>
</property>
<property name="title">
<string>Lora module Interface</string>
</property>
<widget class="QLabel" name="mLoraIFModuleType">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>131</width>
<height>61</height>
</rect>
</property>
<property name="text">
<string>Module Type: ???
Module state: ??</string>
</property>
</widget>
<widget class="QSpinBox" name="mLoraChannelSpinBox">
<property name="geometry">
<rect>
<x>470</x>
<y>30</y>
<width>51</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QSpinBox" name="mLoraAddressSpinBox">
<property name="geometry">
<rect>
<x>470</x>
<y>50</y>
<width>51</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>378</x>
<y>30</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Module Channel</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>380</x>
<y>51</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Module Address</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</widget>
<zorder>groupBox_2</zorder>
<zorder>groupBox</zorder>
<zorder>MainPageLabel</zorder>
@@ -552,17 +783,17 @@
<zorder>mLogStartDateEdit</zorder>
<zorder>mGetChaletLogButton</zorder>
<zorder>mChaletTemperatureLbl</zorder>
<zorder>mWiFiIPAddressEditBx</zorder>
<zorder>mWiFiGetRemoteSettingsBtn</zorder>
<zorder>mWiFiSetRemoteSettingsBtn</zorder>
<zorder>label</zorder>
<zorder>mWiFiGatewayAddressEditBx</zorder>
<zorder>label_2</zorder>
<zorder>mSolarPanelCurrentCnvLbl</zorder>
<zorder>mFirmwareVersionLabel</zorder>
<zorder>mGetFirmwareVersionBtn</zorder>
<zorder>mStartTerminalShellBtn</zorder>
<zorder>mStartSyslogShellBtn</zorder>
<zorder>mTotalRxTxRequestsLbl</zorder>
<zorder>mResetCommStatsBtn</zorder>
<zorder>mLostReqsStatsLbl</zorder>
<zorder>mGetWifiStatusBtn</zorder>
<zorder>mModuleIPAddressLbl</zorder>
<zorder>mLoraIFGroupBox</zorder>
</widget>
<resources/>
<connections/>
@@ -99,6 +99,11 @@ int CChaletMasterCtrlInterface::DeviceFrameReceived(int TargetDeviceID, int Targ
mProgramHandle->DeviceFirmwareVersionReceived(Data);
break;
}
case CHALET_INTERFACE_GET_WIFI_STATUS_RESPONSE:
{
mProgramHandle->WifiStatusReceived(Data);
break;
}
case CHALET_INTERFACE_GENERAL_STATUS_REQUEST:
case CHALET_INTERFACE_AC_POWER_STATE_STATUS_REQUEST:
case CHALET_INTERFACE_AC_POWER_SET_STATE_REQUEST:
+54 -23
View File
@@ -7,6 +7,7 @@ CIspindel::CIspindel(CIspindelGUI *IspindelGui)
mIspindelGui = IspindelGui;
IspindelGui->mProgramHandle = this;
mNetworkInterface = new CIspindelInterface(this);
mOG = 0.0;
}
@@ -42,10 +43,12 @@ void CIspindel::IspindelFullBufferReceived(QByteArray *Data)
mIspindelDataList.append(NewFrame);
}
mOG = mIspindelDataList.first()->mGravity;
SetLasFrameTextInGUI(*mIspindelDataList.last());
mIspindelGui->UpdateIspindelPlot(&mIspindelDataList);
}
void CIspindel::IspindelLastFrameReceived(QByteArray Data)
@@ -66,6 +69,19 @@ void CIspindel::IspindelLastFrameReceived(QByteArray Data)
// qDebug("Latest Ispindel data received");
}
int CIspindel::DeleteSampleResponseReceived(QByteArray Data)
{
bool Success;
QDataStream Strm(&Data,QIODevice::ReadOnly | QIODevice::Unbuffered);
Strm >> Success;
if(Success)
{
mNetworkInterface->SendMasterCtrlCommand(ISPINDEL_GET_FULL_DATA_BUFFER_REQUEST,QByteArray());
return RET_OK;
}
return RET_ERROR;
}
void CIspindel::ClearIspindleDataList()
{
@@ -88,8 +104,9 @@ void CIspindel::ConnectedToMaster(bool connected)
void CIspindel::SetLasFrameTextInGUI(CIspindelData Frame)
{
QString FrameText;
QString ABVText;
FrameText = QString("\nLast Frame:\n------------------------------\nAngle: %1\nBattery Voltage: %2\nGravity: %3\nSample Interval: %4\nIspindel ID: %5\nIspindel Name: %6\nRSSI: %7\nTemperature: %8%9\nSample date time: %10\n------------------------------")\
FrameText = QString("\nLast Frame:\n------------------------------\nAngle: %1\nBattery Voltage: %2\nGravity: %3\nSample Interval: %4\nIspindel ID: %5\nIspindel Name: %6\nRSSI: %7\nTemperature: %8%9 (%11F)\nSample date time: %10\n------------------------------")\
.arg(Frame.mAngle)\
.arg(Frame.mBattery)\
.arg(Frame.mGravity)\
@@ -98,26 +115,40 @@ void CIspindel::SetLasFrameTextInGUI(CIspindelData Frame)
.arg(Frame.mIspindelName)\
.arg(Frame.mRSSI)\
.arg(Frame.mTemperature).arg(Frame.mTemperatureUnits)\
.arg(Frame.mSampleDateTime.toString("yyyy-MM-dd - hh:mm:ss"));
// FrameText = QString("\nLast Frame\n\
// Angle: %1\n\
// Battery Voltage: %2\n\
// Gravity: %3\n\
// Sample Interval: %4\n\
// Ispindel ID: %5\n\
// Ispindel Name: %6\n\
// RSSI: %7\n\
// Temperature: %8%9\n\
// Sample date time: %10")\
// .arg(Frame.mAngle)\
// .arg(Frame.mBattery)\
// .arg(Frame.mGravity)\
// .arg(Frame.mInterval)\
// .arg(Frame.mIspindelID)\
// .arg(Frame.mIspindelName)\
// .arg(Frame.mRSSI)\
// .arg(Frame.mTemperature).arg(Frame.mTemperatureUnits)\
// .arg(Frame.mSampleDateTime.toString("yyyy-MM-dd - hh:mm:ss"));
.arg(Frame.mSampleDateTime.toString("yyyy-MM-dd - hh:mm:ss"))\
.arg(((Frame.mTemperature*9/5)+32));
mIspindelGui->SetLastIspindelFrameData(FrameText);
if(mIspindelDataList.size() > 1)
{
float ABV = ((mOG - Frame.mGravity) * 131.25);
ABVText = QString("ABV : %1\%").arg(ABV);
}
else
{
ABVText = QString("ABV : ?\%");
}
mIspindelGui->SetLastIspindelFrameData(FrameText,ABVText);
}
int CIspindel::SetOGFromItem(int ItemIndex)
{
if(ItemIndex >= mIspindelDataList.size())
return RET_ERROR;
mOG = mIspindelDataList.at(ItemIndex)->mGravity;
SetLasFrameTextInGUI(*mIspindelDataList.last());
return RET_OK;
}
int CIspindel::DeleteSample(int ItemIndex)
{
if(ItemIndex >= mIspindelDataList.size())
return RET_ERROR;
QByteArray Data;
QDataStream Strm(&Data,QIODevice::WriteOnly | QIODevice::Unbuffered);
Strm << ItemIndex;
mNetworkInterface->SendMasterCtrlCommand(ISPINDEL_DELETE_SAMPLE_REQUEST,Data);
}
+4
View File
@@ -25,9 +25,13 @@ public:
void ClearIspindleDataList();
void ConnectedToMaster(bool connected);
void SetLasFrameTextInGUI(CIspindelData Frame);
int SetOGFromItem(int ItemIndex);
int DeleteSample(int ItemIndex);
int DeleteSampleResponseReceived(QByteArray Data);
QList<CIspindelData*> mIspindelDataList;
CIspindelInterface *mNetworkInterface;
double mOG;
+67 -1
View File
@@ -57,6 +57,13 @@ CIspindelGUI::CIspindelGUI(QWidget *parent) :
// mIspindelPlot->graph(1)->addData(now,20);
mIspindelPlot->replot();
ui->mSamplesTable->setColumnCount(4);
ui->mSamplesTable->setHorizontalHeaderLabels(QStringList() << "Sample" << "Date" << "Gravity" << "Temperature");
connect(ui->mSetOGBtn,SIGNAL(clicked(bool)),this,SLOT(SetOGButtonClicked(bool)));
connect(ui->mDelSelectedSampleBtn,SIGNAL(clicked(bool)),this,SLOT(DeleteSampleBtnClicked(bool)));
}
CIspindelGUI::~CIspindelGUI()
@@ -64,9 +71,10 @@ CIspindelGUI::~CIspindelGUI()
delete ui;
}
void CIspindelGUI::SetLastIspindelFrameData(QString Data)
void CIspindelGUI::SetLastIspindelFrameData(QString Data, QString ABVText)
{
ui->mLastFrameDataLbl->setText(Data);
ui->mABVLabel->setText(ABVText);
}
int CIspindelGUI::UpdateIspindelPlot(QList<CIspindelData *> *Data)
@@ -98,6 +106,21 @@ int CIspindelGUI::UpdateIspindelPlot(QList<CIspindelData *> *Data)
mIspindelPlot->replot();
ui->mSamplesTable->setRowCount(Data->size());
QTableWidgetItem *TableItem;
for(int i= 0; i < Data->size(); i++)
{
TableItem = new QTableWidgetItem(QString("%1").arg(i));
ui->mSamplesTable->setItem(i,0,TableItem);
TableItem = new QTableWidgetItem(Data->at(i)->mSampleDateTime.toString("yyyy-MM-dd - hh:mm:ss"));
ui->mSamplesTable->setItem(i,1,TableItem);
TableItem = new QTableWidgetItem(QString("%1").arg(Data->at(i)->mGravity));
ui->mSamplesTable->setItem(i,2,TableItem);
TableItem = new QTableWidgetItem(QString("%1").arg(Data->at(i)->mTemperature));
ui->mSamplesTable->setItem(i,3,TableItem);
}
ui->mSamplesTable->resizeColumnsToContents();
return RET_OK;
}
@@ -106,5 +129,48 @@ int CIspindelGUI::NewIspindelFrameReceived(CIspindelData *Data)
mIspindelPlot->graph(0)->addData(Data->mSampleDateTime.toSecsSinceEpoch(),Data->mGravity);
mIspindelPlot->graph(1)->addData(Data->mSampleDateTime.toSecsSinceEpoch(),Data->mTemperature);
QTableWidgetItem *TableItem;
int RowIndex = ui->mSamplesTable->rowCount();
ui->mSamplesTable->insertRow(RowIndex);
TableItem = new QTableWidgetItem(QString("%1").arg(RowIndex));
ui->mSamplesTable->setItem(RowIndex,0,TableItem);
TableItem = new QTableWidgetItem(Data->mSampleDateTime.toString("yyyy-MM-dd - hh:mm:ss"));
ui->mSamplesTable->setItem(RowIndex,1,TableItem);
TableItem = new QTableWidgetItem(QString("%1").arg(Data->mGravity));
ui->mSamplesTable->setItem(RowIndex,2,TableItem);
TableItem = new QTableWidgetItem(QString("%1").arg(Data->mTemperature));
ui->mSamplesTable->setItem(RowIndex,3,TableItem);
mIspindelPlot->replot();
return RET_OK;
}
void CIspindelGUI::SetOGButtonClicked(bool)
{
QList<QTableWidgetItem*> SelectedItemsList;
SelectedItemsList = ui->mSamplesTable->selectedItems();
if(SelectedItemsList.size() == 0)
return;
int SampleIndex = SelectedItemsList.at(0)->row();
mProgramHandle->SetOGFromItem(SampleIndex);
}
void CIspindelGUI::DeleteSampleBtnClicked(bool)
{
QList<QTableWidgetItem*> SelectedItemsList;
SelectedItemsList = ui->mSamplesTable->selectedItems();
if(SelectedItemsList.size() == 0)
return;
int SampleIndex = SelectedItemsList.at(0)->row();
mProgramHandle->DeleteSample(SampleIndex);
}
+7 -1
View File
@@ -21,12 +21,18 @@ public:
~CIspindelGUI();
CIspindel *mProgramHandle;
void SetLastIspindelFrameData(QString Data);
void SetLastIspindelFrameData(QString Data, QString ABVText);
int UpdateIspindelPlot(QList<CIspindelData*> *Data);
int NewIspindelFrameReceived(CIspindelData *Data);
QCustomPlot *mIspindelPlot;
public slots:
void SetOGButtonClicked(bool );
void DeleteSampleBtnClicked(bool);
private:
Ui::CIspindelGUI *ui;
};
+51 -5
View File
@@ -16,8 +16,8 @@
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>510</x>
<y>20</y>
<x>520</x>
<y>0</y>
<width>91</width>
<height>41</height>
</rect>
@@ -45,9 +45,9 @@
<property name="geometry">
<rect>
<x>60</x>
<y>50</y>
<y>10</y>
<width>381</width>
<height>211</height>
<height>241</height>
</rect>
</property>
<property name="font">
@@ -65,7 +65,7 @@
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QTableWidget" name="tableWidget">
<widget class="QTableWidget" name="mSamplesTable">
<property name="geometry">
<rect>
<x>10</x>
@@ -75,6 +75,52 @@
</rect>
</property>
</widget>
<widget class="QLabel" name="mABVLabel">
<property name="geometry">
<rect>
<x>660</x>
<y>50</y>
<width>231</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>ABV : ?</string>
</property>
</widget>
<widget class="QPushButton" name="mSetOGBtn">
<property name="geometry">
<rect>
<x>650</x>
<y>10</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Set OG</string>
</property>
</widget>
<widget class="QPushButton" name="mDelSelectedSampleBtn">
<property name="geometry">
<rect>
<x>520</x>
<y>590</y>
<width>81</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Delete Sample</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
+6
View File
@@ -48,8 +48,14 @@ int CIspindelInterface::DeviceFrameReceived(int TargetDeviceID, int TargetDevice
mProgramHandle->IspindelLastFrameReceived(Data);
break;
}
case ISPINDEL_DELETE_SAMPLE_RESPONSE:
{
mProgramHandle->DeleteSampleResponseReceived(Data);
break;
}
case ISPINDEL_GET_FULL_DATA_BUFFER_REQUEST:
case ISPINDLE_LATEST_DATA_REQUEST:
case ISPINDEL_DELETE_SAMPLE_REQUEST:
default:
{
qDebug("Ispindel: Invalid Ethernet Msg received from MasterCtrl: %d",MessageID);
+30 -4
View File
@@ -235,10 +235,10 @@ enum AV_RECEIVER_INTERFACE_CMDS
AV_RECEIVER_INTERFACE_GENERAL_STATUS_RESPONSE,
AV_RECEIVER_INTERFACE_SET_MAIN_POWER_REQUEST,
AV_RECEIVER_INTERFACE_SET_MAIN_POWER_RESPONSE,
AV_RECEIVER_INTERFACE_SET_SPEAKERB_REQUEST,
AV_RECEIVER_INTERFACE_SET_SPEAKERB_RESPONSE,
AV_RECEIVER_INTERFACE_SET_SPEAKERA_REQUEST,
AV_RECEIVER_INTERFACE_SET_SPEAKERA_RESPONSE,
AV_RECEIVER_INTERFACE_SET_ZONE2_REQUEST,
AV_RECEIVER_INTERFACE_SET_ZONE2_RESPONSE,
AV_RECEIVER_INTERFACE_SET_MAIN_ZONE_REQUEST,
AV_RECEIVER_INTERFACE_SET_MAIN_ZONE_RESPONSE,
AV_RECEIVER_INTERFACE_SET_SPEAKERS_REQUEST,
AV_RECEIVER_INTERFACE_SET_SPEAKERS_RESPONSE,
AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_REQUEST,
@@ -276,6 +276,10 @@ enum CHALET_INTERFACE_CMDS
CHALET_INTERFACE_WIFI_SET_DEVICE_PARAMS_RESPONSE,
CHALET_INTERFACE_GET_FIRMWARE_VERSION_REQUEST,
CHALET_INTERFACE_GET_FIRMWARE_VERSION_RESPONSE,
CHALET_INTERFACE_CLEAR_COMMS_STATS_REQUEST,
CHALET_INTERFACE_CLEAR_COMMS_STATS_RESPONSE,
CHALET_INTERFACE_GET_WIFI_STATUS_REQUEST,
CHALET_INTERFACE_GET_WIFI_STATUS_RESPONSE,
MAX_CHALET_INTERFACE_CMD
@@ -306,6 +310,8 @@ enum CHALET_CMDS
CHALET_GET_STORED_WIFI_SETTINGS_RESPONSE,
CHALET_SET_STORED_WIFI_SETTINGS_REQUEST,
CHALET_SET_STORED_WIFI_SETTINGS_RESPONSE,
CHALET_CLEAR_COMMS_STATISTICS_REQUEST,
CHALET_CLEAR_COMMS_STATISTICS_RESPONSE,
MAX_CHALET_CMD
@@ -352,8 +358,28 @@ enum ISPINDLE_CMDS
ISPINDLE_LATEST_DATA_RESPONSE,
ISPINDEL_GET_FULL_DATA_BUFFER_REQUEST,
ISPINDEL_GET_FULL_DATA_BUFFER_RESPONSE,
ISPINDEL_DELETE_SAMPLE_REQUEST,
ISPINDEL_DELETE_SAMPLE_RESPONSE,
MAX_ISPINDLE_CMDS
};
enum LORA_INTERFACE_CMDS
{
LORA_IF_ACK = 1,
LORA_IF_GET_STATUS_REQUEST,
LORA_IF_GET_STATUS_RESPONSE,
LORA_IF_SEND_FRAME_REQUEST,
LORA_IF_SEND_FRAME_RESPONSE,
LORA_IF_NEW_FRAME_RESPONSE,
LORA_IF_GET_MODULE_CONFIG_REQUEST,
LORA_IF_GET_MODULE_CONFIG_RESPONSE,
LORA_IF_GET_RSSI_REQUEST,
LORA_IF_GET_RSSI_RESPONSE,
LORA_IF_SET_MODULE_CONFIG_REQUEST,
LORA_IF_SET_MODULE_CONFIG_RESPONSE,
MAX_LORA_IF_CMD
};
#endif
+3
View File
@@ -50,6 +50,9 @@ CLightShowWidget::CLightShowWidget(QWidget *parent)
setSceneRect(-100,-100,parentWidget()->geometry().width(),parentWidget()->geometry().height());
setMinimumSize(parentWidget()->geometry().width(),parentWidget()->geometry().height());
mScene->views().at(0)->setBackgroundBrush(QBrush(QColor(Qt::black)));
}