Compare commits
10 Commits
50d091c68c
...
2dfd185494
| Author | SHA1 | Date | |
|---|---|---|---|
| 2dfd185494 | |||
| ac8490b5ee | |||
| 59b07d5db3 | |||
| 635d754d27 | |||
| 52841786a9 | |||
| 17e753c365 | |||
| a69e88c091 | |||
| 75b487a862 | |||
| 512bc280e7 | |||
| f7eeb9ecf4 |
8873
ChaletLora.X.production.hex
Normal file
8873
ChaletLora.X.production.hex
Normal file
File diff suppressed because it is too large
Load Diff
0
DisplaySwitch.exe
Normal file
0
DisplaySwitch.exe
Normal file
@ -11,6 +11,9 @@ CAvReceiver::CAvReceiver(CAvReceiverGui *ReceiverGui)
|
|||||||
mReceiverPollTimer->setSingleShot(false);
|
mReceiverPollTimer->setSingleShot(false);
|
||||||
mReceiverPollTimer->setInterval(1000);
|
mReceiverPollTimer->setInterval(1000);
|
||||||
connect(mReceiverPollTimer,SIGNAL(timeout()),this,SLOT(PollTimerExpired()));
|
connect(mReceiverPollTimer,SIGNAL(timeout()),this,SLOT(PollTimerExpired()));
|
||||||
|
|
||||||
|
connect(&mVolumeController,&CVolumeController::ExternalVolumeChanged,this,&CAvReceiver::ExternalVolumeChanged);
|
||||||
|
mTempReceiverVolume = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAvReceiver::~CAvReceiver()
|
CAvReceiver::~CAvReceiver()
|
||||||
@ -23,44 +26,45 @@ int CAvReceiver::Start()
|
|||||||
{
|
{
|
||||||
mNetworkInterface->ConnectToMasterCtrl();
|
mNetworkInterface->ConnectToMasterCtrl();
|
||||||
mReceiverPollTimer->start();
|
mReceiverPollTimer->start();
|
||||||
|
mVolumeController.Init(this);
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int CAvReceiver::SpeakerBToggleSwitchPressed(bool state)
|
int CAvReceiver::Zone2ToggleSwitchPressed(bool state)
|
||||||
{
|
{
|
||||||
|
|
||||||
QByteArray SpkrState;
|
QByteArray ZoneState;
|
||||||
SpkrState.clear();
|
ZoneState.clear();
|
||||||
|
|
||||||
if(state)
|
if(state)
|
||||||
{
|
{
|
||||||
SpkrState.append((char)0x01);
|
ZoneState.append((char)0x01);
|
||||||
}
|
}
|
||||||
else
|
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;
|
QByteArray ZoneState;
|
||||||
SpkrState.clear();
|
ZoneState.clear();
|
||||||
|
|
||||||
if(state)
|
if(state)
|
||||||
{
|
{
|
||||||
SpkrState.append((char)0x01);
|
ZoneState.append((char)0x01);
|
||||||
}
|
}
|
||||||
else
|
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 +75,88 @@ void CAvReceiver::PollTimerExpired()
|
|||||||
|
|
||||||
int CAvReceiver::ReceiverGeneralStatusReceived(QByteArray StatusData)
|
int CAvReceiver::ReceiverGeneralStatusReceived(QByteArray StatusData)
|
||||||
{
|
{
|
||||||
mReceiverStatus.FromByteArray(StatusData);
|
QDataStream Strm(&StatusData,QIODevice::ReadOnly | QIODevice::Unbuffered);
|
||||||
mReceiverGui->UpdateReceiverStatus(mReceiverStatus);
|
Strm.device()->seek(0);
|
||||||
|
|
||||||
|
Strm >> mReceiverStatus;
|
||||||
|
Strm >> mZone2Status;
|
||||||
|
mReceiverGui->UpdateReceiverStatus(mReceiverStatus, mZone2Status);
|
||||||
|
mTempReceiverVolume = mReceiverStatus.mMainVolume;
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
int CAvReceiver::SelectScenePressed(char Zone, char Scene)
|
||||||
|
{
|
||||||
|
QByteArray SceneData;
|
||||||
|
SceneData.append(Zone).append(Scene);
|
||||||
|
|
||||||
|
return mNetworkInterface->SendMasterCtrlCommand(AV_RECEIVER_INTERFACE_SELECT_SCENE_REQUEST,SceneData);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CAvReceiver::MainZoneVolumeChanged(float Value)
|
||||||
|
{
|
||||||
|
// qDebug("MainZoneVolumeChanged : %f",Value);
|
||||||
|
QByteArray VolumeData;
|
||||||
|
QDataStream Strm(&VolumeData,QIODevice::WriteOnly);
|
||||||
|
Strm << Value;
|
||||||
|
return mNetworkInterface->SendMasterCtrlCommand(AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_REQUEST,VolumeData);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CAvReceiver::Zone2VolumeChanged(float Value)
|
||||||
|
{
|
||||||
|
QByteArray VolumeData;
|
||||||
|
QDataStream Strm(&VolumeData,QIODevice::WriteOnly);
|
||||||
|
Strm << Value;
|
||||||
|
return mNetworkInterface->SendMasterCtrlCommand(AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_REQUEST,VolumeData);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CAvReceiver::SyncZonesVolumesChanged(bool Sync)
|
||||||
|
{
|
||||||
|
QByteArray SyncData;
|
||||||
|
QDataStream Strm(&SyncData,QIODevice::WriteOnly);
|
||||||
|
Strm << Sync;
|
||||||
|
return mNetworkInterface->SendMasterCtrlCommand(AV_RECEIVER_INTERFACE_SET_SYNC_Z2_WITH_Z1_REQUEST,SyncData);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CAvReceiver::Zone2InputSrcChanged(QString InputSrc)
|
||||||
|
{
|
||||||
|
QByteArray SourceData;
|
||||||
|
QDataStream Strm(&SourceData,QIODevice::WriteOnly);
|
||||||
|
Strm << InputSrc;
|
||||||
|
return mNetworkInterface->SendMasterCtrlCommand(AV_RECEIVER_INTERFACE_SET_ZONE2_INPUT_REQUEST,SourceData);
|
||||||
|
}
|
||||||
|
|
||||||
|
//We need to implement this in a slot because the Windows API runs in a differen Thread and it crashes the MasterCtrl socket.
|
||||||
|
void CAvReceiver::ExternalVolumeChanged(float Value)
|
||||||
|
{
|
||||||
|
float ValueInPercent;
|
||||||
|
float Ret;
|
||||||
|
if(Value > 0)
|
||||||
|
{
|
||||||
|
mTempReceiverVolume += Value;
|
||||||
|
MainZoneVolumeChanged(mTempReceiverVolume);
|
||||||
|
Ret = 0.04;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(mTempReceiverVolume == -80.5)
|
||||||
|
{
|
||||||
|
Ret = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mTempReceiverVolume += Value;
|
||||||
|
if(mTempReceiverVolume == -80.5)
|
||||||
|
{
|
||||||
|
MainZoneVolumeChanged(mTempReceiverVolume);
|
||||||
|
Ret = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainZoneVolumeChanged(mTempReceiverVolume);
|
||||||
|
Ret = 0.04;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mVolumeController.SetMasterVolume(Ret);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "AvReceiverData.h"
|
#include "AvReceiverData.h"
|
||||||
|
#include "VolumeController.h"
|
||||||
|
|
||||||
class CAvReceiverNetworkCtrlInterface;
|
class CAvReceiverNetworkCtrlInterface;
|
||||||
|
|
||||||
@ -17,20 +18,30 @@ public:
|
|||||||
|
|
||||||
int Start();
|
int Start();
|
||||||
|
|
||||||
int SpeakerBToggleSwitchPressed(bool state);
|
int Zone2ToggleSwitchPressed(bool state);
|
||||||
int SpeakerAToggleSwitchPressed(bool state);
|
int MainUnitToggleSwitchPressed(bool state);
|
||||||
int ReceiverGeneralStatusReceived(QByteArray StatusData);
|
int ReceiverGeneralStatusReceived(QByteArray StatusData);
|
||||||
|
int SelectScenePressed(char Zone, char Scene);
|
||||||
|
int MainZoneVolumeChanged(float Value);
|
||||||
|
int Zone2VolumeChanged(float Value);
|
||||||
|
int Zone2InputSrcChanged(QString InputSrc);
|
||||||
|
int SyncZonesVolumesChanged(bool Sync);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CAvReceiverNetworkCtrlInterface *mNetworkInterface;
|
CAvReceiverNetworkCtrlInterface *mNetworkInterface;
|
||||||
CAvReceiverGui *mReceiverGui;
|
CAvReceiverGui *mReceiverGui;
|
||||||
QTimer *mReceiverPollTimer;
|
QTimer *mReceiverPollTimer;
|
||||||
|
CVolumeController mVolumeController;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CAvReceiverMainStatus mReceiverStatus;
|
CAvReceiverMainStatus mReceiverStatus;
|
||||||
|
CAvReceiverMainStatus mZone2Status;
|
||||||
|
float mTempReceiverVolume;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void PollTimerExpired();
|
void PollTimerExpired();
|
||||||
|
void ExternalVolumeChanged(float Value);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AVRECEIVER_H
|
#endif // AVRECEIVER_H
|
||||||
|
|||||||
@ -20,11 +20,10 @@ QByteArray CAvReceiverMainStatus::ToByteArray()
|
|||||||
Strm << mIsMute;
|
Strm << mIsMute;
|
||||||
Strm << mInput;
|
Strm << mInput;
|
||||||
Strm << mProgram;
|
Strm << mProgram;
|
||||||
Strm << mSpeakerAState;
|
|
||||||
Strm << mSpeakerBState;
|
|
||||||
|
|
||||||
Strm << mDataValid;
|
Strm << mDataValid;
|
||||||
Strm << mReceiverOnline;
|
Strm << mReceiverOnline;
|
||||||
|
Strm << mSyncZonesVolumes;
|
||||||
|
|
||||||
return Output;
|
return Output;
|
||||||
|
|
||||||
@ -41,12 +40,39 @@ int CAvReceiverMainStatus::FromByteArray(QByteArray Data)
|
|||||||
Strm >> mIsMute;
|
Strm >> mIsMute;
|
||||||
Strm >> mInput;
|
Strm >> mInput;
|
||||||
Strm >> mProgram;
|
Strm >> mProgram;
|
||||||
Strm >> mSpeakerAState;
|
|
||||||
Strm >> mSpeakerBState;
|
|
||||||
|
|
||||||
Strm >> mDataValid;
|
Strm >> mDataValid;
|
||||||
Strm >> mReceiverOnline;
|
Strm >> mReceiverOnline;
|
||||||
|
Strm >> mSyncZonesVolumes;
|
||||||
|
|
||||||
return RET_OK;
|
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
|
||||||
|
<< source.mSyncZonesVolumes;
|
||||||
|
|
||||||
|
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
|
||||||
|
>> dest.mSyncZonesVolumes;
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|||||||
@ -3,6 +3,16 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include "GlobalDefine.h"
|
#include "GlobalDefine.h"
|
||||||
|
|
||||||
|
#define MAIN_ZONE_MIN_VOLUME (float)-80.5
|
||||||
|
#define MAIN_ZONE_MAX_VOLUME (float)16.5
|
||||||
|
|
||||||
|
enum eAVReceiverZones
|
||||||
|
{
|
||||||
|
AV_RECEIVER_MAIN_ZONE = 1,
|
||||||
|
AV_RECEIVER_ZONE_2,
|
||||||
|
|
||||||
|
AV_RECEIVER_MAX_ZONE
|
||||||
|
};
|
||||||
|
|
||||||
class CAvReceiverMainStatus
|
class CAvReceiverMainStatus
|
||||||
{
|
{
|
||||||
@ -19,12 +29,13 @@ public:
|
|||||||
bool mIsMute;
|
bool mIsMute;
|
||||||
QString mInput;
|
QString mInput;
|
||||||
QString mProgram;
|
QString mProgram;
|
||||||
bool mSpeakerAState;
|
bool mSyncZonesVolumes;
|
||||||
bool mSpeakerBState;
|
|
||||||
|
|
||||||
bool mDataValid;
|
bool mDataValid;
|
||||||
bool mReceiverOnline;
|
bool mReceiverOnline;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QDataStream &operator<<(QDataStream &out, const CAvReceiverMainStatus &source);
|
||||||
|
QDataStream &operator>>(QDataStream &in, CAvReceiverMainStatus &dest);
|
||||||
#endif // AVRECEIVERDATA_H
|
#endif // AVRECEIVERDATA_H
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "AvReceiverGui.h"
|
#include "AvReceiverGui.h"
|
||||||
#include "ui_AvReceiverGui.h"
|
#include "ui_AvReceiverGui.h"
|
||||||
|
#include "TrayVolumeCtrl.h"
|
||||||
|
|
||||||
#include "AvReceiver.h"
|
#include "AvReceiver.h"
|
||||||
|
|
||||||
@ -8,41 +9,63 @@ CAvReceiverGui::CAvReceiverGui(QWidget *parent) :
|
|||||||
ui(new Ui::CAvReceiverGui)
|
ui(new Ui::CAvReceiverGui)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
mVolumeBarMovementTimer = new QTimer();
|
||||||
|
mVolumeBarMovementTimer->setInterval(500);
|
||||||
|
mVolumeBarMovementTimer->setSingleShot(true);
|
||||||
|
mLockZone2VolumeWithZone1 = false;
|
||||||
|
|
||||||
connect(ui->mSpkBCheckBox,SIGNAL(toggled(bool)),this,SLOT(SpeakerBRadioClicked(bool)));
|
mTrayVolumeCtrlGuiHandle = 0;
|
||||||
connect(ui->mSpkACheckBox,SIGNAL(toggled(bool)),this,SLOT(SpeakerARadioClicked(bool)));
|
|
||||||
|
|
||||||
|
ui->mZone2InputComboBx->addItems(QStringList() << "AUDIO1" << "AUDIO2" << "AUDIO3" << "AUDIO4" << "AUDIO5" << "PHONO" << "TUNER" << "SERVER" << "Main Zone Sync");
|
||||||
|
ui->mZone2InputComboBx->setEditable(false);
|
||||||
|
|
||||||
|
connect(mVolumeBarMovementTimer,SIGNAL(timeout()),this,SLOT(VolumeBarMovementTimerExpired()));
|
||||||
|
connect(ui->mSpkBCheckBox,SIGNAL(clicked(bool)),this,SLOT(SpeakerBRadioClicked(bool)));
|
||||||
|
connect(ui->mSpkACheckBox,SIGNAL(clicked(bool)),this,SLOT(SpeakerARadioClicked(bool)));
|
||||||
|
connect(ui->MainZoneScene1Btn,SIGNAL(clicked(bool)),this,SLOT(MainZoneScene1BtnClicked(bool)));
|
||||||
|
connect(ui->MainZoneScene2Btn,SIGNAL(clicked(bool)),this,SLOT(MainZoneScene2BtnClicked(bool)));
|
||||||
|
connect(ui->MainZoneScene3Btn,SIGNAL(clicked(bool)),this,SLOT(MainZoneScene3BtnClicked(bool)));
|
||||||
|
connect(ui->MainZoneScene4Btn,SIGNAL(clicked(bool)),this,SLOT(MainZoneScene4BtnClicked(bool)));
|
||||||
|
connect(ui->mMainZoneVolumeSldBar,SIGNAL(valueChanged(int)),this,SLOT(MainZoneVolumeSetChanged(int)));
|
||||||
|
connect(ui->mZone2VolumeSldBar,SIGNAL(valueChanged(int)),this,SLOT(Zone2VolumeSetChanged(int)));
|
||||||
|
connect(ui->mZone2InputComboBx,&QComboBox::currentTextChanged,this,&CAvReceiverGui::Zone2InputSelectionChanged);
|
||||||
|
connect(ui->mZone2SyncVolumeChkBx,&QCheckBox::clicked,this,&CAvReceiverGui::Zone2LockVolumeChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAvReceiverGui::~CAvReceiverGui()
|
CAvReceiverGui::~CAvReceiverGui()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
|
delete mVolumeBarMovementTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAvReceiverGui::SpeakerBRadioClicked(bool checked)
|
void CAvReceiverGui::SpeakerBRadioClicked(bool checked)
|
||||||
{
|
{
|
||||||
mProgramHandle->SpeakerBToggleSwitchPressed(checked);
|
mProgramHandle->Zone2ToggleSwitchPressed(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAvReceiverGui::SpeakerARadioClicked(bool 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;
|
QString StatusText;
|
||||||
|
|
||||||
StatusText.clear();
|
StatusText.clear();
|
||||||
StatusText += "Receiver Status:\n\n";
|
StatusText += "Main Receiver Status:\n\n";
|
||||||
|
|
||||||
StatusText += "Power: ";
|
StatusText += "Power: ";
|
||||||
if(Status.mMainPwrStatus == true)
|
if(Status.mMainPwrStatus == true)
|
||||||
{
|
{
|
||||||
StatusText += "ON\n";
|
StatusText += "ON\n";
|
||||||
|
ui->mSpkACheckBox->setChecked(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StatusText += "OFF\n";
|
StatusText += "OFF\n";
|
||||||
|
ui->mSpkACheckBox->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusText += "Mute: ";
|
StatusText += "Mute: ";
|
||||||
@ -75,20 +98,26 @@ int CAvReceiverGui::UpdateReceiverStatus(CAvReceiverMainStatus Status)
|
|||||||
StatusText +=Status.mProgram;
|
StatusText +=Status.mProgram;
|
||||||
StatusText += "\n";
|
StatusText += "\n";
|
||||||
|
|
||||||
StatusText += "Zone A: ";
|
ui->mRcvrStatusLabel->setText(StatusText);
|
||||||
if(Status.mSpeakerAState == true)
|
|
||||||
|
if(/*ui->mMainZoneVolumeSldBar->isSliderDown() == false && */mVolumeBarMovementTimer->isActive() == false)
|
||||||
{
|
{
|
||||||
StatusText += "ON\n";
|
int SliderValue = ConvertVolumeToBarPosition(Status.mMainVolume);
|
||||||
ui->mSpkACheckBox->setChecked(true);
|
disconnect(ui->mMainZoneVolumeSldBar,SIGNAL(valueChanged(int)),this,SLOT(MainZoneVolumeSetChanged(int)));
|
||||||
}
|
ui->mMainZoneVolumeSldBar->setValue(SliderValue);
|
||||||
else
|
connect(ui->mMainZoneVolumeSldBar,SIGNAL(valueChanged(int)),this,SLOT(MainZoneVolumeSetChanged(int)));
|
||||||
{
|
ui->mMainZoneSliderValueLbl->setText("");
|
||||||
StatusText += "OFF\n";
|
mTrayVolumeCtrlGuiHandle->SetMainZoneVolume(SliderValue,Status.mMainVolume);
|
||||||
ui->mSpkACheckBox->setChecked(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusText += "Zone B: ";
|
|
||||||
if(Status.mSpeakerBState == true)
|
|
||||||
|
|
||||||
|
|
||||||
|
StatusText = "Zone2 Status\n\n";
|
||||||
|
|
||||||
|
StatusText += "Power: ";
|
||||||
|
if(Zone2Status.mMainPwrStatus == true)
|
||||||
{
|
{
|
||||||
StatusText += "ON\n";
|
StatusText += "ON\n";
|
||||||
ui->mSpkBCheckBox->setChecked(true);
|
ui->mSpkBCheckBox->setChecked(true);
|
||||||
@ -99,6 +128,155 @@ int CAvReceiverGui::UpdateReceiverStatus(CAvReceiverMainStatus Status)
|
|||||||
ui->mSpkBCheckBox->setChecked(false);
|
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);
|
||||||
|
ui->mZone2InputComboBx->setCurrentText(Zone2Status.mInput);
|
||||||
|
|
||||||
|
if(/*ui->mZone2VolumeSldBar->isSliderDown() == false && */mVolumeBarMovementTimer->isActive() == false)
|
||||||
|
{
|
||||||
|
int SliderValue = ConvertVolumeToBarPosition(Zone2Status.mMainVolume);
|
||||||
|
disconnect(ui->mZone2VolumeSldBar,SIGNAL(valueChanged(int)),this,SLOT(Zone2VolumeSetChanged(int)));
|
||||||
|
ui->mZone2VolumeSldBar->setValue(SliderValue);
|
||||||
|
connect(ui->mZone2VolumeSldBar,SIGNAL(valueChanged(int)),this,SLOT(Zone2VolumeSetChanged(int)));
|
||||||
|
ui->mZone2SliderValueLbl->setText("");
|
||||||
|
mTrayVolumeCtrlGuiHandle->SetZone2Volume(SliderValue,Zone2Status.mMainVolume);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Status.mSyncZonesVolumes)
|
||||||
|
ui->mZone2SyncVolumeChkBx->setCheckState(Qt::Checked);
|
||||||
|
else
|
||||||
|
ui->mZone2SyncVolumeChkBx->setCheckState(Qt::Unchecked);
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAvReceiverGui::MainZoneScene1BtnClicked(bool)
|
||||||
|
{
|
||||||
|
mProgramHandle->SelectScenePressed(AV_RECEIVER_MAIN_ZONE,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAvReceiverGui::MainZoneScene2BtnClicked(bool)
|
||||||
|
{
|
||||||
|
mProgramHandle->SelectScenePressed(AV_RECEIVER_MAIN_ZONE,2);
|
||||||
|
}
|
||||||
|
void CAvReceiverGui::MainZoneScene3BtnClicked(bool)
|
||||||
|
{
|
||||||
|
mProgramHandle->SelectScenePressed(AV_RECEIVER_MAIN_ZONE,3);
|
||||||
|
}
|
||||||
|
void CAvReceiverGui::MainZoneScene4BtnClicked(bool)
|
||||||
|
{
|
||||||
|
mProgramHandle->SelectScenePressed(AV_RECEIVER_MAIN_ZONE,4);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CAvReceiverGui::ConvertVolumeToBarPosition(float Volume)
|
||||||
|
{
|
||||||
|
int Pos;
|
||||||
|
Pos = (int)((Volume + 80.5) *2);
|
||||||
|
return Pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CAvReceiverGui::ConvertBarPositionToVolume(int position)
|
||||||
|
{
|
||||||
|
float Volume;
|
||||||
|
Volume = (float)position;
|
||||||
|
Volume = ((Volume/2) - 80.5);
|
||||||
|
|
||||||
|
return Volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAvReceiverGui::MainZoneVolumeSetChanged(int value)
|
||||||
|
{
|
||||||
|
// int BarPosition = ui->mMainZoneVolumeSldBar->value();
|
||||||
|
int BarPosition = value;
|
||||||
|
float Volume = ConvertBarPositionToVolume(BarPosition);
|
||||||
|
|
||||||
|
ui->mMainZoneSliderValueLbl->setText(QString("%1").arg(Volume));
|
||||||
|
mProgramHandle->MainZoneVolumeChanged(Volume);
|
||||||
|
|
||||||
|
|
||||||
|
// if(mLockZone2VolumeWithZone1 == true)
|
||||||
|
if(ui->mZone2SyncVolumeChkBx->checkState() == Qt::Checked)
|
||||||
|
{
|
||||||
|
ui->mZone2VolumeSldBar->setValue(BarPosition);
|
||||||
|
// mVolumeBarMovementTimer->start();
|
||||||
|
// //mProgramHandle->Zone2VolumeChanged(Volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAvReceiverGui::Zone2VolumeSetChanged(int value)
|
||||||
|
{
|
||||||
|
// int BarPosition = ui->mZone2VolumeSldBar->value();
|
||||||
|
int BarPosition = value;
|
||||||
|
float Volume = ConvertBarPositionToVolume(BarPosition);
|
||||||
|
|
||||||
|
ui->mZone2SliderValueLbl->setText(QString("%1").arg(Volume));
|
||||||
|
mProgramHandle->Zone2VolumeChanged(Volume);
|
||||||
|
// mVolumeBarMovementTimer->start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAvReceiverGui::VolumeBarMovementTimerExpired()
|
||||||
|
{
|
||||||
|
int BarPosition = ui->mMainZoneVolumeSldBar->value();
|
||||||
|
float Volume = ConvertBarPositionToVolume(BarPosition);
|
||||||
|
mProgramHandle->Zone2VolumeChanged(Volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAvReceiverGui::Zone2LockVolumeChanged(bool checked)
|
||||||
|
{
|
||||||
|
mLockZone2VolumeWithZone1 = checked;
|
||||||
|
if(checked)
|
||||||
|
{
|
||||||
|
// //Set Zone 2 volume to main zone value
|
||||||
|
// int BarPosition = ui->mMainZoneVolumeSldBar->value();
|
||||||
|
// float Volume = ConvertBarPositionToVolume(BarPosition);
|
||||||
|
|
||||||
|
// mProgramHandle->Zone2VolumeChanged(Volume);
|
||||||
|
|
||||||
|
ui->mZone2VolumeSldBar->setEnabled(false);
|
||||||
|
|
||||||
|
mProgramHandle->SyncZonesVolumesChanged(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->mZone2VolumeSldBar->setEnabled(true);
|
||||||
|
mProgramHandle->SyncZonesVolumesChanged(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAvReceiverGui::Zone2InputSelectionChanged()
|
||||||
|
{
|
||||||
|
QString Src = ui->mZone2InputComboBx->currentText();
|
||||||
|
mProgramHandle->Zone2InputSrcChanged(Src);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,9 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
class CAvReceiver;
|
class CAvReceiver;
|
||||||
#include "AvReceiverData.h"
|
#include "AvReceiverData.h"
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
class CTrayVolumeCtrl;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CAvReceiverGui;
|
class CAvReceiverGui;
|
||||||
@ -19,7 +22,12 @@ public:
|
|||||||
|
|
||||||
CAvReceiver *mProgramHandle;
|
CAvReceiver *mProgramHandle;
|
||||||
|
|
||||||
int UpdateReceiverStatus(CAvReceiverMainStatus Status);
|
int UpdateReceiverStatus(CAvReceiverMainStatus Status, CAvReceiverMainStatus Zone2Status);
|
||||||
|
int ConvertVolumeToBarPosition(float Volume);
|
||||||
|
float ConvertBarPositionToVolume(int position);
|
||||||
|
QTimer *mVolumeBarMovementTimer;
|
||||||
|
bool mLockZone2VolumeWithZone1;
|
||||||
|
CTrayVolumeCtrl *mTrayVolumeCtrlGuiHandle;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CAvReceiverGui *ui;
|
Ui::CAvReceiverGui *ui;
|
||||||
@ -27,6 +35,15 @@ private:
|
|||||||
public slots:
|
public slots:
|
||||||
void SpeakerBRadioClicked(bool checked);
|
void SpeakerBRadioClicked(bool checked);
|
||||||
void SpeakerARadioClicked(bool checked);
|
void SpeakerARadioClicked(bool checked);
|
||||||
|
void MainZoneScene1BtnClicked(bool);
|
||||||
|
void MainZoneScene2BtnClicked(bool);
|
||||||
|
void MainZoneScene3BtnClicked(bool);
|
||||||
|
void MainZoneScene4BtnClicked(bool);
|
||||||
|
void MainZoneVolumeSetChanged(int);
|
||||||
|
void Zone2VolumeSetChanged(int);
|
||||||
|
void VolumeBarMovementTimerExpired();
|
||||||
|
void Zone2InputSelectionChanged();
|
||||||
|
void Zone2LockVolumeChanged(bool checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AVRECEIVERGUI_H
|
#endif // AVRECEIVERGUI_H
|
||||||
|
|||||||
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>796</width>
|
<width>883</width>
|
||||||
<height>447</height>
|
<height>453</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -29,10 +29,10 @@
|
|||||||
<widget class="QLabel" name="mRcvrStatusLabel">
|
<widget class="QLabel" name="mRcvrStatusLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>100</x>
|
<x>50</x>
|
||||||
<y>110</y>
|
<y>130</y>
|
||||||
<width>181</width>
|
<width>181</width>
|
||||||
<height>231</height>
|
<height>181</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -42,27 +42,198 @@
|
|||||||
<widget class="QCheckBox" name="mSpkBCheckBox">
|
<widget class="QCheckBox" name="mSpkBCheckBox">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>570</x>
|
<x>350</x>
|
||||||
<y>130</y>
|
<y>110</y>
|
||||||
<width>70</width>
|
<width>70</width>
|
||||||
<height>17</height>
|
<height>17</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Speaker B</string>
|
<string>Zone 2</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QCheckBox" name="mSpkACheckBox">
|
<widget class="QCheckBox" name="mSpkACheckBox">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>570</x>
|
<x>50</x>
|
||||||
<y>160</y>
|
<y>110</y>
|
||||||
<width>70</width>
|
<width>70</width>
|
||||||
<height>17</height>
|
<height>17</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Speaker A</string>
|
<string>Main Zone</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="mZone2StatusLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>370</x>
|
||||||
|
<y>140</y>
|
||||||
|
<width>171</width>
|
||||||
|
<height>191</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QGroupBox" name="MainZoneSceneBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>40</x>
|
||||||
|
<y>320</y>
|
||||||
|
<width>101</width>
|
||||||
|
<height>81</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Scene</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QPushButton" name="MainZoneScene1Btn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>31</width>
|
||||||
|
<height>22</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>1</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="MainZoneScene2Btn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>50</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>31</width>
|
||||||
|
<height>22</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>2</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="MainZoneScene3Btn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>31</width>
|
||||||
|
<height>22</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>3</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="MainZoneScene4Btn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>50</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>31</width>
|
||||||
|
<height>22</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>4</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSlider" name="mMainZoneVolumeSldBar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>190</x>
|
||||||
|
<y>120</y>
|
||||||
|
<width>21</width>
|
||||||
|
<height>160</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>194</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSlider" name="mZone2VolumeSldBar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>500</x>
|
||||||
|
<y>119</y>
|
||||||
|
<width>20</width>
|
||||||
|
<height>151</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>182</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="mMainZoneSliderValueLbl">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>180</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>47</width>
|
||||||
|
<height>14</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="mZone2SliderValueLbl">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>490</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>51</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QComboBox" name="mZone2InputComboBx">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>580</x>
|
||||||
|
<y>180</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="mZone2SyncVolumeChkBx">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>590</x>
|
||||||
|
<y>120</y>
|
||||||
|
<width>171</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Sync volume with Main zone</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
@ -39,7 +39,7 @@ int CAvReceiverNetworkCtrlInterface::DeviceFrameReceived(int TargetDeviceID, int
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case AV_RECEIVER_INTERFACE_SET_SPEAKERB_RESPONSE:
|
case AV_RECEIVER_INTERFACE_SET_ZONE2_RESPONSE:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -48,10 +48,21 @@ int CAvReceiverNetworkCtrlInterface::DeviceFrameReceived(int TargetDeviceID, int
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_RESPONSE:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_RESPONSE:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case AV_RECEIVER_INTERFACE_GENERAL_STATUS_REQUEST:
|
case AV_RECEIVER_INTERFACE_GENERAL_STATUS_REQUEST:
|
||||||
case AV_RECEIVER_INTERFACE_SET_MAIN_POWER_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:
|
case AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_REQUEST:
|
||||||
|
case AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_REQUEST:
|
||||||
|
case AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_REQUEST:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
qDebug("AV Receiver: Invalid Ethernet Msg received: %d",MessageID);
|
qDebug("AV Receiver: Invalid Ethernet Msg received: %d",MessageID);
|
||||||
|
|||||||
138
Sources/AvReceiver/VolumeController.cpp
Normal file
138
Sources/AvReceiver/VolumeController.cpp
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
#include "VolumeController.h"
|
||||||
|
#include <windows.h>
|
||||||
|
#include <combaseapi.h>
|
||||||
|
#include <AvReceiver.h>
|
||||||
|
#include <initguid.h>
|
||||||
|
#include <Functiondiscoverykeys_devpkey.h>
|
||||||
|
|
||||||
|
CVolumeController::CVolumeController(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
mDeviceEnumerator = NULL;
|
||||||
|
mAudioDevice = NULL;
|
||||||
|
mEndpointVolume = 0;
|
||||||
|
mProgramPtr = 0;
|
||||||
|
mVolumeControllerActive = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CVolumeController::~CVolumeController()
|
||||||
|
{
|
||||||
|
if(mVolumeControllerActive == true)
|
||||||
|
{
|
||||||
|
if(mEndpointVolume != NULL)
|
||||||
|
{
|
||||||
|
mEndpointVolume->UnregisterControlChangeNotify(this);
|
||||||
|
mEndpointVolume->Release();
|
||||||
|
}
|
||||||
|
if(mAudioDevice != NULL)
|
||||||
|
mAudioDevice->Release();
|
||||||
|
if(mDeviceEnumerator != NULL)
|
||||||
|
mDeviceEnumerator->Release();
|
||||||
|
|
||||||
|
CoUninitialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int CVolumeController::Init(CAvReceiver *ProgramPtr)
|
||||||
|
{
|
||||||
|
mProgramPtr = ProgramPtr;
|
||||||
|
IPropertyStore *pProps = NULL;
|
||||||
|
IMMDeviceCollection *pCollection = NULL;
|
||||||
|
|
||||||
|
CoInitialize(NULL);
|
||||||
|
CoCreateGuid(&mMyGUID);
|
||||||
|
|
||||||
|
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
|
||||||
|
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
|
||||||
|
HRESULT hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL,CLSCTX_ALL, IID_IMMDeviceEnumerator,(void**)&mDeviceEnumerator);
|
||||||
|
|
||||||
|
hr = mDeviceEnumerator->EnumAudioEndpoints(eRender,DEVICE_STATE_ACTIVE,&pCollection);
|
||||||
|
unsigned int count;
|
||||||
|
hr = pCollection->GetCount(&count);
|
||||||
|
|
||||||
|
|
||||||
|
// mDeviceEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &mAudioDevice); // Get the default audio output device
|
||||||
|
|
||||||
|
bool InterfaceFound = false;
|
||||||
|
for(unsigned int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
hr = pCollection->Item(i,&mAudioDevice);
|
||||||
|
mAudioDevice->OpenPropertyStore(STGM_READ,&pProps);
|
||||||
|
PROPVARIANT DevName;
|
||||||
|
// Initialize container for property value.
|
||||||
|
PropVariantInit(&DevName);
|
||||||
|
hr = pProps->GetValue(PKEY_Device_FriendlyName, &DevName); //Get the friendly name
|
||||||
|
QString FriendlyName = QString("%1").arg(DevName.pwszVal);
|
||||||
|
PropVariantClear(&DevName);
|
||||||
|
qDebug("%s",qPrintable(FriendlyName));
|
||||||
|
if(FriendlyName.contains("SPDIF"))
|
||||||
|
{
|
||||||
|
//We found our interface.
|
||||||
|
InterfaceFound = true;
|
||||||
|
qDebug("Audio interface found... binding callback.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(pProps != NULL)
|
||||||
|
pProps->Release();
|
||||||
|
|
||||||
|
if(InterfaceFound == false)
|
||||||
|
{
|
||||||
|
qDebug("Audio interface not found");
|
||||||
|
if(mAudioDevice != NULL)
|
||||||
|
mAudioDevice->Release();
|
||||||
|
if(mDeviceEnumerator != NULL)
|
||||||
|
mDeviceEnumerator->Release();
|
||||||
|
CoUninitialize();
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
mAudioDevice->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER, NULL, (void**)&mEndpointVolume); // Activate the endpoint volume interface
|
||||||
|
|
||||||
|
mEndpointVolume->RegisterControlChangeNotify(this);// Set up the volume change callback
|
||||||
|
|
||||||
|
|
||||||
|
mEndpointVolume->SetMasterVolumeLevelScalar(0.02,&mMyGUID);
|
||||||
|
mEndpointVolume->GetMasterVolumeLevelScalar(&mMasterVolume);
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int CVolumeController::SetMasterVolume(float Volume)
|
||||||
|
{
|
||||||
|
mEndpointVolume->SetMasterVolumeLevelScalar(Volume,&mMyGUID);
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP CVolumeController:: OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify)
|
||||||
|
{
|
||||||
|
if (pNotify)
|
||||||
|
{
|
||||||
|
if(pNotify->guidEventContext != mMyGUID)
|
||||||
|
{
|
||||||
|
// qDebug("Volume changed. Current %f, Requested: %f",mMasterVolume,pNotify->fMasterVolume);
|
||||||
|
// float NewVolume;
|
||||||
|
if(mMasterVolume > pNotify->fMasterVolume) //Volume decrease
|
||||||
|
{
|
||||||
|
// qDebug("Volume Decrease");
|
||||||
|
emit ExternalVolumeChanged(-EXTERNAL_VOLUME_INCREMENT);
|
||||||
|
}
|
||||||
|
else if(mMasterVolume < pNotify->fMasterVolume) //Volume increase
|
||||||
|
{
|
||||||
|
// qDebug("Volume increase");
|
||||||
|
emit ExternalVolumeChanged(EXTERNAL_VOLUME_INCREMENT);
|
||||||
|
|
||||||
|
}
|
||||||
|
// qDebug("Setting interface volume to %f",NewVolume);
|
||||||
|
// mEndpointVolume->SetMasterVolumeLevelScalar(NewVolume,&mMyGUID);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mEndpointVolume->GetMasterVolumeLevelScalar(&mMasterVolume);
|
||||||
|
// qDebug("Setting internal master volume: %f",mMasterVolume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
57
Sources/AvReceiver/VolumeController.h
Normal file
57
Sources/AvReceiver/VolumeController.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#ifndef VOLUMECONTROLLER_H
|
||||||
|
#define VOLUMECONTROLLER_H
|
||||||
|
|
||||||
|
#include "GlobalDefine.h"
|
||||||
|
#include <QObject>
|
||||||
|
#include <endpointvolume.h>
|
||||||
|
#include <Mmdeviceapi.h>
|
||||||
|
|
||||||
|
#define EXTERNAL_VOLUME_INCREMENT 1
|
||||||
|
|
||||||
|
class CAvReceiver;
|
||||||
|
|
||||||
|
|
||||||
|
class CVolumeController : public QObject, public IAudioEndpointVolumeCallback
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit CVolumeController(QObject *parent = 0);
|
||||||
|
~CVolumeController();
|
||||||
|
int Init(CAvReceiver *ProgramPtr);
|
||||||
|
bool mVolumeControllerActive;
|
||||||
|
int SetMasterVolume(float Volume);
|
||||||
|
|
||||||
|
CAvReceiver *mProgramPtr;
|
||||||
|
|
||||||
|
private:
|
||||||
|
IMMDeviceEnumerator *mDeviceEnumerator ;
|
||||||
|
IMMDevice *mAudioDevice ;
|
||||||
|
IAudioEndpointVolume *mEndpointVolume;
|
||||||
|
GUID mMyGUID;
|
||||||
|
float mMasterVolume;
|
||||||
|
// CAudioNotificationCallback *mAudioNotificationObject;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) {
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(ULONG) AddRef() {return 2;}
|
||||||
|
STDMETHODIMP_(ULONG) Release() {return 1;}
|
||||||
|
STDMETHODIMP OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void ExternalVolumeChanged(float);
|
||||||
|
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // VOLUMECONTROLLER_H
|
||||||
53
Sources/AvReceiver/VolumeController.h.T22060
Normal file
53
Sources/AvReceiver/VolumeController.h.T22060
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#ifndef VOLUMECONTROLLER_H
|
||||||
|
#define VOLUMECONTROLLER_H
|
||||||
|
|
||||||
|
#include "GlobalDefine.h"
|
||||||
|
#include <QObject>
|
||||||
|
#include <endpointvolume.h>
|
||||||
|
#include <Mmdeviceapi.h>
|
||||||
|
|
||||||
|
class CAvReceiver;
|
||||||
|
|
||||||
|
|
||||||
|
class CVolumeController : public QObject, public IAudioEndpointVolumeCallback
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit CVolumeController(QObject *parent = 0);
|
||||||
|
~CVolumeController();
|
||||||
|
int Init();
|
||||||
|
|
||||||
|
CAvReceiver *mProgramPtr;
|
||||||
|
|
||||||
|
private:
|
||||||
|
IMMDeviceEnumerator *mDeviceEnumerator ;
|
||||||
|
IMMDevice *mAudioDevice ;
|
||||||
|
IAudioEndpointVolume *mEndpointVolume;
|
||||||
|
// CAudioNotificationCallback *mAudioNotificationObject;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) {
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(ULONG) AddRef() {return 2;}
|
||||||
|
|
||||||
|
STDMETHODIMP_(ULONG) Release() {return 1;}
|
||||||
|
|
||||||
|
STDMETHODIMP OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // VOLUMECONTROLLER_H
|
||||||
75
Sources/CRC32.cpp
Normal file
75
Sources/CRC32.cpp
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#include "CRC32.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCRC32::CCRC32()
|
||||||
|
{
|
||||||
|
InitTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CCRC32::InitTable()
|
||||||
|
{
|
||||||
|
quint32 i;
|
||||||
|
quint32 j;
|
||||||
|
quint32 crc;
|
||||||
|
|
||||||
|
for (i=0; i<256; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
crc = i;
|
||||||
|
|
||||||
|
for (j=0; j<8; j++) {
|
||||||
|
|
||||||
|
if ( crc & 0x00000001L ) crc = ( crc >> 1 ) ^ CRC_POLY_32;
|
||||||
|
else crc = crc >> 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
mCRC32Table[i] = crc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
quint32 CCRC32::ComputeCRC32(QByteArray Buffer)
|
||||||
|
{
|
||||||
|
return ComputeCRC32((const unsigned char *)Buffer.data(),Buffer.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
quint32 CCRC32::ComputeCRC32( const unsigned char *input_str, qulonglong num_bytes )
|
||||||
|
{
|
||||||
|
quint32 crc;
|
||||||
|
quint32 tmp;
|
||||||
|
quint32 long_c;
|
||||||
|
const unsigned char *ptr;
|
||||||
|
qulonglong a;
|
||||||
|
|
||||||
|
crc = CRC_START_32;
|
||||||
|
ptr = input_str;
|
||||||
|
|
||||||
|
if ( ptr != NULL ) for (a=0; a<num_bytes; a++) {
|
||||||
|
|
||||||
|
long_c = 0x000000FFL & (quint32) *ptr;
|
||||||
|
tmp = crc ^ long_c;
|
||||||
|
crc = (crc >> 8) ^ mCRC32Table[ tmp & 0xff ];
|
||||||
|
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
crc ^= 0xffffffffL;
|
||||||
|
|
||||||
|
return crc & 0xffffffffL;
|
||||||
|
}
|
||||||
|
|
||||||
|
quint32 CCRC32::UpdateCRC32(quint32 crc, unsigned char c)
|
||||||
|
{
|
||||||
|
quint32 tmp;
|
||||||
|
quint32 long_c;
|
||||||
|
|
||||||
|
long_c = 0x000000ffL & (quint32) c;
|
||||||
|
|
||||||
|
|
||||||
|
tmp = crc ^ long_c;
|
||||||
|
crc = (crc >> 8) ^ mCRC32Table[ tmp & 0xff ];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return crc & 0xffffffffL;;
|
||||||
|
}
|
||||||
55
Sources/CRC32.h
Normal file
55
Sources/CRC32.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#ifndef CRC32_H
|
||||||
|
#define CRC32_H
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* #define CRC_POLY_xxxx
|
||||||
|
*
|
||||||
|
* The constants of the form CRC_POLY_xxxx define the polynomials for some well
|
||||||
|
* known CRC calculations.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CRC_POLY_16 0xA001
|
||||||
|
#define CRC_POLY_32 0xEDB88320L
|
||||||
|
#define CRC_POLY_CCITT 0x1021
|
||||||
|
#define CRC_POLY_DNP 0xA6BC
|
||||||
|
#define CRC_POLY_KERMIT 0x8408
|
||||||
|
#define CRC_POLY_SICK 0x8005
|
||||||
|
|
||||||
|
/*
|
||||||
|
* #define CRC_START_xxxx
|
||||||
|
*
|
||||||
|
* The constants of the form CRC_START_xxxx define the values that are used for
|
||||||
|
* initialization of a CRC value for common used calculation methods.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CRC_START_8 0x00
|
||||||
|
#define CRC_START_16 0x0000
|
||||||
|
#define CRC_START_MODBUS 0xFFFF
|
||||||
|
#define CRC_START_XMODEM 0x0000
|
||||||
|
#define CRC_START_CCITT_1D0F 0x1D0F
|
||||||
|
#define CRC_START_CCITT_FFFF 0xFFFF
|
||||||
|
#define CRC_START_KERMIT 0x0000
|
||||||
|
#define CRC_START_SICK 0x0000
|
||||||
|
#define CRC_START_DNP 0x0000
|
||||||
|
#define CRC_START_32 0xFFFFFFFFL
|
||||||
|
|
||||||
|
|
||||||
|
class CCRC32
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCRC32();
|
||||||
|
|
||||||
|
void InitTable();
|
||||||
|
quint32 ComputeCRC32( const unsigned char *input_str, qulonglong num_bytes );
|
||||||
|
quint32 ComputeCRC32( QByteArray Buffer);
|
||||||
|
quint32 UpdateCRC32( quint32 crc, unsigned char c );
|
||||||
|
|
||||||
|
private:
|
||||||
|
quint32 mCRC32Table[256];
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CRC32_H
|
||||||
@ -124,3 +124,182 @@ int CChalet::RequestChaletLogs(QDate StartDate)
|
|||||||
return mNetworkInterface->SendMasterCtrlCommand(CHALET_INTERFACE_GET_DATA_LOG_REQUEST,StartDateData);
|
return mNetworkInterface->SendMasterCtrlCommand(CHALET_INTERFACE_GET_DATA_LOG_REQUEST,StartDateData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CChalet::RequestDeviceWifiParams()
|
||||||
|
{
|
||||||
|
|
||||||
|
mNetworkInterface->SendMasterCtrlCommand(CHALET_INTERFACE_WIFI_GET_DEVICE_PARAMS_REQUEST,QByteArray());
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
quint32 Add = 0;
|
||||||
|
char byte;
|
||||||
|
byte = Data->at(0);
|
||||||
|
Add += (quint32)(byte & 0x000000FF);
|
||||||
|
Add <<= 8;
|
||||||
|
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);
|
||||||
|
QHostAddress IP = QHostAddress(Add);
|
||||||
|
|
||||||
|
Add = 0;
|
||||||
|
byte = Data->at(4);
|
||||||
|
Add += (quint32)(byte & 0x000000FF);
|
||||||
|
Add <<= 8;
|
||||||
|
byte = Data->at(5);
|
||||||
|
Add += (quint32)(byte & 0x000000FF);
|
||||||
|
Add <<= 8;
|
||||||
|
byte = Data->at(6);
|
||||||
|
Add += (quint32)(byte & 0x000000FF);
|
||||||
|
Add <<= 8;
|
||||||
|
byte = Data->at(7);
|
||||||
|
Add += (quint32)(byte & 0x000000FF);
|
||||||
|
QHostAddress Gateway = QHostAddress(Add);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CChalet::DeviceFirmwareVersionReceived(QByteArray Data)
|
||||||
|
{
|
||||||
|
mChaletGui->UpdateFirmwareVersion(Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
if(DeviceGateway.setAddress(Gateway) == false)
|
||||||
|
{
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
QByteArray Buffer;
|
||||||
|
Buffer.resize(8);
|
||||||
|
|
||||||
|
quint32 Address = DeviceIP.toIPv4Address();
|
||||||
|
char byte = (char)(Address & 0x000000FF);
|
||||||
|
Buffer[3] = byte;
|
||||||
|
Address >>= 8;
|
||||||
|
byte = (char)(Address & 0x000000FF);
|
||||||
|
Buffer[2] = byte;
|
||||||
|
Address >>= 8;
|
||||||
|
byte = (char)(Address & 0x000000FF);
|
||||||
|
Buffer[1] = byte;
|
||||||
|
Address >>= 8;
|
||||||
|
byte = (char)(Address & 0x000000FF);
|
||||||
|
Buffer[0] = byte;
|
||||||
|
Address >>= 8;
|
||||||
|
|
||||||
|
Address = DeviceGateway.toIPv4Address();
|
||||||
|
byte = (char)(Address & 0x000000FF);
|
||||||
|
Buffer[7] = byte;
|
||||||
|
Address >>= 8;
|
||||||
|
byte = (char)(Address & 0x000000FF);
|
||||||
|
Buffer[6] = byte;
|
||||||
|
Address >>= 8;
|
||||||
|
byte = (char)(Address & 0x000000FF);
|
||||||
|
Buffer[5] = byte;
|
||||||
|
Address >>= 8;
|
||||||
|
byte = (char)(Address & 0x000000FF);
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -32,6 +32,14 @@ public:
|
|||||||
int DoHarakiriButtonClicked(bool Verified);
|
int DoHarakiriButtonClicked(bool Verified);
|
||||||
int RebootCPUButtonPressed();
|
int RebootCPUButtonPressed();
|
||||||
int RequestChaletLogs(QDate StartDate);
|
int RequestChaletLogs(QDate StartDate);
|
||||||
|
int RequestDeviceWifiParams();
|
||||||
|
int DeviceWiFiParamsReceived(QByteArray *Data);
|
||||||
|
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:
|
signals:
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@ CChaletMainStatus::CChaletMainStatus()
|
|||||||
mBatteryVoltage = 0;
|
mBatteryVoltage = 0;
|
||||||
mIsOnline = false;
|
mIsOnline = false;
|
||||||
mLostRequestPercentage = 0;
|
mLostRequestPercentage = 0;
|
||||||
|
mChaletTemperature = -100;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +47,11 @@ QDataStream &operator>>(QDataStream &in, CChaletMainStatus &dest)
|
|||||||
>> dest.mLostRequestPercentage
|
>> dest.mLostRequestPercentage
|
||||||
>> dest.mThisStatusDateTime
|
>> dest.mThisStatusDateTime
|
||||||
>> dest.mLastLoraStatus
|
>> dest.mLastLoraStatus
|
||||||
>> dest.mStatusToggleBit;
|
>> dest.mStatusToggleBit
|
||||||
|
>> dest.mChaletTemperature
|
||||||
|
>> dest.mTotalNbChaletRxCmds
|
||||||
|
>> dest.mTotalMasterTxCmds
|
||||||
|
>> dest.mMasterLostRequestCount;
|
||||||
|
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,6 +43,7 @@ public:
|
|||||||
qint8 mCurrentSensorStatus;
|
qint8 mCurrentSensorStatus;
|
||||||
|
|
||||||
float mBatteryVoltage;
|
float mBatteryVoltage;
|
||||||
|
float mChaletTemperature;
|
||||||
qint16 mBatteryCurrent;
|
qint16 mBatteryCurrent;
|
||||||
qint16 mBatterySOC;
|
qint16 mBatterySOC;
|
||||||
|
|
||||||
@ -57,6 +58,10 @@ public:
|
|||||||
float mLostRequestPercentage;
|
float mLostRequestPercentage;
|
||||||
|
|
||||||
|
|
||||||
|
int mTotalNbChaletRxCmds;
|
||||||
|
int mTotalMasterTxCmds;
|
||||||
|
int mMasterLostRequestCount;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
QDataStream &operator>>(QDataStream &in, CChaletMainStatus &dest);
|
QDataStream &operator>>(QDataStream &in, CChaletMainStatus &dest);
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
#include "ChaletGui.h"
|
#include "ChaletGui.h"
|
||||||
#include "ui_ChaletGui.h"
|
#include "ui_ChaletGui.h"
|
||||||
#include "CChalet.h"
|
#include "CChalet.h"
|
||||||
|
#include "LoraModuleInterface.h"
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
|
#include "LoraModuleInterfaceData.h"
|
||||||
|
|
||||||
CChaletGui::CChaletGui(QWidget *parent) :
|
CChaletGui::CChaletGui(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
@ -15,6 +17,15 @@ CChaletGui::CChaletGui(QWidget *parent) :
|
|||||||
ui->mDoHarakiriButton->setEnabled(false);
|
ui->mDoHarakiriButton->setEnabled(false);
|
||||||
ui->mLogStartDateEdit->setDate(QDate::currentDate());
|
ui->mLogStartDateEdit->setDate(QDate::currentDate());
|
||||||
|
|
||||||
|
mGetFimwVersionButtonColorTimer = new QTimer;
|
||||||
|
mGetFimwVersionButtonColorTimer->setSingleShot(true);
|
||||||
|
mGetFimwVersionButtonColorTimer->setInterval(500);
|
||||||
|
|
||||||
|
mGetWifiParamsButtonColorTimer = new QTimer;
|
||||||
|
mGetWifiParamsButtonColorTimer->setSingleShot(true);
|
||||||
|
mGetWifiParamsButtonColorTimer->setInterval(500);
|
||||||
|
|
||||||
|
|
||||||
connect(ui->mWiFiModuleONBtn,SIGNAL(clicked()),this,SLOT(WiFiONButtonClicked()));
|
connect(ui->mWiFiModuleONBtn,SIGNAL(clicked()),this,SLOT(WiFiONButtonClicked()));
|
||||||
connect(ui->mWiFiModuleOFFBtn,SIGNAL(clicked(bool)),this,SLOT(WiFiOFFButtonClicked()));
|
connect(ui->mWiFiModuleOFFBtn,SIGNAL(clicked(bool)),this,SLOT(WiFiOFFButtonClicked()));
|
||||||
connect(ui->mInverterRelayOFFBtn,SIGNAL(clicked()),this,SLOT(InverterPowerOFFButtonClicked()));
|
connect(ui->mInverterRelayOFFBtn,SIGNAL(clicked()),this,SLOT(InverterPowerOFFButtonClicked()));
|
||||||
@ -23,17 +34,29 @@ CChaletGui::CChaletGui(QWidget *parent) :
|
|||||||
connect(ui->mDoHarakiriButton,SIGNAL(clicked(bool)),this,SLOT(DoHarakiriButtonClicked()));
|
connect(ui->mDoHarakiriButton,SIGNAL(clicked(bool)),this,SLOT(DoHarakiriButtonClicked()));
|
||||||
connect(ui->mEnableHarakiriChkBx,SIGNAL(clicked(bool)),this,SLOT(EnableHarakiriClicked(bool)));
|
connect(ui->mEnableHarakiriChkBx,SIGNAL(clicked(bool)),this,SLOT(EnableHarakiriClicked(bool)));
|
||||||
connect(ui->mGetChaletLogButton,SIGNAL(clicked(bool)),this,SLOT(GetChaletLogsBtnClicked()));
|
connect(ui->mGetChaletLogButton,SIGNAL(clicked(bool)),this,SLOT(GetChaletLogsBtnClicked()));
|
||||||
|
connect(ui->mWiFiGetRemoteSettingsBtn,SIGNAL(clicked(bool)),this,SLOT(GetDeviceWiFiParamsButtonClicked(bool)));
|
||||||
|
connect(ui->mWiFiSetRemoteSettingsBtn,SIGNAL(clicked(bool)),this,SLOT(SetDeviceWiFiParamsButtonClicked(bool)));
|
||||||
|
connect(ui->mGetFirmwareVersionBtn,SIGNAL(clicked(bool)),this,SLOT(GetFirmwareVersionBtnClicked()));
|
||||||
|
connect(ui->mStartSyslogShellBtn,SIGNAL(clicked(bool)),this,SLOT(StartSyslogShellBtnClicked()));
|
||||||
|
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 = new QCustomPlot(ui->mPlotWidget);
|
||||||
mBatteryPlotWidget->resize(ui->mPlotWidget->size());
|
mBatteryPlotWidget->resize(ui->mPlotWidget->size());
|
||||||
|
|
||||||
// create graph and assign data to it:
|
// create graph and assign data to it:
|
||||||
mBatteryPlotWidget->addGraph();
|
mBatteryPlotWidget->addGraph();
|
||||||
|
mBatteryPlotWidget->addGraph(mBatteryPlotWidget->xAxis,mBatteryPlotWidget->yAxis2);
|
||||||
|
|
||||||
|
|
||||||
// give the axes some labels:
|
// give the axes some labels:
|
||||||
mBatteryPlotWidget->xAxis->setLabel("time");
|
mBatteryPlotWidget->xAxis->setLabel("time");
|
||||||
mBatteryPlotWidget->yAxis->setLabel("Volts");
|
mBatteryPlotWidget->yAxis->setLabel("Volts");
|
||||||
|
mBatteryPlotWidget->yAxis2->setLabel("RSSI (dBm)");
|
||||||
|
mBatteryPlotWidget->yAxis2->setVisible(true);
|
||||||
|
|
||||||
double now = QDateTime::currentDateTime().toSecsSinceEpoch();
|
double now = QDateTime::currentDateTime().toSecsSinceEpoch();
|
||||||
QSharedPointer<QCPAxisTickerDateTime> dateTicker(new QCPAxisTickerDateTime);
|
QSharedPointer<QCPAxisTickerDateTime> dateTicker(new QCPAxisTickerDateTime);
|
||||||
@ -53,16 +76,47 @@ CChaletGui::CChaletGui(QWidget *parent) :
|
|||||||
mBatteryPlotWidget->xAxis->setRange(midnight.toSecsSinceEpoch(), eod.toSecsSinceEpoch());
|
mBatteryPlotWidget->xAxis->setRange(midnight.toSecsSinceEpoch(), eod.toSecsSinceEpoch());
|
||||||
|
|
||||||
mBatteryPlotWidget->yAxis->setRange(12,15);
|
mBatteryPlotWidget->yAxis->setRange(12,15);
|
||||||
|
mBatteryPlotWidget->yAxis2->setRange(-255,0.0);
|
||||||
|
QList<QCPAxis*> xAxis, yAxis;
|
||||||
|
xAxis.append(mBatteryPlotWidget->xAxis);
|
||||||
|
yAxis.append(mBatteryPlotWidget->yAxis);
|
||||||
|
yAxis.append(mBatteryPlotWidget->yAxis2);
|
||||||
|
mBatteryPlotWidget->axisRect()->setRangeDragAxes(xAxis,yAxis);
|
||||||
|
mBatteryPlotWidget->axisRect()->setRangeZoomAxes(xAxis,yAxis);
|
||||||
|
mBatteryPlotWidget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
|
||||||
|
|
||||||
mBatteryPlotWidget->graph(0)->addData(now,13.5);
|
mBatteryPlotWidget->graph(0)->addData(now,13.5);
|
||||||
|
|
||||||
mBatteryPlotWidget->replot();
|
mBatteryPlotWidget->replot();
|
||||||
|
|
||||||
|
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)");
|
||||||
|
|
||||||
|
ui->mChaletWifiSelectionRadioBtn->setChecked(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CChaletGui::~CChaletGui()
|
CChaletGui::~CChaletGui()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
delete mBatteryPlotWidget;
|
delete mBatteryPlotWidget;
|
||||||
|
delete mGetFimwVersionButtonColorTimer;
|
||||||
|
delete mGetWifiParamsButtonColorTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CChaletGui::UpdateChaletStatus(CChaletMainStatus Status)
|
int CChaletGui::UpdateChaletStatus(CChaletMainStatus Status)
|
||||||
@ -80,13 +134,16 @@ int CChaletGui::UpdateChaletStatus(CChaletMainStatus Status)
|
|||||||
pal.setColor(QPalette::WindowText,QColor(Qt::red));
|
pal.setColor(QPalette::WindowText,QColor(Qt::red));
|
||||||
ui->mChaletOnlineStatusLbl->setPalette(pal);
|
ui->mChaletOnlineStatusLbl->setPalette(pal);
|
||||||
|
|
||||||
ui->mWiFiModuleStatusLabel->setText("Unknown");
|
// ui->mWiFiModuleStatusLabel->setText("Unknown");
|
||||||
ui->mInverterRlyStatusLabel->setText("Unknown");
|
// ui->mInverterRlyStatusLabel->setText("Unknown");
|
||||||
ui->mCurrentSensorStateLbl->setText("Current Sensor: Unknown state");
|
// ui->mCurrentSensorStateLbl->setText("Current Sensor: Unknown state");
|
||||||
ui->mBatteryVoltageLabel->setText("Battery Voltage: Unknown");
|
// ui->mBatteryVoltageLabel->setText("Battery Voltage: Unknown");
|
||||||
ui->mBatterySOCLabel->setText("Battery SOC: Unknown");
|
// ui->mBatterySOCLabel->setText("Battery SOC: Unknown");
|
||||||
ui->mSolarPanelCurrentLabel->setText("Solar Panel Current: Unknown");
|
// ui->mSolarPanelCurrentLabel->setText("Raw Solar Panel Current: Unknown");
|
||||||
ui->mLostReqPercentLbl->setText("N/A");
|
// 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;
|
return RET_OK;
|
||||||
@ -182,11 +239,17 @@ int CChaletGui::UpdateChaletStatus(CChaletMainStatus Status)
|
|||||||
|
|
||||||
QString Voltage = QString("Battery Voltage: %1").arg(Status.mBatteryVoltage);
|
QString Voltage = QString("Battery Voltage: %1").arg(Status.mBatteryVoltage);
|
||||||
ui->mBatteryVoltageLabel->setText(Voltage);
|
ui->mBatteryVoltageLabel->setText(Voltage);
|
||||||
ui->mVoltageLCD->display(Voltage);
|
|
||||||
|
|
||||||
QString Current = QString("Solar Panel Current: %1").arg(Status.mBatteryCurrent);
|
QString Current = QString("Raw Solar Panel Current: %1").arg(Status.mBatteryCurrent - 2);
|
||||||
ui->mSolarPanelCurrentLabel->setText(Current);
|
ui->mSolarPanelCurrentLabel->setText(Current);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QString SOC = QString("Battery SOC: %1").arg(Status.mBatterySOC);
|
QString SOC = QString("Battery SOC: %1").arg(Status.mBatterySOC);
|
||||||
ui->mBatterySOCLabel->setText(SOC);
|
ui->mBatterySOCLabel->setText(SOC);
|
||||||
|
|
||||||
@ -194,6 +257,16 @@ int CChaletGui::UpdateChaletStatus(CChaletMainStatus Status)
|
|||||||
ui->mLostReqPercentLbl->setText(Percent);
|
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)
|
if(Status.mStatusToggleBit != LastToggle)
|
||||||
{
|
{
|
||||||
LastToggle = Status.mStatusToggleBit;
|
LastToggle = Status.mStatusToggleBit;
|
||||||
@ -212,6 +285,49 @@ int CChaletGui::UpdateChaletStatus(CChaletMainStatus Status)
|
|||||||
|
|
||||||
mBatteryPlotWidget->replot();
|
mBatteryPlotWidget->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Temperature = QString("Temperature: %1").arg(Status.mChaletTemperature);
|
||||||
|
ui->mChaletTemperatureLbl->setText(Temperature);
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CChaletGui::UpdateLoraModuleStatus(CLoraModuleInterfaceStatus Status)
|
||||||
|
{
|
||||||
|
if(ui->mLoraModuleCommActivityLbl->isEnabled())
|
||||||
|
{
|
||||||
|
ui->mLoraModuleCommActivityLbl->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->mLoraModuleCommActivityLbl->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ModuleStatusTxt = QString("Ambient RSSI: %1 [%3dBm]\nLast Rx RSSI: %2 [%4dBm]").arg(Status.mModuleAmbientRSSI).arg(Status.mModuleLastRxRSSI).arg(-1*(255-Status.mModuleAmbientRSSI)).arg(-1*(255-Status.mModuleLastRxRSSI));
|
||||||
|
ui->mLoraIFModuleStatus->setText(ModuleStatusTxt);
|
||||||
|
|
||||||
|
quint32 Add = 0;
|
||||||
|
|
||||||
|
Add += (quint32)(Status.mIPAddress1 & 0x000000FF);
|
||||||
|
Add <<= 8;
|
||||||
|
Add += (quint32)(Status.mIPAddress2 & 0x000000FF);
|
||||||
|
Add <<= 8;
|
||||||
|
Add += (quint32)(Status.mIPAddress3 & 0x000000FF);
|
||||||
|
Add <<= 8;
|
||||||
|
Add += (quint32)(Status.mIPAddress4 & 0x000000FF);
|
||||||
|
QHostAddress IP = QHostAddress(Add);
|
||||||
|
|
||||||
|
QString IPString = QString("Lora Module IP Address:").append(IP.toString());
|
||||||
|
ui->mLoraModuleIPAddressLbl->setText(IPString);
|
||||||
|
|
||||||
|
if(Status.mModuleLastRxRSSI > 10) //filter glitches
|
||||||
|
{
|
||||||
|
double CurTime = QDateTime::currentDateTime().toSecsSinceEpoch();
|
||||||
|
mBatteryPlotWidget->graph(1)->addData(CurTime,-1*(255-Status.mModuleLastRxRSSI));
|
||||||
|
|
||||||
|
mBatteryPlotWidget->replot();
|
||||||
|
}
|
||||||
|
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,6 +351,9 @@ int CChaletGui::UpdateChaletLogPlot(QByteArray *Log)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(x.size() == 0 || y.size() == 0)
|
||||||
|
return RET_ERROR;
|
||||||
|
|
||||||
mBatteryPlotWidget->graph(0)->data().clear();
|
mBatteryPlotWidget->graph(0)->data().clear();
|
||||||
mBatteryPlotWidget->graph(0)->setData(x,y);
|
mBatteryPlotWidget->graph(0)->setData(x,y);
|
||||||
mBatteryPlotWidget->xAxis->setRange(x.first(),x.last());
|
mBatteryPlotWidget->xAxis->setRange(x.first(),x.last());
|
||||||
@ -304,3 +423,127 @@ void CChaletGui::RebootCPUButtonClicked()
|
|||||||
}
|
}
|
||||||
mProgramHandle->RequestChaletLogs(StartDate);
|
mProgramHandle->RequestChaletLogs(StartDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CChaletGui::GetDeviceWiFiParamsButtonClicked(bool state)
|
||||||
|
{
|
||||||
|
mProgramHandle->RequestDeviceWifiParams();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChaletGui::SetDeviceWiFiParamsButtonClicked(bool state)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
ui->mWiFiGetRemoteSettingsBtn->setAutoFillBackground(true);
|
||||||
|
ui->mWiFiGetRemoteSettingsBtn->setPalette(pal);
|
||||||
|
ui->mWiFiGetRemoteSettingsBtn->update();
|
||||||
|
|
||||||
|
mGetWifiParamsButtonColorTimer->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChaletGui::GetFirmwareVersionBtnClicked()
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
VersionString.prepend("Firmware version: ");
|
||||||
|
ui->mFirmwareVersionLabel->setText(VersionString);
|
||||||
|
|
||||||
|
QPalette pal = ui->mGetFirmwareVersionBtn->palette();
|
||||||
|
pal.setColor(QPalette::Button, QColor(Qt::green));
|
||||||
|
ui->mGetFirmwareVersionBtn->setAutoFillBackground(true);
|
||||||
|
ui->mGetFirmwareVersionBtn->setPalette(pal);
|
||||||
|
ui->mGetFirmwareVersionBtn->update();
|
||||||
|
|
||||||
|
mGetFimwVersionButtonColorTimer->start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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\"");
|
||||||
|
|
||||||
|
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\"");
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
ui->mGetFirmwareVersionBtn->setAutoFillBackground(true);
|
||||||
|
ui->mGetFirmwareVersionBtn->setPalette(mFirmVersionDefaultBtnPal);
|
||||||
|
ui->mGetFirmwareVersionBtn->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChaletGui::GetWifiParamsBtnColorTimerExpired()
|
||||||
|
{
|
||||||
|
ui->mWiFiGetRemoteSettingsBtn->setAutoFillBackground(true);
|
||||||
|
ui->mWiFiGetRemoteSettingsBtn->setPalette(mFirmVersionDefaultBtnPal);
|
||||||
|
ui->mWiFiGetRemoteSettingsBtn->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChaletGui::GetModuleWifiStatusBtnClicked()
|
||||||
|
{
|
||||||
|
ui->mModuleIPAddressLbl->setText("Module IP Address: ");
|
||||||
|
mProgramHandle->RequestWifiStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChaletGui::WiFiSettingsSelectionChanged()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -4,8 +4,12 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "ChaletData.h"
|
#include "ChaletData.h"
|
||||||
#include "QCustomPlot/qcustomplot.h"
|
#include "QCustomPlot/qcustomplot.h"
|
||||||
|
#include <QHostAddress>
|
||||||
|
|
||||||
class CChalet;
|
class CChalet;
|
||||||
|
class CLoraModuleInterface;
|
||||||
|
class CLoraModuleInterfaceStatus;
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CChaletGui;
|
class CChaletGui;
|
||||||
@ -20,11 +24,17 @@ public:
|
|||||||
~CChaletGui();
|
~CChaletGui();
|
||||||
|
|
||||||
CChalet *mProgramHandle;
|
CChalet *mProgramHandle;
|
||||||
|
CLoraModuleInterface *mLoraModuleIFProgramHandle;
|
||||||
QCustomPlot *mBatteryPlotWidget;
|
QCustomPlot *mBatteryPlotWidget;
|
||||||
|
|
||||||
int UpdateChaletStatus(CChaletMainStatus Status);
|
int UpdateChaletStatus(CChaletMainStatus Status);
|
||||||
|
int UpdateLoraModuleStatus(CLoraModuleInterfaceStatus Status);
|
||||||
int UpdateChaletLogPlot(QByteArray* Log);
|
int UpdateChaletLogPlot(QByteArray* Log);
|
||||||
int ChaletCommActivity();
|
int ChaletCommActivity();
|
||||||
|
QTimer *mGetWifiParamsButtonColorTimer, *mGetFimwVersionButtonColorTimer;
|
||||||
|
QPalette mFirmVersionDefaultBtnPal, mWifiDefaultBtnPal;
|
||||||
|
int mChaletLastLostReqCount;
|
||||||
|
QHostAddress mModuleIPAddress;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CChaletGui *ui;
|
Ui::CChaletGui *ui;
|
||||||
@ -38,6 +48,21 @@ public slots:
|
|||||||
void DoHarakiriButtonClicked();
|
void DoHarakiriButtonClicked();
|
||||||
void EnableHarakiriClicked(bool);
|
void EnableHarakiriClicked(bool);
|
||||||
void GetChaletLogsBtnClicked();
|
void GetChaletLogsBtnClicked();
|
||||||
|
void GetDeviceWiFiParamsButtonClicked(bool);
|
||||||
|
void SetDeviceWiFiParamsButtonClicked(bool);
|
||||||
|
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();
|
||||||
|
void WiFiSettingsSelectionChanged();
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHALETGUI_H
|
#endif // CHALETGUI_H
|
||||||
|
|||||||
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1205</width>
|
<width>1443</width>
|
||||||
<height>598</height>
|
<height>662</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -36,8 +36,8 @@
|
|||||||
<widget class="QLabel" name="mInverterRlyStatusLabel">
|
<widget class="QLabel" name="mInverterRlyStatusLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>198</x>
|
<x>238</x>
|
||||||
<y>50</y>
|
<y>120</y>
|
||||||
<width>210</width>
|
<width>210</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -49,8 +49,8 @@
|
|||||||
<widget class="QLabel" name="mWiFiModuleStatusLabel">
|
<widget class="QLabel" name="mWiFiModuleStatusLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>198</x>
|
<x>238</x>
|
||||||
<y>90</y>
|
<y>160</y>
|
||||||
<width>130</width>
|
<width>130</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -62,8 +62,8 @@
|
|||||||
<widget class="QLabel" name="mWiFiSectionLabel">
|
<widget class="QLabel" name="mWiFiSectionLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>26</x>
|
<x>66</x>
|
||||||
<y>90</y>
|
<y>160</y>
|
||||||
<width>31</width>
|
<width>31</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -75,8 +75,8 @@
|
|||||||
<widget class="QPushButton" name="mInverterRelayOFFBtn">
|
<widget class="QPushButton" name="mInverterRelayOFFBtn">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>126</x>
|
<x>166</x>
|
||||||
<y>50</y>
|
<y>120</y>
|
||||||
<width>61</width>
|
<width>61</width>
|
||||||
<height>22</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -88,8 +88,8 @@
|
|||||||
<widget class="QPushButton" name="mWiFiModuleOFFBtn">
|
<widget class="QPushButton" name="mWiFiModuleOFFBtn">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>126</x>
|
<x>166</x>
|
||||||
<y>90</y>
|
<y>160</y>
|
||||||
<width>61</width>
|
<width>61</width>
|
||||||
<height>23</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -101,8 +101,8 @@
|
|||||||
<widget class="QPushButton" name="mInverterRelayONBtn">
|
<widget class="QPushButton" name="mInverterRelayONBtn">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>70</x>
|
<x>110</x>
|
||||||
<y>50</y>
|
<y>120</y>
|
||||||
<width>51</width>
|
<width>51</width>
|
||||||
<height>23</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -114,8 +114,8 @@
|
|||||||
<widget class="QPushButton" name="mWiFiModuleONBtn">
|
<widget class="QPushButton" name="mWiFiModuleONBtn">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>70</x>
|
<x>110</x>
|
||||||
<y>90</y>
|
<y>160</y>
|
||||||
<width>51</width>
|
<width>51</width>
|
||||||
<height>23</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -127,8 +127,8 @@
|
|||||||
<widget class="QLabel" name="mWiFiSectionLabel_2">
|
<widget class="QLabel" name="mWiFiSectionLabel_2">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>16</x>
|
<x>56</x>
|
||||||
<y>50</y>
|
<y>120</y>
|
||||||
<width>51</width>
|
<width>51</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -140,8 +140,8 @@
|
|||||||
<widget class="QPushButton" name="mRebootCPUBtn">
|
<widget class="QPushButton" name="mRebootCPUBtn">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>66</x>
|
<x>106</x>
|
||||||
<y>130</y>
|
<y>200</y>
|
||||||
<width>75</width>
|
<width>75</width>
|
||||||
<height>23</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -152,12 +152,12 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<widget class="QCheckBox" name="mEnableHarakiriChkBx">
|
<widget class="QCheckBox" name="mEnableHarakiriChkBx">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>850</x>
|
<x>680</x>
|
||||||
<y>80</y>
|
<y>70</y>
|
||||||
<width>111</width>
|
<width>111</width>
|
||||||
<height>17</height>
|
<height>17</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -169,8 +169,8 @@
|
|||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>830</x>
|
<x>660</x>
|
||||||
<y>50</y>
|
<y>40</y>
|
||||||
<width>151</width>
|
<width>151</width>
|
||||||
<height>81</height>
|
<height>81</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -195,8 +195,8 @@
|
|||||||
<widget class="QLabel" name="mBatteryVoltageLabel">
|
<widget class="QLabel" name="mBatteryVoltageLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>147</x>
|
<x>187</x>
|
||||||
<y>170</y>
|
<y>240</y>
|
||||||
<width>241</width>
|
<width>241</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -229,21 +229,21 @@
|
|||||||
<widget class="QLabel" name="mSolarPanelCurrentLabel">
|
<widget class="QLabel" name="mSolarPanelCurrentLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>147</x>
|
<x>187</x>
|
||||||
<y>190</y>
|
<y>260</y>
|
||||||
<width>241</width>
|
<width>241</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Solar Panel Current: </string>
|
<string>Raw Solar Panel Current: </string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="mBatterySOCLabel">
|
<widget class="QLabel" name="mBatterySOCLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>147</x>
|
<x>190</x>
|
||||||
<y>210</y>
|
<y>300</y>
|
||||||
<width>241</width>
|
<width>241</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -255,8 +255,8 @@
|
|||||||
<widget class="QLabel" name="mCurrentSensorStateLbl">
|
<widget class="QLabel" name="mCurrentSensorStateLbl">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>147</x>
|
<x>190</x>
|
||||||
<y>230</y>
|
<y>320</y>
|
||||||
<width>241</width>
|
<width>241</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -268,8 +268,8 @@
|
|||||||
<widget class="QLabel" name="mLostReqPercentLbl">
|
<widget class="QLabel" name="mLostReqPercentLbl">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>770</x>
|
<x>430</x>
|
||||||
<y>200</y>
|
<y>160</y>
|
||||||
<width>241</width>
|
<width>241</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -281,28 +281,18 @@
|
|||||||
<widget class="QWidget" name="mPlotWidget" native="true">
|
<widget class="QWidget" name="mPlotWidget" native="true">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>590</x>
|
<x>420</x>
|
||||||
<y>250</y>
|
<y>260</y>
|
||||||
<width>571</width>
|
<width>1021</width>
|
||||||
<height>321</height>
|
<height>321</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLCDNumber" name="mVoltageLCD">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>30</x>
|
|
||||||
<y>170</y>
|
|
||||||
<width>111</width>
|
|
||||||
<height>23</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="mChaletCommActivityLbl">
|
<widget class="QLabel" name="mChaletCommActivityLbl">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>770</x>
|
<x>430</x>
|
||||||
<y>180</y>
|
<y>140</y>
|
||||||
<width>47</width>
|
<width>47</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -314,8 +304,8 @@
|
|||||||
<widget class="QLabel" name="mLasCommRequestReceivedLbl">
|
<widget class="QLabel" name="mLasCommRequestReceivedLbl">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>770</x>
|
<x>430</x>
|
||||||
<y>160</y>
|
<y>120</y>
|
||||||
<width>301</width>
|
<width>301</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -327,8 +317,8 @@
|
|||||||
<widget class="QDateEdit" name="mLogStartDateEdit">
|
<widget class="QDateEdit" name="mLogStartDateEdit">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>950</x>
|
<x>520</x>
|
||||||
<y>220</y>
|
<y>210</y>
|
||||||
<width>110</width>
|
<width>110</width>
|
||||||
<height>22</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -337,8 +327,8 @@
|
|||||||
<widget class="QPushButton" name="mGetChaletLogButton">
|
<widget class="QPushButton" name="mGetChaletLogButton">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>1070</x>
|
<x>640</x>
|
||||||
<y>220</y>
|
<y>210</y>
|
||||||
<width>75</width>
|
<width>75</width>
|
||||||
<height>23</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -347,6 +337,504 @@
|
|||||||
<string>PushButton</string>
|
<string>PushButton</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QLabel" name="mChaletTemperatureLbl">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>190</x>
|
||||||
|
<y>340</y>
|
||||||
|
<width>241</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Temperature:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QGroupBox" name="WifiSettingGroupBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>60</x>
|
||||||
|
<y>380</y>
|
||||||
|
<width>321</width>
|
||||||
|
<height>251</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>150</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>150</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>180</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>180</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>90</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>90</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>120</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>120</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>60</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>220</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>220</y>
|
||||||
|
<width>75</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>SET</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QRadioButton" name="mChaletWifiSelectionRadioBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>40</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>85</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Chalet</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QRadioButton" name="mLoraIFWifiSelectionRadioBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>140</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>101</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Lora Module IF</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="mSolarPanelCurrentCnvLbl">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>190</x>
|
||||||
|
<y>280</y>
|
||||||
|
<width>201</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Solar Panel Current (A):</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="mFirmwareVersionLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>510</x>
|
||||||
|
<y>590</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Firmware Version: ?</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="mGetFirmwareVersionBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>420</x>
|
||||||
|
<y>590</y>
|
||||||
|
<width>75</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>GET</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="mStartTerminalShellBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>420</x>
|
||||||
|
<y>620</y>
|
||||||
|
<width>75</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Terminal</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="mStartSyslogShellBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>510</x>
|
||||||
|
<y>620</y>
|
||||||
|
<width>75</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<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 --> Chalet: ??
|
||||||
|
Chalet --> 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="mLoraIFModuleStatus">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>141</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 class="QLabel" name="mLoraModuleCommActivityLbl">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>390</x>
|
||||||
|
<y>80</y>
|
||||||
|
<width>47</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Activity!!!</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="mGetLoraWifiStatusBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>170</x>
|
||||||
|
<y>130</y>
|
||||||
|
<width>61</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>GET</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="mLoraModuleIPAddressLbl">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>240</x>
|
||||||
|
<y>130</y>
|
||||||
|
<width>291</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>
|
||||||
|
<zorder>WifiSettingGroupBox</zorder>
|
||||||
<zorder>groupBox</zorder>
|
<zorder>groupBox</zorder>
|
||||||
<zorder>MainPageLabel</zorder>
|
<zorder>MainPageLabel</zorder>
|
||||||
<zorder>mInverterRlyStatusLabel</zorder>
|
<zorder>mInverterRlyStatusLabel</zorder>
|
||||||
@ -366,12 +854,26 @@
|
|||||||
<zorder>mCurrentSensorStateLbl</zorder>
|
<zorder>mCurrentSensorStateLbl</zorder>
|
||||||
<zorder>mLostReqPercentLbl</zorder>
|
<zorder>mLostReqPercentLbl</zorder>
|
||||||
<zorder>mPlotWidget</zorder>
|
<zorder>mPlotWidget</zorder>
|
||||||
<zorder>mVoltageLCD</zorder>
|
|
||||||
<zorder>mChaletCommActivityLbl</zorder>
|
<zorder>mChaletCommActivityLbl</zorder>
|
||||||
<zorder>mLasCommRequestReceivedLbl</zorder>
|
<zorder>mLasCommRequestReceivedLbl</zorder>
|
||||||
<zorder>mLogStartDateEdit</zorder>
|
<zorder>mLogStartDateEdit</zorder>
|
||||||
<zorder>mGetChaletLogButton</zorder>
|
<zorder>mGetChaletLogButton</zorder>
|
||||||
|
<zorder>mChaletTemperatureLbl</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>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
<buttongroups>
|
||||||
|
<buttongroup name="buttonGroup"/>
|
||||||
|
</buttongroups>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@ -84,11 +84,33 @@ int CChaletMasterCtrlInterface::DeviceFrameReceived(int TargetDeviceID, int Targ
|
|||||||
mProgramHandle->ChaletLogReceived(&Data);
|
mProgramHandle->ChaletLogReceived(&Data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case CHALET_INTERFACE_WIFI_GET_DEVICE_PARAMS_RESPONSE:
|
||||||
|
{
|
||||||
|
mProgramHandle->DeviceWiFiParamsReceived(&Data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CHALET_INTERFACE_WIFI_SET_DEVICE_PARAMS_RESPONSE:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CHALET_INTERFACE_GET_FIRMWARE_VERSION_RESPONSE:
|
||||||
|
{
|
||||||
|
mProgramHandle->DeviceFirmwareVersionReceived(Data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CHALET_INTERFACE_GET_WIFI_STATUS_RESPONSE:
|
||||||
|
{
|
||||||
|
mProgramHandle->WifiStatusReceived(Data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case CHALET_INTERFACE_GENERAL_STATUS_REQUEST:
|
case CHALET_INTERFACE_GENERAL_STATUS_REQUEST:
|
||||||
case CHALET_INTERFACE_AC_POWER_STATE_STATUS_REQUEST:
|
case CHALET_INTERFACE_AC_POWER_STATE_STATUS_REQUEST:
|
||||||
case CHALET_INTERFACE_AC_POWER_SET_STATE_REQUEST:
|
case CHALET_INTERFACE_AC_POWER_SET_STATE_REQUEST:
|
||||||
case CHALET_INTERFACE_BATTERY_VOLTAGE_REQUEST:
|
case CHALET_INTERFACE_BATTERY_VOLTAGE_REQUEST:
|
||||||
case CHALET_INTERFACE_GET_TODAYS_DATA_LOG_REQUEST:
|
case CHALET_INTERFACE_GET_TODAYS_DATA_LOG_REQUEST:
|
||||||
|
case CHALET_INTERFACE_WIFI_GET_DEVICE_PARAMS_REQUEST:
|
||||||
|
case CHALET_INTERFACE_WIFI_SET_DEVICE_PARAMS_REQUEST:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
qDebug("Chalet: Invalid Ethernet Msg received from MasterCtrl: %d",MessageID);
|
qDebug("Chalet: Invalid Ethernet Msg received from MasterCtrl: %d",MessageID);
|
||||||
|
|||||||
@ -9,15 +9,19 @@ CGuiMain::CGuiMain(QWidget *parent)
|
|||||||
mAvReceiverGui = new CAvReceiverGui(this);
|
mAvReceiverGui = new CAvReceiverGui(this);
|
||||||
mMainTabWidget = new QTabWidget(this);
|
mMainTabWidget = new QTabWidget(this);
|
||||||
mChaletGui = new CChaletGui(this);
|
mChaletGui = new CChaletGui(this);
|
||||||
|
mIspindelGui = new CIspindelGUI(this);
|
||||||
mTowerLightShowGui = new CTowerLightShowGui;
|
mTowerLightShowGui = new CTowerLightShowGui;
|
||||||
|
mPICUploaderGui = new CPICUploaderGui;
|
||||||
setCentralWidget(mMainTabWidget);
|
setCentralWidget(mMainTabWidget);
|
||||||
mMainTabWidget->addTab(mSMSGui,"SMS");
|
mMainTabWidget->addTab(mSMSGui,"SMS");
|
||||||
mMainTabWidget->addTab(mSprinklerGui,"Sprinkler");
|
mMainTabWidget->addTab(mSprinklerGui,"Sprinkler");
|
||||||
mMainTabWidget->addTab(mAvReceiverGui,"AV Receiver");
|
mMainTabWidget->addTab(mAvReceiverGui,"AV Receiver");
|
||||||
mMainTabWidget->addTab(mChaletGui,"Chalet");
|
mMainTabWidget->addTab(mChaletGui,"Chalet");
|
||||||
mMainTabWidget->addTab(mTowerLightShowGui,"Lightshow");
|
mMainTabWidget->addTab(mTowerLightShowGui,"Lightshow");
|
||||||
|
mMainTabWidget->addTab(mPICUploaderGui,"Firmware Upload");
|
||||||
|
mMainTabWidget->addTab(mIspindelGui,"ISpindel");
|
||||||
|
|
||||||
resize(1500,768);
|
resize(1700,768);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGuiMain::~CGuiMain()
|
CGuiMain::~CGuiMain()
|
||||||
|
|||||||
@ -9,6 +9,8 @@
|
|||||||
#include "AvReceiverGui.h"
|
#include "AvReceiverGui.h"
|
||||||
#include "ChaletGui.h"
|
#include "ChaletGui.h"
|
||||||
#include "TowerLightShowGui.h"
|
#include "TowerLightShowGui.h"
|
||||||
|
#include "PICUploaderGui.h"
|
||||||
|
#include "IspindelGUI.h"
|
||||||
|
|
||||||
class CGuiMain : public QMainWindow
|
class CGuiMain : public QMainWindow
|
||||||
{
|
{
|
||||||
@ -24,6 +26,8 @@ public:
|
|||||||
CChaletGui *mChaletGui;
|
CChaletGui *mChaletGui;
|
||||||
QTabWidget *mMainTabWidget;
|
QTabWidget *mMainTabWidget;
|
||||||
CTowerLightShowGui *mTowerLightShowGui;
|
CTowerLightShowGui *mTowerLightShowGui;
|
||||||
|
CPICUploaderGui *mPICUploaderGui;
|
||||||
|
CIspindelGUI *mIspindelGui;
|
||||||
int RespawnMainWindow();
|
int RespawnMainWindow();
|
||||||
int HideMainWindow();
|
int HideMainWindow();
|
||||||
|
|
||||||
|
|||||||
154
Sources/Ispindel/Ispindel.cpp
Normal file
154
Sources/Ispindel/Ispindel.cpp
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
#include "Ispindel.h"
|
||||||
|
#include <QDataStream>
|
||||||
|
#include "IspindelInterface.h"
|
||||||
|
|
||||||
|
CIspindel::CIspindel(CIspindelGUI *IspindelGui)
|
||||||
|
{
|
||||||
|
mIspindelGui = IspindelGui;
|
||||||
|
IspindelGui->mProgramHandle = this;
|
||||||
|
mNetworkInterface = new CIspindelInterface(this);
|
||||||
|
mOG = 0.0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CIspindel::~CIspindel()
|
||||||
|
{
|
||||||
|
delete mNetworkInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CIspindel::Start()
|
||||||
|
{
|
||||||
|
mNetworkInterface->ConnectToMasterCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CIspindel::IspindelFullBufferReceived(QByteArray *Data)
|
||||||
|
{
|
||||||
|
int NbItems;
|
||||||
|
QDataStream Strm(Data,QIODevice::ReadOnly | QIODevice::Unbuffered);
|
||||||
|
|
||||||
|
Strm >> NbItems;
|
||||||
|
|
||||||
|
if(NbItems == 0)
|
||||||
|
{
|
||||||
|
qDebug("Received empty Ispindel buffer...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClearIspindleDataList();
|
||||||
|
|
||||||
|
for(int i = 0; i < NbItems; i++)
|
||||||
|
{
|
||||||
|
CIspindelData *NewFrame = new CIspindelData;
|
||||||
|
Strm >> *NewFrame;
|
||||||
|
|
||||||
|
mIspindelDataList.append(NewFrame);
|
||||||
|
}
|
||||||
|
mOG = mIspindelDataList.first()->mGravity;
|
||||||
|
SetLasFrameTextInGUI(*mIspindelDataList.last());
|
||||||
|
mIspindelGui->UpdateIspindelPlot(&mIspindelDataList);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CIspindel::IspindelLastFrameReceived(QByteArray Data)
|
||||||
|
{
|
||||||
|
int DataSize;
|
||||||
|
QDataStream Strm(&Data,QIODevice::ReadOnly | QIODevice::Unbuffered);
|
||||||
|
|
||||||
|
if(Data.size() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CIspindelData *NewData = new CIspindelData();
|
||||||
|
Strm >> *NewData;
|
||||||
|
|
||||||
|
mIspindelDataList.append(NewData);
|
||||||
|
SetLasFrameTextInGUI(*NewData);
|
||||||
|
mIspindelGui->NewIspindelFrameReceived(NewData);
|
||||||
|
|
||||||
|
// 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()
|
||||||
|
{
|
||||||
|
for(int i = 0; i < mIspindelDataList.size(); i++)
|
||||||
|
{
|
||||||
|
delete mIspindelDataList[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
mIspindelDataList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CIspindel::ConnectedToMaster(bool connected)
|
||||||
|
{
|
||||||
|
if(connected)
|
||||||
|
{
|
||||||
|
mNetworkInterface->SendMasterCtrlCommand(ISPINDEL_GET_FULL_DATA_BUFFER_REQUEST,QByteArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (%11F)\nSample date time: %10\n------------------------------")\
|
||||||
|
.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.mTemperature*9/5)+32));
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
43
Sources/Ispindel/Ispindel.h
Normal file
43
Sources/Ispindel/Ispindel.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#ifndef ISPINDEL_H
|
||||||
|
#define ISPINDEL_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "IspindelGUI.h"
|
||||||
|
#include "IspindelData.h"
|
||||||
|
#include <QList>
|
||||||
|
#include "QCustomPlot/qcustomplot.h"
|
||||||
|
|
||||||
|
class CIspindelInterface;
|
||||||
|
|
||||||
|
class CIspindel : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit CIspindel(CIspindelGUI *IspindelGui);
|
||||||
|
~CIspindel();
|
||||||
|
|
||||||
|
CIspindelGUI *mIspindelGui;
|
||||||
|
|
||||||
|
|
||||||
|
void Start();
|
||||||
|
void IspindelFullBufferReceived(QByteArray *Data);
|
||||||
|
void IspindelLastFrameReceived(QByteArray Data);
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ISPINDEL_H
|
||||||
54
Sources/Ispindel/IspindelData.cpp
Normal file
54
Sources/Ispindel/IspindelData.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#include "IspindelData.h"
|
||||||
|
|
||||||
|
|
||||||
|
CIspindelData::CIspindelData()
|
||||||
|
{
|
||||||
|
mIspindelID = mRSSI = mInterval = 0;
|
||||||
|
mIspindelName = mTemperatureUnits = "";
|
||||||
|
mAngle = mBattery = mGravity = mTemperature = 0.0;
|
||||||
|
mSampleDateTime = QDateTime::currentDateTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
QDataStream &operator<<(QDataStream &out, const CIspindelData &source)
|
||||||
|
{
|
||||||
|
out << source.mAngle
|
||||||
|
<< source.mBattery
|
||||||
|
<< source.mGravity
|
||||||
|
<< source.mInterval
|
||||||
|
<< source.mIspindelID
|
||||||
|
<< source.mIspindelName
|
||||||
|
<< source.mRSSI
|
||||||
|
<< source.mTemperature
|
||||||
|
<< source.mTemperatureUnits
|
||||||
|
<< source.mSampleDateTime;
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDataStream &operator>>(QDataStream &in, CIspindelData &dest)
|
||||||
|
{
|
||||||
|
in >> dest.mAngle
|
||||||
|
>> dest.mBattery
|
||||||
|
>> dest.mGravity
|
||||||
|
>> dest.mInterval
|
||||||
|
>> dest.mIspindelID
|
||||||
|
>> dest.mIspindelName
|
||||||
|
>> dest.mRSSI
|
||||||
|
>> dest.mTemperature
|
||||||
|
>> dest.mTemperatureUnits
|
||||||
|
>> dest.mSampleDateTime;
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray CIspindelData::ToByteArray()
|
||||||
|
{
|
||||||
|
QByteArray Array;
|
||||||
|
QDataStream Strm(&Array,QIODevice::WriteOnly | QIODevice::Unbuffered);
|
||||||
|
|
||||||
|
Strm << *this;
|
||||||
|
|
||||||
|
return Array;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
25
Sources/Ispindel/IspindelData.h
Normal file
25
Sources/Ispindel/IspindelData.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef CISPINDELDATA_H
|
||||||
|
#define CISPINDELDATA_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QDataStream>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
|
class CIspindelData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CIspindelData();
|
||||||
|
|
||||||
|
int mIspindelID, mRSSI, mInterval;
|
||||||
|
QString mIspindelName, mTemperatureUnits;
|
||||||
|
double mAngle, mBattery, mGravity, mTemperature;
|
||||||
|
QDateTime mSampleDateTime;
|
||||||
|
|
||||||
|
QByteArray ToByteArray();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
QDataStream &operator<<(QDataStream &out, const CIspindelData &source);
|
||||||
|
QDataStream &operator>>(QDataStream &in, CIspindelData &dest);
|
||||||
|
#endif // CISPINDELDATA_H
|
||||||
176
Sources/Ispindel/IspindelGUI.cpp
Normal file
176
Sources/Ispindel/IspindelGUI.cpp
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
#include "IspindelGUI.h"
|
||||||
|
#include "ui_IspindelGUI.h"
|
||||||
|
#include "Ispindel.h"
|
||||||
|
#include "IspindelData.h"
|
||||||
|
#include "GlobalDefine.h"
|
||||||
|
|
||||||
|
CIspindelGUI::CIspindelGUI(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::CIspindelGUI)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
|
||||||
|
mIspindelPlot = new QCustomPlot(ui->mIspindelPlot);
|
||||||
|
mIspindelPlot->resize(ui->mIspindelPlot->size());
|
||||||
|
|
||||||
|
// create graph and assign data to it:
|
||||||
|
mIspindelPlot->addGraph();
|
||||||
|
mIspindelPlot->addGraph(mIspindelPlot->xAxis,mIspindelPlot->yAxis2);
|
||||||
|
|
||||||
|
|
||||||
|
// give the axes some labels:
|
||||||
|
mIspindelPlot->xAxis->setLabel("Time");
|
||||||
|
mIspindelPlot->yAxis->setLabel("Gravity");
|
||||||
|
mIspindelPlot->yAxis2->setLabel("Temprature (C)");
|
||||||
|
mIspindelPlot->yAxis2->setVisible(true);
|
||||||
|
|
||||||
|
double now = QDateTime::currentDateTime().toSecsSinceEpoch();
|
||||||
|
QSharedPointer<QCPAxisTickerDateTime> dateTicker(new QCPAxisTickerDateTime);
|
||||||
|
dateTicker->setDateTimeFormat("hh:mm:ss\ndd MMM");
|
||||||
|
mIspindelPlot->xAxis->setTicker(dateTicker);
|
||||||
|
mIspindelPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
|
||||||
|
QList<QCPAxis*> xAxis, yAxis;
|
||||||
|
xAxis.append(mIspindelPlot->xAxis);
|
||||||
|
yAxis.append(mIspindelPlot->yAxis);
|
||||||
|
yAxis.append(mIspindelPlot->yAxis2);
|
||||||
|
mIspindelPlot->axisRect()->setRangeDragAxes(xAxis,yAxis);
|
||||||
|
mIspindelPlot->axisRect()->setRangeZoomAxes(xAxis,yAxis);
|
||||||
|
// mIspindelPlot->yAxis2->axisRect()->setRangeZoomAxes(0,mIspindelPlot->yAxis2);
|
||||||
|
|
||||||
|
|
||||||
|
QDateTime Now = QDateTime::currentDateTime().toLocalTime();
|
||||||
|
|
||||||
|
QDateTime midnight = Now;
|
||||||
|
midnight.setTime(QTime(0,0,0));
|
||||||
|
QDateTime eod = Now;
|
||||||
|
eod.setTime(QTime(23,59,0));
|
||||||
|
|
||||||
|
//mIspindelPlot->xAxis->setRange(0/*QCPAxisTickerDateTime::dateTimeToKey(midnight)*/,QCPAxisTickerDateTime::dateTimeToKey(eod));
|
||||||
|
// mIspindelPlot->xAxis->setRange(now, now+(2*3600));
|
||||||
|
mIspindelPlot->xAxis->setRange(midnight.toSecsSinceEpoch(), eod.toSecsSinceEpoch());
|
||||||
|
|
||||||
|
mIspindelPlot->yAxis->setRange(1.000,1.01);
|
||||||
|
mIspindelPlot->yAxis2->setRange(15,25);
|
||||||
|
|
||||||
|
// mIspindelPlot->graph(0)->addData(now,1.005);
|
||||||
|
// 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()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CIspindelGUI::SetLastIspindelFrameData(QString Data, QString ABVText)
|
||||||
|
{
|
||||||
|
ui->mLastFrameDataLbl->setText(Data);
|
||||||
|
ui->mABVLabel->setText(ABVText);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CIspindelGUI::UpdateIspindelPlot(QList<CIspindelData *> *Data)
|
||||||
|
{
|
||||||
|
if(Data->size() == 0)
|
||||||
|
return RET_ERROR;
|
||||||
|
|
||||||
|
QVector<double> x,y,ty;
|
||||||
|
for(int i = 0; i < Data->size(); i++)
|
||||||
|
{
|
||||||
|
x.append(Data->at(i)->mSampleDateTime.toSecsSinceEpoch());
|
||||||
|
y.append(Data->at(i)->mGravity);
|
||||||
|
ty.append(Data->at(i)->mTemperature);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(x.size() == 0 || y.size() == 0)
|
||||||
|
return RET_ERROR;
|
||||||
|
|
||||||
|
mIspindelPlot->graph(0)->data().clear();
|
||||||
|
mIspindelPlot->graph(0)->setData(x,y);
|
||||||
|
mIspindelPlot->xAxis->setRange(x.first(),x.last());
|
||||||
|
mIspindelPlot->yAxis->setRange(y.first(),y.last());
|
||||||
|
|
||||||
|
|
||||||
|
mIspindelPlot->graph(1)->setPen(QColor(Qt::red));
|
||||||
|
mIspindelPlot->graph(1)->setName("Température");
|
||||||
|
mIspindelPlot->graph(1)->setData(x,ty);
|
||||||
|
mIspindelPlot->yAxis2->setRange(10,30);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
40
Sources/Ispindel/IspindelGUI.h
Normal file
40
Sources/Ispindel/IspindelGUI.h
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#ifndef ISPINDELGUI_H
|
||||||
|
#define ISPINDELGUI_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include "QCustomPlot/qcustomplot.h"
|
||||||
|
#include <QList>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CIspindelGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CIspindel;
|
||||||
|
class CIspindelData;
|
||||||
|
|
||||||
|
class CIspindelGUI : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CIspindelGUI(QWidget *parent = 0);
|
||||||
|
~CIspindelGUI();
|
||||||
|
CIspindel *mProgramHandle;
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ISPINDELGUI_H
|
||||||
127
Sources/Ispindel/IspindelGUI.ui
Normal file
127
Sources/Ispindel/IspindelGUI.ui
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CIspindelGUI</class>
|
||||||
|
<widget class="QDialog" name="CIspindelGUI">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1123</width>
|
||||||
|
<height>629</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>520</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>91</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>ISpindel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="mIspindelPlot" native="true">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>520</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>661</width>
|
||||||
|
<height>461</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="mLastFrameDataLbl">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>60</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>381</width>
|
||||||
|
<height>241</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Tahoma</family>
|
||||||
|
<pointsize>11</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>No data...</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QTableWidget" name="mSamplesTable">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>290</y>
|
||||||
|
<width>461</width>
|
||||||
|
<height>331</height>
|
||||||
|
</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/>
|
||||||
|
</ui>
|
||||||
70
Sources/Ispindel/IspindelInterface.cpp
Normal file
70
Sources/Ispindel/IspindelInterface.cpp
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#include "IspindelInterface.h"
|
||||||
|
#include "IspindelData.h"
|
||||||
|
#include "Ispindel.h"
|
||||||
|
#include "ProtocolDefs.h"
|
||||||
|
|
||||||
|
CIspindelInterface::CIspindelInterface(CIspindel *ProgramHandle)
|
||||||
|
{
|
||||||
|
mMyDeviceID = ID_ISPINDEL_INTERFACE;
|
||||||
|
mNetworkPort = 2182;
|
||||||
|
mMasterCtrlIPAddress = "127.0.0.1";
|
||||||
|
mNetworkCommSocket = 0;
|
||||||
|
mDeviceAddress = 1;
|
||||||
|
|
||||||
|
mProgramHandle = ProgramHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CIspindelInterface::DeviceConnectedToMaster(bool Connected)
|
||||||
|
{
|
||||||
|
if(Connected)
|
||||||
|
{
|
||||||
|
qDebug("Ispindel Interface connected to Master.");
|
||||||
|
mProgramHandle->ConnectedToMaster(Connected);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return RET_ERROR;
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CIspindelInterface::DeviceFrameReceived(int TargetDeviceID, int TargetDeviceAddress, int SenderID, int SenderAddress, int MessageID, int DataSize, QByteArray Data)
|
||||||
|
{
|
||||||
|
Q_UNUSED(DataSize)
|
||||||
|
Q_UNUSED(SenderID)
|
||||||
|
Q_UNUSED(SenderAddress)
|
||||||
|
|
||||||
|
if(TargetDeviceID == mMyDeviceID && (TargetDeviceAddress == BROADCAST_VALUE || TargetDeviceAddress == mDeviceAddress))
|
||||||
|
{
|
||||||
|
switch(MessageID)
|
||||||
|
{
|
||||||
|
case ISPINDEL_GET_FULL_DATA_BUFFER_RESPONSE:
|
||||||
|
{
|
||||||
|
mProgramHandle->IspindelFullBufferReceived(&Data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ISPINDLE_LATEST_DATA_RESPONSE:
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
|
||||||
|
}
|
||||||
20
Sources/Ispindel/IspindelInterface.h
Normal file
20
Sources/Ispindel/IspindelInterface.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#ifndef ISPINDELINTERFACE_H
|
||||||
|
#define ISPINDELINTERFACE_H
|
||||||
|
|
||||||
|
#include "MasterCtrlInterface.h"
|
||||||
|
|
||||||
|
class CIspindel;
|
||||||
|
|
||||||
|
class CIspindelInterface : public CMasterCtrlInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CIspindelInterface(CIspindel *ProgramHandle);
|
||||||
|
|
||||||
|
int DeviceFrameReceived(int TargetDeviceID, int TargetDeviceAddress, int SenderID, int SenderAddress, int MessageID, int DataSize, QByteArray Data);
|
||||||
|
int DeviceConnectedToMaster(bool Connected);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CIspindel *mProgramHandle;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ISPINDELINTERFACE_H
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
#include "LoraModuleIFMasterCtrlInterface.h"
|
||||||
|
#include "LoraModuleInterface.h"
|
||||||
|
#include "LoraModuleInterfaceData.h"
|
||||||
|
|
||||||
|
CLoraModuleIFMasterCtrlInterface::CLoraModuleIFMasterCtrlInterface(CLoraModuleInterface *ProgramHandle)
|
||||||
|
{
|
||||||
|
mMyDeviceID = ID_LORA_INTERFACE_INTERFACE;
|
||||||
|
mNetworkPort = 2182;
|
||||||
|
mMasterCtrlIPAddress = "127.0.0.1";
|
||||||
|
mNetworkCommSocket = 0;
|
||||||
|
mDeviceAddress = 1;
|
||||||
|
|
||||||
|
mProgramHandle = ProgramHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLoraModuleIFMasterCtrlInterface::DeviceFrameReceived(int TargetDeviceID, int TargetDeviceAddress, int SenderID, int SenderAddress, int MessageID, int DataSize, QByteArray Data)
|
||||||
|
{
|
||||||
|
Q_UNUSED(DataSize)
|
||||||
|
Q_UNUSED(SenderID)
|
||||||
|
Q_UNUSED(SenderAddress)
|
||||||
|
|
||||||
|
|
||||||
|
if(TargetDeviceID == mMyDeviceID && (TargetDeviceAddress == BROADCAST_VALUE || TargetDeviceAddress == mDeviceAddress))
|
||||||
|
{
|
||||||
|
switch(MessageID)
|
||||||
|
{
|
||||||
|
case LORA_MODULE_IF_INTERFACE_ACK:
|
||||||
|
{
|
||||||
|
qDebug("Chalet Interface ACK received");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LORA_MODULE_IF_INTERFACE_GENERAL_STATUS_RESPONSE:
|
||||||
|
{
|
||||||
|
// qDebug("Rx Lora Module IF status");
|
||||||
|
CLoraModuleInterfaceStatus Status;
|
||||||
|
QDataStream Strm(Data);
|
||||||
|
Strm >> Status;
|
||||||
|
mProgramHandle->NewLoraModuleStatusData(Status);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LORA_MODULE_IF_INTERFACE_GENERAL_STATUS_REQUEST:
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
qDebug("CLoraModuleIFMasterCtrlInterface: invalid command received");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLoraModuleIFMasterCtrlInterface::DeviceConnectedToMaster(bool Connected)
|
||||||
|
{
|
||||||
|
if(Connected)
|
||||||
|
{
|
||||||
|
qDebug("LoraModuleIF Interface connected to Master.");
|
||||||
|
mProgramHandle->ConnectedToMaster(Connected);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return RET_ERROR;
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef LORAMODULEIFMASTERCTRLINTERFACE_H
|
||||||
|
#define LORAMODULEIFMASTERCTRLINTERFACE_H
|
||||||
|
|
||||||
|
#include "MasterCtrlInterface.h"
|
||||||
|
class CLoraModuleInterface;
|
||||||
|
|
||||||
|
class CLoraModuleIFMasterCtrlInterface: public CMasterCtrlInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CLoraModuleIFMasterCtrlInterface(CLoraModuleInterface *ProgramHandle);
|
||||||
|
|
||||||
|
int DeviceFrameReceived(int TargetDeviceID, int TargetDeviceAddress, int SenderID, int SenderAddress, int MessageID, int DataSize, QByteArray Data);
|
||||||
|
int DeviceConnectedToMaster(bool Connected = true);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CLoraModuleInterface *mProgramHandle;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LORAMODULEIFMASTERCTRLINTERFACE_H
|
||||||
44
Sources/LoRaModuleInterface/LoraModuleInterface.cpp
Normal file
44
Sources/LoRaModuleInterface/LoraModuleInterface.cpp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#include "LoraModuleInterface.h"
|
||||||
|
#include "LoraModuleIFMasterCtrlInterface.h"
|
||||||
|
|
||||||
|
CLoraModuleInterface::CLoraModuleInterface(CChaletGui *ChaletGuiPtr)
|
||||||
|
{
|
||||||
|
mChaletGui = ChaletGuiPtr;
|
||||||
|
mChaletGui->mLoraModuleIFProgramHandle = this;
|
||||||
|
mNetworkInterface = new CLoraModuleIFMasterCtrlInterface(this);
|
||||||
|
|
||||||
|
|
||||||
|
mLoraModulePollTimer = new QTimer();
|
||||||
|
mLoraModulePollTimer->setInterval(1000);
|
||||||
|
mLoraModulePollTimer->setSingleShot(false);
|
||||||
|
connect(mLoraModulePollTimer,&QTimer::timeout,this,&CLoraModuleInterface::LoraModulePollTimerExpired);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLoraModuleInterface::ConnectedToMaster(bool connected)
|
||||||
|
{
|
||||||
|
if(connected)
|
||||||
|
{
|
||||||
|
mLoraModulePollTimer->start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mLoraModulePollTimer->stop();
|
||||||
|
}
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLoraModuleInterface::Start()
|
||||||
|
{
|
||||||
|
mNetworkInterface->ConnectToMasterCtrl();
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLoraModuleInterface::LoraModulePollTimerExpired()
|
||||||
|
{
|
||||||
|
mNetworkInterface->SendMasterCtrlCommand(LORA_MODULE_IF_INTERFACE_GENERAL_STATUS_REQUEST,QByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLoraModuleInterface::NewLoraModuleStatusData(CLoraModuleInterfaceStatus Data)
|
||||||
|
{
|
||||||
|
mChaletGui->UpdateLoraModuleStatus(Data);
|
||||||
|
}
|
||||||
29
Sources/LoRaModuleInterface/LoraModuleInterface.h
Normal file
29
Sources/LoRaModuleInterface/LoraModuleInterface.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef LORAMODULEINTERFACE_H
|
||||||
|
#define LORAMODULEINTERFACE_H
|
||||||
|
|
||||||
|
#include "ChaletGui.h"
|
||||||
|
#include <QTimer>
|
||||||
|
#include "LoraModuleInterfaceData.h"
|
||||||
|
|
||||||
|
|
||||||
|
class CLoraModuleIFMasterCtrlInterface;
|
||||||
|
|
||||||
|
class CLoraModuleInterface : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
CLoraModuleInterface(CChaletGui *ChaletGuiPtr);
|
||||||
|
int Start();
|
||||||
|
|
||||||
|
int ConnectedToMaster(bool connected);
|
||||||
|
int NewLoraModuleStatusData(CLoraModuleInterfaceStatus Data);
|
||||||
|
|
||||||
|
CLoraModuleIFMasterCtrlInterface *mNetworkInterface;
|
||||||
|
CChaletGui *mChaletGui;
|
||||||
|
QTimer *mLoraModulePollTimer;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void LoraModulePollTimerExpired();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LORAMODULEINTERFACE_H
|
||||||
90
Sources/LoRaModuleInterface/LoraModuleInterfaceData.cpp
Normal file
90
Sources/LoRaModuleInterface/LoraModuleInterfaceData.cpp
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
#include "LoraModuleInterfaceData.h"
|
||||||
|
|
||||||
|
CLoraModuleInterfaceStatus::CLoraModuleInterfaceStatus()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CLoraModuleInterfaceStatus& CLoraModuleInterfaceStatus::operator = (const CLoraModuleInterfaceStatus &rhs)
|
||||||
|
{
|
||||||
|
if(this == &rhs)
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
mModuleModel = rhs.mModuleModel;
|
||||||
|
mModuleInternalAddress = rhs.mModuleInternalAddress;
|
||||||
|
mModuleUARTParity = rhs.mModuleUARTParity;
|
||||||
|
mModuleUARTRate = rhs.mModuleUARTRate;
|
||||||
|
mModuleAirRate = rhs.mModuleAirRate;
|
||||||
|
mModuleSubPacket = rhs.mModuleSubPacket;
|
||||||
|
mModuleRSSIEnabled = rhs.mModuleRSSIEnabled;
|
||||||
|
mModuleTxPower = rhs.mModuleTxPower;
|
||||||
|
mModuleInternalChannel = rhs.mModuleInternalChannel;
|
||||||
|
mModuleRSSIByteEnabled = rhs.mModuleRSSIByteEnabled;
|
||||||
|
mModuleTxMethod = rhs.mModuleTxMethod;
|
||||||
|
mModuleLBTEnabled = rhs.mModuleLBTEnabled;
|
||||||
|
mModuleWORCycle = rhs.mModuleWORCycle;
|
||||||
|
mModuleAmbientRSSI = rhs.mModuleAmbientRSSI;
|
||||||
|
mModuleLastRxRSSI = rhs.mModuleLastRxRSSI;
|
||||||
|
|
||||||
|
mIPAddress1 = rhs.mIPAddress1;
|
||||||
|
mIPAddress2 = rhs.mIPAddress2;
|
||||||
|
mIPAddress3 = rhs.mIPAddress3;
|
||||||
|
mIPAddress4 = rhs.mIPAddress4;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDataStream &operator<<(QDataStream &out, const CLoraModuleInterfaceStatus &source)
|
||||||
|
{
|
||||||
|
out << source.mModuleModel
|
||||||
|
<< source.mModuleInternalAddress
|
||||||
|
<< source.mModuleUARTParity
|
||||||
|
<< source.mModuleUARTRate
|
||||||
|
<< source.mModuleAirRate
|
||||||
|
<< source.mModuleSubPacket
|
||||||
|
<< source.mModuleRSSIEnabled
|
||||||
|
<< source.mModuleTxPower
|
||||||
|
<< source.mModuleInternalChannel
|
||||||
|
<< source.mModuleRSSIByteEnabled
|
||||||
|
<< source.mModuleTxMethod
|
||||||
|
<< source.mModuleLBTEnabled
|
||||||
|
<< source.mModuleWORCycle
|
||||||
|
<< source.mModuleAmbientRSSI
|
||||||
|
<< source.mModuleLastRxRSSI
|
||||||
|
<< source.mIPAddress1
|
||||||
|
<< source.mIPAddress2
|
||||||
|
<< source.mIPAddress3
|
||||||
|
<< source.mIPAddress4;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDataStream &operator>>(QDataStream &in, CLoraModuleInterfaceStatus &dest)
|
||||||
|
{
|
||||||
|
in >> dest.mModuleModel
|
||||||
|
>> dest.mModuleInternalAddress
|
||||||
|
>> dest.mModuleUARTParity
|
||||||
|
>> dest.mModuleUARTRate
|
||||||
|
>> dest.mModuleAirRate
|
||||||
|
>> dest.mModuleSubPacket
|
||||||
|
>> dest.mModuleRSSIEnabled
|
||||||
|
>> dest.mModuleTxPower
|
||||||
|
>> dest.mModuleInternalChannel
|
||||||
|
>> dest.mModuleRSSIByteEnabled
|
||||||
|
>> dest.mModuleTxMethod
|
||||||
|
>> dest.mModuleLBTEnabled
|
||||||
|
>> dest.mModuleWORCycle
|
||||||
|
>> dest.mModuleAmbientRSSI
|
||||||
|
>> dest.mModuleLastRxRSSI
|
||||||
|
>> dest.mIPAddress1
|
||||||
|
>> dest.mIPAddress2
|
||||||
|
>> dest.mIPAddress3
|
||||||
|
>> dest.mIPAddress4;
|
||||||
|
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
110
Sources/LoRaModuleInterface/LoraModuleInterfaceData.h
Normal file
110
Sources/LoRaModuleInterface/LoraModuleInterfaceData.h
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
#ifndef LORAMODULEINTERFACEDATA_H
|
||||||
|
#define LORAMODULEINTERFACEDATA_H
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include <QDataStream>
|
||||||
|
|
||||||
|
class CLoraModuleInterfaceStatus
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
enum eE220UartRates
|
||||||
|
{
|
||||||
|
E220_UART_1200 = 0,
|
||||||
|
E220_UART_2400,
|
||||||
|
E220_UART_4800,
|
||||||
|
E220_UART_9600,
|
||||||
|
E220_UART_19200,
|
||||||
|
E220_UART_38400,
|
||||||
|
E220_UART_57600,
|
||||||
|
E220_UART_115200
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum eE220ParityBit
|
||||||
|
{
|
||||||
|
E220_UART_8N1=0,
|
||||||
|
E220_UART_8O1,
|
||||||
|
E220_UART_8E1,
|
||||||
|
E220_UART_8N1_bis
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum e220AirDataRates
|
||||||
|
{
|
||||||
|
E220_AIR_RATE_24K = 0,
|
||||||
|
E220_AIR_RATE_24K_1,
|
||||||
|
E220_AIR_RATE_24K_2,
|
||||||
|
E220_AIR_RATE_48K,
|
||||||
|
E220_AIR_RATE_96K,
|
||||||
|
E220_AIR_RATE_192K,
|
||||||
|
E220_AIR_RATE_384K,
|
||||||
|
E220_AIR_RATE_625K
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum e220PacketSizes
|
||||||
|
{
|
||||||
|
E220_PACKET_200,
|
||||||
|
E220_PACKET_128,
|
||||||
|
E220_PACKET_64,
|
||||||
|
E220_PACKET_32
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum e220TransmitPower
|
||||||
|
{
|
||||||
|
E220_TX_PWR_30,
|
||||||
|
E220_TX_PWR_27,
|
||||||
|
E220_TX_PWR_24,
|
||||||
|
E220_TX_PWR_21
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum e220WORCycles
|
||||||
|
{
|
||||||
|
E220_WOR_500MS,
|
||||||
|
E220_WOR_1000MS,
|
||||||
|
E220_WOR_1500MS,
|
||||||
|
E220_WOR_2000MS,
|
||||||
|
E220_WOR_2500MS,
|
||||||
|
E220_WOR_3000MS,
|
||||||
|
E220_WOR_3500MS,
|
||||||
|
E220_WOR_4000MS
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLoraModuleInterfaceStatus();
|
||||||
|
|
||||||
|
quint8 mModuleModel;
|
||||||
|
quint16 mModuleInternalAddress;
|
||||||
|
quint8 mModuleUARTParity;
|
||||||
|
quint8 mModuleUARTRate;
|
||||||
|
quint8 mModuleAirRate;
|
||||||
|
quint8 mModuleSubPacket;
|
||||||
|
quint8 mModuleRSSIEnabled;
|
||||||
|
quint8 mModuleTxPower;
|
||||||
|
quint8 mModuleInternalChannel;
|
||||||
|
quint8 mModuleRSSIByteEnabled;
|
||||||
|
quint8 mModuleTxMethod;
|
||||||
|
quint8 mModuleLBTEnabled;
|
||||||
|
quint8 mModuleWORCycle;
|
||||||
|
|
||||||
|
quint8 mModuleAmbientRSSI;
|
||||||
|
quint8 mModuleLastRxRSSI;
|
||||||
|
|
||||||
|
quint8 mIPAddress1;
|
||||||
|
quint8 mIPAddress2;
|
||||||
|
quint8 mIPAddress3;
|
||||||
|
quint8 mIPAddress4;
|
||||||
|
|
||||||
|
CLoraModuleInterfaceStatus& operator=(const CLoraModuleInterfaceStatus &rhs);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
QDataStream &operator<<(QDataStream &out, const CLoraModuleInterfaceStatus &source);
|
||||||
|
QDataStream &operator>>(QDataStream &in, CLoraModuleInterfaceStatus &dest);
|
||||||
|
|
||||||
|
#endif // LORAMODULEINTERFACEDATA_H
|
||||||
@ -62,7 +62,7 @@ int CMasterCtrlInterface::NewFrameReceived(int TargetDeviceID, int TargetDeviceA
|
|||||||
}
|
}
|
||||||
case ETH_NETWK_CONNECTION_REFUSED:
|
case ETH_NETWK_CONNECTION_REFUSED:
|
||||||
{
|
{
|
||||||
qDebug("MasterCtrl connection refused");
|
qDebug("MasterCtrl connection refused for device ID: %d, address: %d",TargetDeviceID,TargetDeviceAddress);
|
||||||
mNetworkCommSocket->close();
|
mNetworkCommSocket->close();
|
||||||
delete mNetworkCommSocket;
|
delete mNetworkCommSocket;
|
||||||
mNetworkCommSocket = 0;
|
mNetworkCommSocket = 0;
|
||||||
|
|||||||
292
Sources/PICUploader/BootloaderProtocol.cpp
Normal file
292
Sources/PICUploader/BootloaderProtocol.cpp
Normal file
@ -0,0 +1,292 @@
|
|||||||
|
#include "BootloaderProtocol.h"
|
||||||
|
#include "PICUploader.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CBootloaderProtocol::CBootloaderProtocol(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
mCRCEngine.InitTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
CBootloaderProtocol::~CBootloaderProtocol()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int CBootloaderProtocol::BootloaderProtocolInit()
|
||||||
|
{
|
||||||
|
BootloaderProtocolResetStateMachine();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CBootloaderProtocol::BootloaderProtocolResetStateMachine()
|
||||||
|
{
|
||||||
|
mBootloaderDataSize = 0;
|
||||||
|
mBootloaderHeader = 0;
|
||||||
|
mBootloaderBufPtr = 0;
|
||||||
|
mBootloaderDataBuffer.clear();
|
||||||
|
mBootloaderCommand = 0;
|
||||||
|
mBootloaderCRC = 0;
|
||||||
|
mBootloaderComputedCRC = CRC_START_32;
|
||||||
|
mBootloaderState = RxHeader1;
|
||||||
|
mBootloaderDataCtr = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int CBootloaderProtocol::BooloaderProtocolRxFrame(QByteArray Frame)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < Frame.size(); i++)
|
||||||
|
{
|
||||||
|
BootloaderProtocolStateMachine(Frame.at(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBootloaderProtocol::BootloaderProtocolStateMachine(unsigned char Data)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch(mBootloaderState)
|
||||||
|
{
|
||||||
|
case Initialization: //Reset all pointers and data...
|
||||||
|
{
|
||||||
|
mBootloaderDataSize = 0;
|
||||||
|
mBootloaderBufPtr = 0;
|
||||||
|
mBootloaderDataBuffer.clear();
|
||||||
|
mBootloaderCommand = 0;
|
||||||
|
mBootloaderCRC = 0;
|
||||||
|
mBootloaderComputedCRC = CRC_START_32;
|
||||||
|
mBootloaderState = RxHeader1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RxHeader1: //Wait for data header...
|
||||||
|
{
|
||||||
|
mBootloaderHeader += Data; //0xDE
|
||||||
|
mBootloaderComputedCRC = mCRCEngine.UpdateCRC32(mBootloaderComputedCRC,Data);
|
||||||
|
|
||||||
|
if(Data == BOOTLOADER_FRAME_HEADER_1)
|
||||||
|
{
|
||||||
|
mBootloaderState = RxHeader2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BootloaderProtocolResetStateMachine();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RxHeader2: //Wait for data header...
|
||||||
|
{
|
||||||
|
mBootloaderHeader <<= 8;
|
||||||
|
mBootloaderHeader += Data; //0xAD
|
||||||
|
mBootloaderComputedCRC = mCRCEngine.UpdateCRC32(mBootloaderComputedCRC,Data);
|
||||||
|
|
||||||
|
if(Data == BOOTLOADER_FRAME_HEADER_2)
|
||||||
|
{
|
||||||
|
mBootloaderState = RxHeader3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BootloaderProtocolResetStateMachine();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RxHeader3: //Wait for data header...
|
||||||
|
{
|
||||||
|
mBootloaderHeader <<= 8;
|
||||||
|
mBootloaderHeader += Data; //0xBE
|
||||||
|
mBootloaderComputedCRC = mCRCEngine.UpdateCRC32(mBootloaderComputedCRC,Data);
|
||||||
|
|
||||||
|
if(Data == BOOTLOADER_FRAME_HEADER_3)
|
||||||
|
{
|
||||||
|
mBootloaderState = RxHeader4;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BootloaderProtocolResetStateMachine();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RxHeader4: //Wait for data header...
|
||||||
|
{
|
||||||
|
mBootloaderHeader <<= 8;
|
||||||
|
mBootloaderHeader += Data; //0xEF
|
||||||
|
mBootloaderComputedCRC = mCRCEngine.UpdateCRC32(mBootloaderComputedCRC,Data);
|
||||||
|
|
||||||
|
if(mBootloaderHeader != BOOTLOADER_FRAME_HEADER)
|
||||||
|
{
|
||||||
|
//TODO, send NACK?
|
||||||
|
BootloaderProtocolResetStateMachine();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mBootloaderState = RxCmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RxCmd:
|
||||||
|
{
|
||||||
|
mBootloaderCommand = Data;
|
||||||
|
mBootloaderState = RxPayloadSize1;
|
||||||
|
mBootloaderComputedCRC = mCRCEngine.UpdateCRC32(mBootloaderComputedCRC,Data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RxPayloadSize1:
|
||||||
|
{
|
||||||
|
mBootloaderDataSize = Data;
|
||||||
|
mBootloaderState = RxPayloadSize2;
|
||||||
|
mBootloaderComputedCRC = mCRCEngine.UpdateCRC32(mBootloaderComputedCRC,Data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RxPayloadSize2:
|
||||||
|
{
|
||||||
|
mBootloaderDataSize <<= 8;
|
||||||
|
mBootloaderDataSize += Data;
|
||||||
|
|
||||||
|
mBootloaderState = RxPayloadSize3;
|
||||||
|
mBootloaderComputedCRC = mCRCEngine.UpdateCRC32(mBootloaderComputedCRC,Data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RxPayloadSize3:
|
||||||
|
{
|
||||||
|
mBootloaderDataSize <<= 8;
|
||||||
|
mBootloaderDataSize += Data;
|
||||||
|
mBootloaderComputedCRC = mCRCEngine.UpdateCRC32(mBootloaderComputedCRC,Data);
|
||||||
|
|
||||||
|
mBootloaderState = RxPayloadSize4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RxPayloadSize4:
|
||||||
|
{
|
||||||
|
mBootloaderDataSize <<= 8;
|
||||||
|
mBootloaderDataSize += Data;
|
||||||
|
mBootloaderComputedCRC = mCRCEngine.UpdateCRC32(mBootloaderComputedCRC,Data);
|
||||||
|
|
||||||
|
if(mBootloaderDataSize > MAX_BOOTLOADER_PAYLOAD_SIZE)
|
||||||
|
{
|
||||||
|
//TODO, send NACK?
|
||||||
|
BootloaderProtocolResetStateMachine();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
mBootloaderState = RxPayload;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RxPayload: //Data size
|
||||||
|
{
|
||||||
|
mBootloaderDataBuffer.append(Data);
|
||||||
|
mBootloaderDataCtr++;
|
||||||
|
mBootloaderComputedCRC = mCRCEngine.UpdateCRC32(mBootloaderComputedCRC,Data);
|
||||||
|
|
||||||
|
if(mBootloaderDataCtr == mBootloaderDataSize)
|
||||||
|
{
|
||||||
|
mBootloaderState = RxCRC1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RxCRC1: //Data size
|
||||||
|
{
|
||||||
|
mBootloaderCRC = Data;
|
||||||
|
mBootloaderState = RxCRC2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RxCRC2: //Data size
|
||||||
|
{
|
||||||
|
mBootloaderCRC <<= 8;
|
||||||
|
mBootloaderCRC += Data;
|
||||||
|
mBootloaderState = RxCRC3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RxCRC3: //Data size
|
||||||
|
{
|
||||||
|
mBootloaderCRC <<= 8;
|
||||||
|
mBootloaderCRC += Data;
|
||||||
|
mBootloaderState = RxCRC4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RxCRC4: //Data size
|
||||||
|
{
|
||||||
|
mBootloaderCRC <<= 8;
|
||||||
|
mBootloaderCRC += Data;
|
||||||
|
|
||||||
|
mBootloaderComputedCRC ^= 0xffffffffL;
|
||||||
|
//if(mBootloaderCRC == 0xBAADCAFE)
|
||||||
|
if(mBootloaderCRC == mBootloaderComputedCRC)
|
||||||
|
{
|
||||||
|
mProgramHandle->BootloaderRxCmd(mBootloaderCommand,mBootloaderDataBuffer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("Bootloader Protocol bad CRC...");
|
||||||
|
}
|
||||||
|
|
||||||
|
BootloaderProtocolResetStateMachine();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
BootloaderProtocolResetStateMachine();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray CBootloaderProtocol::BootloaderProtocolGetFrame(char Cmd, QByteArray Data)
|
||||||
|
{
|
||||||
|
QByteArray Frame;
|
||||||
|
Frame.clear();
|
||||||
|
|
||||||
|
// Header
|
||||||
|
Frame.append(BOOTLOADER_FRAME_HEADER_1);
|
||||||
|
Frame.append(BOOTLOADER_FRAME_HEADER_2);
|
||||||
|
Frame.append(BOOTLOADER_FRAME_HEADER_3);
|
||||||
|
Frame.append(BOOTLOADER_FRAME_HEADER_4);
|
||||||
|
|
||||||
|
//Cmd
|
||||||
|
Frame.append(Cmd);
|
||||||
|
|
||||||
|
//Size
|
||||||
|
unsigned int Size = Data.size();
|
||||||
|
|
||||||
|
char nibble = (char)((Size >> 24) &0x000000FF);
|
||||||
|
Frame.append(nibble);
|
||||||
|
|
||||||
|
nibble = (char)((Size >> 16) &0x000000FF);
|
||||||
|
Frame.append(nibble);
|
||||||
|
|
||||||
|
nibble = (char)((Size >> 8) &0x000000FF);
|
||||||
|
Frame.append(nibble);
|
||||||
|
|
||||||
|
nibble = (char)(Size &0x000000FF);
|
||||||
|
Frame.append(nibble);
|
||||||
|
|
||||||
|
//Payload
|
||||||
|
Frame.append(Data);
|
||||||
|
|
||||||
|
//CRC
|
||||||
|
unsigned int CRC = mCRCEngine.ComputeCRC32(Frame);
|
||||||
|
|
||||||
|
nibble = (char)((CRC >> 24) &0x000000FF);
|
||||||
|
Frame.append(nibble);
|
||||||
|
|
||||||
|
nibble = (char)((CRC >> 16) &0x000000FF);
|
||||||
|
Frame.append(nibble);
|
||||||
|
|
||||||
|
nibble = (char)((CRC >> 8) &0x000000FF);
|
||||||
|
Frame.append(nibble);
|
||||||
|
|
||||||
|
nibble = (char)(CRC &0x000000FF);
|
||||||
|
Frame.append(nibble);
|
||||||
|
|
||||||
|
/* Frame.append(0xBA);
|
||||||
|
Frame.append(0xAD);
|
||||||
|
Frame.append(0xCA);
|
||||||
|
Frame.append(0xFE);*/
|
||||||
|
|
||||||
|
//Send
|
||||||
|
return Frame;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
77
Sources/PICUploader/BootloaderProtocol.h
Normal file
77
Sources/PICUploader/BootloaderProtocol.h
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#ifndef BOOTLOADERPROTOCOL_H
|
||||||
|
#define BOOTLOADERPROTOCOL_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "ProtocolDefs.h"
|
||||||
|
#include "CRC32.h"
|
||||||
|
|
||||||
|
class CPICUploader;
|
||||||
|
|
||||||
|
#define BOOTLOADER_FRAME_HEADER 0xDEADBEEF
|
||||||
|
#define BOOTLOADER_FRAME_HEADER_1 0xDE
|
||||||
|
#define BOOTLOADER_FRAME_HEADER_2 0xAD
|
||||||
|
#define BOOTLOADER_FRAME_HEADER_3 0xBE
|
||||||
|
#define BOOTLOADER_FRAME_HEADER_4 0xEF
|
||||||
|
#define MAX_BOOTLOADER_PAYLOAD_SIZE 200
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
enum eProtocolBootloaderStates
|
||||||
|
{
|
||||||
|
Initialization,
|
||||||
|
RxHeader1,
|
||||||
|
RxHeader2,
|
||||||
|
RxHeader3,
|
||||||
|
RxHeader4,
|
||||||
|
RxCmd,
|
||||||
|
RxPayloadSize1,
|
||||||
|
RxPayloadSize2,
|
||||||
|
RxPayloadSize3,
|
||||||
|
RxPayloadSize4,
|
||||||
|
RxPayload,
|
||||||
|
RxCRC1,
|
||||||
|
RxCRC2,
|
||||||
|
RxCRC3,
|
||||||
|
RxCRC4
|
||||||
|
};
|
||||||
|
|
||||||
|
class CBootloaderProtocol : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit CBootloaderProtocol(QObject *parent = 0);
|
||||||
|
~CBootloaderProtocol();
|
||||||
|
|
||||||
|
int BootloaderProtocolInit();
|
||||||
|
int BootloaderProtocolResetStateMachine();
|
||||||
|
|
||||||
|
int BooloaderProtocolRxFrame(QByteArray Frame);
|
||||||
|
void BootloaderProtocolStateMachine(unsigned char data);
|
||||||
|
|
||||||
|
QByteArray BootloaderProtocolGetFrame(char Cmd, QByteArray Data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CPICUploader *mProgramHandle;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned int mBootloaderHeader;
|
||||||
|
unsigned int mBootloaderDataSize;
|
||||||
|
unsigned int mBootloaderDataCtr;
|
||||||
|
unsigned int mBootloaderBufPtr;
|
||||||
|
unsigned int mBootloaderCRC;
|
||||||
|
unsigned int mBootloaderComputedCRC;
|
||||||
|
QByteArray mBootloaderDataBuffer;
|
||||||
|
unsigned char mBootloaderCommand;
|
||||||
|
unsigned char mBootloaderState;
|
||||||
|
|
||||||
|
CCRC32 mCRCEngine;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BOOTLOADERPROTOCOL_H
|
||||||
380
Sources/PICUploader/HexFile.cpp
Normal file
380
Sources/PICUploader/HexFile.cpp
Normal file
@ -0,0 +1,380 @@
|
|||||||
|
#include "HexFile.h"
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include "CRC32.h"
|
||||||
|
|
||||||
|
#define USE_BIG_RECORDS
|
||||||
|
#define MAX_RECORDS_IN_BIG_RECORDS 512 //16 bytes by record, 512 bytes by row --> 16 rows / big record
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CHexFile::CHexFile(void)
|
||||||
|
{
|
||||||
|
mFileOpened = false;
|
||||||
|
mFileParsed = false;
|
||||||
|
mRecordsListValid = false;
|
||||||
|
mHighAddress = 0;
|
||||||
|
mDiscardedRecords = 0;
|
||||||
|
mTotalParsedRecords = 0;
|
||||||
|
mFirmwareCRC = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CHexFile::~CHexFile(void)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < mRecordsList.size(); i++)
|
||||||
|
delete mRecordsList.at(i);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int CHexFile::CloseOpenedHexFile()
|
||||||
|
{
|
||||||
|
for(int i = 0; i < mRecordsList.size(); i++)
|
||||||
|
delete mRecordsList.at(i);
|
||||||
|
|
||||||
|
mRecordsList.clear();
|
||||||
|
|
||||||
|
mFileOpened = false;
|
||||||
|
mFileParsed = false;
|
||||||
|
mHexfileHandle = 0;
|
||||||
|
mRecordsListValid = false;
|
||||||
|
mHighAddress = 0;
|
||||||
|
mDiscardedRecords = 0;
|
||||||
|
mTotalParsedRecords = 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CHexFile::OpenDataFile(QString FilePath, bool CloseIfAlreadyParsed)
|
||||||
|
{
|
||||||
|
|
||||||
|
//Check if file exists
|
||||||
|
if(QFile::exists(FilePath) == false)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if(mFileParsed == true)
|
||||||
|
{
|
||||||
|
if(CloseIfAlreadyParsed == false)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CloseOpenedHexFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mHexfileHandle = new QFile(FilePath);
|
||||||
|
|
||||||
|
if(mHexfileHandle->open(QIODevice::ReadOnly|QIODevice::Text|QIODevice::Unbuffered) == false)
|
||||||
|
{
|
||||||
|
delete mHexfileHandle;
|
||||||
|
mHexfileHandle = 0;
|
||||||
|
qDebug("Cannot open specified HEX file...");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mHexFileSize = mHexfileHandle->size();
|
||||||
|
|
||||||
|
mFileOpened = true;
|
||||||
|
|
||||||
|
mRecordsTableSize = 0;
|
||||||
|
mFirmwareDataSize = 0;
|
||||||
|
|
||||||
|
return ParseData();
|
||||||
|
|
||||||
|
mHexfileHandle->close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int CHexFile::ParseData(void)
|
||||||
|
{
|
||||||
|
if(!mFileOpened)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int Ret;
|
||||||
|
bool Finished = false;
|
||||||
|
unsigned int CurAddress;
|
||||||
|
|
||||||
|
// CArray<CHexRecord*,CHexRecord*> TempArray;
|
||||||
|
QList<CHexRecord*> TempList;
|
||||||
|
QString RecordString;
|
||||||
|
QTextStream RecordFileStream(mHexfileHandle);
|
||||||
|
// CArchive ar(&mHexfileHandle,CArchive::load);
|
||||||
|
|
||||||
|
while(!Finished)
|
||||||
|
{
|
||||||
|
CHexRecord *NewRecord = new CHexRecord;
|
||||||
|
RecordString.clear();
|
||||||
|
// ar.ReadString(mRecordString);
|
||||||
|
RecordString = RecordFileStream.readLine();
|
||||||
|
// Ret = NewRecord.DecodeRawRecord(&mRecordString,mHighAddress);
|
||||||
|
Ret = NewRecord->DecodeRawRecord(&RecordString,mHighAddress);
|
||||||
|
mTotalParsedRecords++;
|
||||||
|
|
||||||
|
switch(Ret)
|
||||||
|
{
|
||||||
|
case CHexRecord::RET_DATA_RECORD:
|
||||||
|
{
|
||||||
|
#ifdef USE_BIG_RECORDS
|
||||||
|
TempList.append(NewRecord);
|
||||||
|
// mRecordsTable[mRecordsTableSize] = NewRecord;
|
||||||
|
// mRecordsTableSize++;
|
||||||
|
#else
|
||||||
|
mRecordsList.append(NewRecord);
|
||||||
|
mRecordsTable[mRecordsTableSize] = NewRecord;
|
||||||
|
mRecordsTableSize++;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CHexRecord::RET_EOF_RECORD:
|
||||||
|
{
|
||||||
|
mHexfileHandle->close();
|
||||||
|
mFileOpened = false;
|
||||||
|
delete mHexfileHandle;
|
||||||
|
mRecordsListValid = true;
|
||||||
|
Finished = true;
|
||||||
|
delete NewRecord;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case CHexRecord::RET_EXTENDED_LINEAR_ADDRESS:
|
||||||
|
{
|
||||||
|
// mHighAddress = NewRecord.GetExtenedAddress();
|
||||||
|
mHighAddress = NewRecord->GetExtenedAddress();
|
||||||
|
CurAddress = mHighAddress;
|
||||||
|
delete NewRecord;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CHexRecord::RET_IGNORED_ALL_FF_RECORD:
|
||||||
|
{
|
||||||
|
delete NewRecord;
|
||||||
|
mDiscardedRecords++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CHexRecord::RET_EXTENDED_ADDRESS:
|
||||||
|
case CHexRecord::RET_START_SEGMENT_ADDRESS:
|
||||||
|
case CHexRecord::RET_START_LINEAR_ADDRESS:
|
||||||
|
case CHexRecord::RET_UNKNOWN_RECORD_TYPE:
|
||||||
|
case CHexRecord::RET_INVALID_RECORD:
|
||||||
|
case CHexRecord::RET_BAD_RECORD_CHECKSUM:
|
||||||
|
case CHexRecord::RET_UNMANAGED_RECORD_TYPE:
|
||||||
|
{
|
||||||
|
mHexfileHandle->close();
|
||||||
|
mFileOpened = false;
|
||||||
|
delete mHexfileHandle;
|
||||||
|
Finished = true;
|
||||||
|
//MessageBox(NULL,"Parsing Error", "Cannot Parse Hex File",MB_OK);
|
||||||
|
QMessageBox::warning(0,"Parsing Error","Cannot parse HEX file",QMessageBox::Ok);
|
||||||
|
delete NewRecord;
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_BIG_RECORDS
|
||||||
|
int i;
|
||||||
|
int RecordCount;
|
||||||
|
CHexRecord *TempRecordPtr;
|
||||||
|
CHexRecord *BigRecord = new CHexRecord;
|
||||||
|
CCRC32 Crc32Engine;
|
||||||
|
|
||||||
|
|
||||||
|
TempRecordPtr = TempList.at(0);
|
||||||
|
CurAddress = TempRecordPtr->GetStartAddress();
|
||||||
|
*BigRecord = *TempRecordPtr;
|
||||||
|
RecordCount = 1;
|
||||||
|
|
||||||
|
for(i = 1; i < TempList.size(); i++)
|
||||||
|
{
|
||||||
|
// if(CurAddress == 0x1d0097F0)
|
||||||
|
// {
|
||||||
|
// CurAddress = CurAddress;
|
||||||
|
// }
|
||||||
|
CurAddress += (TempRecordPtr->GetRecordSizeInBytes());
|
||||||
|
TempRecordPtr = TempList.at(i);
|
||||||
|
if(CurAddress == TempRecordPtr->GetStartAddress() && RecordCount<MAX_RECORDS_IN_BIG_RECORDS && (i != (TempList.size()-1)))
|
||||||
|
{
|
||||||
|
BigRecord->AppendRecord(TempRecordPtr);
|
||||||
|
RecordCount++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RecordCount = 1; //Init to 1 because we load the record right below...
|
||||||
|
mRecordsList.append(BigRecord);
|
||||||
|
BigRecord = new CHexRecord;
|
||||||
|
|
||||||
|
if(i == TempList.size()-1) //Manage the last record.
|
||||||
|
{
|
||||||
|
*BigRecord = *TempRecordPtr;
|
||||||
|
mRecordsList.append(BigRecord);
|
||||||
|
BigRecord->mRecordSize += TempRecordPtr->mRecordSize;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*BigRecord = *TempRecordPtr;
|
||||||
|
CurAddress = TempRecordPtr->GetStartAddress();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
for(i = 0; i < TempList.size(); i++)
|
||||||
|
{
|
||||||
|
delete TempList[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// for(i = 0; i < mRecordsList.size(); i++)
|
||||||
|
// {
|
||||||
|
// mFirmwareDataSize += mRecordsList.at(i)->GetRecordSizeInBytes();
|
||||||
|
// }
|
||||||
|
|
||||||
|
FilterRecords(0x1D004000,0x1D07FFFF);
|
||||||
|
|
||||||
|
QByteArray RawShit = GetRawData(false);
|
||||||
|
|
||||||
|
mFirmwareDataSize = RawShit.size();
|
||||||
|
|
||||||
|
unsigned int testcrc = CRC_START_32;
|
||||||
|
for(unsigned int i = 0; i < mFirmwareDataSize; i++)
|
||||||
|
{
|
||||||
|
testcrc = Crc32Engine.UpdateCRC32(testcrc,RawShit[i]);
|
||||||
|
}
|
||||||
|
testcrc ^= 0xffffffffL;
|
||||||
|
|
||||||
|
mFirmwareCRC = Crc32Engine.ComputeCRC32((const unsigned char *)RawShit.data(),RawShit.size());
|
||||||
|
|
||||||
|
mFileParsed = true;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CHexFile::FilterRecords(unsigned int StartAddress, unsigned int EndAddress)
|
||||||
|
{
|
||||||
|
if(mRecordsList.isEmpty() == true)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool done = false;
|
||||||
|
int i = 0;
|
||||||
|
while(done == false)
|
||||||
|
{
|
||||||
|
if(mRecordsList.at(i)->GetStartAddress() < StartAddress ||
|
||||||
|
mRecordsList.at(i)->GetStartAddress() > EndAddress)
|
||||||
|
{
|
||||||
|
//Record is outside filter area, delete it...
|
||||||
|
delete mRecordsList.at(i);
|
||||||
|
mRecordsList.removeAt(i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i == mRecordsList.size())
|
||||||
|
{
|
||||||
|
done = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CHexFile::GetNBRecords(void)
|
||||||
|
{
|
||||||
|
// return mRecordsTableSize;
|
||||||
|
|
||||||
|
return mRecordsList.size();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long CHexFile::GetFileSize(void)
|
||||||
|
{
|
||||||
|
return mHexFileSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CHexFile::GetDataCRC32()
|
||||||
|
{
|
||||||
|
return mFirmwareCRC;
|
||||||
|
}
|
||||||
|
|
||||||
|
CHexRecord * CHexFile::GetRecord(int RecordIndex, int &Status)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(RecordIndex > mRecordsList.size())
|
||||||
|
// if(RecordIndex > mRecordsTableSize)
|
||||||
|
{
|
||||||
|
Status = ERR_INDEX_OUT_OF_BOUND;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//CHexRecord *mRecordPtr = (CHexRecord*)&mRecordsList.GetAt(RecordIndex);
|
||||||
|
CHexRecord *mRecordPtr = mRecordsList.at(RecordIndex);
|
||||||
|
// CHexRecord *mRecordPtr = mRecordsTable[RecordIndex];
|
||||||
|
return mRecordPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray CHexFile::GetRawData(bool IncludeHeader)
|
||||||
|
{
|
||||||
|
QByteArray Data;
|
||||||
|
Data.clear();
|
||||||
|
|
||||||
|
|
||||||
|
if(IncludeHeader)
|
||||||
|
{
|
||||||
|
QDataStream Strm(&Data,QIODevice::WriteOnly);
|
||||||
|
|
||||||
|
//Header
|
||||||
|
Strm << HEX_FILE_HEADER_CODE;
|
||||||
|
//Flags
|
||||||
|
Strm << (int)0x0000; //TODO: Manage that
|
||||||
|
//Nb Records
|
||||||
|
Strm << GetNBRecords();
|
||||||
|
//Firmware size
|
||||||
|
Strm << GetFirmwareSize();
|
||||||
|
//Version
|
||||||
|
Strm << (int)0x00; //TODO: Manage that
|
||||||
|
//CRC32
|
||||||
|
Strm << GetDataCRC32();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for(int i = 0; i < mRecordsList.size(); i++)
|
||||||
|
{
|
||||||
|
Data.append(mRecordsList.at(i)->GetRecord());
|
||||||
|
}
|
||||||
|
|
||||||
|
return Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString CHexFile::GetHexFileInfoString()
|
||||||
|
{
|
||||||
|
|
||||||
|
QString string;
|
||||||
|
string.clear();
|
||||||
|
|
||||||
|
if(HexDataValid() == false)
|
||||||
|
return QString("No file loaded\n");
|
||||||
|
|
||||||
|
for(int i = 0; i < mRecordsList.size(); i++)
|
||||||
|
{
|
||||||
|
CHexRecord *rec = mRecordsList.at(i);
|
||||||
|
unsigned int StartAddress = rec->GetStartAddress();
|
||||||
|
unsigned int Size = rec->GetRecordSizeInBytes();
|
||||||
|
unsigned int EndAddress = StartAddress + Size;
|
||||||
|
string.append(QString("Record %1: Start = [0x%2], Length = [%3], End = 0x%4\n").arg(i).arg(StartAddress,0,16).arg(Size).arg(EndAddress,0,16));
|
||||||
|
}
|
||||||
|
string.prepend("-------------------------------------------------------------\n");
|
||||||
|
string.append("-------------------------------------------------------------\n");
|
||||||
|
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
63
Sources/PICUploader/HexFile.h
Normal file
63
Sources/PICUploader/HexFile.h
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "HexRecord.h"
|
||||||
|
#include <QString>
|
||||||
|
#include <QList>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
|
#define HEX_FILE_HEADER_CODE (int)0xBAADBEEF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class CHexFile
|
||||||
|
{
|
||||||
|
|
||||||
|
enum eHexFileStatus
|
||||||
|
{
|
||||||
|
STATUS_OK,
|
||||||
|
STATUS_OK_LAST_INDEX,
|
||||||
|
ERR_INDEX_OUT_OF_BOUND
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
CHexFile(void);
|
||||||
|
~CHexFile(void);
|
||||||
|
|
||||||
|
int OpenDataFile(QString FilePath, bool CloseIfAlreadyParsed = true);
|
||||||
|
int CloseDataFile();
|
||||||
|
int CloseOpenedHexFile();
|
||||||
|
int ParseData(void);
|
||||||
|
unsigned int GetNBRecords(void);
|
||||||
|
unsigned long GetFileSize(void);
|
||||||
|
unsigned int GetFirmwareSize(void){return mFirmwareDataSize;}
|
||||||
|
unsigned int GetDataCRC32(void);
|
||||||
|
bool HexFileLoaded(void){return mFileOpened;}
|
||||||
|
bool HexDataValid(void){return mFileParsed;}
|
||||||
|
unsigned long GetTotalParsedRecords(void){return mTotalParsedRecords;}
|
||||||
|
QByteArray GetRawData(bool IncludeHeader = true);
|
||||||
|
int FilterRecords(unsigned int StartAddress, unsigned int EndAddress);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CHexRecord * GetRecord(int RecordIndex, int &Status);
|
||||||
|
unsigned long mDiscardedRecords;
|
||||||
|
unsigned long mTotalParsedRecords;
|
||||||
|
|
||||||
|
QString GetHexFileInfoString();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QFile *mHexfileHandle;
|
||||||
|
bool mFileOpened;
|
||||||
|
bool mFileParsed;
|
||||||
|
bool mRecordsListValid;
|
||||||
|
//CArray<CHexRecord*,CHexRecord*> mRecordsList;
|
||||||
|
QList<CHexRecord*> mRecordsList;
|
||||||
|
// CHexRecord* mRecordsTable[0x3000];
|
||||||
|
unsigned int mRecordsTableSize;
|
||||||
|
unsigned int mHighAddress;
|
||||||
|
unsigned long mHexFileSize;
|
||||||
|
unsigned int mFirmwareDataSize;
|
||||||
|
unsigned int mFirmwareCRC;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
198
Sources/PICUploader/HexRecord.cpp
Normal file
198
Sources/PICUploader/HexRecord.cpp
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
#include "HexRecord.h"
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QDataStream>
|
||||||
|
CHexRecord::CHexRecord(void)
|
||||||
|
{
|
||||||
|
mRecordData = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CHexRecord::~CHexRecord(void)
|
||||||
|
{
|
||||||
|
mStartAddress = 0;
|
||||||
|
mRecordSize = 0;
|
||||||
|
mRecordType = 0;
|
||||||
|
mExtendedAddress = 0;
|
||||||
|
// delete[] mRecordData;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CHexRecord::DecodeRawRecord(QString *RawRecordData, unsigned int HighAddress)
|
||||||
|
{
|
||||||
|
bool OK;
|
||||||
|
// CString RecordString;
|
||||||
|
QString RecordString;
|
||||||
|
bool IsAllFF = true;
|
||||||
|
int StartIndex = RawRecordData->indexOf(QChar(':'));
|
||||||
|
|
||||||
|
if(StartIndex == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
RecordString = RawRecordData->right(RawRecordData->length()-1); //Remove all that is left of ':'
|
||||||
|
|
||||||
|
QString RecordSizeString;
|
||||||
|
RecordSizeString = RecordString.mid(0,2);
|
||||||
|
//sscanf_s(RecordSizeString.GetBuffer(),"%x",&mRecordSize);
|
||||||
|
mRecordSize = RecordSizeString.toUInt(&OK,16);
|
||||||
|
|
||||||
|
QString RecordAddress;
|
||||||
|
RecordAddress = RecordString.mid(2,4);
|
||||||
|
//sscanf_s(RecordAddress.GetBuffer(),"%x",&mStartAddress);
|
||||||
|
mStartAddress = RecordAddress.toUInt(&OK,16);
|
||||||
|
mStartAddress |= (HighAddress & 0xFFFF0000);
|
||||||
|
|
||||||
|
if(mStartAddress == 0x1d0097F0)
|
||||||
|
{
|
||||||
|
mStartAddress = mStartAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString RecordTypeString;
|
||||||
|
RecordTypeString = RecordString.mid(6,2);
|
||||||
|
//sscanf_s(RecordTypeString.GetBuffer(),"%x",&mRecordType);
|
||||||
|
mRecordType = RecordTypeString.toUInt(&OK,16);
|
||||||
|
|
||||||
|
RecordString = RecordString.right(RecordString.length()- 8);
|
||||||
|
|
||||||
|
if(mRecordType >= MAX_RECORD_TYPE)
|
||||||
|
return RET_UNKNOWN_RECORD_TYPE;
|
||||||
|
|
||||||
|
if(mRecordSize %2 != 0)
|
||||||
|
{
|
||||||
|
mRecordSize++;//Pad the last word if we do not have an even number of bytes in the record.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
switch(mRecordType)
|
||||||
|
{
|
||||||
|
case DATA_RECORD_TYPE: //0x00
|
||||||
|
{
|
||||||
|
char *DataPtr;
|
||||||
|
QString DataString;
|
||||||
|
// mRecordData = new char[mRecordSize/*+10*/]; //I have no clue why I have to allocate more space but if I don't delete[] crashes. I think it's a scanf bug...
|
||||||
|
// DataPtr = mRecordData.data();
|
||||||
|
|
||||||
|
for(unsigned int i = 0; i < mRecordSize; i++)
|
||||||
|
{
|
||||||
|
DataString = RecordString.mid(2*i,2);
|
||||||
|
char DataByte = (char)DataString.toUShort(&OK,16);
|
||||||
|
//sscanf_s(DataString.GetBuffer(),"%x",&mRecordData[i],sizeof(char)/*DataPtr*/);
|
||||||
|
//mRecordData[i] = (char)DataString.toUShort(&OK,16);
|
||||||
|
mRecordData.append(DataByte);
|
||||||
|
if((unsigned char)DataByte != 0xFF)
|
||||||
|
IsAllFF = false;
|
||||||
|
//DataPtr++;
|
||||||
|
}
|
||||||
|
if(mRecordSize %2 != 0) //Is this really needed?
|
||||||
|
{
|
||||||
|
//*DataPtr++ = 0xFF; //Pad the last word if we do not have an even number of bytes in the record.
|
||||||
|
mRecordData.append(0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
mRecordSize /= 4; //Transfom the size in WORD size...
|
||||||
|
|
||||||
|
//#ifdef IGNORE_ALL_FF_RECORDS
|
||||||
|
if(IsAllFF)
|
||||||
|
{
|
||||||
|
|
||||||
|
return RET_IGNORED_ALL_FF_RECORD;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return RET_DATA_RECORD;
|
||||||
|
//#else
|
||||||
|
// return RET_DATA_RECORD;
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EOF_RECORD_TYPE: //0x01
|
||||||
|
{
|
||||||
|
return RET_EOF_RECORD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EXTENDED_ADDRESS_TYPE: //0x02
|
||||||
|
{
|
||||||
|
return RET_UNMANAGED_RECORD_TYPE;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case START_SEGMENT_ADDRESS_TYPE: //0x03
|
||||||
|
{
|
||||||
|
return RET_UNMANAGED_RECORD_TYPE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EXTENDED_LINEAR_ADDRESS_TYPE: //0x04
|
||||||
|
{
|
||||||
|
QString ExtendedAddressString;
|
||||||
|
ExtendedAddressString = RecordString.mid(0,4);
|
||||||
|
//sscanf_s(ExtendedAddressString.GetBuffer(),"%x",&mExtendedAddress);
|
||||||
|
mExtendedAddress = ExtendedAddressString.toUInt(&OK,16);
|
||||||
|
mExtendedAddress <<= 16;
|
||||||
|
return RET_EXTENDED_LINEAR_ADDRESS;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case START_LINEAR_ADDRESS_TYPE: //0x05
|
||||||
|
{
|
||||||
|
return RET_UNMANAGED_RECORD_TYPE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return RET_UNKNOWN_RECORD_TYPE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CHexRecord::AppendRecord(CHexRecord *NewRecord)
|
||||||
|
{
|
||||||
|
unsigned int NewSize;
|
||||||
|
|
||||||
|
NewSize = GetRecordSizeInBytes() + NewRecord->GetRecordSizeInBytes();
|
||||||
|
|
||||||
|
// char *NewBuff = new char[NewSize];
|
||||||
|
// memcpy(NewBuff,mRecordData,GetRecordSizeInBytes());
|
||||||
|
// memcpy(&NewBuff[GetRecordSizeInBytes()],NewRecord->GetDataBuffer(),NewRecord->GetRecordSizeInBytes());
|
||||||
|
|
||||||
|
//delete[] mRecordData;
|
||||||
|
//mRecordData = NewBuff;
|
||||||
|
|
||||||
|
mRecordData.append(NewRecord->GetData());
|
||||||
|
mRecordSize = NewSize/4;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
CHexRecord& CHexRecord::operator = (const CHexRecord &rhs)
|
||||||
|
{
|
||||||
|
if(this == &rhs)
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
mExtendedAddress = rhs.mExtendedAddress;
|
||||||
|
mRecordSize = rhs.mRecordSize;
|
||||||
|
mStartAddress = rhs.mStartAddress;
|
||||||
|
mRecordType = rhs.mRecordType;
|
||||||
|
mRecordData = rhs.mRecordData;
|
||||||
|
|
||||||
|
// mRecordData = new char[mRecordSize*4];
|
||||||
|
// memcpy(mRecordData,rhs.mRecordData,mRecordSize*4);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray CHexRecord::GetRecord()
|
||||||
|
{
|
||||||
|
QByteArray Record;
|
||||||
|
Record.clear();
|
||||||
|
QDataStream Strm(&Record,QIODevice::WriteOnly);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Header
|
||||||
|
Strm << HEX_RECORD_HEADER;
|
||||||
|
//Size
|
||||||
|
Strm << GetRecordSizeInBytes();
|
||||||
|
//Address
|
||||||
|
Strm << GetStartAddress();
|
||||||
|
//Data
|
||||||
|
Record.append(mRecordData);
|
||||||
|
|
||||||
|
|
||||||
|
return Record;
|
||||||
|
}
|
||||||
65
Sources/PICUploader/HexRecord.h
Normal file
65
Sources/PICUploader/HexRecord.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QString>
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
|
#define IGNORE_ALL_FF_RECORDS
|
||||||
|
#define HEX_RECORD_HEADER (int)0xDEADBEEF
|
||||||
|
class CHexRecord
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
enum eRecordTypes
|
||||||
|
{
|
||||||
|
DATA_RECORD_TYPE, //0x00
|
||||||
|
EOF_RECORD_TYPE, //0x01
|
||||||
|
EXTENDED_ADDRESS_TYPE, //0x02
|
||||||
|
START_SEGMENT_ADDRESS_TYPE, //0x03
|
||||||
|
EXTENDED_LINEAR_ADDRESS_TYPE, //0x04
|
||||||
|
START_LINEAR_ADDRESS_TYPE, //0x05
|
||||||
|
MAX_RECORD_TYPE
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eRetValues
|
||||||
|
{
|
||||||
|
RET_DATA_RECORD,
|
||||||
|
RET_EOF_RECORD,
|
||||||
|
RET_EXTENDED_ADDRESS,
|
||||||
|
RET_START_SEGMENT_ADDRESS,
|
||||||
|
RET_EXTENDED_LINEAR_ADDRESS,
|
||||||
|
RET_IGNORED_ALL_FF_RECORD,
|
||||||
|
RET_START_LINEAR_ADDRESS,
|
||||||
|
RET_UNKNOWN_RECORD_TYPE,
|
||||||
|
RET_INVALID_RECORD,
|
||||||
|
RET_BAD_RECORD_CHECKSUM,
|
||||||
|
RET_UNMANAGED_RECORD_TYPE
|
||||||
|
};
|
||||||
|
|
||||||
|
//char *mRecordData;
|
||||||
|
QByteArray mRecordData;
|
||||||
|
unsigned int mStartAddress;
|
||||||
|
unsigned int mRecordSize;
|
||||||
|
unsigned int mRecordType;
|
||||||
|
unsigned int mExtendedAddress;
|
||||||
|
|
||||||
|
|
||||||
|
CHexRecord(void);
|
||||||
|
~CHexRecord(void);
|
||||||
|
|
||||||
|
int SetRecordStartAddress(unsigned int Address);
|
||||||
|
int SetRecordSize(unsigned int size);
|
||||||
|
int DecodeRawRecord(QString *RawRecordData, unsigned int HighAddress);
|
||||||
|
|
||||||
|
unsigned int GetExtenedAddress(void){return mExtendedAddress;}
|
||||||
|
unsigned int GetStartAddress(void){return mStartAddress;}
|
||||||
|
char *GetDataBuffer(void){return mRecordData.data();}
|
||||||
|
QByteArray GetData(void){return mRecordData;}
|
||||||
|
unsigned int GetRecordSize(void){return mRecordData.size()/4;}
|
||||||
|
unsigned int GetRecordSizeInBytes(void){return mRecordData.size();}
|
||||||
|
unsigned int GetRecordType(void){return mRecordType;}
|
||||||
|
unsigned int AppendRecord(CHexRecord *RecordToAppend);
|
||||||
|
QByteArray GetRecord();
|
||||||
|
|
||||||
|
CHexRecord& operator=(const CHexRecord &rhs);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
916
Sources/PICUploader/PICUploader.cpp
Normal file
916
Sources/PICUploader/PICUploader.cpp
Normal file
@ -0,0 +1,916 @@
|
|||||||
|
#include "PICUploader.h"
|
||||||
|
#include "GlobalDefine.h"
|
||||||
|
#include <QHostAddress>
|
||||||
|
#include <QtEndian>
|
||||||
|
|
||||||
|
|
||||||
|
CPICUploader::CPICUploader(CPICUploaderGui *Gui)
|
||||||
|
{
|
||||||
|
mPICUploaderGui = Gui;
|
||||||
|
mPICUploaderGui->mProgramHandle = this;
|
||||||
|
|
||||||
|
connect(&mBootloaderSocket,SIGNAL(connected()),this,SLOT(BootloaderSocketConnected()));
|
||||||
|
connect(&mBootloaderSocket,SIGNAL(disconnected()),this,SLOT(BootloaderSocketDisconnected()));
|
||||||
|
connect(&mBootloaderSocket,SIGNAL(readyRead()),this,SLOT(BootloaderDataAvailable()));
|
||||||
|
connect(&mBootloaderSocket,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(BootloaderSocketError(QAbstractSocket::SocketError)));
|
||||||
|
|
||||||
|
mBootloaderProtocol.mProgramHandle = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int CPICUploader::Start()
|
||||||
|
{
|
||||||
|
mBootloaderProtocol.BootloaderProtocolInit();
|
||||||
|
ResetBooloaderInterfaceStateMachine();
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int CPICUploader::OpenHexFileRequest(QString FilePath)
|
||||||
|
{
|
||||||
|
if(mHexFile.HexFileLoaded() == true)
|
||||||
|
{
|
||||||
|
mHexFile.CloseOpenedHexFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ret = mHexFile.OpenDataFile(FilePath);
|
||||||
|
|
||||||
|
if(ret == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
QString HexFileStats = QString("HexFileSize: %1\nFirmware Size: %4\nNb analyzed Records: %2\nNb Big Records: %3\nData CRC32: 0x%5").arg(mHexFile.GetFileSize()).arg(mHexFile.GetTotalParsedRecords()).arg(mHexFile.GetNBRecords()).arg(mHexFile.GetFirmwareSize()).arg(mHexFile.GetDataCRC32(),0,16);
|
||||||
|
|
||||||
|
mPICUploaderGui->SetHexFileStats(HexFileStats);
|
||||||
|
|
||||||
|
|
||||||
|
//HexFileStats << "HexFileSize: " << mHexFile.GetFileSize() << "\n";
|
||||||
|
// HexFileStats <<
|
||||||
|
}
|
||||||
|
|
||||||
|
int CPICUploader::ShowHexFileInfoRequest()
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(mHexFile.GetHexFileInfoString());
|
||||||
|
}
|
||||||
|
|
||||||
|
int CPICUploader::ConnectToBootloader(QString IP)
|
||||||
|
{
|
||||||
|
|
||||||
|
mBootloaderSocket.connectToHost(IP,99);
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CPICUploader::DisconnectFromBootloader()
|
||||||
|
{
|
||||||
|
mBootloaderSocket.disconnectFromHost();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploader::BootloaderSocketConnected()
|
||||||
|
{
|
||||||
|
mPICUploaderGui->UploaderSocketConnected();
|
||||||
|
mPICUploaderGui->AddTextToLogScreen("Socket Connected");
|
||||||
|
BootloaderInterfaceStateMachine(BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT,BOOTLOADER_UPLOAD_BOOTLOADER_CONNECTED_CMD);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploader::BootloaderSocketDisconnected()
|
||||||
|
{
|
||||||
|
mPICUploaderGui->UploaderSocketDisconnected();
|
||||||
|
mPICUploaderGui->AddTextToLogScreen("Socket Disconnected");
|
||||||
|
BootloaderInterfaceStateMachine(BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT,BOOTLOADER_UPLOAD_BOOTLOADER_DISCONNECTED_CMD);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploader::BootloaderDataAvailable()
|
||||||
|
{
|
||||||
|
|
||||||
|
QByteArray Data = mBootloaderSocket.readAll();
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Recevied %1 bytes from bootloader").arg(Data.size()));
|
||||||
|
mBootloaderProtocol.BooloaderProtocolRxFrame(Data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploader::BootloaderSocketError(QAbstractSocket::SocketError Error)
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Socket error %1 in PICUploader").arg(Error));
|
||||||
|
}
|
||||||
|
|
||||||
|
int CPICUploader::SendSingleCmdRequest(int CmdID)
|
||||||
|
{
|
||||||
|
QByteArray Frame = mBootloaderProtocol.BootloaderProtocolGetFrame(CmdID,QByteArray());
|
||||||
|
mBootloaderSocket.write(Frame);
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CPICUploader::SendCmdRequest(int CmdID, QByteArray Data)
|
||||||
|
{
|
||||||
|
QByteArray Frame = mBootloaderProtocol.BootloaderProtocolGetFrame(CmdID,Data);
|
||||||
|
mBootloaderSocket.write(Frame);
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CPICUploader::GuiEvent(int EventID, void *Data)
|
||||||
|
{
|
||||||
|
switch(EventID)
|
||||||
|
{
|
||||||
|
case CPICUploaderGui::UPLOADER_GUI_HEARTBEAT_BTN_CLICK_EVENT:
|
||||||
|
{
|
||||||
|
SendSingleCmdRequest(BOOTLOADER_HEARTBEAT_REQUEST);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CPICUploaderGui::UPLOADER_GUI_FLASH_ERASE_BTN_CLICK_EVENT:
|
||||||
|
{
|
||||||
|
BootloaderInterfaceStateMachine(BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT,BOOTLOADER_UPLOAD_ERASE_FLASH_GUI_CMD);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CPICUploaderGui::UPLOADER_GUI_INIT_UPLOAD_BTN_CLICK_EVENT:
|
||||||
|
{
|
||||||
|
BootloaderInterfaceStateMachine(BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT,BOOTLOADER_UPLOAD_START_UPLOAD_GUI_CMD);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CPICUploaderGui::UPLOADER_GUI_SEND_DATA_CHUNK_BTN_CLICK_EVENT:
|
||||||
|
{
|
||||||
|
SendSingleCmdRequest(BOOTLOADER_SEND_DATA_CHUNK_REQUEST);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CPICUploaderGui::UPLOADER_GUI_UPLOAD_FINISHED_BTN_CLICK_EVENT:
|
||||||
|
{
|
||||||
|
SendSingleCmdRequest(BOOTLOADER_UPLOAD_FINISHED_REQUEST);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CPICUploaderGui::UPLOADER_GUI_EXECUTE_UPGRADE_BTN_CLICK_EVENT:
|
||||||
|
{
|
||||||
|
SendSingleCmdRequest(BOOTLOADER_EXECUTE_UPGRAGE_REQUEST);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CPICUploaderGui::UPLOADER_GUI_ABORT_BTN_CLICK_EVENT:
|
||||||
|
{
|
||||||
|
BootloaderInterfaceStateMachine(BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT,BOOTLOADER_UPLOAD_ABORT_GUI_CMD);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CPICUploaderGui::UPLOADER_GUI_AUTOMATIC_UPDATE_START_BTN_CLICK_EVENT:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CPICUploaderGui::UPLOADER_GUI_GET_STATE_BTN_CLICK_EVENT:
|
||||||
|
{
|
||||||
|
SendSingleCmdRequest(BOOTLOADER_GET_STATE_REQUEST);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CPICUploaderGui::UPLOADER_GUI_CHECK_FLASH_CLICK_EVENT:
|
||||||
|
{
|
||||||
|
SendSingleCmdRequest(BOOTLOADER_CHECK_FLASH_FIRMW_INTEGRITY_REQUEST);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CPICUploaderGui::UPLOADER_GUI_GET_STORED_FIRMWARE_INFO_CLICK_EVENT:
|
||||||
|
{
|
||||||
|
SendSingleCmdRequest(BOOTLOADER_GET_STORED_FIRMWARE_INFO_REQUEST);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CPICUploader::BootloaderRxCmd(int CmdID, QByteArray Data)
|
||||||
|
{
|
||||||
|
switch(CmdID)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_HEARTBEAT_RESPONSE:
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Heartbeat device response: %1").arg((int)Data.at(0)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_ERASE_BOOTLOADER_FLASH_RESPONSE:
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Erase flash device response: %1").arg((int)Data.at(0)));
|
||||||
|
BootloaderInterfaceStateMachine(BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT,BOOTLOADER_UPLOAD_ERASE_BOOTLOADER_FLASH_ACK_HOST_CMD,Data.at(0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_ERASE_BOOTLOADER_FLASH_RESULT_RESPONSE:
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Erase flash result device response: %1").arg((int)Data.at(0)));
|
||||||
|
BootloaderInterfaceStateMachine(BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT,BOOTLOADER_UPLOAD_ERASE_BOOTLOADER_FLASH_RESULT_HOST_CMD,Data.at(0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_INIT_UPLOAD_RESPONSE:
|
||||||
|
{
|
||||||
|
int ChunkSize;
|
||||||
|
quint32 temp = *(int*)Data.mid(1,4).data();
|
||||||
|
qToBigEndian(temp,&ChunkSize);
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Init Upload device response: %1, Chunk Size: %2").arg((int)Data.at(0)).arg(ChunkSize));
|
||||||
|
BootloaderInterfaceStateMachine(BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT,BOOTLOADER_UPLOAD_INIT_UPLOAD_HOST_CMD,(int)Data.at(0),(void*)&ChunkSize);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_GET_STATE_RESPONSE:
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Get State device Response: %1").arg((int)Data.at(0)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_READY_FOR_DATA_RESPONSE:
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Ready for data device response: %1").arg((int)Data.at(0)));
|
||||||
|
BootloaderInterfaceStateMachine(BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT,BOOTLOADER_UPLOAD_READY_FOR_DATA_HOST_CMD,(int)Data.at(0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_SEND_DATA_CHUNK_RESPONSE:
|
||||||
|
{
|
||||||
|
quint32 temp = *(int*)Data.mid(1,4).data();
|
||||||
|
int Index;
|
||||||
|
qToBigEndian(temp,&Index);
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Send Chunk device response: %1, Index: %2").arg((int)Data.at(0)).arg(Index));
|
||||||
|
BootloaderInterfaceStateMachine(BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT,BOOTLOADER_UPLOAD_SEND_DATA_CHUNK_HOST_CMD,(int)Data.at(0),(void*)&Index);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_UPLOAD_FINISHED_RESPONSE:
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Upload finished device response: %1").arg((int)Data.at(0)));
|
||||||
|
BootloaderInterfaceStateMachine(BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT,BOOTLOADER_UPLOAD_UPLOAD_FINISHED_HOST_CMD,(int)Data.at(0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_EXECUTE_UPGRADE_RESPONSE:
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Execute upgrade device response: %1").arg((int)Data.at(0)));
|
||||||
|
BootloaderInterfaceStateMachine(BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT,BOOTLOADER_UPLOAD_EXECUTE_UPGRADE_HOST_CMD,(int)Data.at(0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_ABORT_OPERATION_RESPONSE:
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Abort Operation device response: %1").arg((int)Data.at(0)));
|
||||||
|
BootloaderInterfaceStateMachine(BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT,BOOTLOADER_UPLOAD_ABORT_OPERATION_HOST_CMD,(int)Data.at(0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_CHECK_FLASH_FIRMW_INTEGRITY_RESPONSE:
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Flash integrity check response: %1").arg((int)Data.at(0)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_GET_STORED_FIRMWARE_INFO_RESPONSE:
|
||||||
|
{
|
||||||
|
QString FirmwareInfo;
|
||||||
|
FirmwareInfo.clear();
|
||||||
|
|
||||||
|
if(Data.at(0) == 0)
|
||||||
|
{
|
||||||
|
FirmwareInfo = "--------------------------------\nNo firmware stored in SPI flash\n--------------------------------";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
quint32 FirmwareFlags, NbRecords, FirmwareSize, VersionCode, DataCRC32;
|
||||||
|
|
||||||
|
quint32 temp = *(int*)Data.mid(1,4).data();
|
||||||
|
qToBigEndian(temp,&FirmwareFlags);
|
||||||
|
|
||||||
|
temp = *(int*)Data.mid(5,4).data();
|
||||||
|
qToBigEndian(temp,&NbRecords);
|
||||||
|
|
||||||
|
temp = *(int*)Data.mid(9,4).data();
|
||||||
|
qToBigEndian(temp,&FirmwareSize);
|
||||||
|
|
||||||
|
temp = *(int*)Data.mid(13,4).data();
|
||||||
|
qToBigEndian(temp,&VersionCode);
|
||||||
|
|
||||||
|
temp = *(int*)Data.mid(17,4).data();
|
||||||
|
qToBigEndian(temp,&DataCRC32);
|
||||||
|
|
||||||
|
FirmwareInfo = QString("\n----------------------------------\nStored firmware info:\nFirmware flags: 0x%1\nNb Records: %2\nFirmware Size: %3\nVersion: %4\nData CRC32: 0x%5\n----------------------------------\n")\
|
||||||
|
.arg(FirmwareFlags,0,16).arg(NbRecords).arg(FirmwareSize).arg(VersionCode).arg(DataCRC32,0,16);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(FirmwareInfo);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int CPICUploader::BootloaderInterfaceStateMachine(int Event, int Cmd, int CmdParam, void* Data)
|
||||||
|
{
|
||||||
|
switch(Event)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT:
|
||||||
|
{
|
||||||
|
switch(Cmd)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_BOOTLOADER_DISCONNECTED_CMD:
|
||||||
|
{
|
||||||
|
ResetBooloaderInterfaceStateMachine();
|
||||||
|
return RET_OK;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// State machine implementation starts here...
|
||||||
|
|
||||||
|
switch (mBootloaderInterfaceSMState)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_INTERFACE_SM_STANDBY_STATE:
|
||||||
|
{
|
||||||
|
switch(Event)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_SM_TICK_EVENT:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT:
|
||||||
|
{
|
||||||
|
switch(Cmd)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_BOOTLOADER_CONNECTED_CMD:
|
||||||
|
{
|
||||||
|
mBootloaderInterfaceSMState = BOOTLOADER_INTERFACE_SM_BOOTLDR_CONNECTED_STATE;
|
||||||
|
mPICUploaderGui->AddTextToLogScreen("[BootloaderSM] Going into CONNECTED state\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_INTERFACE_SM_BOOTLDR_CONNECTED_STATE:
|
||||||
|
{
|
||||||
|
switch(Event)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_SM_TICK_EVENT:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT:
|
||||||
|
{
|
||||||
|
switch(Cmd)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_ERASE_FLASH_GUI_CMD:
|
||||||
|
{
|
||||||
|
SendSingleCmdRequest(BOOTLOADER_ERASE_BOOTLOADER_FLASH_REQUEST);
|
||||||
|
mBootloaderInterfaceSMState = BOOTLOADER_INTERFACE_SM_ERASE_FLASH_STATE;
|
||||||
|
mPICUploaderGui->AddTextToLogScreen("[BootloaderSM] Going into ERASE_FLASH state\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_UPLOAD_START_FULL_UPDATE_GUI_CMD:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_UPLOAD_START_UPLOAD_GUI_CMD:
|
||||||
|
{
|
||||||
|
SendSingleCmdRequest(BOOTLOADER_INIT_UPLOAD_REQUEST);
|
||||||
|
mBootloaderInterfaceSMState = BOOTLOADER_INTERFACE_SM_INIT_UPLOAD_STATE;
|
||||||
|
mPICUploaderGui->AddTextToLogScreen("[BootloaderSM] Going into INIT_UPLOAD state\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_INTERFACE_SM_ERASE_FLASH_STATE:
|
||||||
|
{
|
||||||
|
switch(Event)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_SM_TICK_EVENT:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT:
|
||||||
|
{
|
||||||
|
switch(Cmd)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_ERASE_BOOTLOADER_FLASH_ACK_HOST_CMD:
|
||||||
|
{
|
||||||
|
if(CmdParam != BOOTLOADER_FLASH_ERASE_OK)
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen("Flash erase refused from host. Going back to CONNECTED state\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen("Device confirmed erasing flash in progress... \n");
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_UPLOAD_ERASE_BOOTLOADER_FLASH_RESULT_HOST_CMD:
|
||||||
|
{
|
||||||
|
if(CmdParam != BOOTLOADER_FLASH_ERASE_OK)
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen("Flash erase failed. Going back to CONNECTED state\n");
|
||||||
|
mBootloaderInterfaceSMState = BOOTLOADER_INTERFACE_SM_BOOTLDR_CONNECTED_STATE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen("Flash erase success. \n");
|
||||||
|
mBootloaderInterfaceSMState = BOOTLOADER_INTERFACE_SM_BOOTLDR_CONNECTED_STATE;
|
||||||
|
mPICUploaderGui->AddTextToLogScreen("[BootloaderSM] Going into CONNECTED state\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_INTERFACE_SM_INIT_UPLOAD_STATE:
|
||||||
|
{
|
||||||
|
switch(Event)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_SM_TICK_EVENT:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT:
|
||||||
|
{
|
||||||
|
switch(Cmd)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_INIT_UPLOAD_HOST_CMD:
|
||||||
|
{
|
||||||
|
if(CmdParam == BOOTLOADER_INIT_UPLOAD_SUCCESS)
|
||||||
|
{
|
||||||
|
//Host is in update mode. Load the buffer size and wait for "Ready for data" CMD (stay in the same state)
|
||||||
|
mFirmwareUploadBufferSize = *(int*)Data;
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Init upload accepted by host. Frame size: %1\n").arg(mFirmwareUploadBufferSize));
|
||||||
|
mBootloaderInterfaceSMState = BOOTLOADER_INTERFACE_SM_WAIT_READY_FOR_DATA_FROM_HOST_STATE;
|
||||||
|
mPICUploaderGui->AddTextToLogScreen("[BootloaderSM] Going into READY_FOR_DATA state\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Something's wrong with the host. Abort upload...
|
||||||
|
//TODO: Make the GUI aware of this.
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Init upload refused. Error code: %1. Going back to STANDBY state\n").arg(CmdParam));
|
||||||
|
ResetBooloaderInterfaceStateMachine();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_INTERFACE_SM_WAIT_READY_FOR_DATA_FROM_HOST_STATE:
|
||||||
|
{
|
||||||
|
switch(Event)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_SM_TICK_EVENT:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT:
|
||||||
|
{
|
||||||
|
switch(Cmd)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_READY_FOR_DATA_HOST_CMD:
|
||||||
|
{
|
||||||
|
//Host is ready for data. Start the upload state machine
|
||||||
|
mPICUploaderGui->AddTextToLogScreen("Host ready for data. Starting upload\n");
|
||||||
|
BootloaderFirmwareUploadStateMachine(BOOTLOADER_FIRM_UPLD_CMD_EVENT,BOOTLOADER_FIRM_UPLD_INIT_UPLOAD_CMD);
|
||||||
|
mBootloaderInterfaceSMState = BOOTLOADER_INTERFACE_SM_SEND_DATA_STATE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Invalid response from host received int <WAIT READY FOR DATA> state. Response Cmd received: %1. Going back to STANDBY state\n").arg(Cmd));
|
||||||
|
ResetBooloaderInterfaceStateMachine();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_INTERFACE_SM_SEND_DATA_STATE:
|
||||||
|
{
|
||||||
|
switch(Event)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_SM_TICK_EVENT:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT:
|
||||||
|
{
|
||||||
|
switch(Cmd)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_SEND_DATA_CHUNK_HOST_CMD:
|
||||||
|
{
|
||||||
|
int Res = BootloaderFirmwareUploadStateMachine(BOOTLOADER_FIRM_UPLD_CMD_EVENT,BOOTLOADER_FIRM_UPLD_CHUNK_RX_RESPONSE_CMD,CmdParam,*(int*)Data);
|
||||||
|
switch(Res)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_FIRM_UPLD_SENDING_RES:
|
||||||
|
{
|
||||||
|
//All is going well.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_FIRM_UPLD_FINISHED_RES:
|
||||||
|
{
|
||||||
|
mBootloaderInterfaceSMState = BOOTLOADER_INTERFACE_SM_DATA_FINISHED_STATE;
|
||||||
|
mPICUploaderGui->AddTextToLogScreen("Bootloader upload state machine uploaded all firmware\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_FIRM_UPLD_ERROR_RES:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_FIRM_UPLD_TIMEOUT_RES:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_FIRM_UPLD_ABORT_RES:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_FIRM_UPLD_OK_RES:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_INTERFACE_SM_DATA_FINISHED_STATE:
|
||||||
|
{
|
||||||
|
switch(Event)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_SM_TICK_EVENT:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT:
|
||||||
|
{
|
||||||
|
switch(Cmd)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_UPLOAD_BOOTLOADER_CONNECTED_CMD:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_UPLOAD_UPLOAD_FINISHED_HOST_CMD:
|
||||||
|
{
|
||||||
|
mBootloaderInterfaceSMState = BOOTLOADER_INTERFACE_SM_BOOTLDR_CONNECTED_STATE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
//State machine managing firmware packets upload and errors
|
||||||
|
int CPICUploader::BootloaderFirmwareUploadStateMachine(int Event, int Cmd, int CmdResult, int CmdParam)
|
||||||
|
{
|
||||||
|
switch(mBootloaderFirmwareUpldState)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_FIRM_UPLD_STANDBY_STATE:
|
||||||
|
{
|
||||||
|
switch(Event)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_FIRM_UPLD_TICK_EVENT:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_FIRM_UPLD_CMD_EVENT:
|
||||||
|
{
|
||||||
|
switch(Cmd)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_FIRM_UPLD_INIT_UPLOAD_CMD:
|
||||||
|
{
|
||||||
|
//TODO: Send First chunk
|
||||||
|
bool Finished;
|
||||||
|
mFirmwareData = mHexFile.GetRawData();
|
||||||
|
SendCmdRequest(BOOTLOADER_SEND_DATA_CHUNK_REQUEST, GetCurDataChunk(Finished));
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Upload SM: Sending first frame (%1)\n").arg(mFirmwareUploadCurFrame));
|
||||||
|
int NbChunks = mFirmwareData.size() / mFirmwareUploadBufferSize;
|
||||||
|
mPICUploaderGui->SetUploadProgressSettings(NbChunks);
|
||||||
|
mPICUploaderGui->ResetProgressBar();
|
||||||
|
if(Finished)
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("That was the last chunk. Going into UPLOAD_FINISHED state\n"));
|
||||||
|
mBootloaderFirmwareUpldState = BOOTLOADER_FIRM_UPLD_FINISHED_STATE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mBootloaderFirmwareUpldState = BOOTLOADER_FIRM_UPLD_SEND_CHUNK_STATE;
|
||||||
|
}
|
||||||
|
return BOOTLOADER_FIRM_UPLD_SENDING_RES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_FIRM_UPLD_ABORT_UPLOAD_CMD:
|
||||||
|
{
|
||||||
|
ResetFirmwareUploadStateMachine();
|
||||||
|
return BOOTLOADER_FIRM_UPLD_ABORT_RES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
//TODO: Find out what to do with that...
|
||||||
|
return BOOTLOADER_FIRM_UPLD_ERROR_RES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// case BOOTLOADER_FIRM_UPLD_WAIT_FOR_HOST_READY_STATE:
|
||||||
|
// {
|
||||||
|
// switch(Event)
|
||||||
|
// {
|
||||||
|
// case BOOTLOADER_FIRM_UPLD_TICK_EVENT:
|
||||||
|
// {
|
||||||
|
// return BOOTLOADER_FIRM_UPLD_WAITING_FOR_HOST_RES;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// case BOOTLOADER_FIRM_UPLD_CMD_EVENT:
|
||||||
|
// {
|
||||||
|
// switch(Cmd)
|
||||||
|
// {
|
||||||
|
// case BOOTLOADER_FIRM_UPLD_INIT_UPLOAD_ACK_CMD:
|
||||||
|
// {
|
||||||
|
// if(CmdResult == BOOTLOADER_INIT_UPLOAD_SUCCESS)
|
||||||
|
// {
|
||||||
|
// //Host is in update mode. Load the buffer size and wait for "Ready for data" CMD (stay in the same state)
|
||||||
|
// mFirmwareUploadBufferSize = CmdParam;
|
||||||
|
// return BOOTLOADER_FIRM_UPLD_WAITING_FOR_HOST_RES;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ResetFirmwareUploadStateMachine();
|
||||||
|
// return BOOTLOADER_FIRM_UPLD_ERROR_RES;
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// case BOOTLOADER_FIRM_UPLD_HOST_READY_FOR_DATA_CMD:
|
||||||
|
// {
|
||||||
|
// //Host is ready for data. Send the first chunk and go into next state (send chunk)
|
||||||
|
// //TODO: Send first data chunk
|
||||||
|
// mBootloaderFirmwareUpldState = BOOTLOADER_FIRM_UPLD_SEND_CHUNK_STATE;
|
||||||
|
// return BOOTLOADER_FIRM_UPLD_SENDING_RES;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// default:
|
||||||
|
// {
|
||||||
|
// return BOOTLOADER_FIRM_UPLD_ERROR_RES;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
case BOOTLOADER_FIRM_UPLD_SEND_CHUNK_STATE:
|
||||||
|
{
|
||||||
|
switch(Event)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_FIRM_UPLD_TICK_EVENT:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_FIRM_UPLD_CMD_EVENT:
|
||||||
|
{
|
||||||
|
switch(Cmd)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_FIRM_UPLD_CHUNK_RX_RESPONSE_CMD:
|
||||||
|
{
|
||||||
|
switch(CmdResult)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_CHUNK_TRANSFER_SUCCESS:
|
||||||
|
{
|
||||||
|
if(mFirmwareUploadCurFrame == 700 || mFirmwareUploadCurFrame == 800 || mFirmwareUploadCurFrame == 900)
|
||||||
|
{
|
||||||
|
int toto = 5;
|
||||||
|
}
|
||||||
|
bool Finished = false;
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Upload SM: Sending frame Nb: %1\n").arg(mFirmwareUploadCurFrame));
|
||||||
|
mFirmwareUploadCurFrame++;
|
||||||
|
SendCmdRequest(BOOTLOADER_SEND_DATA_CHUNK_REQUEST, GetCurDataChunk(Finished));
|
||||||
|
mPICUploaderGui->TickProgressBar();
|
||||||
|
if(Finished)
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("That was the last chunk. Going into UPLOAD_FINISHED state\n"));
|
||||||
|
mBootloaderFirmwareUpldState = BOOTLOADER_FIRM_UPLD_FINISHED_STATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_CHUNK_TRANSFER_ERROR_RESEND:
|
||||||
|
{
|
||||||
|
//TODO: Resend current frame
|
||||||
|
if(mFirmwareUploadCurFrame != CmdParam)
|
||||||
|
{
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Upload of frame %1 failed. and frame index desynchronized (Curframe = %2). Aborting and going to STANDBY mode\n").arg(CmdParam).arg(mFirmwareUploadCurFrame));
|
||||||
|
ResetFirmwareUploadStateMachine();
|
||||||
|
return BOOTLOADER_FIRM_UPLD_ERROR_RES;
|
||||||
|
}
|
||||||
|
bool Finished;
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Upload of frame %1 failed. Trying to resend\n").arg(CmdParam));
|
||||||
|
SendCmdRequest(BOOTLOADER_SEND_DATA_CHUNK_REQUEST, GetCurDataChunk(Finished));
|
||||||
|
//TODO: Manage the number of failed attempts.
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_CHUNK_TRANSFER_ERROR_FLASH_FAILURE:
|
||||||
|
{
|
||||||
|
ResetFirmwareUploadStateMachine();
|
||||||
|
return BOOTLOADER_FIRM_UPLD_ERROR_RES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_CHUNK_TRANSFER_ERROR_INVALID_CHUNK_INDEX:
|
||||||
|
{
|
||||||
|
ResetFirmwareUploadStateMachine();
|
||||||
|
return BOOTLOADER_FIRM_UPLD_ERROR_RES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_CHUNK_TRANSFER_ERROR_FLASH_ERROR:
|
||||||
|
{
|
||||||
|
ResetFirmwareUploadStateMachine();
|
||||||
|
return BOOTLOADER_FIRM_UPLD_ERROR_RES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return BOOTLOADER_FIRM_UPLD_SENDING_RES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_FIRM_UPLD_ABORT_UPLOAD_CMD:
|
||||||
|
{
|
||||||
|
ResetFirmwareUploadStateMachine();
|
||||||
|
return BOOTLOADER_FIRM_UPLD_ABORT_RES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
ResetFirmwareUploadStateMachine();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_FIRM_UPLD_FINISHED_STATE:
|
||||||
|
{
|
||||||
|
switch(Event)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_FIRM_UPLD_TICK_EVENT:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_FIRM_UPLD_CMD_EVENT:
|
||||||
|
{
|
||||||
|
switch(Cmd)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_FIRM_UPLD_CHUNK_RX_RESPONSE_CMD:
|
||||||
|
{switch(CmdResult)
|
||||||
|
{
|
||||||
|
case BOOTLOADER_CHUNK_TRANSFER_SUCCESS:
|
||||||
|
{
|
||||||
|
//TODO: Send upload finished CMD to host
|
||||||
|
|
||||||
|
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Upload of last frame success. Frame Nb %1\n").arg(CmdParam));
|
||||||
|
mPICUploaderGui->TickProgressBar();
|
||||||
|
|
||||||
|
return BOOTLOADER_FIRM_UPLD_FINISHED_RES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_CHUNK_TRANSFER_ERROR_RESEND:
|
||||||
|
{
|
||||||
|
//TODO: Resend current frame
|
||||||
|
if(mFirmwareUploadCurFrame != CmdParam)
|
||||||
|
{
|
||||||
|
//TODO: Manage this error... (Abort)
|
||||||
|
ResetFirmwareUploadStateMachine();
|
||||||
|
return BOOTLOADER_FIRM_UPLD_ERROR_RES;
|
||||||
|
}
|
||||||
|
bool Finished;
|
||||||
|
mPICUploaderGui->AddTextToLogScreen(QString("Upload of frame %1 failed. Trying to resend\n").arg(CmdParam));
|
||||||
|
SendCmdRequest(BOOTLOADER_SEND_DATA_CHUNK_REQUEST, GetCurDataChunk(Finished));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_CHUNK_TRANSFER_ERROR_FLASH_FAILURE:
|
||||||
|
{
|
||||||
|
ResetFirmwareUploadStateMachine();
|
||||||
|
return BOOTLOADER_FIRM_UPLD_ERROR_RES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_CHUNK_TRANSFER_ERROR_INVALID_CHUNK_INDEX:
|
||||||
|
{
|
||||||
|
ResetFirmwareUploadStateMachine();
|
||||||
|
return BOOTLOADER_FIRM_UPLD_ERROR_RES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOTLOADER_CHUNK_TRANSFER_ERROR_FLASH_ERROR:
|
||||||
|
{
|
||||||
|
ResetFirmwareUploadStateMachine();
|
||||||
|
return BOOTLOADER_FIRM_UPLD_ERROR_RES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ResetFirmwareUploadStateMachine();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
ResetFirmwareUploadStateMachine();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return BOOTLOADER_FIRM_UPLD_OK_RES;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int CPICUploader::ResetBooloaderInterfaceStateMachine()
|
||||||
|
{
|
||||||
|
mBootloaderInterfaceSMState = BOOTLOADER_INTERFACE_SM_STANDBY_STATE;
|
||||||
|
mFirmwareUploadBufferSize = 0;
|
||||||
|
mFirmwareUploadCurFrame = 0;
|
||||||
|
ResetFirmwareUploadStateMachine();
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CPICUploader::ResetFirmwareUploadStateMachine()
|
||||||
|
{
|
||||||
|
mBootloaderFirmwareUpldState = BOOTLOADER_FIRM_UPLD_STANDBY_STATE;
|
||||||
|
mFirmwareData.clear();
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Sends current data chunk based on mFirmwareUploadCurFrame and mFirmwareUploadBufferSize.
|
||||||
|
QByteArray CPICUploader::GetCurDataChunk(bool &IsLastChunk)
|
||||||
|
{
|
||||||
|
QByteArray Chunk;
|
||||||
|
QByteArray Payload;
|
||||||
|
Chunk.clear();
|
||||||
|
|
||||||
|
unsigned int index = mFirmwareUploadCurFrame * mFirmwareUploadBufferSize;
|
||||||
|
if((index + mFirmwareUploadBufferSize) >= mFirmwareData.size())
|
||||||
|
{
|
||||||
|
IsLastChunk = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Payload = mFirmwareData.mid(index,mFirmwareUploadBufferSize);
|
||||||
|
|
||||||
|
Chunk.append(IntToByteArray(mFirmwareUploadCurFrame));
|
||||||
|
Chunk.append(IntToByteArray(Payload.size()));
|
||||||
|
Chunk.append(Payload);
|
||||||
|
|
||||||
|
return Chunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QByteArray CPICUploader::IntToByteArray(int data)
|
||||||
|
{
|
||||||
|
QByteArray Array;
|
||||||
|
unsigned char nibble = (char)((data >> 24) &0x000000FF);
|
||||||
|
Array.append(nibble);
|
||||||
|
|
||||||
|
nibble = (char)((data >> 16) &0x000000FF);
|
||||||
|
Array.append(nibble);
|
||||||
|
|
||||||
|
nibble = (char)((data >> 8) &0x000000FF);
|
||||||
|
Array.append(nibble);
|
||||||
|
|
||||||
|
nibble = (char)(data &0x000000FF);
|
||||||
|
Array.append(nibble);
|
||||||
|
|
||||||
|
return Array;
|
||||||
|
}
|
||||||
176
Sources/PICUploader/PICUploader.h
Normal file
176
Sources/PICUploader/PICUploader.h
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
#ifndef PICUPLOADER_H
|
||||||
|
#define PICUPLOADER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "PICUploaderGui.h"
|
||||||
|
#include "HexFile.h"
|
||||||
|
#include <QTcpSocket>
|
||||||
|
#include "BootloaderProtocol.h"
|
||||||
|
|
||||||
|
enum eBootloaderUploadSMEvents
|
||||||
|
{
|
||||||
|
BOOTLOADER_UPLOAD_SM_TICK_EVENT,
|
||||||
|
BOOTLOADER_UPLOAD_SM_NEW_CMD_EVENT,
|
||||||
|
|
||||||
|
BOOTLOADER_UPLOAD_SM_MAX_EVENT
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eBootloaderSMCmdEvents
|
||||||
|
{
|
||||||
|
BOOTLOADER_UPLOAD_ERASE_FLASH_GUI_CMD,
|
||||||
|
BOOTLOADER_UPLOAD_START_UPLOAD_GUI_CMD,
|
||||||
|
BOOTLOADER_UPLOAD_START_FULL_UPDATE_GUI_CMD,
|
||||||
|
BOOTLOADER_UPLOAD_ABORT_GUI_CMD,
|
||||||
|
BOOTLOADER_UPLOAD_BOOTLOADER_CONNECTED_CMD,
|
||||||
|
BOOTLOADER_UPLOAD_BOOTLOADER_DISCONNECTED_CMD,
|
||||||
|
|
||||||
|
BOOTLOADER_UPLOAD_HEARTBEAT_HOST_CMD,
|
||||||
|
BOOTLOADER_UPLOAD_ERASE_BOOTLOADER_FLASH_ACK_HOST_CMD,
|
||||||
|
BOOTLOADER_UPLOAD_ERASE_BOOTLOADER_FLASH_RESULT_HOST_CMD,
|
||||||
|
BOOTLOADER_UPLOAD_INIT_UPLOAD_HOST_CMD,
|
||||||
|
BOOTLOADER_UPLOAD_GET_STATE_HOST_CMD,
|
||||||
|
BOOTLOADER_UPLOAD_READY_FOR_DATA_HOST_CMD,
|
||||||
|
BOOTLOADER_UPLOAD_SEND_DATA_CHUNK_HOST_CMD,
|
||||||
|
BOOTLOADER_UPLOAD_UPLOAD_FINISHED_HOST_CMD,
|
||||||
|
BOOTLOADER_UPLOAD_EXECUTE_UPGRADE_HOST_CMD,
|
||||||
|
BOOTLOADER_UPLOAD_ABORT_OPERATION_HOST_CMD,
|
||||||
|
|
||||||
|
BOOTLOADER_UPLOAD_MAX_CMD
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum eBootloaderInterfaceSMStates
|
||||||
|
{
|
||||||
|
BOOTLOADER_INTERFACE_SM_STANDBY_STATE,
|
||||||
|
BOOTLOADER_INTERFACE_SM_BOOTLDR_CONNECTED_STATE,
|
||||||
|
BOOTLOADER_INTERFACE_SM_ERASE_FLASH_STATE,
|
||||||
|
BOOTLOADER_INTERFACE_SM_WAIT_READY_FOR_DATA_FROM_HOST_STATE,
|
||||||
|
BOOTLOADER_INTERFACE_SM_INIT_UPLOAD_STATE,
|
||||||
|
BOOTLOADER_INTERFACE_SM_SEND_DATA_STATE,
|
||||||
|
BOOTLOADER_INTERFACE_SM_DATA_FINISHED_STATE,
|
||||||
|
|
||||||
|
BOOTLOADER_UPLOAD_MAX_STATE
|
||||||
|
}BootloaderInterfaceSMStates;
|
||||||
|
|
||||||
|
typedef enum eBootloaderFirmwareUploadSMStates
|
||||||
|
{
|
||||||
|
BOOTLOADER_FIRM_UPLD_STANDBY_STATE,
|
||||||
|
// BOOTLOADER_FIRM_UPLD_WAIT_FOR_HOST_READY_STATE,
|
||||||
|
BOOTLOADER_FIRM_UPLD_SEND_CHUNK_STATE,
|
||||||
|
BOOTLOADER_FIRM_UPLD_FINISHED_STATE,
|
||||||
|
|
||||||
|
BOOTLOADER_FIRM_UPLD_MAX_STATE
|
||||||
|
}BootloaderFirmwareUpldState;
|
||||||
|
|
||||||
|
enum eBootloaderFirmwareUploadEvents
|
||||||
|
{
|
||||||
|
BOOTLOADER_FIRM_UPLD_TICK_EVENT,
|
||||||
|
BOOTLOADER_FIRM_UPLD_CMD_EVENT,
|
||||||
|
|
||||||
|
BOOTLOADER_FIRM_UPLD_MAX_EVENT
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eBootloaderFirmwareUploadSMCmd
|
||||||
|
{
|
||||||
|
BOOTLOADER_FIRM_UPLD_INIT_UPLOAD_CMD,
|
||||||
|
BOOTLOADER_FIRM_UPLD_CHUNK_RX_RESPONSE_CMD,
|
||||||
|
BOOTLOADER_FIRM_UPLD_ABORT_UPLOAD_CMD,
|
||||||
|
|
||||||
|
BOOTLOADER_FIRM_UPLD_MAX_CMD
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eBootloaderProtocolDataTransferError
|
||||||
|
{
|
||||||
|
BOOTLOADER_CHUNK_TRANSFER_SUCCESS = 1,
|
||||||
|
BOOTLOADER_CHUNK_TRANSFER_ERROR_RESEND = 2,
|
||||||
|
BOOTLOADER_CHUNK_TRANSFER_ERROR_FLASH_FAILURE = 3,
|
||||||
|
BOOTLOADER_CHUNK_TRANSFER_ERROR_INVALID_CHUNK_INDEX = 4,
|
||||||
|
BOOTLOADER_CHUNK_TRANSFER_ERROR_FLASH_ERROR = 5,
|
||||||
|
|
||||||
|
BOOTLOADER_CHUNK_TRANSFER_MAX_ERROR
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eBootloaderProtocolInitUploadError
|
||||||
|
{
|
||||||
|
BOOTLOADER_INIT_UPLOAD_FAILED = 0,
|
||||||
|
BOOTLOADER_INIT_UPLOAD_SUCCESS = 1,
|
||||||
|
BOOTLOADER_INIT_UPLOAD_ERROR_FLASH_NOT_ERASED = 2,
|
||||||
|
|
||||||
|
BOOTLOADER_INIT_UPLOAD_MAX_ERROR
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eBootloaderFirmwareUploadRes
|
||||||
|
{
|
||||||
|
|
||||||
|
BOOTLOADER_FIRM_UPLD_STANDBY_RES,
|
||||||
|
BOOTLOADER_FIRM_UPLD_SENDING_RES,
|
||||||
|
BOOTLOADER_FIRM_UPLD_FINISHED_RES,
|
||||||
|
BOOTLOADER_FIRM_UPLD_ERROR_RES,
|
||||||
|
BOOTLOADER_FIRM_UPLD_TIMEOUT_RES,
|
||||||
|
BOOTLOADER_FIRM_UPLD_ABORT_RES,
|
||||||
|
BOOTLOADER_FIRM_UPLD_OK_RES,
|
||||||
|
|
||||||
|
BOOTLOADER_FIRM_UPLD_MAX_RES
|
||||||
|
};
|
||||||
|
|
||||||
|
//Used for both ACK and erase operation result
|
||||||
|
enum eBootloaderFlashEraseResult
|
||||||
|
{
|
||||||
|
BOOTLOADER_FLASH_ERASE_ERROR = 0,
|
||||||
|
BOOTLOADER_FLASH_ERASE_OK = 1,
|
||||||
|
|
||||||
|
BOOTLOADER_FLASH_ERASE_MAX_RESULT
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CPICUploader : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit CPICUploader(CPICUploaderGui *Gui);
|
||||||
|
int OpenHexFileRequest(QString FilePath);
|
||||||
|
|
||||||
|
int Start();
|
||||||
|
|
||||||
|
CPICUploaderGui *mPICUploaderGui;
|
||||||
|
|
||||||
|
CHexFile mHexFile;
|
||||||
|
|
||||||
|
QTcpSocket mBootloaderSocket;
|
||||||
|
CBootloaderProtocol mBootloaderProtocol;
|
||||||
|
|
||||||
|
int ConnectToBootloader(QString IP);
|
||||||
|
int DisconnectFromBootloader();
|
||||||
|
int SendSingleCmdRequest(int CmdID);
|
||||||
|
int SendCmdRequest(int CmdID, QByteArray Data);
|
||||||
|
int GuiEvent(int EventID, void* Data=0);
|
||||||
|
int ShowHexFileInfoRequest();
|
||||||
|
|
||||||
|
int BootloaderRxCmd(int CmdID, QByteArray Data);
|
||||||
|
|
||||||
|
int BootloaderFirmwareUploadStateMachine(int Event, int Cmd, int CmdResult = 1, int CmdParam = 0xBAADCAFE);
|
||||||
|
int BootloaderInterfaceStateMachine(int Event, int Cmd, int CmdParam = 0, void *Data = 0);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
BootloaderInterfaceSMStates mBootloaderInterfaceSMState;
|
||||||
|
int ResetBooloaderInterfaceStateMachine();
|
||||||
|
BootloaderFirmwareUpldState mBootloaderFirmwareUpldState;
|
||||||
|
int ResetFirmwareUploadStateMachine();
|
||||||
|
unsigned int mFirmwareUploadBufferSize;
|
||||||
|
unsigned int mFirmwareUploadCurFrame;
|
||||||
|
QByteArray mFirmwareData;
|
||||||
|
QByteArray GetCurDataChunk(bool &IsLastChunk);
|
||||||
|
QByteArray IntToByteArray(int);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void BootloaderSocketConnected();
|
||||||
|
void BootloaderSocketDisconnected();
|
||||||
|
void BootloaderDataAvailable();
|
||||||
|
void BootloaderSocketError(QAbstractSocket::SocketError);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PICUPLOADER_H
|
||||||
165
Sources/PICUploader/PICUploaderGui.cpp
Normal file
165
Sources/PICUploader/PICUploaderGui.cpp
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
#include "PICUploaderGui.h"
|
||||||
|
#include "ui_PICUploaderGui.h"
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include "PICUploader.h"
|
||||||
|
#include "ProtocolDefs.h"
|
||||||
|
|
||||||
|
CPICUploaderGui::CPICUploaderGui(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::CPICUploaderGui)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
connect(ui->mHexFileSelectBtn,SIGNAL(clicked(bool)),this,SLOT(OpenHexFileBtnClicked(bool)));
|
||||||
|
connect(ui->mConnectBtn,SIGNAL(clicked(bool)),this,SLOT(ConnectBtnClicked(bool)));
|
||||||
|
connect(ui->mSendCmdBtn,SIGNAL(clicked(bool)),this,SLOT(SendSingleCmdCliked(bool)));
|
||||||
|
connect(ui->mClearLogginWndwBtn,SIGNAL(clicked(bool)),SLOT(ClearLogScreen(bool)));
|
||||||
|
connect(ui->mShowHexFileInfoBtn,SIGNAL(clicked(bool)),this,SLOT(ShowHexFileInfoClicked(bool)));
|
||||||
|
ui->mUploadProgressBar->reset();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CPICUploaderGui::~CPICUploaderGui()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploaderGui::OpenHexFileBtnClicked(bool checked)
|
||||||
|
{
|
||||||
|
QString FileName = QFileDialog::getOpenFileName(0,"Select Firmware Hex File",QString(),"Hex files (*.hex)");
|
||||||
|
if(mProgramHandle->OpenHexFileRequest(FileName) != 1)
|
||||||
|
{
|
||||||
|
ui->mOpenedHexFilePathLbl->setText(FileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploaderGui::SetHexFileStats(QString Stats)
|
||||||
|
{
|
||||||
|
ui->mHexFileStatsLbl->setText(Stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploaderGui::ConnectBtnClicked(bool)
|
||||||
|
{
|
||||||
|
if(ui->mConnectBtn->text() == "Connect")
|
||||||
|
{
|
||||||
|
QString IP = ui->mIPAddressEdit->text();
|
||||||
|
if(IP.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ui->mConnectBtn->setText("Disconnect");
|
||||||
|
// ui->mConnectBtn->setEnabled(false);
|
||||||
|
mProgramHandle->ConnectToBootloader(IP);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// ui->mConnectBtn->setText("Connect");
|
||||||
|
mProgramHandle->DisconnectFromBootloader();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploaderGui::UploaderSocketConnected()
|
||||||
|
{
|
||||||
|
ui->mConnectBtn->setEnabled(true);
|
||||||
|
ui->mConnectBtn->setText("Disconnect");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploaderGui::UploaderSocketDisconnected()
|
||||||
|
{
|
||||||
|
ui->mConnectBtn->setEnabled(true);
|
||||||
|
ui->mConnectBtn->setText("Connect");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploaderGui::SendSingleCmdCliked(bool)
|
||||||
|
{
|
||||||
|
QString CmdSelection = ui->mCmdSelectCombo->currentText();
|
||||||
|
|
||||||
|
if(CmdSelection == "Heartbeat")
|
||||||
|
{
|
||||||
|
// mProgramHandle->SendSingleCmdRequest(BOOTLOADER_HEARTBEAT_REQUEST);
|
||||||
|
mProgramHandle->GuiEvent(UPLOADER_GUI_HEARTBEAT_BTN_CLICK_EVENT);
|
||||||
|
}
|
||||||
|
else if(CmdSelection == "Flash Erase")
|
||||||
|
{
|
||||||
|
//mProgramHandle->SendSingleCmdRequest(BOOTLOADER_ERASE_BOOTLOADER_FLASH_REQUEST);
|
||||||
|
mProgramHandle->GuiEvent(UPLOADER_GUI_FLASH_ERASE_BTN_CLICK_EVENT);
|
||||||
|
}
|
||||||
|
else if(CmdSelection == "Init Upload")
|
||||||
|
{
|
||||||
|
// mProgramHandle->SendSingleCmdRequest(BOOTLOADER_INIT_UPLOAD_REQUEST);
|
||||||
|
mProgramHandle->GuiEvent(UPLOADER_GUI_INIT_UPLOAD_BTN_CLICK_EVENT);
|
||||||
|
}
|
||||||
|
else if(CmdSelection == "Get State")
|
||||||
|
{
|
||||||
|
// mProgramHandle->SendSingleCmdRequest(BOOTLOADER_GET_STATE_REQUEST);
|
||||||
|
mProgramHandle->GuiEvent(UPLOADER_GUI_GET_STATE_BTN_CLICK_EVENT);
|
||||||
|
}
|
||||||
|
else if(CmdSelection == "Send Data Chunk")
|
||||||
|
{
|
||||||
|
// mProgramHandle->SendSingleCmdRequest(BOOTLOADER_SEND_DATA_CHUNK_REQUEST);
|
||||||
|
mProgramHandle->GuiEvent(UPLOADER_GUI_SEND_DATA_CHUNK_BTN_CLICK_EVENT);
|
||||||
|
}
|
||||||
|
else if(CmdSelection == "Upload Finished")
|
||||||
|
{
|
||||||
|
// mProgramHandle->SendSingleCmdRequest(BOOTLOADER_UPLOAD_FINISHED_REQUEST);
|
||||||
|
mProgramHandle->GuiEvent(UPLOADER_GUI_UPLOAD_FINISHED_BTN_CLICK_EVENT);
|
||||||
|
}
|
||||||
|
else if(CmdSelection == "Execute Upgrade")
|
||||||
|
{
|
||||||
|
// mProgramHandle->SendSingleCmdRequest(BOOTLOADER_EXECUTE_UPGRAGE_REQUEST);
|
||||||
|
mProgramHandle->GuiEvent(UPLOADER_GUI_EXECUTE_UPGRADE_BTN_CLICK_EVENT);
|
||||||
|
}
|
||||||
|
else if(CmdSelection == "Abort")
|
||||||
|
{
|
||||||
|
// mProgramHandle->SendSingleCmdRequest(BOOTLOADER_ABORT_OPERATION_REQUEST);
|
||||||
|
mProgramHandle->GuiEvent(UPLOADER_GUI_ABORT_BTN_CLICK_EVENT);
|
||||||
|
}
|
||||||
|
else if(CmdSelection == "Check Flash")
|
||||||
|
{
|
||||||
|
mProgramHandle->GuiEvent(UPLOADER_GUI_CHECK_FLASH_CLICK_EVENT);
|
||||||
|
}
|
||||||
|
else if(CmdSelection == "Get Stored Firmware Info")
|
||||||
|
{
|
||||||
|
mProgramHandle->GuiEvent(UPLOADER_GUI_GET_STORED_FIRMWARE_INFO_CLICK_EVENT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("Unknown selection???!!!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploaderGui::AddTextToLogScreen(QString Text)
|
||||||
|
{
|
||||||
|
Text.append("\n");
|
||||||
|
mLogScreenText.prepend(Text);
|
||||||
|
ui->mLoggingWindowTextEdit->setPlainText(mLogScreenText);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploaderGui::ClearLogScreen(bool dummy)
|
||||||
|
{
|
||||||
|
mLogScreenText.clear();
|
||||||
|
ui->mLoggingWindowTextEdit->setPlainText(mLogScreenText);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploaderGui::ShowHexFileInfoClicked(bool)
|
||||||
|
{
|
||||||
|
mProgramHandle->ShowHexFileInfoRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploaderGui::SetUploadProgressSettings(int max)
|
||||||
|
{
|
||||||
|
ui->mUploadProgressBar->setRange(0,max);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploaderGui::TickProgressBar()
|
||||||
|
{
|
||||||
|
ui->mUploadProgressBar->setValue(ui->mUploadProgressBar->value()+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPICUploaderGui::ResetProgressBar()
|
||||||
|
{
|
||||||
|
ui->mUploadProgressBar->reset();
|
||||||
|
}
|
||||||
62
Sources/PICUploader/PICUploaderGui.h
Normal file
62
Sources/PICUploader/PICUploaderGui.h
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#ifndef PICUPLOADERGUI_H
|
||||||
|
#define PICUPLOADERGUI_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
class CPICUploader;
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CPICUploaderGui;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CPICUploaderGui : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum eUploaderGuiEvents
|
||||||
|
{
|
||||||
|
UPLOADER_GUI_HEARTBEAT_BTN_CLICK_EVENT,
|
||||||
|
UPLOADER_GUI_FLASH_ERASE_BTN_CLICK_EVENT,
|
||||||
|
UPLOADER_GUI_INIT_UPLOAD_BTN_CLICK_EVENT,
|
||||||
|
UPLOADER_GUI_GET_STATE_BTN_CLICK_EVENT,
|
||||||
|
UPLOADER_GUI_SEND_DATA_CHUNK_BTN_CLICK_EVENT,
|
||||||
|
UPLOADER_GUI_UPLOAD_FINISHED_BTN_CLICK_EVENT,
|
||||||
|
UPLOADER_GUI_EXECUTE_UPGRADE_BTN_CLICK_EVENT,
|
||||||
|
UPLOADER_GUI_ABORT_BTN_CLICK_EVENT,
|
||||||
|
UPLOADER_GUI_AUTOMATIC_UPDATE_START_BTN_CLICK_EVENT,
|
||||||
|
UPLOADER_GUI_CHECK_FLASH_CLICK_EVENT,
|
||||||
|
UPLOADER_GUI_GET_STORED_FIRMWARE_INFO_CLICK_EVENT,
|
||||||
|
|
||||||
|
UPLOADER_GUI_MAX_EVENT
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CPICUploaderGui(QWidget *parent = nullptr);
|
||||||
|
~CPICUploaderGui();
|
||||||
|
|
||||||
|
void SetHexFileStats(QString Stats);
|
||||||
|
void UploaderSocketConnected();
|
||||||
|
void UploaderSocketDisconnected();
|
||||||
|
void AddTextToLogScreen(QString Text);
|
||||||
|
void SetUploadProgressSettings(int max);
|
||||||
|
void TickProgressBar();
|
||||||
|
void ResetProgressBar();
|
||||||
|
|
||||||
|
|
||||||
|
CPICUploader *mProgramHandle;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CPICUploaderGui *ui;
|
||||||
|
QString mLogScreenText;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void OpenHexFileBtnClicked(bool);
|
||||||
|
void ConnectBtnClicked(bool);
|
||||||
|
void SendSingleCmdCliked(bool);
|
||||||
|
void ClearLogScreen(bool);
|
||||||
|
void ShowHexFileInfoClicked(bool);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PICUPLOADERGUI_H
|
||||||
324
Sources/PICUploader/PICUploaderGui.ui
Normal file
324
Sources/PICUploader/PICUploaderGui.ui
Normal file
@ -0,0 +1,324 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CPICUploaderGui</class>
|
||||||
|
<widget class="QDialog" name="CPICUploaderGui">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1024</width>
|
||||||
|
<height>768</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>260</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>191</width>
|
||||||
|
<height>31</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Firmware Uploader</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="mHexFileSelectBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>110</y>
|
||||||
|
<width>81</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Open Hex File</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="mIPAddressEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>690</x>
|
||||||
|
<y>120</y>
|
||||||
|
<width>181</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>192.168.30.125</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="mOpenedHexFilePathLbl">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>140</y>
|
||||||
|
<width>521</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>No File Opened</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="mHexFileStatsLbl">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>170</y>
|
||||||
|
<width>471</width>
|
||||||
|
<height>131</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::Box</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="mConnectBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>890</x>
|
||||||
|
<y>120</y>
|
||||||
|
<width>75</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Connect</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="mSendCmdBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>890</x>
|
||||||
|
<y>170</y>
|
||||||
|
<width>75</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Send Cmd</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QComboBox" name="mCmdSelectCombo">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>710</x>
|
||||||
|
<y>170</y>
|
||||||
|
<width>151</width>
|
||||||
|
<height>22</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Heartbeat</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Get Stored Firmware Info</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Flash Erase</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Init Upload</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Get State</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Send Data Chunk</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Upload Finished</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Execute Upgrade</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Check Flash</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Abort</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPlainTextEdit" name="mLoggingWindowTextEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>310</y>
|
||||||
|
<width>651</width>
|
||||||
|
<height>341</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="mClearLogginWndwBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>660</y>
|
||||||
|
<width>75</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Clear</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="mShowHexFileInfoBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>170</x>
|
||||||
|
<y>110</y>
|
||||||
|
<width>75</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Show Info</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="mFilterParamsLbl">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>680</x>
|
||||||
|
<y>320</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>81</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::Box</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="mFilterStartAddressTxtEdit">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>760</x>
|
||||||
|
<y>330</y>
|
||||||
|
<width>113</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0x1D004000</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="mFilterEndAddressTxtEdit">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>760</x>
|
||||||
|
<y>370</y>
|
||||||
|
<width>113</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0x1D07FFFF</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>690</x>
|
||||||
|
<y>330</y>
|
||||||
|
<width>71</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Start Address</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>690</x>
|
||||||
|
<y>370</y>
|
||||||
|
<width>71</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>End Address</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>680</x>
|
||||||
|
<y>300</y>
|
||||||
|
<width>71</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Code area</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QProgressBar" name="mUploadProgressBar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>680</x>
|
||||||
|
<y>420</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>24</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@ -59,6 +59,10 @@ enum DEVICES_IDS
|
|||||||
ID_DEADBOLT_INTERFACE,
|
ID_DEADBOLT_INTERFACE,
|
||||||
ID_AVRECEIVER_INTERFACE,
|
ID_AVRECEIVER_INTERFACE,
|
||||||
ID_CHALET_INTERFACE,
|
ID_CHALET_INTERFACE,
|
||||||
|
ID_CHALET_DEVICE,
|
||||||
|
ID_ISPINDEL_INTERFACE,
|
||||||
|
ID_LORA_INTERFACE_DEVICE,
|
||||||
|
ID_LORA_INTERFACE_INTERFACE,
|
||||||
ID_NB_DEVICE_ID
|
ID_NB_DEVICE_ID
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -234,14 +238,24 @@ enum AV_RECEIVER_INTERFACE_CMDS
|
|||||||
AV_RECEIVER_INTERFACE_GENERAL_STATUS_RESPONSE,
|
AV_RECEIVER_INTERFACE_GENERAL_STATUS_RESPONSE,
|
||||||
AV_RECEIVER_INTERFACE_SET_MAIN_POWER_REQUEST,
|
AV_RECEIVER_INTERFACE_SET_MAIN_POWER_REQUEST,
|
||||||
AV_RECEIVER_INTERFACE_SET_MAIN_POWER_RESPONSE,
|
AV_RECEIVER_INTERFACE_SET_MAIN_POWER_RESPONSE,
|
||||||
AV_RECEIVER_INTERFACE_SET_SPEAKERB_REQUEST,
|
AV_RECEIVER_INTERFACE_SET_ZONE2_REQUEST,
|
||||||
AV_RECEIVER_INTERFACE_SET_SPEAKERB_RESPONSE,
|
AV_RECEIVER_INTERFACE_SET_ZONE2_RESPONSE,
|
||||||
AV_RECEIVER_INTERFACE_SET_SPEAKERA_REQUEST,
|
AV_RECEIVER_INTERFACE_SET_MAIN_ZONE_REQUEST,
|
||||||
AV_RECEIVER_INTERFACE_SET_SPEAKERA_RESPONSE,
|
AV_RECEIVER_INTERFACE_SET_MAIN_ZONE_RESPONSE,
|
||||||
AV_RECEIVER_INTERFACE_SET_SPEAKERS_REQUEST,
|
AV_RECEIVER_INTERFACE_SET_SPEAKERS_REQUEST,
|
||||||
AV_RECEIVER_INTERFACE_SET_SPEAKERS_RESPONSE,
|
AV_RECEIVER_INTERFACE_SET_SPEAKERS_RESPONSE,
|
||||||
AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_REQUEST,
|
AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_REQUEST,
|
||||||
AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_RESPONSE,
|
AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_RESPONSE,
|
||||||
|
AV_RECEIVER_INTERFACE_SELECT_SCENE_REQUEST,
|
||||||
|
AV_RECEIVER_INTERFACE_SELECT_SCENE_RESPONSE,
|
||||||
|
AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_REQUEST,
|
||||||
|
AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_RESPONSE,
|
||||||
|
AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_REQUEST,
|
||||||
|
AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_RESPONSE,
|
||||||
|
AV_RECEIVER_INTERFACE_SET_ZONE2_INPUT_REQUEST,
|
||||||
|
AV_RECEIVER_INTERFACE_SET_ZONE2_INPUT_RESPONSE,
|
||||||
|
AV_RECEIVER_INTERFACE_SET_SYNC_Z2_WITH_Z1_REQUEST,
|
||||||
|
AV_RECEIVER_INTERFACE_SET_SYNC_Z2_WITH_Z1_RESPONSE,
|
||||||
|
|
||||||
|
|
||||||
MAX_AV_RECEIVER_INTERFACE_CMD
|
MAX_AV_RECEIVER_INTERFACE_CMD
|
||||||
@ -269,9 +283,129 @@ enum CHALET_INTERFACE_CMDS
|
|||||||
CHALET_INTERFACE_CHALET_ACTIVITY_RESPONSE,
|
CHALET_INTERFACE_CHALET_ACTIVITY_RESPONSE,
|
||||||
CHALET_INTERFACE_GET_DATA_LOG_REQUEST,
|
CHALET_INTERFACE_GET_DATA_LOG_REQUEST,
|
||||||
CHALET_INTERFACE_GET_DATA_LOG_RESPONSE,
|
CHALET_INTERFACE_GET_DATA_LOG_RESPONSE,
|
||||||
|
CHALET_INTERFACE_WIFI_GET_DEVICE_PARAMS_REQUEST,
|
||||||
|
CHALET_INTERFACE_WIFI_GET_DEVICE_PARAMS_RESPONSE,
|
||||||
|
CHALET_INTERFACE_WIFI_SET_DEVICE_PARAMS_REQUEST,
|
||||||
|
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
|
MAX_CHALET_INTERFACE_CMD
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum CHALET_CMDS
|
||||||
|
{
|
||||||
|
CHALET_ACK = 1,
|
||||||
|
CHALET_GENERAL_STATUS_REQUEST, //2
|
||||||
|
CHALET_GENERAL_STATUS_RESPONSE, //3
|
||||||
|
CHALET_AC_POWER_STATE_STATUS_REQUEST,
|
||||||
|
CHALET_AC_POWER_STATE_STATUS_RESPONSE,
|
||||||
|
CHALET_AC_POWER_SET_STATE_REQUEST,
|
||||||
|
CHALET_AC_POWER_SET_STATE_RESPONSE,
|
||||||
|
CHALET_BATTERY_VOLTAGE_REQUEST,
|
||||||
|
CHALET_BATTERY_VOLTAGE_RESPONSE, //9
|
||||||
|
CHALET_BATTERY_CURRENT_REQUEST,
|
||||||
|
CHALET_BATTERY_CURRENT_RESPONSE,
|
||||||
|
CHALET_WIFI_STATUS_REQUEST,
|
||||||
|
CHALET_WIFI_STATUS_RESPONSE, //D
|
||||||
|
CHALET_WIFI_SET_STATE_REQUEST,
|
||||||
|
CHALET_WIFI_SET_STATE_RESPONSE, //F
|
||||||
|
CHALET_DO_HARAKIRI_REQUEST,
|
||||||
|
CHALET_DO_HARAKIRI_CONFIRMATION,
|
||||||
|
CHALET_REBOOT_CPU_REQUEST, //12
|
||||||
|
CHALET_REBOOT_CPU_RESPONSE,
|
||||||
|
CHALET_GET_STORED_WIFI_SETTINGS_REQUEST, //14
|
||||||
|
CHALET_GET_STORED_WIFI_SETTINGS_RESPONSE,
|
||||||
|
CHALET_SET_STORED_WIFI_SETTINGS_REQUEST, //
|
||||||
|
CHALET_SET_STORED_WIFI_SETTINGS_RESPONSE,
|
||||||
|
CHALET_GET_FIRMWARE_VERSION_REQUEST,
|
||||||
|
CHALET_GET_FIRMWARE_VERSION_RESPONSE,
|
||||||
|
CHALET_CLEAR_COMMS_STATISTICS_REQUEST,
|
||||||
|
CHALET_CLEAR_COMMS_STATISTICS_RESPONSE,
|
||||||
|
|
||||||
|
|
||||||
|
MAX_CHALET_CMD
|
||||||
|
};
|
||||||
|
|
||||||
|
enum BOOTLOADER_CMDS
|
||||||
|
{
|
||||||
|
BOOTLOADER_ACK = 1,
|
||||||
|
BOOTLOADER_HEARTBEAT_REQUEST,
|
||||||
|
BOOTLOADER_HEARTBEAT_RESPONSE,
|
||||||
|
BOOTLOADER_ERASE_BOOTLOADER_FLASH_REQUEST,
|
||||||
|
BOOTLOADER_ERASE_BOOTLOADER_FLASH_RESPONSE,
|
||||||
|
BOOTLOADER_ERASE_BOOTLOADER_FLASH_RESULT_RESPONSE,
|
||||||
|
BOOTLOADER_INIT_UPLOAD_REQUEST,
|
||||||
|
BOOTLOADER_INIT_UPLOAD_RESPONSE,
|
||||||
|
BOOTLOADER_GET_STATE_REQUEST,
|
||||||
|
BOOTLOADER_GET_STATE_RESPONSE,
|
||||||
|
BOOTLOADER_READY_FOR_DATA_RESPONSE,
|
||||||
|
BOOTLOADER_SEND_DATA_CHUNK_REQUEST,
|
||||||
|
BOOTLOADER_SEND_DATA_CHUNK_RESPONSE,
|
||||||
|
BOOTLOADER_UPLOAD_FINISHED_REQUEST,
|
||||||
|
BOOTLOADER_UPLOAD_FINISHED_RESPONSE,
|
||||||
|
BOOTLOADER_EXECUTE_UPGRAGE_REQUEST,
|
||||||
|
BOOTLOADER_EXECUTE_UPGRADE_RESPONSE,
|
||||||
|
BOOTLOADER_ABORT_OPERATION_REQUEST,
|
||||||
|
BOOTLOADER_ABORT_OPERATION_RESPONSE,
|
||||||
|
BOOTLOADER_SEND_FLASH_DATA_REQUEST,
|
||||||
|
BOOTLOADER_SEND_FLASH_DATA_RESPONSE,
|
||||||
|
BOOTLOADER_SEND_FLASH_DATA_CHUNK,
|
||||||
|
BOOTLOADER_SEND_FLASH_DATA_CHUNK_RESPONSE,
|
||||||
|
BOOTLOADER_CHECK_FLASH_FIRMW_INTEGRITY_REQUEST,
|
||||||
|
BOOTLOADER_CHECK_FLASH_FIRMW_INTEGRITY_RESPONSE,
|
||||||
|
BOOTLOADER_GET_STORED_FIRMWARE_INFO_REQUEST,
|
||||||
|
BOOTLOADER_GET_STORED_FIRMWARE_INFO_RESPONSE,
|
||||||
|
|
||||||
|
|
||||||
|
MAX_BOOTLOADER_CMD
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ISPINDLE_CMDS
|
||||||
|
{
|
||||||
|
ISPINDLE_ACK = 1,
|
||||||
|
ISPINDLE_LATEST_DATA_REQUEST,
|
||||||
|
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
|
||||||
|
};
|
||||||
|
|
||||||
|
enum LORA_MODULE_IF_INTERFACE_CMDS
|
||||||
|
{
|
||||||
|
LORA_MODULE_IF_INTERFACE_ACK = 1,
|
||||||
|
LORA_MODULE_IF_INTERFACE_GENERAL_STATUS_REQUEST,
|
||||||
|
LORA_MODULE_IF_INTERFACE_GENERAL_STATUS_RESPONSE,
|
||||||
|
|
||||||
|
|
||||||
|
MAX_LORA_MODULE_IF_INTERFACE_CMD
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -9,11 +9,18 @@ CSystemGui::CSystemGui(QObject *parent) : QObject(parent)
|
|||||||
mSprinklers = new CSprinkler(mGui->mSprinklerGui);
|
mSprinklers = new CSprinkler(mGui->mSprinklerGui);
|
||||||
mAvReceiver = new CAvReceiver(mGui->mAvReceiverGui);
|
mAvReceiver = new CAvReceiver(mGui->mAvReceiverGui);
|
||||||
mChalet = new CChalet(mGui->mChaletGui);
|
mChalet = new CChalet(mGui->mChaletGui);
|
||||||
|
mPICUploader = new CPICUploader(mGui->mPICUploaderGui);
|
||||||
|
mIspindel = new CIspindel(mGui->mIspindelGui);
|
||||||
|
mLoraModuleIF = new CLoraModuleInterface(mGui->mChaletGui);
|
||||||
|
mTrayVolumeCtrl = new CTrayVolumeCtrl(mGui->mAvReceiverGui);
|
||||||
|
mGui->mAvReceiverGui->mTrayVolumeCtrlGuiHandle = mTrayVolumeCtrl;
|
||||||
|
|
||||||
mSysTrayMgr = new CSystemTrayManager();
|
mSysTrayMgr = new CSystemTrayManager(mTrayVolumeCtrl);
|
||||||
mSysTrayMgr->mProgramHandle=this;
|
mSysTrayMgr->mProgramHandle=this;
|
||||||
mSMSClient->mTrayIconMgr = mSysTrayMgr;
|
mSMSClient->mTrayIconMgr = mSysTrayMgr;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CSystemGui::~CSystemGui()
|
CSystemGui::~CSystemGui()
|
||||||
@ -24,6 +31,10 @@ CSystemGui::~CSystemGui()
|
|||||||
delete mSysTrayMgr;
|
delete mSysTrayMgr;
|
||||||
delete mAvReceiver;
|
delete mAvReceiver;
|
||||||
delete mChalet;
|
delete mChalet;
|
||||||
|
delete mPICUploader;
|
||||||
|
delete mIspindel;
|
||||||
|
delete mLoraModuleIF;
|
||||||
|
delete mTrayVolumeCtrl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,6 +45,9 @@ void CSystemGui::Start()
|
|||||||
mSMSClient->Start();
|
mSMSClient->Start();
|
||||||
mAvReceiver->Start();
|
mAvReceiver->Start();
|
||||||
mChalet->Start();
|
mChalet->Start();
|
||||||
|
mPICUploader->Start();
|
||||||
|
mIspindel->Start();
|
||||||
|
// mLoraModuleIF->Start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +73,8 @@ int CSystemGui::TrayIconLeftClick()
|
|||||||
if(mGui->isVisible())
|
if(mGui->isVisible())
|
||||||
{
|
{
|
||||||
mGui->hide();
|
mGui->hide();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,6 +10,10 @@
|
|||||||
#include "AvReceiverGui.h"
|
#include "AvReceiverGui.h"
|
||||||
#include "AvReceiver.h"
|
#include "AvReceiver.h"
|
||||||
#include "CChalet.h"
|
#include "CChalet.h"
|
||||||
|
#include "PICUploader.h"
|
||||||
|
#include "Ispindel.h"
|
||||||
|
#include "LoraModuleInterface.h"
|
||||||
|
#include "TrayVolumeCtrl.h"
|
||||||
|
|
||||||
|
|
||||||
class CSystemGui : public QObject
|
class CSystemGui : public QObject
|
||||||
@ -35,6 +39,10 @@ private:
|
|||||||
CSprinkler *mSprinklers;
|
CSprinkler *mSprinklers;
|
||||||
CAvReceiver *mAvReceiver;
|
CAvReceiver *mAvReceiver;
|
||||||
CChalet *mChalet;
|
CChalet *mChalet;
|
||||||
|
CPICUploader *mPICUploader;
|
||||||
|
CIspindel *mIspindel;
|
||||||
|
CLoraModuleInterface *mLoraModuleIF;
|
||||||
|
CTrayVolumeCtrl *mTrayVolumeCtrl;
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#include "SystemGui.h"
|
#include "SystemGui.h"
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
|
|
||||||
CSystemTrayManager::CSystemTrayManager()
|
CSystemTrayManager::CSystemTrayManager(CTrayVolumeCtrl *VolumeCtrlWidget)
|
||||||
{
|
{
|
||||||
|
|
||||||
mProgramHandle = 0;
|
mProgramHandle = 0;
|
||||||
@ -13,8 +13,20 @@ CSystemTrayManager::CSystemTrayManager()
|
|||||||
connect(&mSystemTrayIcon,SIGNAL(messageClicked()),this,SLOT(TrayBaloonMessageClicked()));
|
connect(&mSystemTrayIcon,SIGNAL(messageClicked()),this,SLOT(TrayBaloonMessageClicked()));
|
||||||
connect(mTrayMenu,SIGNAL(triggered(QAction*)),this,SLOT(TrayMenuClicked(QAction*)));
|
connect(mTrayMenu,SIGNAL(triggered(QAction*)),this,SLOT(TrayMenuClicked(QAction*)));
|
||||||
|
|
||||||
mShowSettingsGUIAction = mTrayMenu->addAction("Settings");
|
|
||||||
|
QWidgetAction *test = new QWidgetAction(0);
|
||||||
|
test->setDefaultWidget(VolumeCtrlWidget);
|
||||||
|
// mTrayVolumeAction = new CTrayVolumeMenuAction("Volume");
|
||||||
|
// mShowSettingsGUIAction = mTrayMenu->addAction("Settings");
|
||||||
mQuitAction = mTrayMenu->addAction("Quit SMS Client");
|
mQuitAction = mTrayMenu->addAction("Quit SMS Client");
|
||||||
|
mTrayMenu->addSection("Display");
|
||||||
|
mCloneDisplaysAction = mTrayMenu->addAction("Clone");
|
||||||
|
mExtendDisplaysAction = mTrayMenu->addAction("Extend");
|
||||||
|
mTrayMenu->addSeparator();
|
||||||
|
mTrayMenu->addAction(test);
|
||||||
|
//mTrayMenu->setMinimumWidth(300);
|
||||||
|
|
||||||
|
|
||||||
mSystemTrayIcon.setIcon(QIcon("./Ico/sms.png"));
|
mSystemTrayIcon.setIcon(QIcon("./Ico/sms.png"));
|
||||||
mSystemTrayIcon.setToolTip("SMS Client :)");
|
mSystemTrayIcon.setToolTip("SMS Client :)");
|
||||||
mSystemTrayIcon.show();
|
mSystemTrayIcon.show();
|
||||||
@ -44,7 +56,8 @@ void CSystemTrayManager::TrayIconActivated(QSystemTrayIcon::ActivationReason Rea
|
|||||||
}
|
}
|
||||||
case QSystemTrayIcon::Context:
|
case QSystemTrayIcon::Context:
|
||||||
{
|
{
|
||||||
//qDebug("Context");
|
// mTrayVolumeCtrl->show();
|
||||||
|
qDebug("Context");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QSystemTrayIcon::DoubleClick:
|
case QSystemTrayIcon::DoubleClick:
|
||||||
@ -56,6 +69,7 @@ void CSystemTrayManager::TrayIconActivated(QSystemTrayIcon::ActivationReason Rea
|
|||||||
//qDebug("Trigger");
|
//qDebug("Trigger");
|
||||||
//mTrayMenu->popup(QCursor::pos());
|
//mTrayMenu->popup(QCursor::pos());
|
||||||
//mProgramHandle->RespawnMainWindowRequest();
|
//mProgramHandle->RespawnMainWindowRequest();
|
||||||
|
// mTrayVolumeCtrl->show();
|
||||||
mProgramHandle->TrayIconLeftClick();
|
mProgramHandle->TrayIconLeftClick();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -78,6 +92,14 @@ void CSystemTrayManager::TrayMenuClicked(QAction *Menu)
|
|||||||
qDebug("Settings");
|
qDebug("Settings");
|
||||||
mProgramHandle->ShowSettingsWindowRequest();
|
mProgramHandle->ShowSettingsWindowRequest();
|
||||||
}
|
}
|
||||||
|
else if(Menu == mCloneDisplaysAction)
|
||||||
|
{
|
||||||
|
system("C:\\Windows\\System32\\DisplaySwitch.exe /clone");
|
||||||
|
}
|
||||||
|
else if(Menu == mExtendDisplaysAction)
|
||||||
|
{
|
||||||
|
system("C:\\Windows\\System32\\DisplaySwitch.exe /extend");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,8 @@
|
|||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include "TrayVolumeCtrl.h"
|
||||||
|
|
||||||
|
|
||||||
class CSystemGui;
|
class CSystemGui;
|
||||||
|
|
||||||
@ -12,7 +14,7 @@ class CSystemTrayManager: public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CSystemTrayManager();
|
CSystemTrayManager(CTrayVolumeCtrl *VolumeCtrlWidget);
|
||||||
virtual ~CSystemTrayManager();
|
virtual ~CSystemTrayManager();
|
||||||
CSystemGui *mProgramHandle;
|
CSystemGui *mProgramHandle;
|
||||||
int NewSMSMessagesPendingCount(int count);
|
int NewSMSMessagesPendingCount(int count);
|
||||||
@ -21,7 +23,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
QSystemTrayIcon mSystemTrayIcon;
|
QSystemTrayIcon mSystemTrayIcon;
|
||||||
QMenu *mTrayMenu;
|
QMenu *mTrayMenu;
|
||||||
QAction *mQuitAction, *mShowSettingsGUIAction;
|
// CTrayVolumeMenuAction *mTrayVolumeAction;
|
||||||
|
QAction *mQuitAction, *mShowSettingsGUIAction, *mTrayVolumeMenuAction, *mCloneDisplaysAction, *mExtendDisplaysAction;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void TrayIconActivated(QSystemTrayIcon::ActivationReason);
|
void TrayIconActivated(QSystemTrayIcon::ActivationReason);
|
||||||
|
|||||||
@ -50,6 +50,9 @@ CLightShowWidget::CLightShowWidget(QWidget *parent)
|
|||||||
setSceneRect(-100,-100,parentWidget()->geometry().width(),parentWidget()->geometry().height());
|
setSceneRect(-100,-100,parentWidget()->geometry().width(),parentWidget()->geometry().height());
|
||||||
setMinimumSize(parentWidget()->geometry().width(),parentWidget()->geometry().height());
|
setMinimumSize(parentWidget()->geometry().width(),parentWidget()->geometry().height());
|
||||||
|
|
||||||
|
mScene->views().at(0)->setBackgroundBrush(QBrush(QColor(Qt::black)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
89
Sources/TrayVolumeCtrl.cpp
Normal file
89
Sources/TrayVolumeCtrl.cpp
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
#include "TrayVolumeCtrl.h"
|
||||||
|
#include "AvReceiverGui.h"
|
||||||
|
|
||||||
|
|
||||||
|
CTrayVolumeCtrl::CTrayVolumeCtrl(CAvReceiverGui *AvReceiverGuiPtr, QWidget *parent) :
|
||||||
|
QWidget(parent)
|
||||||
|
{
|
||||||
|
mAvReceiverGuiHandle = AvReceiverGuiPtr;
|
||||||
|
|
||||||
|
mMainZoneSlider = new QSlider();
|
||||||
|
mZone2Slider = new QSlider();
|
||||||
|
mMainZoneLabel = new QLabel("Main\n0");
|
||||||
|
mMainZoneLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
mZone2Label = new QLabel("Zone 2\n0");
|
||||||
|
mZone2Label->setAlignment(Qt::AlignCenter);
|
||||||
|
mLayout = new QGridLayout(this);
|
||||||
|
mButton1 = new QPushButton("1");
|
||||||
|
mButton2 = new QPushButton("2");
|
||||||
|
mButton3 = new QPushButton("3");
|
||||||
|
mButton4 = new QPushButton("4");
|
||||||
|
|
||||||
|
|
||||||
|
mLayout->addWidget(mMainZoneLabel,0,0);
|
||||||
|
mLayout->addWidget(mZone2Label,0,1);
|
||||||
|
mLayout->addWidget(mMainZoneSlider,1,0,4,1);
|
||||||
|
mLayout->addWidget(mZone2Slider,1,1,4,1);
|
||||||
|
mLayout->addWidget(mButton1,1,2);
|
||||||
|
mLayout->addWidget(mButton2,2,2);
|
||||||
|
mLayout->addWidget(mButton3,3,2);
|
||||||
|
mLayout->addWidget(mButton4,4,2);
|
||||||
|
mButton1->setMaximumWidth(25);
|
||||||
|
mButton2->setMaximumWidth(25);
|
||||||
|
mButton3->setMaximumWidth(25);
|
||||||
|
mButton4->setMaximumWidth(25);
|
||||||
|
|
||||||
|
mMainZoneSlider->setMaximum(182);
|
||||||
|
mZone2Slider->setMaximum(182);
|
||||||
|
|
||||||
|
|
||||||
|
connect(mMainZoneSlider,&QSlider::valueChanged,this,&CTrayVolumeCtrl::MainZoneSliderValueChanged);
|
||||||
|
connect(mZone2Slider,&QSlider::valueChanged,this,&CTrayVolumeCtrl::Zone2SliderValueChanged);
|
||||||
|
connect(mButton1,&QPushButton::clicked,mAvReceiverGuiHandle,&CAvReceiverGui::MainZoneScene1BtnClicked);
|
||||||
|
connect(mButton2,&QPushButton::clicked,mAvReceiverGuiHandle,&CAvReceiverGui::MainZoneScene2BtnClicked);
|
||||||
|
connect(mButton3,&QPushButton::clicked,mAvReceiverGuiHandle,&CAvReceiverGui::MainZoneScene3BtnClicked);
|
||||||
|
connect(mButton4,&QPushButton::clicked,mAvReceiverGuiHandle,&CAvReceiverGui::MainZoneScene4BtnClicked);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CTrayVolumeCtrl::~CTrayVolumeCtrl()
|
||||||
|
{
|
||||||
|
delete mLayout;
|
||||||
|
delete mMainZoneSlider;
|
||||||
|
delete mZone2Slider;
|
||||||
|
delete mZone2Label;
|
||||||
|
delete mMainZoneLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CTrayVolumeCtrl::MainZoneSliderValueChanged()
|
||||||
|
{
|
||||||
|
float SetVolume = mAvReceiverGuiHandle->ConvertBarPositionToVolume(mMainZoneSlider->value());
|
||||||
|
mMainZoneLabel->setText(QString("Main\n%1").arg(SetVolume));
|
||||||
|
mAvReceiverGuiHandle->MainZoneVolumeSetChanged(mMainZoneSlider->value());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTrayVolumeCtrl::Zone2SliderValueChanged()
|
||||||
|
{
|
||||||
|
float SetVolume = mAvReceiverGuiHandle->ConvertBarPositionToVolume(mZone2Slider->value());
|
||||||
|
mZone2Label->setText(QString("Main\n%1").arg(SetVolume));
|
||||||
|
mAvReceiverGuiHandle->Zone2VolumeSetChanged(mZone2Slider->value());
|
||||||
|
}
|
||||||
|
|
||||||
|
int CTrayVolumeCtrl::SetMainZoneVolume(int SliderValue, float Volume)
|
||||||
|
{
|
||||||
|
mMainZoneSlider->blockSignals(true);
|
||||||
|
mMainZoneLabel->setText(QString("Main\n%1").arg(Volume));
|
||||||
|
mMainZoneSlider->setValue(SliderValue);
|
||||||
|
mMainZoneSlider->blockSignals(false);
|
||||||
|
mMainZoneCurVolume = Volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CTrayVolumeCtrl::SetZone2Volume(int SliderValue, float Volume)
|
||||||
|
{
|
||||||
|
mZone2Slider->blockSignals(true);
|
||||||
|
mZone2Label->setText(QString("Zone 2\n%1").arg(Volume));
|
||||||
|
mZone2Slider->setValue(SliderValue);
|
||||||
|
mZone2Slider->blockSignals(false);
|
||||||
|
mZone2CurVolume = Volume;
|
||||||
|
}
|
||||||
42
Sources/TrayVolumeCtrl.h
Normal file
42
Sources/TrayVolumeCtrl.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#ifndef TRAYVOLUMECTRL_H
|
||||||
|
#define TRAYVOLUMECTRL_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QSlider>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
class CAvReceiverGui;
|
||||||
|
|
||||||
|
class CTrayVolumeCtrl : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CTrayVolumeCtrl(CAvReceiverGui *AvReceiverGuiPtr,QWidget *parent = 0);
|
||||||
|
~CTrayVolumeCtrl();
|
||||||
|
//QHBoxLayout *mLayout;
|
||||||
|
QGridLayout *mLayout;
|
||||||
|
QSlider *mMainZoneSlider, *mZone2Slider;
|
||||||
|
QLabel *mMainZoneLabel, *mZone2Label;
|
||||||
|
QPushButton *mButton1, *mButton2, *mButton3, *mButton4;
|
||||||
|
CAvReceiverGui *mAvReceiverGuiHandle;
|
||||||
|
|
||||||
|
int SetMainZoneVolume(int SliderValue, float Volume);
|
||||||
|
int SetZone2Volume(int SliderValue, float Volume);
|
||||||
|
|
||||||
|
float mMainZoneCurVolume, mZone2CurVolume;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void MainZoneSliderValueChanged();
|
||||||
|
void Zone2SliderValueChanged();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TRAYVOLUMECTRL_H
|
||||||
@ -28,6 +28,9 @@ INCLUDEPATH += Sources\
|
|||||||
Sources/AvReceiver\
|
Sources/AvReceiver\
|
||||||
Sources/Chalet\
|
Sources/Chalet\
|
||||||
Sources/Tower\
|
Sources/Tower\
|
||||||
|
Sources/PICUploader\
|
||||||
|
Sources/Ispindel \
|
||||||
|
Sources/LoRaModuleInterface
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
Sources/Chalet/CChalet.cpp \
|
Sources/Chalet/CChalet.cpp \
|
||||||
@ -36,6 +39,7 @@ SOURCES += \
|
|||||||
Sources/Chalet/ChaletMasterCtrlInterface.cpp \
|
Sources/Chalet/ChaletMasterCtrlInterface.cpp \
|
||||||
Sources/GuiMain.cpp \
|
Sources/GuiMain.cpp \
|
||||||
Sources/NetworkProtocol.cpp \
|
Sources/NetworkProtocol.cpp \
|
||||||
|
Sources/PICUploader/PICUploaderGui.cpp \
|
||||||
Sources/ProgramSettings.cpp \
|
Sources/ProgramSettings.cpp \
|
||||||
Sources/SystemGui.cpp \
|
Sources/SystemGui.cpp \
|
||||||
Sources/SMSClient/SMSConversation.cpp \
|
Sources/SMSClient/SMSConversation.cpp \
|
||||||
@ -64,7 +68,21 @@ SOURCES += \
|
|||||||
Sources/Tower/LedStringWidget.cpp \
|
Sources/Tower/LedStringWidget.cpp \
|
||||||
Sources/Tower/LEDAnimator.cpp \
|
Sources/Tower/LEDAnimator.cpp \
|
||||||
Sources/Tower/LEDAnimation.cpp \
|
Sources/Tower/LEDAnimation.cpp \
|
||||||
Sources/main.cpp
|
Sources/main.cpp \
|
||||||
|
Sources/PICUploader/PICUploader.cpp \
|
||||||
|
Sources/PICUploader/HexFile.cpp \
|
||||||
|
Sources/PICUploader/HexRecord.cpp \
|
||||||
|
Sources/PICUploader/BootloaderProtocol.cpp \
|
||||||
|
Sources/CRC32.cpp \
|
||||||
|
Sources/Ispindel/IspindelGUI.cpp \
|
||||||
|
Sources/Ispindel/Ispindel.cpp \
|
||||||
|
Sources/Ispindel/IspindelInterface.cpp \
|
||||||
|
Sources/Ispindel/IspindelData.cpp \
|
||||||
|
Sources/LoRaModuleInterface/LoraModuleInterface.cpp \
|
||||||
|
Sources/LoRaModuleInterface/LoraModuleIFMasterCtrlInterface.cpp \
|
||||||
|
Sources/LoRaModuleInterface/LoraModuleInterfaceData.cpp \
|
||||||
|
Sources/TrayVolumeCtrl.cpp \
|
||||||
|
Sources/AvReceiver/VolumeController.cpp
|
||||||
|
|
||||||
HEADERS += Sources/AbstractNetworkInterface.h \
|
HEADERS += Sources/AbstractNetworkInterface.h \
|
||||||
Sources/Chalet/CChalet.h \
|
Sources/Chalet/CChalet.h \
|
||||||
@ -73,6 +91,7 @@ HEADERS += Sources/AbstractNetworkInterface.h \
|
|||||||
Sources/Chalet/ChaletMasterCtrlInterface.h \
|
Sources/Chalet/ChaletMasterCtrlInterface.h \
|
||||||
Sources/GuiMain.h \
|
Sources/GuiMain.h \
|
||||||
Sources/NetworkProtocol.h \
|
Sources/NetworkProtocol.h \
|
||||||
|
Sources/PICUploader/PICUploaderGui.h \
|
||||||
Sources/ProgramSettings.h \
|
Sources/ProgramSettings.h \
|
||||||
Sources/ProtocolDefs.h \
|
Sources/ProtocolDefs.h \
|
||||||
Sources/SystemGui.h \
|
Sources/SystemGui.h \
|
||||||
@ -102,12 +121,32 @@ HEADERS += Sources/AbstractNetworkInterface.h \
|
|||||||
Sources/Tower/RGBLedWidget.h \
|
Sources/Tower/RGBLedWidget.h \
|
||||||
Sources/Tower/LedStringWidget.h \
|
Sources/Tower/LedStringWidget.h \
|
||||||
Sources/Tower/LEDAnimator.h \
|
Sources/Tower/LEDAnimator.h \
|
||||||
Sources/Tower/LEDAnimation.h
|
Sources/Tower/LEDAnimation.h \
|
||||||
|
Sources/PICUploader/PICUploader.h \
|
||||||
|
Sources/PICUploader/HexFile.h \
|
||||||
|
Sources/PICUploader/HexRecord.h \
|
||||||
|
Sources/PICUploader/BootloaderProtocol.h \
|
||||||
|
Sources/CRC32.h \
|
||||||
|
Sources/Ispindel/IspindelGUI.h \
|
||||||
|
Sources/Ispindel/Ispindel.h \
|
||||||
|
Sources/Ispindel/IspindelInterface.h \
|
||||||
|
Sources/Ispindel/IspindelData.h \
|
||||||
|
Sources/LoRaModuleInterface/LoraModuleInterface.h \
|
||||||
|
Sources/LoRaModuleInterface/LoraModuleIFMasterCtrlInterface.h \
|
||||||
|
Sources/LoRaModuleInterface/LoraModuleInterfaceData.h \
|
||||||
|
Sources/TrayVolumeCtrl.h \
|
||||||
|
Sources/AvReceiver/VolumeController.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
SMSGui.ui \
|
SMSGui.ui \
|
||||||
Sources/Chalet/ChaletGui.ui \
|
Sources/Chalet/ChaletGui.ui \
|
||||||
|
Sources/PICUploader/PICUploaderGui.ui \
|
||||||
Sources/Sprinkler/SprinklerGui.ui \
|
Sources/Sprinkler/SprinklerGui.ui \
|
||||||
Sources/Sprinkler/SprinklerDeviceGuiItem.ui \
|
Sources/Sprinkler/SprinklerDeviceGuiItem.ui \
|
||||||
Sources/AvReceiver/AvReceiverGui.ui \
|
Sources/AvReceiver/AvReceiverGui.ui \
|
||||||
Sources/Tower/TowerLightShowGui.ui
|
Sources/Tower/TowerLightShowGui.ui \
|
||||||
|
Sources/Ispindel/IspindelGUI.ui
|
||||||
|
|
||||||
|
#win32: LIBS += -luuid
|
||||||
|
|
||||||
|
win32: LIBS += -lole32
|
||||||
|
|||||||
264
SystemGui.pro.user.5a351af
Normal file
264
SystemGui.pro.user.5a351af
Normal file
@ -0,0 +1,264 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE QtCreatorProject>
|
||||||
|
<!-- Written by QtCreator 4.2.1, 2023-01-15T12:49:24. -->
|
||||||
|
<qtcreator>
|
||||||
|
<data>
|
||||||
|
<variable>EnvironmentId</variable>
|
||||||
|
<value type="QByteArray">{5a351af6-dc3b-4afc-af92-7da5e3a5cd12}</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
<value type="int">0</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||||
|
<valuemap type="QVariantMap">
|
||||||
|
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||||
|
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||||
|
<value type="QString" key="language">Cpp</value>
|
||||||
|
<valuemap type="QVariantMap" key="value">
|
||||||
|
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||||
|
</valuemap>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||||
|
<value type="QString" key="language">QmlJS</value>
|
||||||
|
<valuemap type="QVariantMap" key="value">
|
||||||
|
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||||
|
</valuemap>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||||
|
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||||
|
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||||
|
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||||
|
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||||
|
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||||
|
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||||
|
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||||
|
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||||
|
<valuemap type="QVariantMap"/>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||||
|
<valuemap type="QVariantMap">
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 5.14.2</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 5.14.2</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{dc2b548b-27bc-4e25-8500-cc36640735d8}</value>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/Main/PicDev/Projets/MasterCtrl/SystemGui</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
|
||||||
|
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/Main/PicDev/Projets/MasterCtrl/SystemGui</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||||
|
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||||
|
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||||
|
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||||
|
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||||
|
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||||
|
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||||
|
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||||
|
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||||
|
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||||
|
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||||
|
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||||
|
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||||
|
<value type="int">0</value>
|
||||||
|
<value type="int">1</value>
|
||||||
|
<value type="int">2</value>
|
||||||
|
<value type="int">3</value>
|
||||||
|
<value type="int">4</value>
|
||||||
|
<value type="int">5</value>
|
||||||
|
<value type="int">6</value>
|
||||||
|
<value type="int">7</value>
|
||||||
|
<value type="int">8</value>
|
||||||
|
<value type="int">9</value>
|
||||||
|
<value type="int">10</value>
|
||||||
|
<value type="int">11</value>
|
||||||
|
<value type="int">12</value>
|
||||||
|
<value type="int">13</value>
|
||||||
|
<value type="int">14</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||||
|
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">SystemGui</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Main/PicDev/Projets/MasterCtrl/SystemGui/SystemGui.pro</value>
|
||||||
|
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">SystemGui.pro</value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">D:/Main/PicDev/Projets/MasterCtrl/SystemGui</value>
|
||||||
|
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||||
|
<value type="int">1</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||||
|
<value type="int">18</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>Version</variable>
|
||||||
|
<value type="int">18</value>
|
||||||
|
</data>
|
||||||
|
</qtcreator>
|
||||||
@ -12,7 +12,11 @@
|
|||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
#include <QtWidgets/QCheckBox>
|
#include <QtWidgets/QCheckBox>
|
||||||
|
#include <QtWidgets/QComboBox>
|
||||||
|
#include <QtWidgets/QGroupBox>
|
||||||
#include <QtWidgets/QLabel>
|
#include <QtWidgets/QLabel>
|
||||||
|
#include <QtWidgets/QPushButton>
|
||||||
|
#include <QtWidgets/QSlider>
|
||||||
#include <QtWidgets/QWidget>
|
#include <QtWidgets/QWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@ -24,24 +28,80 @@ public:
|
|||||||
QLabel *mRcvrStatusLabel;
|
QLabel *mRcvrStatusLabel;
|
||||||
QCheckBox *mSpkBCheckBox;
|
QCheckBox *mSpkBCheckBox;
|
||||||
QCheckBox *mSpkACheckBox;
|
QCheckBox *mSpkACheckBox;
|
||||||
|
QLabel *mZone2StatusLabel;
|
||||||
|
QGroupBox *MainZoneSceneBox;
|
||||||
|
QPushButton *MainZoneScene1Btn;
|
||||||
|
QPushButton *MainZoneScene2Btn;
|
||||||
|
QPushButton *MainZoneScene3Btn;
|
||||||
|
QPushButton *MainZoneScene4Btn;
|
||||||
|
QSlider *mMainZoneVolumeSldBar;
|
||||||
|
QSlider *mZone2VolumeSldBar;
|
||||||
|
QLabel *mMainZoneSliderValueLbl;
|
||||||
|
QLabel *mZone2SliderValueLbl;
|
||||||
|
QComboBox *mZone2InputComboBx;
|
||||||
|
QCheckBox *mZone2SyncVolumeChkBx;
|
||||||
|
|
||||||
void setupUi(QWidget *CAvReceiverGui)
|
void setupUi(QWidget *CAvReceiverGui)
|
||||||
{
|
{
|
||||||
if (CAvReceiverGui->objectName().isEmpty())
|
if (CAvReceiverGui->objectName().isEmpty())
|
||||||
CAvReceiverGui->setObjectName(QString::fromUtf8("CAvReceiverGui"));
|
CAvReceiverGui->setObjectName(QString::fromUtf8("CAvReceiverGui"));
|
||||||
CAvReceiverGui->resize(796, 447);
|
CAvReceiverGui->resize(883, 453);
|
||||||
label = new QLabel(CAvReceiverGui);
|
label = new QLabel(CAvReceiverGui);
|
||||||
label->setObjectName(QString::fromUtf8("label"));
|
label->setObjectName(QString::fromUtf8("label"));
|
||||||
label->setGeometry(QRect(230, 30, 201, 16));
|
label->setGeometry(QRect(230, 30, 201, 16));
|
||||||
mRcvrStatusLabel = new QLabel(CAvReceiverGui);
|
mRcvrStatusLabel = new QLabel(CAvReceiverGui);
|
||||||
mRcvrStatusLabel->setObjectName(QString::fromUtf8("mRcvrStatusLabel"));
|
mRcvrStatusLabel->setObjectName(QString::fromUtf8("mRcvrStatusLabel"));
|
||||||
mRcvrStatusLabel->setGeometry(QRect(100, 110, 181, 231));
|
mRcvrStatusLabel->setGeometry(QRect(50, 130, 181, 181));
|
||||||
mSpkBCheckBox = new QCheckBox(CAvReceiverGui);
|
mSpkBCheckBox = new QCheckBox(CAvReceiverGui);
|
||||||
mSpkBCheckBox->setObjectName(QString::fromUtf8("mSpkBCheckBox"));
|
mSpkBCheckBox->setObjectName(QString::fromUtf8("mSpkBCheckBox"));
|
||||||
mSpkBCheckBox->setGeometry(QRect(570, 130, 70, 17));
|
mSpkBCheckBox->setGeometry(QRect(350, 110, 70, 17));
|
||||||
mSpkACheckBox = new QCheckBox(CAvReceiverGui);
|
mSpkACheckBox = new QCheckBox(CAvReceiverGui);
|
||||||
mSpkACheckBox->setObjectName(QString::fromUtf8("mSpkACheckBox"));
|
mSpkACheckBox->setObjectName(QString::fromUtf8("mSpkACheckBox"));
|
||||||
mSpkACheckBox->setGeometry(QRect(570, 160, 70, 17));
|
mSpkACheckBox->setGeometry(QRect(50, 110, 70, 17));
|
||||||
|
mZone2StatusLabel = new QLabel(CAvReceiverGui);
|
||||||
|
mZone2StatusLabel->setObjectName(QString::fromUtf8("mZone2StatusLabel"));
|
||||||
|
mZone2StatusLabel->setGeometry(QRect(370, 140, 171, 191));
|
||||||
|
MainZoneSceneBox = new QGroupBox(CAvReceiverGui);
|
||||||
|
MainZoneSceneBox->setObjectName(QString::fromUtf8("MainZoneSceneBox"));
|
||||||
|
MainZoneSceneBox->setGeometry(QRect(40, 320, 101, 81));
|
||||||
|
MainZoneScene1Btn = new QPushButton(MainZoneSceneBox);
|
||||||
|
MainZoneScene1Btn->setObjectName(QString::fromUtf8("MainZoneScene1Btn"));
|
||||||
|
MainZoneScene1Btn->setGeometry(QRect(10, 20, 31, 22));
|
||||||
|
MainZoneScene2Btn = new QPushButton(MainZoneSceneBox);
|
||||||
|
MainZoneScene2Btn->setObjectName(QString::fromUtf8("MainZoneScene2Btn"));
|
||||||
|
MainZoneScene2Btn->setGeometry(QRect(50, 20, 31, 22));
|
||||||
|
MainZoneScene3Btn = new QPushButton(MainZoneSceneBox);
|
||||||
|
MainZoneScene3Btn->setObjectName(QString::fromUtf8("MainZoneScene3Btn"));
|
||||||
|
MainZoneScene3Btn->setGeometry(QRect(10, 50, 31, 22));
|
||||||
|
MainZoneScene4Btn = new QPushButton(MainZoneSceneBox);
|
||||||
|
MainZoneScene4Btn->setObjectName(QString::fromUtf8("MainZoneScene4Btn"));
|
||||||
|
MainZoneScene4Btn->setGeometry(QRect(50, 50, 31, 22));
|
||||||
|
mMainZoneVolumeSldBar = new QSlider(CAvReceiverGui);
|
||||||
|
mMainZoneVolumeSldBar->setObjectName(QString::fromUtf8("mMainZoneVolumeSldBar"));
|
||||||
|
mMainZoneVolumeSldBar->setGeometry(QRect(190, 120, 21, 160));
|
||||||
|
mMainZoneVolumeSldBar->setMinimum(0);
|
||||||
|
mMainZoneVolumeSldBar->setMaximum(194);
|
||||||
|
mMainZoneVolumeSldBar->setSingleStep(1);
|
||||||
|
mMainZoneVolumeSldBar->setOrientation(Qt::Vertical);
|
||||||
|
mZone2VolumeSldBar = new QSlider(CAvReceiverGui);
|
||||||
|
mZone2VolumeSldBar->setObjectName(QString::fromUtf8("mZone2VolumeSldBar"));
|
||||||
|
mZone2VolumeSldBar->setGeometry(QRect(500, 119, 20, 151));
|
||||||
|
mZone2VolumeSldBar->setMaximum(182);
|
||||||
|
mZone2VolumeSldBar->setOrientation(Qt::Vertical);
|
||||||
|
mMainZoneSliderValueLbl = new QLabel(CAvReceiverGui);
|
||||||
|
mMainZoneSliderValueLbl->setObjectName(QString::fromUtf8("mMainZoneSliderValueLbl"));
|
||||||
|
mMainZoneSliderValueLbl->setGeometry(QRect(180, 100, 47, 14));
|
||||||
|
mMainZoneSliderValueLbl->setAlignment(Qt::AlignCenter);
|
||||||
|
mZone2SliderValueLbl = new QLabel(CAvReceiverGui);
|
||||||
|
mZone2SliderValueLbl->setObjectName(QString::fromUtf8("mZone2SliderValueLbl"));
|
||||||
|
mZone2SliderValueLbl->setGeometry(QRect(490, 100, 51, 16));
|
||||||
|
mZone2SliderValueLbl->setAlignment(Qt::AlignCenter);
|
||||||
|
mZone2InputComboBx = new QComboBox(CAvReceiverGui);
|
||||||
|
mZone2InputComboBx->setObjectName(QString::fromUtf8("mZone2InputComboBx"));
|
||||||
|
mZone2InputComboBx->setGeometry(QRect(580, 180, 121, 21));
|
||||||
|
mZone2SyncVolumeChkBx = new QCheckBox(CAvReceiverGui);
|
||||||
|
mZone2SyncVolumeChkBx->setObjectName(QString::fromUtf8("mZone2SyncVolumeChkBx"));
|
||||||
|
mZone2SyncVolumeChkBx->setGeometry(QRect(590, 120, 171, 17));
|
||||||
|
|
||||||
retranslateUi(CAvReceiverGui);
|
retranslateUi(CAvReceiverGui);
|
||||||
|
|
||||||
@ -53,8 +113,17 @@ public:
|
|||||||
CAvReceiverGui->setWindowTitle(QCoreApplication::translate("CAvReceiverGui", "Form", nullptr));
|
CAvReceiverGui->setWindowTitle(QCoreApplication::translate("CAvReceiverGui", "Form", nullptr));
|
||||||
label->setText(QCoreApplication::translate("CAvReceiverGui", "AvReceiver", nullptr));
|
label->setText(QCoreApplication::translate("CAvReceiverGui", "AvReceiver", nullptr));
|
||||||
mRcvrStatusLabel->setText(QCoreApplication::translate("CAvReceiverGui", "TextLabel", nullptr));
|
mRcvrStatusLabel->setText(QCoreApplication::translate("CAvReceiverGui", "TextLabel", nullptr));
|
||||||
mSpkBCheckBox->setText(QCoreApplication::translate("CAvReceiverGui", "Speaker B", nullptr));
|
mSpkBCheckBox->setText(QCoreApplication::translate("CAvReceiverGui", "Zone 2", nullptr));
|
||||||
mSpkACheckBox->setText(QCoreApplication::translate("CAvReceiverGui", "Speaker A", nullptr));
|
mSpkACheckBox->setText(QCoreApplication::translate("CAvReceiverGui", "Main Zone", nullptr));
|
||||||
|
mZone2StatusLabel->setText(QCoreApplication::translate("CAvReceiverGui", "TextLabel", nullptr));
|
||||||
|
MainZoneSceneBox->setTitle(QCoreApplication::translate("CAvReceiverGui", "Scene", nullptr));
|
||||||
|
MainZoneScene1Btn->setText(QCoreApplication::translate("CAvReceiverGui", "1", nullptr));
|
||||||
|
MainZoneScene2Btn->setText(QCoreApplication::translate("CAvReceiverGui", "2", nullptr));
|
||||||
|
MainZoneScene3Btn->setText(QCoreApplication::translate("CAvReceiverGui", "3", nullptr));
|
||||||
|
MainZoneScene4Btn->setText(QCoreApplication::translate("CAvReceiverGui", "4", nullptr));
|
||||||
|
mMainZoneSliderValueLbl->setText(QCoreApplication::translate("CAvReceiverGui", "TextLabel", nullptr));
|
||||||
|
mZone2SliderValueLbl->setText(QCoreApplication::translate("CAvReceiverGui", "TextLabel", nullptr));
|
||||||
|
mZone2SyncVolumeChkBx->setText(QCoreApplication::translate("CAvReceiverGui", "Sync volume with Main zone", nullptr));
|
||||||
} // retranslateUi
|
} // retranslateUi
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
261
ui_ChaletGui.h
261
ui_ChaletGui.h
@ -11,12 +11,15 @@
|
|||||||
|
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
|
#include <QtWidgets/QButtonGroup>
|
||||||
#include <QtWidgets/QCheckBox>
|
#include <QtWidgets/QCheckBox>
|
||||||
#include <QtWidgets/QDateEdit>
|
#include <QtWidgets/QDateEdit>
|
||||||
#include <QtWidgets/QGroupBox>
|
#include <QtWidgets/QGroupBox>
|
||||||
#include <QtWidgets/QLCDNumber>
|
|
||||||
#include <QtWidgets/QLabel>
|
#include <QtWidgets/QLabel>
|
||||||
|
#include <QtWidgets/QLineEdit>
|
||||||
#include <QtWidgets/QPushButton>
|
#include <QtWidgets/QPushButton>
|
||||||
|
#include <QtWidgets/QRadioButton>
|
||||||
|
#include <QtWidgets/QSpinBox>
|
||||||
#include <QtWidgets/QWidget>
|
#include <QtWidgets/QWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@ -44,17 +47,51 @@ public:
|
|||||||
QLabel *mCurrentSensorStateLbl;
|
QLabel *mCurrentSensorStateLbl;
|
||||||
QLabel *mLostReqPercentLbl;
|
QLabel *mLostReqPercentLbl;
|
||||||
QWidget *mPlotWidget;
|
QWidget *mPlotWidget;
|
||||||
QLCDNumber *mVoltageLCD;
|
|
||||||
QLabel *mChaletCommActivityLbl;
|
QLabel *mChaletCommActivityLbl;
|
||||||
QLabel *mLasCommRequestReceivedLbl;
|
QLabel *mLasCommRequestReceivedLbl;
|
||||||
QDateEdit *mLogStartDateEdit;
|
QDateEdit *mLogStartDateEdit;
|
||||||
QPushButton *mGetChaletLogButton;
|
QPushButton *mGetChaletLogButton;
|
||||||
|
QLabel *mChaletTemperatureLbl;
|
||||||
|
QGroupBox *WifiSettingGroupBox;
|
||||||
|
QLineEdit *mWifiAccessPtNameEditBx;
|
||||||
|
QLabel *mAccessPtNameLabel;
|
||||||
|
QLabel *mAccessPtPassLbl;
|
||||||
|
QLineEdit *mWifiPasswordEditBx;
|
||||||
|
QLabel *label;
|
||||||
|
QLineEdit *mWiFiIPAddressEditBx;
|
||||||
|
QLabel *label_2;
|
||||||
|
QLineEdit *mWiFiGatewayAddressEditBx;
|
||||||
|
QCheckBox *mDHCPEnableChkBx;
|
||||||
|
QPushButton *mWiFiGetRemoteSettingsBtn;
|
||||||
|
QPushButton *mWiFiSetRemoteSettingsBtn;
|
||||||
|
QRadioButton *mChaletWifiSelectionRadioBtn;
|
||||||
|
QRadioButton *mLoraIFWifiSelectionRadioBtn;
|
||||||
|
QLabel *mSolarPanelCurrentCnvLbl;
|
||||||
|
QLabel *mFirmwareVersionLabel;
|
||||||
|
QPushButton *mGetFirmwareVersionBtn;
|
||||||
|
QPushButton *mStartTerminalShellBtn;
|
||||||
|
QPushButton *mStartSyslogShellBtn;
|
||||||
|
QLabel *mTotalRxTxRequestsLbl;
|
||||||
|
QPushButton *mResetCommStatsBtn;
|
||||||
|
QLabel *mLostReqsStatsLbl;
|
||||||
|
QPushButton *mGetWifiStatusBtn;
|
||||||
|
QLabel *mModuleIPAddressLbl;
|
||||||
|
QGroupBox *mLoraIFGroupBox;
|
||||||
|
QLabel *mLoraIFModuleStatus;
|
||||||
|
QSpinBox *mLoraChannelSpinBox;
|
||||||
|
QSpinBox *mLoraAddressSpinBox;
|
||||||
|
QLabel *label_3;
|
||||||
|
QLabel *label_4;
|
||||||
|
QLabel *mLoraModuleCommActivityLbl;
|
||||||
|
QPushButton *mGetLoraWifiStatusBtn;
|
||||||
|
QLabel *mLoraModuleIPAddressLbl;
|
||||||
|
QButtonGroup *buttonGroup;
|
||||||
|
|
||||||
void setupUi(QWidget *CChaletGui)
|
void setupUi(QWidget *CChaletGui)
|
||||||
{
|
{
|
||||||
if (CChaletGui->objectName().isEmpty())
|
if (CChaletGui->objectName().isEmpty())
|
||||||
CChaletGui->setObjectName(QString::fromUtf8("CChaletGui"));
|
CChaletGui->setObjectName(QString::fromUtf8("CChaletGui"));
|
||||||
CChaletGui->resize(1205, 598);
|
CChaletGui->resize(1443, 662);
|
||||||
MainPageLabel = new QLabel(CChaletGui);
|
MainPageLabel = new QLabel(CChaletGui);
|
||||||
MainPageLabel->setObjectName(QString::fromUtf8("MainPageLabel"));
|
MainPageLabel->setObjectName(QString::fromUtf8("MainPageLabel"));
|
||||||
MainPageLabel->setGeometry(QRect(460, 10, 71, 31));
|
MainPageLabel->setGeometry(QRect(460, 10, 71, 31));
|
||||||
@ -65,44 +102,44 @@ public:
|
|||||||
MainPageLabel->setFont(font);
|
MainPageLabel->setFont(font);
|
||||||
mInverterRlyStatusLabel = new QLabel(CChaletGui);
|
mInverterRlyStatusLabel = new QLabel(CChaletGui);
|
||||||
mInverterRlyStatusLabel->setObjectName(QString::fromUtf8("mInverterRlyStatusLabel"));
|
mInverterRlyStatusLabel->setObjectName(QString::fromUtf8("mInverterRlyStatusLabel"));
|
||||||
mInverterRlyStatusLabel->setGeometry(QRect(198, 50, 210, 16));
|
mInverterRlyStatusLabel->setGeometry(QRect(238, 120, 210, 16));
|
||||||
mWiFiModuleStatusLabel = new QLabel(CChaletGui);
|
mWiFiModuleStatusLabel = new QLabel(CChaletGui);
|
||||||
mWiFiModuleStatusLabel->setObjectName(QString::fromUtf8("mWiFiModuleStatusLabel"));
|
mWiFiModuleStatusLabel->setObjectName(QString::fromUtf8("mWiFiModuleStatusLabel"));
|
||||||
mWiFiModuleStatusLabel->setGeometry(QRect(198, 90, 130, 16));
|
mWiFiModuleStatusLabel->setGeometry(QRect(238, 160, 130, 16));
|
||||||
mWiFiSectionLabel = new QLabel(CChaletGui);
|
mWiFiSectionLabel = new QLabel(CChaletGui);
|
||||||
mWiFiSectionLabel->setObjectName(QString::fromUtf8("mWiFiSectionLabel"));
|
mWiFiSectionLabel->setObjectName(QString::fromUtf8("mWiFiSectionLabel"));
|
||||||
mWiFiSectionLabel->setGeometry(QRect(26, 90, 31, 16));
|
mWiFiSectionLabel->setGeometry(QRect(66, 160, 31, 16));
|
||||||
mInverterRelayOFFBtn = new QPushButton(CChaletGui);
|
mInverterRelayOFFBtn = new QPushButton(CChaletGui);
|
||||||
mInverterRelayOFFBtn->setObjectName(QString::fromUtf8("mInverterRelayOFFBtn"));
|
mInverterRelayOFFBtn->setObjectName(QString::fromUtf8("mInverterRelayOFFBtn"));
|
||||||
mInverterRelayOFFBtn->setGeometry(QRect(126, 50, 61, 22));
|
mInverterRelayOFFBtn->setGeometry(QRect(166, 120, 61, 22));
|
||||||
mWiFiModuleOFFBtn = new QPushButton(CChaletGui);
|
mWiFiModuleOFFBtn = new QPushButton(CChaletGui);
|
||||||
mWiFiModuleOFFBtn->setObjectName(QString::fromUtf8("mWiFiModuleOFFBtn"));
|
mWiFiModuleOFFBtn->setObjectName(QString::fromUtf8("mWiFiModuleOFFBtn"));
|
||||||
mWiFiModuleOFFBtn->setGeometry(QRect(126, 90, 61, 23));
|
mWiFiModuleOFFBtn->setGeometry(QRect(166, 160, 61, 23));
|
||||||
mInverterRelayONBtn = new QPushButton(CChaletGui);
|
mInverterRelayONBtn = new QPushButton(CChaletGui);
|
||||||
mInverterRelayONBtn->setObjectName(QString::fromUtf8("mInverterRelayONBtn"));
|
mInverterRelayONBtn->setObjectName(QString::fromUtf8("mInverterRelayONBtn"));
|
||||||
mInverterRelayONBtn->setGeometry(QRect(70, 50, 51, 23));
|
mInverterRelayONBtn->setGeometry(QRect(110, 120, 51, 23));
|
||||||
mWiFiModuleONBtn = new QPushButton(CChaletGui);
|
mWiFiModuleONBtn = new QPushButton(CChaletGui);
|
||||||
mWiFiModuleONBtn->setObjectName(QString::fromUtf8("mWiFiModuleONBtn"));
|
mWiFiModuleONBtn->setObjectName(QString::fromUtf8("mWiFiModuleONBtn"));
|
||||||
mWiFiModuleONBtn->setGeometry(QRect(70, 90, 51, 23));
|
mWiFiModuleONBtn->setGeometry(QRect(110, 160, 51, 23));
|
||||||
mWiFiSectionLabel_2 = new QLabel(CChaletGui);
|
mWiFiSectionLabel_2 = new QLabel(CChaletGui);
|
||||||
mWiFiSectionLabel_2->setObjectName(QString::fromUtf8("mWiFiSectionLabel_2"));
|
mWiFiSectionLabel_2->setObjectName(QString::fromUtf8("mWiFiSectionLabel_2"));
|
||||||
mWiFiSectionLabel_2->setGeometry(QRect(16, 50, 51, 20));
|
mWiFiSectionLabel_2->setGeometry(QRect(56, 120, 51, 20));
|
||||||
mRebootCPUBtn = new QPushButton(CChaletGui);
|
mRebootCPUBtn = new QPushButton(CChaletGui);
|
||||||
mRebootCPUBtn->setObjectName(QString::fromUtf8("mRebootCPUBtn"));
|
mRebootCPUBtn->setObjectName(QString::fromUtf8("mRebootCPUBtn"));
|
||||||
mRebootCPUBtn->setGeometry(QRect(66, 130, 75, 23));
|
mRebootCPUBtn->setGeometry(QRect(106, 200, 75, 23));
|
||||||
mEnableHarakiriChkBx = new QCheckBox(CChaletGui);
|
mEnableHarakiriChkBx = new QCheckBox(CChaletGui);
|
||||||
mEnableHarakiriChkBx->setObjectName(QString::fromUtf8("mEnableHarakiriChkBx"));
|
mEnableHarakiriChkBx->setObjectName(QString::fromUtf8("mEnableHarakiriChkBx"));
|
||||||
mEnableHarakiriChkBx->setEnabled(false);
|
mEnableHarakiriChkBx->setEnabled(true);
|
||||||
mEnableHarakiriChkBx->setGeometry(QRect(850, 80, 111, 17));
|
mEnableHarakiriChkBx->setGeometry(QRect(680, 70, 111, 17));
|
||||||
groupBox = new QGroupBox(CChaletGui);
|
groupBox = new QGroupBox(CChaletGui);
|
||||||
groupBox->setObjectName(QString::fromUtf8("groupBox"));
|
groupBox->setObjectName(QString::fromUtf8("groupBox"));
|
||||||
groupBox->setGeometry(QRect(830, 50, 151, 81));
|
groupBox->setGeometry(QRect(660, 40, 151, 81));
|
||||||
mDoHarakiriButton = new QPushButton(groupBox);
|
mDoHarakiriButton = new QPushButton(groupBox);
|
||||||
mDoHarakiriButton->setObjectName(QString::fromUtf8("mDoHarakiriButton"));
|
mDoHarakiriButton->setObjectName(QString::fromUtf8("mDoHarakiriButton"));
|
||||||
mDoHarakiriButton->setGeometry(QRect(20, 50, 101, 23));
|
mDoHarakiriButton->setGeometry(QRect(20, 50, 101, 23));
|
||||||
mBatteryVoltageLabel = new QLabel(CChaletGui);
|
mBatteryVoltageLabel = new QLabel(CChaletGui);
|
||||||
mBatteryVoltageLabel->setObjectName(QString::fromUtf8("mBatteryVoltageLabel"));
|
mBatteryVoltageLabel->setObjectName(QString::fromUtf8("mBatteryVoltageLabel"));
|
||||||
mBatteryVoltageLabel->setGeometry(QRect(147, 170, 241, 16));
|
mBatteryVoltageLabel->setGeometry(QRect(187, 240, 241, 16));
|
||||||
mChaletOnlineStatusLbl = new QLabel(CChaletGui);
|
mChaletOnlineStatusLbl = new QLabel(CChaletGui);
|
||||||
mChaletOnlineStatusLbl->setObjectName(QString::fromUtf8("mChaletOnlineStatusLbl"));
|
mChaletOnlineStatusLbl->setObjectName(QString::fromUtf8("mChaletOnlineStatusLbl"));
|
||||||
mChaletOnlineStatusLbl->setGeometry(QRect(450, 50, 91, 21));
|
mChaletOnlineStatusLbl->setGeometry(QRect(450, 50, 91, 21));
|
||||||
@ -114,34 +151,153 @@ public:
|
|||||||
mChaletOnlineStatusLbl->setFont(font1);
|
mChaletOnlineStatusLbl->setFont(font1);
|
||||||
mSolarPanelCurrentLabel = new QLabel(CChaletGui);
|
mSolarPanelCurrentLabel = new QLabel(CChaletGui);
|
||||||
mSolarPanelCurrentLabel->setObjectName(QString::fromUtf8("mSolarPanelCurrentLabel"));
|
mSolarPanelCurrentLabel->setObjectName(QString::fromUtf8("mSolarPanelCurrentLabel"));
|
||||||
mSolarPanelCurrentLabel->setGeometry(QRect(147, 190, 241, 16));
|
mSolarPanelCurrentLabel->setGeometry(QRect(187, 260, 241, 16));
|
||||||
mBatterySOCLabel = new QLabel(CChaletGui);
|
mBatterySOCLabel = new QLabel(CChaletGui);
|
||||||
mBatterySOCLabel->setObjectName(QString::fromUtf8("mBatterySOCLabel"));
|
mBatterySOCLabel->setObjectName(QString::fromUtf8("mBatterySOCLabel"));
|
||||||
mBatterySOCLabel->setGeometry(QRect(147, 210, 241, 16));
|
mBatterySOCLabel->setGeometry(QRect(190, 300, 241, 16));
|
||||||
mCurrentSensorStateLbl = new QLabel(CChaletGui);
|
mCurrentSensorStateLbl = new QLabel(CChaletGui);
|
||||||
mCurrentSensorStateLbl->setObjectName(QString::fromUtf8("mCurrentSensorStateLbl"));
|
mCurrentSensorStateLbl->setObjectName(QString::fromUtf8("mCurrentSensorStateLbl"));
|
||||||
mCurrentSensorStateLbl->setGeometry(QRect(147, 230, 241, 16));
|
mCurrentSensorStateLbl->setGeometry(QRect(190, 320, 241, 16));
|
||||||
mLostReqPercentLbl = new QLabel(CChaletGui);
|
mLostReqPercentLbl = new QLabel(CChaletGui);
|
||||||
mLostReqPercentLbl->setObjectName(QString::fromUtf8("mLostReqPercentLbl"));
|
mLostReqPercentLbl->setObjectName(QString::fromUtf8("mLostReqPercentLbl"));
|
||||||
mLostReqPercentLbl->setGeometry(QRect(770, 200, 241, 16));
|
mLostReqPercentLbl->setGeometry(QRect(430, 160, 241, 16));
|
||||||
mPlotWidget = new QWidget(CChaletGui);
|
mPlotWidget = new QWidget(CChaletGui);
|
||||||
mPlotWidget->setObjectName(QString::fromUtf8("mPlotWidget"));
|
mPlotWidget->setObjectName(QString::fromUtf8("mPlotWidget"));
|
||||||
mPlotWidget->setGeometry(QRect(590, 250, 571, 321));
|
mPlotWidget->setGeometry(QRect(420, 260, 1021, 321));
|
||||||
mVoltageLCD = new QLCDNumber(CChaletGui);
|
|
||||||
mVoltageLCD->setObjectName(QString::fromUtf8("mVoltageLCD"));
|
|
||||||
mVoltageLCD->setGeometry(QRect(30, 170, 111, 23));
|
|
||||||
mChaletCommActivityLbl = new QLabel(CChaletGui);
|
mChaletCommActivityLbl = new QLabel(CChaletGui);
|
||||||
mChaletCommActivityLbl->setObjectName(QString::fromUtf8("mChaletCommActivityLbl"));
|
mChaletCommActivityLbl->setObjectName(QString::fromUtf8("mChaletCommActivityLbl"));
|
||||||
mChaletCommActivityLbl->setGeometry(QRect(770, 180, 47, 16));
|
mChaletCommActivityLbl->setGeometry(QRect(430, 140, 47, 16));
|
||||||
mLasCommRequestReceivedLbl = new QLabel(CChaletGui);
|
mLasCommRequestReceivedLbl = new QLabel(CChaletGui);
|
||||||
mLasCommRequestReceivedLbl->setObjectName(QString::fromUtf8("mLasCommRequestReceivedLbl"));
|
mLasCommRequestReceivedLbl->setObjectName(QString::fromUtf8("mLasCommRequestReceivedLbl"));
|
||||||
mLasCommRequestReceivedLbl->setGeometry(QRect(770, 160, 301, 16));
|
mLasCommRequestReceivedLbl->setGeometry(QRect(430, 120, 301, 16));
|
||||||
mLogStartDateEdit = new QDateEdit(CChaletGui);
|
mLogStartDateEdit = new QDateEdit(CChaletGui);
|
||||||
mLogStartDateEdit->setObjectName(QString::fromUtf8("mLogStartDateEdit"));
|
mLogStartDateEdit->setObjectName(QString::fromUtf8("mLogStartDateEdit"));
|
||||||
mLogStartDateEdit->setGeometry(QRect(950, 220, 110, 22));
|
mLogStartDateEdit->setGeometry(QRect(520, 210, 110, 22));
|
||||||
mGetChaletLogButton = new QPushButton(CChaletGui);
|
mGetChaletLogButton = new QPushButton(CChaletGui);
|
||||||
mGetChaletLogButton->setObjectName(QString::fromUtf8("mGetChaletLogButton"));
|
mGetChaletLogButton->setObjectName(QString::fromUtf8("mGetChaletLogButton"));
|
||||||
mGetChaletLogButton->setGeometry(QRect(1070, 220, 75, 23));
|
mGetChaletLogButton->setGeometry(QRect(640, 210, 75, 23));
|
||||||
|
mChaletTemperatureLbl = new QLabel(CChaletGui);
|
||||||
|
mChaletTemperatureLbl->setObjectName(QString::fromUtf8("mChaletTemperatureLbl"));
|
||||||
|
mChaletTemperatureLbl->setGeometry(QRect(190, 340, 241, 16));
|
||||||
|
WifiSettingGroupBox = new QGroupBox(CChaletGui);
|
||||||
|
WifiSettingGroupBox->setObjectName(QString::fromUtf8("WifiSettingGroupBox"));
|
||||||
|
WifiSettingGroupBox->setGeometry(QRect(60, 380, 321, 251));
|
||||||
|
mWifiAccessPtNameEditBx = new QLineEdit(WifiSettingGroupBox);
|
||||||
|
mWifiAccessPtNameEditBx->setObjectName(QString::fromUtf8("mWifiAccessPtNameEditBx"));
|
||||||
|
mWifiAccessPtNameEditBx->setGeometry(QRect(80, 150, 221, 20));
|
||||||
|
mWifiAccessPtNameEditBx->setAlignment(Qt::AlignCenter);
|
||||||
|
mAccessPtNameLabel = new QLabel(WifiSettingGroupBox);
|
||||||
|
mAccessPtNameLabel->setObjectName(QString::fromUtf8("mAccessPtNameLabel"));
|
||||||
|
mAccessPtNameLabel->setGeometry(QRect(10, 150, 71, 20));
|
||||||
|
QFont font2;
|
||||||
|
font2.setPointSize(10);
|
||||||
|
mAccessPtNameLabel->setFont(font2);
|
||||||
|
mAccessPtPassLbl = new QLabel(WifiSettingGroupBox);
|
||||||
|
mAccessPtPassLbl->setObjectName(QString::fromUtf8("mAccessPtPassLbl"));
|
||||||
|
mAccessPtPassLbl->setGeometry(QRect(10, 180, 71, 20));
|
||||||
|
mAccessPtPassLbl->setFont(font2);
|
||||||
|
mWifiPasswordEditBx = new QLineEdit(WifiSettingGroupBox);
|
||||||
|
mWifiPasswordEditBx->setObjectName(QString::fromUtf8("mWifiPasswordEditBx"));
|
||||||
|
mWifiPasswordEditBx->setGeometry(QRect(80, 180, 221, 20));
|
||||||
|
mWifiPasswordEditBx->setAlignment(Qt::AlignCenter);
|
||||||
|
label = new QLabel(WifiSettingGroupBox);
|
||||||
|
label->setObjectName(QString::fromUtf8("label"));
|
||||||
|
label->setGeometry(QRect(10, 90, 71, 20));
|
||||||
|
label->setFont(font2);
|
||||||
|
mWiFiIPAddressEditBx = new QLineEdit(WifiSettingGroupBox);
|
||||||
|
mWiFiIPAddressEditBx->setObjectName(QString::fromUtf8("mWiFiIPAddressEditBx"));
|
||||||
|
mWiFiIPAddressEditBx->setGeometry(QRect(80, 90, 221, 20));
|
||||||
|
mWiFiIPAddressEditBx->setAlignment(Qt::AlignCenter);
|
||||||
|
label_2 = new QLabel(WifiSettingGroupBox);
|
||||||
|
label_2->setObjectName(QString::fromUtf8("label_2"));
|
||||||
|
label_2->setGeometry(QRect(10, 120, 71, 20));
|
||||||
|
label_2->setFont(font2);
|
||||||
|
mWiFiGatewayAddressEditBx = new QLineEdit(WifiSettingGroupBox);
|
||||||
|
mWiFiGatewayAddressEditBx->setObjectName(QString::fromUtf8("mWiFiGatewayAddressEditBx"));
|
||||||
|
mWiFiGatewayAddressEditBx->setGeometry(QRect(80, 120, 221, 20));
|
||||||
|
mWiFiGatewayAddressEditBx->setAlignment(Qt::AlignCenter);
|
||||||
|
mDHCPEnableChkBx = new QCheckBox(WifiSettingGroupBox);
|
||||||
|
mDHCPEnableChkBx->setObjectName(QString::fromUtf8("mDHCPEnableChkBx"));
|
||||||
|
mDHCPEnableChkBx->setGeometry(QRect(20, 60, 70, 17));
|
||||||
|
mWiFiGetRemoteSettingsBtn = new QPushButton(WifiSettingGroupBox);
|
||||||
|
mWiFiGetRemoteSettingsBtn->setObjectName(QString::fromUtf8("mWiFiGetRemoteSettingsBtn"));
|
||||||
|
mWiFiGetRemoteSettingsBtn->setGeometry(QRect(70, 220, 75, 23));
|
||||||
|
mWiFiSetRemoteSettingsBtn = new QPushButton(WifiSettingGroupBox);
|
||||||
|
mWiFiSetRemoteSettingsBtn->setObjectName(QString::fromUtf8("mWiFiSetRemoteSettingsBtn"));
|
||||||
|
mWiFiSetRemoteSettingsBtn->setGeometry(QRect(170, 220, 75, 23));
|
||||||
|
mChaletWifiSelectionRadioBtn = new QRadioButton(WifiSettingGroupBox);
|
||||||
|
buttonGroup = new QButtonGroup(CChaletGui);
|
||||||
|
buttonGroup->setObjectName(QString::fromUtf8("buttonGroup"));
|
||||||
|
buttonGroup->addButton(mChaletWifiSelectionRadioBtn);
|
||||||
|
mChaletWifiSelectionRadioBtn->setObjectName(QString::fromUtf8("mChaletWifiSelectionRadioBtn"));
|
||||||
|
mChaletWifiSelectionRadioBtn->setGeometry(QRect(40, 20, 85, 20));
|
||||||
|
mLoraIFWifiSelectionRadioBtn = new QRadioButton(WifiSettingGroupBox);
|
||||||
|
buttonGroup->addButton(mLoraIFWifiSelectionRadioBtn);
|
||||||
|
mLoraIFWifiSelectionRadioBtn->setObjectName(QString::fromUtf8("mLoraIFWifiSelectionRadioBtn"));
|
||||||
|
mLoraIFWifiSelectionRadioBtn->setGeometry(QRect(140, 20, 101, 20));
|
||||||
|
mSolarPanelCurrentCnvLbl = new QLabel(CChaletGui);
|
||||||
|
mSolarPanelCurrentCnvLbl->setObjectName(QString::fromUtf8("mSolarPanelCurrentCnvLbl"));
|
||||||
|
mSolarPanelCurrentCnvLbl->setGeometry(QRect(190, 280, 201, 16));
|
||||||
|
mFirmwareVersionLabel = new QLabel(CChaletGui);
|
||||||
|
mFirmwareVersionLabel->setObjectName(QString::fromUtf8("mFirmwareVersionLabel"));
|
||||||
|
mFirmwareVersionLabel->setGeometry(QRect(510, 590, 231, 20));
|
||||||
|
mFirmwareVersionLabel->setFont(font2);
|
||||||
|
mGetFirmwareVersionBtn = new QPushButton(CChaletGui);
|
||||||
|
mGetFirmwareVersionBtn->setObjectName(QString::fromUtf8("mGetFirmwareVersionBtn"));
|
||||||
|
mGetFirmwareVersionBtn->setGeometry(QRect(420, 590, 75, 23));
|
||||||
|
mStartTerminalShellBtn = new QPushButton(CChaletGui);
|
||||||
|
mStartTerminalShellBtn->setObjectName(QString::fromUtf8("mStartTerminalShellBtn"));
|
||||||
|
mStartTerminalShellBtn->setGeometry(QRect(420, 620, 75, 23));
|
||||||
|
mStartSyslogShellBtn = new QPushButton(CChaletGui);
|
||||||
|
mStartSyslogShellBtn->setObjectName(QString::fromUtf8("mStartSyslogShellBtn"));
|
||||||
|
mStartSyslogShellBtn->setGeometry(QRect(510, 620, 75, 23));
|
||||||
|
mTotalRxTxRequestsLbl = new QLabel(CChaletGui);
|
||||||
|
mTotalRxTxRequestsLbl->setObjectName(QString::fromUtf8("mTotalRxTxRequestsLbl"));
|
||||||
|
mTotalRxTxRequestsLbl->setGeometry(QRect(430, 180, 521, 16));
|
||||||
|
mResetCommStatsBtn = new QPushButton(CChaletGui);
|
||||||
|
mResetCommStatsBtn->setObjectName(QString::fromUtf8("mResetCommStatsBtn"));
|
||||||
|
mResetCommStatsBtn->setGeometry(QRect(420, 100, 101, 23));
|
||||||
|
mLostReqsStatsLbl = new QLabel(CChaletGui);
|
||||||
|
mLostReqsStatsLbl->setObjectName(QString::fromUtf8("mLostReqsStatsLbl"));
|
||||||
|
mLostReqsStatsLbl->setGeometry(QRect(700, 140, 241, 41));
|
||||||
|
mGetWifiStatusBtn = new QPushButton(CChaletGui);
|
||||||
|
mGetWifiStatusBtn->setObjectName(QString::fromUtf8("mGetWifiStatusBtn"));
|
||||||
|
mGetWifiStatusBtn->setGeometry(QRect(820, 590, 61, 23));
|
||||||
|
mModuleIPAddressLbl = new QLabel(CChaletGui);
|
||||||
|
mModuleIPAddressLbl->setObjectName(QString::fromUtf8("mModuleIPAddressLbl"));
|
||||||
|
mModuleIPAddressLbl->setGeometry(QRect(890, 590, 341, 16));
|
||||||
|
mModuleIPAddressLbl->setFont(font2);
|
||||||
|
mLoraIFGroupBox = new QGroupBox(CChaletGui);
|
||||||
|
mLoraIFGroupBox->setObjectName(QString::fromUtf8("mLoraIFGroupBox"));
|
||||||
|
mLoraIFGroupBox->setGeometry(QRect(890, 20, 541, 201));
|
||||||
|
mLoraIFModuleStatus = new QLabel(mLoraIFGroupBox);
|
||||||
|
mLoraIFModuleStatus->setObjectName(QString::fromUtf8("mLoraIFModuleStatus"));
|
||||||
|
mLoraIFModuleStatus->setGeometry(QRect(10, 20, 231, 141));
|
||||||
|
mLoraChannelSpinBox = new QSpinBox(mLoraIFGroupBox);
|
||||||
|
mLoraChannelSpinBox->setObjectName(QString::fromUtf8("mLoraChannelSpinBox"));
|
||||||
|
mLoraChannelSpinBox->setGeometry(QRect(470, 30, 51, 22));
|
||||||
|
mLoraAddressSpinBox = new QSpinBox(mLoraIFGroupBox);
|
||||||
|
mLoraAddressSpinBox->setObjectName(QString::fromUtf8("mLoraAddressSpinBox"));
|
||||||
|
mLoraAddressSpinBox->setGeometry(QRect(470, 50, 51, 22));
|
||||||
|
label_3 = new QLabel(mLoraIFGroupBox);
|
||||||
|
label_3->setObjectName(QString::fromUtf8("label_3"));
|
||||||
|
label_3->setGeometry(QRect(378, 30, 81, 20));
|
||||||
|
label_3->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||||
|
label_4 = new QLabel(mLoraIFGroupBox);
|
||||||
|
label_4->setObjectName(QString::fromUtf8("label_4"));
|
||||||
|
label_4->setGeometry(QRect(380, 51, 81, 20));
|
||||||
|
label_4->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||||
|
mLoraModuleCommActivityLbl = new QLabel(mLoraIFGroupBox);
|
||||||
|
mLoraModuleCommActivityLbl->setObjectName(QString::fromUtf8("mLoraModuleCommActivityLbl"));
|
||||||
|
mLoraModuleCommActivityLbl->setGeometry(QRect(390, 80, 47, 16));
|
||||||
|
mGetLoraWifiStatusBtn = new QPushButton(mLoraIFGroupBox);
|
||||||
|
mGetLoraWifiStatusBtn->setObjectName(QString::fromUtf8("mGetLoraWifiStatusBtn"));
|
||||||
|
mGetLoraWifiStatusBtn->setGeometry(QRect(170, 130, 61, 20));
|
||||||
|
mLoraModuleIPAddressLbl = new QLabel(mLoraIFGroupBox);
|
||||||
|
mLoraModuleIPAddressLbl->setObjectName(QString::fromUtf8("mLoraModuleIPAddressLbl"));
|
||||||
|
mLoraModuleIPAddressLbl->setGeometry(QRect(240, 130, 291, 16));
|
||||||
|
mLoraModuleIPAddressLbl->setFont(font2);
|
||||||
|
WifiSettingGroupBox->raise();
|
||||||
groupBox->raise();
|
groupBox->raise();
|
||||||
MainPageLabel->raise();
|
MainPageLabel->raise();
|
||||||
mInverterRlyStatusLabel->raise();
|
mInverterRlyStatusLabel->raise();
|
||||||
@ -161,11 +317,22 @@ public:
|
|||||||
mCurrentSensorStateLbl->raise();
|
mCurrentSensorStateLbl->raise();
|
||||||
mLostReqPercentLbl->raise();
|
mLostReqPercentLbl->raise();
|
||||||
mPlotWidget->raise();
|
mPlotWidget->raise();
|
||||||
mVoltageLCD->raise();
|
|
||||||
mChaletCommActivityLbl->raise();
|
mChaletCommActivityLbl->raise();
|
||||||
mLasCommRequestReceivedLbl->raise();
|
mLasCommRequestReceivedLbl->raise();
|
||||||
mLogStartDateEdit->raise();
|
mLogStartDateEdit->raise();
|
||||||
mGetChaletLogButton->raise();
|
mGetChaletLogButton->raise();
|
||||||
|
mChaletTemperatureLbl->raise();
|
||||||
|
mSolarPanelCurrentCnvLbl->raise();
|
||||||
|
mFirmwareVersionLabel->raise();
|
||||||
|
mGetFirmwareVersionBtn->raise();
|
||||||
|
mStartTerminalShellBtn->raise();
|
||||||
|
mStartSyslogShellBtn->raise();
|
||||||
|
mTotalRxTxRequestsLbl->raise();
|
||||||
|
mResetCommStatsBtn->raise();
|
||||||
|
mLostReqsStatsLbl->raise();
|
||||||
|
mGetWifiStatusBtn->raise();
|
||||||
|
mModuleIPAddressLbl->raise();
|
||||||
|
mLoraIFGroupBox->raise();
|
||||||
|
|
||||||
retranslateUi(CChaletGui);
|
retranslateUi(CChaletGui);
|
||||||
|
|
||||||
@ -190,13 +357,47 @@ public:
|
|||||||
mDoHarakiriButton->setText(QCoreApplication::translate("CChaletGui", "DO HARAKIRI !!!", nullptr));
|
mDoHarakiriButton->setText(QCoreApplication::translate("CChaletGui", "DO HARAKIRI !!!", nullptr));
|
||||||
mBatteryVoltageLabel->setText(QCoreApplication::translate("CChaletGui", "Battery Voltage", nullptr));
|
mBatteryVoltageLabel->setText(QCoreApplication::translate("CChaletGui", "Battery Voltage", nullptr));
|
||||||
mChaletOnlineStatusLbl->setText(QCoreApplication::translate("CChaletGui", "OFFLINE", nullptr));
|
mChaletOnlineStatusLbl->setText(QCoreApplication::translate("CChaletGui", "OFFLINE", nullptr));
|
||||||
mSolarPanelCurrentLabel->setText(QCoreApplication::translate("CChaletGui", "Solar Panel Current: ", nullptr));
|
mSolarPanelCurrentLabel->setText(QCoreApplication::translate("CChaletGui", "Raw Solar Panel Current: ", nullptr));
|
||||||
mBatterySOCLabel->setText(QCoreApplication::translate("CChaletGui", "Battery SOC: ", nullptr));
|
mBatterySOCLabel->setText(QCoreApplication::translate("CChaletGui", "Battery SOC: ", nullptr));
|
||||||
mCurrentSensorStateLbl->setText(QCoreApplication::translate("CChaletGui", "Current Sensor:", nullptr));
|
mCurrentSensorStateLbl->setText(QCoreApplication::translate("CChaletGui", "Current Sensor:", nullptr));
|
||||||
mLostReqPercentLbl->setText(QCoreApplication::translate("CChaletGui", "Lost requests: ", nullptr));
|
mLostReqPercentLbl->setText(QCoreApplication::translate("CChaletGui", "Lost requests: ", nullptr));
|
||||||
mChaletCommActivityLbl->setText(QCoreApplication::translate("CChaletGui", "Activity!!!", nullptr));
|
mChaletCommActivityLbl->setText(QCoreApplication::translate("CChaletGui", "Activity!!!", nullptr));
|
||||||
mLasCommRequestReceivedLbl->setText(QCoreApplication::translate("CChaletGui", "Last Request: ", nullptr));
|
mLasCommRequestReceivedLbl->setText(QCoreApplication::translate("CChaletGui", "Last Request: ", nullptr));
|
||||||
mGetChaletLogButton->setText(QCoreApplication::translate("CChaletGui", "PushButton", nullptr));
|
mGetChaletLogButton->setText(QCoreApplication::translate("CChaletGui", "PushButton", nullptr));
|
||||||
|
mChaletTemperatureLbl->setText(QCoreApplication::translate("CChaletGui", "Temperature:", nullptr));
|
||||||
|
WifiSettingGroupBox->setTitle(QCoreApplication::translate("CChaletGui", "Wifi parameters stored in flash", nullptr));
|
||||||
|
mWifiAccessPtNameEditBx->setText(QCoreApplication::translate("CChaletGui", "?", nullptr));
|
||||||
|
mAccessPtNameLabel->setText(QCoreApplication::translate("CChaletGui", "Access Pt:", nullptr));
|
||||||
|
mAccessPtPassLbl->setText(QCoreApplication::translate("CChaletGui", "Password:", nullptr));
|
||||||
|
mWifiPasswordEditBx->setText(QCoreApplication::translate("CChaletGui", "?", nullptr));
|
||||||
|
label->setText(QCoreApplication::translate("CChaletGui", "IP Address:", nullptr));
|
||||||
|
mWiFiIPAddressEditBx->setText(QCoreApplication::translate("CChaletGui", "?", nullptr));
|
||||||
|
label_2->setText(QCoreApplication::translate("CChaletGui", "Gatweway:", nullptr));
|
||||||
|
mWiFiGatewayAddressEditBx->setText(QCoreApplication::translate("CChaletGui", "?", nullptr));
|
||||||
|
mDHCPEnableChkBx->setText(QCoreApplication::translate("CChaletGui", "DHCP", nullptr));
|
||||||
|
mWiFiGetRemoteSettingsBtn->setText(QCoreApplication::translate("CChaletGui", "GET", nullptr));
|
||||||
|
mWiFiSetRemoteSettingsBtn->setText(QCoreApplication::translate("CChaletGui", "SET", nullptr));
|
||||||
|
mChaletWifiSelectionRadioBtn->setText(QCoreApplication::translate("CChaletGui", "Chalet", nullptr));
|
||||||
|
mLoraIFWifiSelectionRadioBtn->setText(QCoreApplication::translate("CChaletGui", "Lora Module IF", nullptr));
|
||||||
|
mSolarPanelCurrentCnvLbl->setText(QCoreApplication::translate("CChaletGui", "Solar Panel Current (A):", nullptr));
|
||||||
|
mFirmwareVersionLabel->setText(QCoreApplication::translate("CChaletGui", "Firmware Version: ?", nullptr));
|
||||||
|
mGetFirmwareVersionBtn->setText(QCoreApplication::translate("CChaletGui", "GET", nullptr));
|
||||||
|
mStartTerminalShellBtn->setText(QCoreApplication::translate("CChaletGui", "Terminal", nullptr));
|
||||||
|
mStartSyslogShellBtn->setText(QCoreApplication::translate("CChaletGui", "Syslog", nullptr));
|
||||||
|
mTotalRxTxRequestsLbl->setText(QCoreApplication::translate("CChaletGui", "Chalet Rx Req :", nullptr));
|
||||||
|
mResetCommStatsBtn->setText(QCoreApplication::translate("CChaletGui", "Reset Comm Stats", nullptr));
|
||||||
|
mLostReqsStatsLbl->setText(QCoreApplication::translate("CChaletGui", "Master --> Chalet: ??\n"
|
||||||
|
"Chalet --> Master: ??", nullptr));
|
||||||
|
mGetWifiStatusBtn->setText(QCoreApplication::translate("CChaletGui", "GET", nullptr));
|
||||||
|
mModuleIPAddressLbl->setText(QCoreApplication::translate("CChaletGui", "Module IP Address:", nullptr));
|
||||||
|
mLoraIFGroupBox->setTitle(QCoreApplication::translate("CChaletGui", "Lora module Interface", nullptr));
|
||||||
|
mLoraIFModuleStatus->setText(QCoreApplication::translate("CChaletGui", "Module Type: ???\n"
|
||||||
|
"Module state: ??", nullptr));
|
||||||
|
label_3->setText(QCoreApplication::translate("CChaletGui", "Module Channel", nullptr));
|
||||||
|
label_4->setText(QCoreApplication::translate("CChaletGui", "Module Address", nullptr));
|
||||||
|
mLoraModuleCommActivityLbl->setText(QCoreApplication::translate("CChaletGui", "Activity!!!", nullptr));
|
||||||
|
mGetLoraWifiStatusBtn->setText(QCoreApplication::translate("CChaletGui", "GET", nullptr));
|
||||||
|
mLoraModuleIPAddressLbl->setText(QCoreApplication::translate("CChaletGui", "Module IP Address:", nullptr));
|
||||||
} // retranslateUi
|
} // retranslateUi
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
99
ui_IspindelGUI.h
Normal file
99
ui_IspindelGUI.h
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
** Form generated from reading UI file 'IspindelGUI.ui'
|
||||||
|
**
|
||||||
|
** Created by: Qt User Interface Compiler version 5.14.2
|
||||||
|
**
|
||||||
|
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
#ifndef UI_ISPINDELGUI_H
|
||||||
|
#define UI_ISPINDELGUI_H
|
||||||
|
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtWidgets/QApplication>
|
||||||
|
#include <QtWidgets/QDialog>
|
||||||
|
#include <QtWidgets/QHeaderView>
|
||||||
|
#include <QtWidgets/QLabel>
|
||||||
|
#include <QtWidgets/QPushButton>
|
||||||
|
#include <QtWidgets/QTableWidget>
|
||||||
|
#include <QtWidgets/QWidget>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class Ui_CIspindelGUI
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QLabel *label;
|
||||||
|
QWidget *mIspindelPlot;
|
||||||
|
QLabel *mLastFrameDataLbl;
|
||||||
|
QTableWidget *mSamplesTable;
|
||||||
|
QLabel *mABVLabel;
|
||||||
|
QPushButton *mSetOGBtn;
|
||||||
|
QPushButton *mDelSelectedSampleBtn;
|
||||||
|
|
||||||
|
void setupUi(QDialog *CIspindelGUI)
|
||||||
|
{
|
||||||
|
if (CIspindelGUI->objectName().isEmpty())
|
||||||
|
CIspindelGUI->setObjectName(QString::fromUtf8("CIspindelGUI"));
|
||||||
|
CIspindelGUI->resize(1123, 629);
|
||||||
|
label = new QLabel(CIspindelGUI);
|
||||||
|
label->setObjectName(QString::fromUtf8("label"));
|
||||||
|
label->setGeometry(QRect(520, 0, 91, 41));
|
||||||
|
QFont font;
|
||||||
|
font.setPointSize(12);
|
||||||
|
label->setFont(font);
|
||||||
|
mIspindelPlot = new QWidget(CIspindelGUI);
|
||||||
|
mIspindelPlot->setObjectName(QString::fromUtf8("mIspindelPlot"));
|
||||||
|
mIspindelPlot->setGeometry(QRect(520, 100, 661, 461));
|
||||||
|
mLastFrameDataLbl = new QLabel(CIspindelGUI);
|
||||||
|
mLastFrameDataLbl->setObjectName(QString::fromUtf8("mLastFrameDataLbl"));
|
||||||
|
mLastFrameDataLbl->setGeometry(QRect(60, 10, 381, 241));
|
||||||
|
QFont font1;
|
||||||
|
font1.setFamily(QString::fromUtf8("Tahoma"));
|
||||||
|
font1.setPointSize(11);
|
||||||
|
font1.setBold(true);
|
||||||
|
font1.setWeight(75);
|
||||||
|
mLastFrameDataLbl->setFont(font1);
|
||||||
|
mLastFrameDataLbl->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
|
||||||
|
mSamplesTable = new QTableWidget(CIspindelGUI);
|
||||||
|
mSamplesTable->setObjectName(QString::fromUtf8("mSamplesTable"));
|
||||||
|
mSamplesTable->setGeometry(QRect(10, 290, 461, 331));
|
||||||
|
mABVLabel = new QLabel(CIspindelGUI);
|
||||||
|
mABVLabel->setObjectName(QString::fromUtf8("mABVLabel"));
|
||||||
|
mABVLabel->setGeometry(QRect(660, 50, 231, 16));
|
||||||
|
QFont font2;
|
||||||
|
font2.setPointSize(12);
|
||||||
|
font2.setBold(true);
|
||||||
|
font2.setWeight(75);
|
||||||
|
mABVLabel->setFont(font2);
|
||||||
|
mSetOGBtn = new QPushButton(CIspindelGUI);
|
||||||
|
mSetOGBtn->setObjectName(QString::fromUtf8("mSetOGBtn"));
|
||||||
|
mSetOGBtn->setGeometry(QRect(650, 10, 75, 23));
|
||||||
|
mDelSelectedSampleBtn = new QPushButton(CIspindelGUI);
|
||||||
|
mDelSelectedSampleBtn->setObjectName(QString::fromUtf8("mDelSelectedSampleBtn"));
|
||||||
|
mDelSelectedSampleBtn->setGeometry(QRect(520, 590, 81, 23));
|
||||||
|
|
||||||
|
retranslateUi(CIspindelGUI);
|
||||||
|
|
||||||
|
QMetaObject::connectSlotsByName(CIspindelGUI);
|
||||||
|
} // setupUi
|
||||||
|
|
||||||
|
void retranslateUi(QDialog *CIspindelGUI)
|
||||||
|
{
|
||||||
|
CIspindelGUI->setWindowTitle(QCoreApplication::translate("CIspindelGUI", "Dialog", nullptr));
|
||||||
|
label->setText(QCoreApplication::translate("CIspindelGUI", "ISpindel", nullptr));
|
||||||
|
mLastFrameDataLbl->setText(QCoreApplication::translate("CIspindelGUI", "No data...", nullptr));
|
||||||
|
mABVLabel->setText(QCoreApplication::translate("CIspindelGUI", "ABV : ?", nullptr));
|
||||||
|
mSetOGBtn->setText(QCoreApplication::translate("CIspindelGUI", "Set OG", nullptr));
|
||||||
|
mDelSelectedSampleBtn->setText(QCoreApplication::translate("CIspindelGUI", "Delete Sample", nullptr));
|
||||||
|
} // retranslateUi
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CIspindelGUI: public Ui_CIspindelGUI {};
|
||||||
|
} // namespace Ui
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // UI_ISPINDELGUI_H
|
||||||
174
ui_PICUploaderGui.h
Normal file
174
ui_PICUploaderGui.h
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
** Form generated from reading UI file 'PICUploaderGui.ui'
|
||||||
|
**
|
||||||
|
** Created by: Qt User Interface Compiler version 5.14.2
|
||||||
|
**
|
||||||
|
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
#ifndef UI_PICUPLOADERGUI_H
|
||||||
|
#define UI_PICUPLOADERGUI_H
|
||||||
|
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtWidgets/QApplication>
|
||||||
|
#include <QtWidgets/QComboBox>
|
||||||
|
#include <QtWidgets/QDialog>
|
||||||
|
#include <QtWidgets/QLabel>
|
||||||
|
#include <QtWidgets/QLineEdit>
|
||||||
|
#include <QtWidgets/QPlainTextEdit>
|
||||||
|
#include <QtWidgets/QProgressBar>
|
||||||
|
#include <QtWidgets/QPushButton>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class Ui_CPICUploaderGui
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QLabel *label;
|
||||||
|
QPushButton *mHexFileSelectBtn;
|
||||||
|
QLineEdit *mIPAddressEdit;
|
||||||
|
QLabel *mOpenedHexFilePathLbl;
|
||||||
|
QLabel *mHexFileStatsLbl;
|
||||||
|
QPushButton *mConnectBtn;
|
||||||
|
QPushButton *mSendCmdBtn;
|
||||||
|
QComboBox *mCmdSelectCombo;
|
||||||
|
QPlainTextEdit *mLoggingWindowTextEdit;
|
||||||
|
QPushButton *mClearLogginWndwBtn;
|
||||||
|
QPushButton *mShowHexFileInfoBtn;
|
||||||
|
QLabel *mFilterParamsLbl;
|
||||||
|
QLineEdit *mFilterStartAddressTxtEdit;
|
||||||
|
QLineEdit *mFilterEndAddressTxtEdit;
|
||||||
|
QLabel *label_2;
|
||||||
|
QLabel *label_3;
|
||||||
|
QLabel *label_4;
|
||||||
|
QProgressBar *mUploadProgressBar;
|
||||||
|
|
||||||
|
void setupUi(QDialog *CPICUploaderGui)
|
||||||
|
{
|
||||||
|
if (CPICUploaderGui->objectName().isEmpty())
|
||||||
|
CPICUploaderGui->setObjectName(QString::fromUtf8("CPICUploaderGui"));
|
||||||
|
CPICUploaderGui->resize(1024, 768);
|
||||||
|
label = new QLabel(CPICUploaderGui);
|
||||||
|
label->setObjectName(QString::fromUtf8("label"));
|
||||||
|
label->setGeometry(QRect(260, 20, 191, 31));
|
||||||
|
QFont font;
|
||||||
|
font.setPointSize(14);
|
||||||
|
font.setBold(true);
|
||||||
|
font.setWeight(75);
|
||||||
|
label->setFont(font);
|
||||||
|
mHexFileSelectBtn = new QPushButton(CPICUploaderGui);
|
||||||
|
mHexFileSelectBtn->setObjectName(QString::fromUtf8("mHexFileSelectBtn"));
|
||||||
|
mHexFileSelectBtn->setGeometry(QRect(70, 110, 81, 23));
|
||||||
|
mIPAddressEdit = new QLineEdit(CPICUploaderGui);
|
||||||
|
mIPAddressEdit->setObjectName(QString::fromUtf8("mIPAddressEdit"));
|
||||||
|
mIPAddressEdit->setGeometry(QRect(690, 120, 181, 20));
|
||||||
|
mOpenedHexFilePathLbl = new QLabel(CPICUploaderGui);
|
||||||
|
mOpenedHexFilePathLbl->setObjectName(QString::fromUtf8("mOpenedHexFilePathLbl"));
|
||||||
|
mOpenedHexFilePathLbl->setGeometry(QRect(70, 140, 521, 16));
|
||||||
|
mHexFileStatsLbl = new QLabel(CPICUploaderGui);
|
||||||
|
mHexFileStatsLbl->setObjectName(QString::fromUtf8("mHexFileStatsLbl"));
|
||||||
|
mHexFileStatsLbl->setGeometry(QRect(70, 170, 471, 131));
|
||||||
|
mHexFileStatsLbl->setFrameShape(QFrame::Box);
|
||||||
|
mConnectBtn = new QPushButton(CPICUploaderGui);
|
||||||
|
mConnectBtn->setObjectName(QString::fromUtf8("mConnectBtn"));
|
||||||
|
mConnectBtn->setGeometry(QRect(890, 120, 75, 23));
|
||||||
|
mSendCmdBtn = new QPushButton(CPICUploaderGui);
|
||||||
|
mSendCmdBtn->setObjectName(QString::fromUtf8("mSendCmdBtn"));
|
||||||
|
mSendCmdBtn->setGeometry(QRect(890, 170, 75, 23));
|
||||||
|
mCmdSelectCombo = new QComboBox(CPICUploaderGui);
|
||||||
|
mCmdSelectCombo->addItem(QString());
|
||||||
|
mCmdSelectCombo->addItem(QString());
|
||||||
|
mCmdSelectCombo->addItem(QString());
|
||||||
|
mCmdSelectCombo->addItem(QString());
|
||||||
|
mCmdSelectCombo->addItem(QString());
|
||||||
|
mCmdSelectCombo->addItem(QString());
|
||||||
|
mCmdSelectCombo->addItem(QString());
|
||||||
|
mCmdSelectCombo->addItem(QString());
|
||||||
|
mCmdSelectCombo->addItem(QString());
|
||||||
|
mCmdSelectCombo->addItem(QString());
|
||||||
|
mCmdSelectCombo->setObjectName(QString::fromUtf8("mCmdSelectCombo"));
|
||||||
|
mCmdSelectCombo->setGeometry(QRect(710, 170, 151, 22));
|
||||||
|
mLoggingWindowTextEdit = new QPlainTextEdit(CPICUploaderGui);
|
||||||
|
mLoggingWindowTextEdit->setObjectName(QString::fromUtf8("mLoggingWindowTextEdit"));
|
||||||
|
mLoggingWindowTextEdit->setGeometry(QRect(10, 310, 651, 341));
|
||||||
|
mLoggingWindowTextEdit->setReadOnly(true);
|
||||||
|
mClearLogginWndwBtn = new QPushButton(CPICUploaderGui);
|
||||||
|
mClearLogginWndwBtn->setObjectName(QString::fromUtf8("mClearLogginWndwBtn"));
|
||||||
|
mClearLogginWndwBtn->setGeometry(QRect(10, 660, 75, 23));
|
||||||
|
mShowHexFileInfoBtn = new QPushButton(CPICUploaderGui);
|
||||||
|
mShowHexFileInfoBtn->setObjectName(QString::fromUtf8("mShowHexFileInfoBtn"));
|
||||||
|
mShowHexFileInfoBtn->setGeometry(QRect(170, 110, 75, 23));
|
||||||
|
mFilterParamsLbl = new QLabel(CPICUploaderGui);
|
||||||
|
mFilterParamsLbl->setObjectName(QString::fromUtf8("mFilterParamsLbl"));
|
||||||
|
mFilterParamsLbl->setGeometry(QRect(680, 320, 231, 81));
|
||||||
|
mFilterParamsLbl->setFrameShape(QFrame::Box);
|
||||||
|
mFilterStartAddressTxtEdit = new QLineEdit(CPICUploaderGui);
|
||||||
|
mFilterStartAddressTxtEdit->setObjectName(QString::fromUtf8("mFilterStartAddressTxtEdit"));
|
||||||
|
mFilterStartAddressTxtEdit->setEnabled(false);
|
||||||
|
mFilterStartAddressTxtEdit->setGeometry(QRect(760, 330, 113, 20));
|
||||||
|
mFilterEndAddressTxtEdit = new QLineEdit(CPICUploaderGui);
|
||||||
|
mFilterEndAddressTxtEdit->setObjectName(QString::fromUtf8("mFilterEndAddressTxtEdit"));
|
||||||
|
mFilterEndAddressTxtEdit->setEnabled(false);
|
||||||
|
mFilterEndAddressTxtEdit->setGeometry(QRect(760, 370, 113, 20));
|
||||||
|
label_2 = new QLabel(CPICUploaderGui);
|
||||||
|
label_2->setObjectName(QString::fromUtf8("label_2"));
|
||||||
|
label_2->setGeometry(QRect(690, 330, 71, 16));
|
||||||
|
label_3 = new QLabel(CPICUploaderGui);
|
||||||
|
label_3->setObjectName(QString::fromUtf8("label_3"));
|
||||||
|
label_3->setGeometry(QRect(690, 370, 71, 16));
|
||||||
|
label_4 = new QLabel(CPICUploaderGui);
|
||||||
|
label_4->setObjectName(QString::fromUtf8("label_4"));
|
||||||
|
label_4->setGeometry(QRect(680, 300, 71, 16));
|
||||||
|
QFont font1;
|
||||||
|
font1.setPointSize(10);
|
||||||
|
label_4->setFont(font1);
|
||||||
|
mUploadProgressBar = new QProgressBar(CPICUploaderGui);
|
||||||
|
mUploadProgressBar->setObjectName(QString::fromUtf8("mUploadProgressBar"));
|
||||||
|
mUploadProgressBar->setGeometry(QRect(680, 420, 231, 23));
|
||||||
|
mUploadProgressBar->setValue(24);
|
||||||
|
|
||||||
|
retranslateUi(CPICUploaderGui);
|
||||||
|
|
||||||
|
QMetaObject::connectSlotsByName(CPICUploaderGui);
|
||||||
|
} // setupUi
|
||||||
|
|
||||||
|
void retranslateUi(QDialog *CPICUploaderGui)
|
||||||
|
{
|
||||||
|
CPICUploaderGui->setWindowTitle(QCoreApplication::translate("CPICUploaderGui", "Dialog", nullptr));
|
||||||
|
label->setText(QCoreApplication::translate("CPICUploaderGui", "Firmware Uploader", nullptr));
|
||||||
|
mHexFileSelectBtn->setText(QCoreApplication::translate("CPICUploaderGui", "Open Hex File", nullptr));
|
||||||
|
mIPAddressEdit->setText(QCoreApplication::translate("CPICUploaderGui", "192.168.30.125", nullptr));
|
||||||
|
mOpenedHexFilePathLbl->setText(QCoreApplication::translate("CPICUploaderGui", "No File Opened", nullptr));
|
||||||
|
mHexFileStatsLbl->setText(QString());
|
||||||
|
mConnectBtn->setText(QCoreApplication::translate("CPICUploaderGui", "Connect", nullptr));
|
||||||
|
mSendCmdBtn->setText(QCoreApplication::translate("CPICUploaderGui", "Send Cmd", nullptr));
|
||||||
|
mCmdSelectCombo->setItemText(0, QCoreApplication::translate("CPICUploaderGui", "Heartbeat", nullptr));
|
||||||
|
mCmdSelectCombo->setItemText(1, QCoreApplication::translate("CPICUploaderGui", "Get Stored Firmware Info", nullptr));
|
||||||
|
mCmdSelectCombo->setItemText(2, QCoreApplication::translate("CPICUploaderGui", "Flash Erase", nullptr));
|
||||||
|
mCmdSelectCombo->setItemText(3, QCoreApplication::translate("CPICUploaderGui", "Init Upload", nullptr));
|
||||||
|
mCmdSelectCombo->setItemText(4, QCoreApplication::translate("CPICUploaderGui", "Get State", nullptr));
|
||||||
|
mCmdSelectCombo->setItemText(5, QCoreApplication::translate("CPICUploaderGui", "Send Data Chunk", nullptr));
|
||||||
|
mCmdSelectCombo->setItemText(6, QCoreApplication::translate("CPICUploaderGui", "Upload Finished", nullptr));
|
||||||
|
mCmdSelectCombo->setItemText(7, QCoreApplication::translate("CPICUploaderGui", "Execute Upgrade", nullptr));
|
||||||
|
mCmdSelectCombo->setItemText(8, QCoreApplication::translate("CPICUploaderGui", "Check Flash", nullptr));
|
||||||
|
mCmdSelectCombo->setItemText(9, QCoreApplication::translate("CPICUploaderGui", "Abort", nullptr));
|
||||||
|
|
||||||
|
mClearLogginWndwBtn->setText(QCoreApplication::translate("CPICUploaderGui", "Clear", nullptr));
|
||||||
|
mShowHexFileInfoBtn->setText(QCoreApplication::translate("CPICUploaderGui", "Show Info", nullptr));
|
||||||
|
mFilterParamsLbl->setText(QString());
|
||||||
|
mFilterStartAddressTxtEdit->setText(QCoreApplication::translate("CPICUploaderGui", "0x1D004000", nullptr));
|
||||||
|
mFilterEndAddressTxtEdit->setText(QCoreApplication::translate("CPICUploaderGui", "0x1D07FFFF", nullptr));
|
||||||
|
label_2->setText(QCoreApplication::translate("CPICUploaderGui", "Start Address", nullptr));
|
||||||
|
label_3->setText(QCoreApplication::translate("CPICUploaderGui", "End Address", nullptr));
|
||||||
|
label_4->setText(QCoreApplication::translate("CPICUploaderGui", "Code area", nullptr));
|
||||||
|
} // retranslateUi
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CPICUploaderGui: public Ui_CPICUploaderGui {};
|
||||||
|
} // namespace Ui
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // UI_PICUPLOADERGUI_H
|
||||||
57
ui_TrayVolumeCtrl.h
Normal file
57
ui_TrayVolumeCtrl.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
** Form generated from reading UI file 'TrayVolumeCtrl.ui'
|
||||||
|
**
|
||||||
|
** Created by: Qt User Interface Compiler version 5.14.2
|
||||||
|
**
|
||||||
|
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
#ifndef UI_TRAYVOLUMECTRL_H
|
||||||
|
#define UI_TRAYVOLUMECTRL_H
|
||||||
|
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtWidgets/QApplication>
|
||||||
|
#include <QtWidgets/QSlider>
|
||||||
|
#include <QtWidgets/QWidget>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class Ui_CTrayVolumeCtrl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QSlider *horizontalSlider;
|
||||||
|
QSlider *horizontalSlider_2;
|
||||||
|
|
||||||
|
void setupUi(QWidget *CTrayVolumeCtrl)
|
||||||
|
{
|
||||||
|
if (CTrayVolumeCtrl->objectName().isEmpty())
|
||||||
|
CTrayVolumeCtrl->setObjectName(QString::fromUtf8("CTrayVolumeCtrl"));
|
||||||
|
CTrayVolumeCtrl->resize(441, 147);
|
||||||
|
horizontalSlider = new QSlider(CTrayVolumeCtrl);
|
||||||
|
horizontalSlider->setObjectName(QString::fromUtf8("horizontalSlider"));
|
||||||
|
horizontalSlider->setGeometry(QRect(70, 40, 160, 16));
|
||||||
|
horizontalSlider->setOrientation(Qt::Horizontal);
|
||||||
|
horizontalSlider_2 = new QSlider(CTrayVolumeCtrl);
|
||||||
|
horizontalSlider_2->setObjectName(QString::fromUtf8("horizontalSlider_2"));
|
||||||
|
horizontalSlider_2->setGeometry(QRect(70, 70, 160, 16));
|
||||||
|
horizontalSlider_2->setOrientation(Qt::Horizontal);
|
||||||
|
|
||||||
|
retranslateUi(CTrayVolumeCtrl);
|
||||||
|
|
||||||
|
QMetaObject::connectSlotsByName(CTrayVolumeCtrl);
|
||||||
|
} // setupUi
|
||||||
|
|
||||||
|
void retranslateUi(QWidget *CTrayVolumeCtrl)
|
||||||
|
{
|
||||||
|
CTrayVolumeCtrl->setWindowTitle(QCoreApplication::translate("CTrayVolumeCtrl", "Form", nullptr));
|
||||||
|
} // retranslateUi
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CTrayVolumeCtrl: public Ui_CTrayVolumeCtrl {};
|
||||||
|
} // namespace Ui
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // UI_TRAYVOLUMECTRL_H
|
||||||
Loading…
x
Reference in New Issue
Block a user