Création des brokers fonctionnelle
This commit is contained in:
@@ -12,6 +12,12 @@ CCloudParams::CCloudParams()
|
||||
mMQTTClientID.clear();
|
||||
}
|
||||
|
||||
CCloudParams::CCloudParams(CCloudParams &Other)
|
||||
{
|
||||
//Assign default values
|
||||
*this = Other;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, CCloudParams &dest)
|
||||
{
|
||||
in >> dest.mMQTTBrokerHostName
|
||||
|
||||
@@ -6,6 +6,7 @@ class CCloudParams
|
||||
{
|
||||
public:
|
||||
CCloudParams();
|
||||
CCloudParams(CCloudParams &Other);
|
||||
|
||||
QString mMQTTBrokerHostName;
|
||||
QString mMQTTBrokerUserName;
|
||||
|
||||
@@ -96,23 +96,49 @@ CLoggingSettingsPage::CLoggingSettingsPage(QWidget *parent) :
|
||||
connect(ui->mDevicePresChangeParamsBtn,&QPushButton::clicked,this,&CLoggingSettingsPage::DevicePresenceModifyParamsBtnPressed);
|
||||
connect(ui->mDevicePresCancelBtn,&QPushButton::clicked,this,&CLoggingSettingsPage::DevicePresenceCancelBtnPressed);
|
||||
|
||||
connect(ui->mAddMQTTBrokerBtn,&QPushButton::clicked,this,&CLoggingSettingsPage::AddMQTTBrokerBtnPressed);
|
||||
connect(ui->mDeleteMQTTBrokerBtn,&QPushButton::clicked,this,&CLoggingSettingsPage::DeleteMQTTBrokerBtnPressed);
|
||||
connect(ui->mMQTTBrokersList,&QListWidget::itemSelectionChanged,this,&CLoggingSettingsPage::MQTTBrokerSelected);
|
||||
|
||||
}
|
||||
|
||||
CLoggingSettingsPage::~CLoggingSettingsPage()
|
||||
{
|
||||
while(mCloudParams.size() != 0)
|
||||
{
|
||||
delete mCloudParams.takeAt(0);
|
||||
}
|
||||
delete ui;
|
||||
}
|
||||
|
||||
int CLoggingSettingsPage::SetCloudParams(const CCloudParams *CloudParams)
|
||||
int CLoggingSettingsPage::SetCloudParams(QList<CCloudParams *> *CloudParams)
|
||||
{
|
||||
if(CloudParams == 0)
|
||||
{
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
|
||||
mCloudParams = *CloudParams;
|
||||
while(mCloudParams.size() != 0)
|
||||
{
|
||||
delete mCloudParams.takeAt(0);
|
||||
}
|
||||
|
||||
UpdateCloudConfig();
|
||||
for(int i = 0; i < CloudParams->size(); i++)
|
||||
{
|
||||
CCloudParams *NewBrokerParam = new CCloudParams;
|
||||
*NewBrokerParam = *CloudParams->at(i);
|
||||
mCloudParams.append(NewBrokerParam);
|
||||
}
|
||||
|
||||
if(mCloudParams.size() != 0)
|
||||
{
|
||||
for(int i = 0; i < mCloudParams.size(); i++)
|
||||
{
|
||||
ui->mMQTTBrokersList->insertItem(i,mCloudParams.at(i)->mMQTTBrokerHostName);
|
||||
ui->mMQTTBrokersList->setCurrentRow(0);
|
||||
}
|
||||
// UpdateCloudConfig();
|
||||
}
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@@ -173,6 +199,7 @@ void CLoggingSettingsPage::ModifyParamsBtnPressed()
|
||||
ui->mCloudMQTTRefreshRateSpinBx->setEnabled(true);
|
||||
ui->mCloudMQTTClientID->setEnabled(true);
|
||||
ui->mChangeParamsBtn->setText("Appliquer");
|
||||
ui->mMQTTBrokersList->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -186,26 +213,41 @@ void CLoggingSettingsPage::ModifyParamsBtnPressed()
|
||||
ui->mCloudMQTTUserNameEdit->setEnabled(false);
|
||||
ui->mCloudMQTTRefreshRateSpinBx->setEnabled(false);
|
||||
ui->mCloudMQTTClientID->setEnabled(false);
|
||||
ui->mMQTTBrokersList->setEnabled(true);
|
||||
|
||||
|
||||
mCloudParams.mMQTTBrokerHostName = ui->mCloudMQTTHostNameEdit->text();
|
||||
mCloudParams.mMQTTBrokerPassword = ui->mCloudMQTTPasswordEdit->text();
|
||||
mCloudParams.mMQTTBrokerPort = (quint32)ui->mCloudMQTTPortSpinBx->value();
|
||||
mCloudParams.mMQTTTopicPrefix = ui->mCloudMQTTTopicPrefixEdit->text();
|
||||
if(mCloudParams.mMQTTTopicPrefix.isEmpty() == false)
|
||||
|
||||
int index = ui->mMQTTBrokersList->currentRow();
|
||||
|
||||
if(index < 0 || index >= mCloudParams.size())
|
||||
{
|
||||
if(mCloudParams.mMQTTTopicPrefix.endsWith("/") == false)
|
||||
qDebug("Big problem in LoggingSettingsPage : invalid broker index");
|
||||
return;
|
||||
}
|
||||
CCloudParams *BrokerParams;
|
||||
BrokerParams = mCloudParams[index];
|
||||
|
||||
BrokerParams->mMQTTBrokerHostName = ui->mCloudMQTTHostNameEdit->text();
|
||||
BrokerParams->mMQTTBrokerPassword = ui->mCloudMQTTPasswordEdit->text();
|
||||
BrokerParams->mMQTTBrokerPort = (quint32)ui->mCloudMQTTPortSpinBx->value();
|
||||
BrokerParams->mMQTTTopicPrefix = ui->mCloudMQTTTopicPrefixEdit->text();
|
||||
if(BrokerParams->mMQTTTopicPrefix.isEmpty() == false)
|
||||
{
|
||||
if(BrokerParams->mMQTTTopicPrefix.endsWith("/") == false)
|
||||
{
|
||||
mCloudParams.mMQTTTopicPrefix.append("/");
|
||||
ui->mCloudMQTTTopicPrefixEdit->setText(mCloudParams.mMQTTTopicPrefix);
|
||||
BrokerParams->mMQTTTopicPrefix.append("/");
|
||||
ui->mCloudMQTTTopicPrefixEdit->setText(BrokerParams->mMQTTTopicPrefix);
|
||||
}
|
||||
}
|
||||
mCloudParams.mMQTTBrokerUserName = ui->mCloudMQTTUserNameEdit->text();
|
||||
mCloudParams.mMQTTTransmitTimeout = (quint32)ui->mCloudMQTTRefreshRateSpinBx->value();
|
||||
mCloudParams.mMQTTClientID = ui->mCloudMQTTClientID->text();
|
||||
BrokerParams->mMQTTBrokerUserName = ui->mCloudMQTTUserNameEdit->text();
|
||||
BrokerParams->mMQTTTransmitTimeout = (quint32)ui->mCloudMQTTRefreshRateSpinBx->value();
|
||||
BrokerParams->mMQTTClientID = ui->mCloudMQTTClientID->text();
|
||||
ui->mMQTTBrokersList->item(index)->setText(BrokerParams->mMQTTBrokerHostName);
|
||||
|
||||
mProgramHandle->SaveCloudLoggingConfigRequest(&mCloudParams);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,19 +262,27 @@ void CLoggingSettingsPage::CancelBtnPressed()
|
||||
ui->mCloudMQTTUserNameEdit->setEnabled(false);
|
||||
ui->mCloudMQTTRefreshRateSpinBx->setEnabled(false);
|
||||
ui->mCloudMQTTClientID->setEnabled(false);
|
||||
ui->mMQTTBrokersList->setEnabled(true);
|
||||
|
||||
UpdateCloudConfig();
|
||||
}
|
||||
|
||||
int CLoggingSettingsPage::UpdateCloudConfig()
|
||||
{
|
||||
ui->mCloudMQTTHostNameEdit->setText(mCloudParams.mMQTTBrokerHostName);
|
||||
ui->mCloudMQTTPasswordEdit->setText(mCloudParams.mMQTTBrokerPassword);
|
||||
ui->mCloudMQTTPortSpinBx->setValue(mCloudParams.mMQTTBrokerPort);
|
||||
ui->mCloudMQTTTopicPrefixEdit->setText(mCloudParams.mMQTTTopicPrefix);
|
||||
ui->mCloudMQTTUserNameEdit->setText(mCloudParams.mMQTTBrokerUserName);
|
||||
ui->mCloudMQTTRefreshRateSpinBx->setValue(mCloudParams.mMQTTTransmitTimeout);
|
||||
ui->mCloudMQTTClientID->setText(mCloudParams.mMQTTClientID);
|
||||
int index = ui->mMQTTBrokersList->currentRow();
|
||||
if(index < 0 || index >= mCloudParams.size())
|
||||
{
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
CCloudParams *BrokerParams = mCloudParams.at(index);
|
||||
|
||||
ui->mCloudMQTTHostNameEdit->setText(BrokerParams->mMQTTBrokerHostName);
|
||||
ui->mCloudMQTTPasswordEdit->setText(BrokerParams->mMQTTBrokerPassword);
|
||||
ui->mCloudMQTTPortSpinBx->setValue(BrokerParams->mMQTTBrokerPort);
|
||||
ui->mCloudMQTTTopicPrefixEdit->setText(BrokerParams->mMQTTTopicPrefix);
|
||||
ui->mCloudMQTTUserNameEdit->setText(BrokerParams->mMQTTBrokerUserName);
|
||||
ui->mCloudMQTTRefreshRateSpinBx->setValue(BrokerParams->mMQTTTransmitTimeout);
|
||||
ui->mCloudMQTTClientID->setText(BrokerParams->mMQTTClientID);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
@@ -593,3 +643,45 @@ void CLoggingSettingsPage::DevicePresenceModifyParamsBtnPressed()
|
||||
mProgramHandle->SaveDeviceDetectionSettingsRequest(&mDeviceDetectConfigHandle);
|
||||
}
|
||||
}
|
||||
|
||||
void CLoggingSettingsPage::AddMQTTBrokerBtnPressed()
|
||||
{
|
||||
CCloudParams *NewParam = new CCloudParams;
|
||||
mCloudParams.append(NewParam);
|
||||
ui->mMQTTBrokersList->addItem("Broker");
|
||||
ui->mMQTTBrokersList->setCurrentRow(ui->mMQTTBrokersList->count()-1);
|
||||
ModifyParamsBtnPressed();
|
||||
|
||||
}
|
||||
void CLoggingSettingsPage::DeleteMQTTBrokerBtnPressed()
|
||||
{
|
||||
int index = ui->mMQTTBrokersList->currentRow();
|
||||
|
||||
if(index < 0 || index >= mCloudParams.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
delete mCloudParams.takeAt(index);
|
||||
ui->mMQTTBrokersList->takeItem(index);
|
||||
if(ui->mMQTTBrokersList->count() == 0)
|
||||
{
|
||||
AddMQTTBrokerBtnPressed();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->mMQTTBrokersList->setCurrentRow(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CLoggingSettingsPage::MQTTBrokerSelected()
|
||||
{
|
||||
int index = ui->mMQTTBrokersList->currentRow();
|
||||
|
||||
if(index < 0 || index >= mCloudParams.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateCloudConfig();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
explicit CLoggingSettingsPage(QWidget *parent = 0);
|
||||
~CLoggingSettingsPage();
|
||||
|
||||
int SetCloudParams(const CCloudParams *CloudParams);
|
||||
int SetCloudParams(QList<CCloudParams *> *CloudParams);
|
||||
int SetGeneralSettingsParams(const CGeneralSystemParams *GeneralParams);
|
||||
int SetCPUWatchdogSettings(const CCPUWatchdogConfig *CPUWatchdogParams);
|
||||
int SetDeviceConfigSettings(const CDeviceDetectionConfig *DevDetectCfgParams);
|
||||
@@ -43,7 +43,7 @@ private:
|
||||
Ui::CLoggingSettingsPage *ui;
|
||||
|
||||
bool EditMode;
|
||||
CCloudParams mCloudParams;
|
||||
QList<CCloudParams*> mCloudParams;
|
||||
CGeneralSystemParams mGeneralSystemParams;
|
||||
CCPUWatchdogConfig mCPUWatchdogParams;
|
||||
CDeviceDetectionConfig mDeviceDetectConfigHandle;
|
||||
@@ -63,6 +63,9 @@ public slots:
|
||||
void DevicePresenceModifyParamsBtnPressed();
|
||||
void DevicePresenceCancelBtnPressed();
|
||||
void SetInternetPresenceStatus(bool);
|
||||
void AddMQTTBrokerBtnPressed();
|
||||
void DeleteMQTTBrokerBtnPressed();
|
||||
void MQTTBrokerSelected();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,14 +34,14 @@
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<x>220</x>
|
||||
<y>100</y>
|
||||
<width>461</width>
|
||||
<width>351</width>
|
||||
<height>271</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Broker MQTT</string>
|
||||
<string>Paramètres du broker</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="mCloudMQTTHostNameLbl">
|
||||
<property name="geometry">
|
||||
@@ -132,7 +132,7 @@
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>20</y>
|
||||
<width>321</width>
|
||||
<width>251</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -142,7 +142,7 @@
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>80</y>
|
||||
<width>321</width>
|
||||
<width>251</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -168,7 +168,7 @@
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>111</y>
|
||||
<width>321</width>
|
||||
<width>251</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -199,7 +199,7 @@
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>160</y>
|
||||
<width>321</width>
|
||||
<width>251</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -230,7 +230,7 @@
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>190</y>
|
||||
<width>321</width>
|
||||
<width>251</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -297,7 +297,7 @@
|
||||
<widget class="QPushButton" name="mChangeParamsBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<x>430</x>
|
||||
<y>380</y>
|
||||
<width>80</width>
|
||||
<height>22</height>
|
||||
@@ -310,7 +310,7 @@
|
||||
<widget class="QPushButton" name="mCancelBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<x>320</x>
|
||||
<y>380</y>
|
||||
<width>80</width>
|
||||
<height>22</height>
|
||||
@@ -1055,6 +1055,55 @@ et l'heure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QListWidget" name="mMQTTBrokersList">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>120</y>
|
||||
<width>181</width>
|
||||
<height>251</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>100</y>
|
||||
<width>91</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Brokers MQTT</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="mDeleteMQTTBrokerBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>370</y>
|
||||
<width>61</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Supprimer</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="mAddMQTTBrokerBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>370</y>
|
||||
<width>61</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ajouter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -43,7 +43,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
||||
mProgramsSettingsTabWidget->addTab(mDataLoggingSettingsPage,"Général");
|
||||
|
||||
|
||||
setWindowFlags(Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
|
||||
// setWindowFlags(Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
|
||||
resize(1700,768);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,9 +82,9 @@ int COtarcikCan::Start()
|
||||
mMainWindow.mCANbusSettingsPage->SetDevicesList(&mCANDevicesList);
|
||||
mMainWindow.mCANViewerPage->InitCANTable(&mCANDevicesList);
|
||||
|
||||
mCloudLoggingParams = *mSystemConfig.GetCloudParams();
|
||||
mMainWindow.mDataLoggingSettingsPage->SetCloudParams(&mCloudLoggingParams);
|
||||
mCANBusMQTTClient.SetMQTTParams(&mCloudLoggingParams);
|
||||
mCloudLoggingParamsList = mSystemConfig.GetCloudParams();
|
||||
mMainWindow.mDataLoggingSettingsPage->SetCloudParams(mCloudLoggingParamsList);
|
||||
mCANBusMQTTClient.SetMQTTParams(mCloudLoggingParamsList->at(0)); //TODO: Fix that
|
||||
mCANBusMQTTClient.SetCANDevicesList(&mCANDevicesList);
|
||||
#ifdef ENABLE_CHIPSET_DRIVER
|
||||
mCANBusMQTTClient.SetCPUInterface(&mCPUInterface);
|
||||
@@ -206,7 +206,7 @@ int COtarcikCan::PopulateCANDevicesList(QList<CCANDeviceConfig *> *CANDeviceConf
|
||||
|
||||
for(int i = 0; i < CANDeviceConfigList->size(); i++)
|
||||
{
|
||||
CCANDevice *NewDevice = new CCANDevice(*CANDeviceConfigList->at(i),&mCANBusMQTTClient,mSystemConfig.mCloudLoggingParams.mMQTTTopicPrefix);
|
||||
CCANDevice *NewDevice = new CCANDevice(*CANDeviceConfigList->at(i),&mCANBusMQTTClient,mSystemConfig.mCloudLoggingParamsList[0]->mMQTTTopicPrefix); //TODO fix the cloud
|
||||
NewDevice->mProgramPtr = this;
|
||||
NewDevice->Init();
|
||||
mCANDevicesList.append(NewDevice);
|
||||
@@ -217,16 +217,17 @@ int COtarcikCan::PopulateCANDevicesList(QList<CCANDeviceConfig *> *CANDeviceConf
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int COtarcikCan::SaveCloudLoggingConfigRequest(CCloudParams *CloudParams)
|
||||
int COtarcikCan::SaveCloudLoggingConfigRequest(QList<CCloudParams *> *CloudParams)
|
||||
{
|
||||
if(CloudParams == 0)
|
||||
{
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
|
||||
mCloudLoggingParams = *CloudParams;
|
||||
mSystemConfig.SetCloudParams(&mCloudLoggingParams);
|
||||
mCANBusMQTTClient.SetMQTTParams(&mCloudLoggingParams);
|
||||
|
||||
mSystemConfig.SetCloudParamsList(CloudParams);
|
||||
mCloudLoggingParamsList = mSystemConfig.GetCloudParams();
|
||||
mCANBusMQTTClient.SetMQTTParams(mCloudLoggingParamsList->at(0)); //TODO: Fix
|
||||
|
||||
if(mSystemConfig.SaveConfig() == RET_OK)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
|
||||
int SaveCANDevicesConfigRequest(QList<CCANDeviceConfig*> *DevicesConfigList);
|
||||
int SaveCloudLoggingConfigRequest(CCloudParams *CloudParams);
|
||||
int SaveCloudLoggingConfigRequest(QList<CCloudParams*> *CloudParams);
|
||||
int SaveGeneralParametersSettingsRequest(CGeneralSystemParams *GeneralParams);
|
||||
int SaveCPUWatchdogSettingsRequest(CCPUWatchdogConfig *CPUWatchdogParams);
|
||||
int SaveDeviceDetectionSettingsRequest(CDeviceDetectionConfig *DeviceDetectconfig);
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
|
||||
private:
|
||||
QList<CCANDevice*> mCANDevicesList;
|
||||
CCloudParams mCloudLoggingParams;
|
||||
QList<CCloudParams*> *mCloudLoggingParamsList;
|
||||
CGeneralSystemParams mGeneralSystemParams;
|
||||
CCPUWatchdogConfig mCPUWatchdogParams;
|
||||
CDeviceDetectionConfig mDeviceDetectionConfigParams;
|
||||
|
||||
@@ -11,6 +11,10 @@ CSystemConfig::~CSystemConfig()
|
||||
{
|
||||
delete mCANDeviceConfigList.takeAt(0);
|
||||
}
|
||||
while(mCloudLoggingParamsList.size() != 0)
|
||||
{
|
||||
delete mCloudLoggingParamsList.takeAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
int CSystemConfig::LoadConfig()
|
||||
@@ -70,7 +74,15 @@ int CSystemConfig::LoadConfig()
|
||||
}
|
||||
|
||||
//Load Cloud logging settings
|
||||
*InputStream >> mCloudLoggingParams;
|
||||
//TODO: load list size
|
||||
int NbCloudParams = 1;
|
||||
*InputStream >> NbCloudParams;
|
||||
for(int i = 0; i < NbCloudParams; i++)
|
||||
{
|
||||
CCloudParams *NewBrokerParams = new CCloudParams;
|
||||
*InputStream >> *NewBrokerParams;
|
||||
mCloudLoggingParamsList.append(NewBrokerParams);
|
||||
}
|
||||
|
||||
//Load general program settings
|
||||
*InputStream >> mGeneralSystemParams;
|
||||
@@ -137,7 +149,11 @@ int CSystemConfig::SaveConfig()
|
||||
}
|
||||
|
||||
//Save the Cloud logging settings
|
||||
*OutputStream << mCloudLoggingParams;
|
||||
*OutputStream << mCloudLoggingParamsList.size();
|
||||
for(int i = 0; i < mCloudLoggingParamsList.size(); i++)
|
||||
{
|
||||
*OutputStream << *mCloudLoggingParamsList.at(i);
|
||||
}
|
||||
|
||||
//Save the general system parameters
|
||||
*OutputStream << mGeneralSystemParams;
|
||||
@@ -193,9 +209,9 @@ int CSystemConfig::SetCANDevicesConfigList(QList<CCANDeviceConfig *> *DevicesCon
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
CCloudParams *CSystemConfig::GetCloudParams()
|
||||
QList<CCloudParams *> *CSystemConfig::GetCloudParams()
|
||||
{
|
||||
return &mCloudLoggingParams;
|
||||
return &mCloudLoggingParamsList;
|
||||
}
|
||||
|
||||
CCANWatchdogConfig *CSystemConfig::GetCANWatchdogConfig()
|
||||
@@ -221,12 +237,22 @@ int CSystemConfig::SetCANWatchdogConfig(CCANWatchdogConfig *Config)
|
||||
mCANWatchdogParams = *Config;
|
||||
}
|
||||
|
||||
int CSystemConfig::SetCloudParams(CCloudParams *CloudParams)
|
||||
int CSystemConfig::SetCloudParamsList(QList<CCloudParams *> *CloudParams)
|
||||
{
|
||||
if(CloudParams == 0)
|
||||
return RET_GENERAL_ERROR;
|
||||
|
||||
mCloudLoggingParams = *CloudParams;
|
||||
while(mCloudLoggingParamsList.size() != 0)
|
||||
{
|
||||
delete mCloudLoggingParamsList.takeAt(0);
|
||||
}
|
||||
|
||||
for(int i = 0; i < CloudParams->size(); i++)
|
||||
{
|
||||
CCloudParams *NewBrokerParams = new CCloudParams(*CloudParams->at(i));
|
||||
mCloudLoggingParamsList.append(NewBrokerParams);
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ public:
|
||||
int SetCANDevicesConfigList(QList<CCANDeviceConfig*> *DevicesConfigList);
|
||||
QList<CCANDeviceConfig*> *GetCANDevicesConfigList();
|
||||
|
||||
CCloudParams *GetCloudParams();
|
||||
int SetCloudParams(CCloudParams *CloudParams);
|
||||
QList<CCloudParams*> *GetCloudParams();
|
||||
int SetCloudParamsList(QList<CCloudParams*> *CloudParams);
|
||||
CGeneralSystemParams *GetGeneralSystemSettings();
|
||||
int SetGeneralSystemParams(CGeneralSystemParams *GeneralParams);
|
||||
CCPUWatchdogConfig *GetCPUWatchdogSettings();
|
||||
@@ -47,7 +47,8 @@ public:
|
||||
QList<CCANDeviceConfig*> mCANDeviceConfigList;
|
||||
|
||||
//Cloud interface config
|
||||
CCloudParams mCloudLoggingParams;
|
||||
QList<CCloudParams*> mCloudLoggingParamsList;
|
||||
// CCloudParams mCloudLoggingParams;
|
||||
|
||||
//Misc general system settings
|
||||
CGeneralSystemParams mGeneralSystemParams;
|
||||
|
||||
Reference in New Issue
Block a user