#include "LoraSettingsGui.h"
#include "ui_LoraSettingsGui.h"
#include "ProgramSettings.h"

CLoraSettingsGui::CLoraSettingsGui(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::CLoraSettingsGui)
{
    ui->setupUi(this);
}

CLoraSettingsGui::~CLoraSettingsGui()
{
    delete ui;
}

CLoraSettingsGui::SetSettings(CSettings *settings)
{
    ui->mLoraAddressSpinBx->setValue(settings->mChaletLoraAddress);
    ui->mLoraChannelSpinBx->setValue(settings->mChaletLoraChannel);
    ui->mComportComboBox->setCurrentText(settings->mChaletComPort);
    ui->mUseLoraIFCheckBx->setChecked(settings->mChaletUseLoraIF);
    return RET_OK;
}

quint16 CLoraSettingsGui::GetChaletLoraAddress()
{
    quint16 Add = ui->mLoraAddressSpinBx->value();
    return Add;
}

quint8 CLoraSettingsGui::GetChaletLoraChannel()
{
    quint16 Chan = ui->mLoraChannelSpinBx->value();
    return Chan;
}

QString CLoraSettingsGui::GetChaletLoraComPort()
{
    return ui->mComportComboBox->currentText();
}

bool CLoraSettingsGui::GetChaletUseLoraIF()
{
    return ui->mUseLoraIFCheckBx->isChecked();
}
