Commit 3130d441689dbf72b1b41770ad89a77d45dd8f8e
1 parent
af41f47300
Exists in
master
and in
2 other branches
IP설정 추가
Showing
2 changed files
with
57 additions
and
0 deletions
Show diff stats
app/gui/oven_control/config.cpp
| @@ -21,8 +21,10 @@ | @@ -21,8 +21,10 @@ | ||
| 21 | #include "fileprocessor.h" | 21 | #include "fileprocessor.h" |
| 22 | #include "backlight.h" | 22 | #include "backlight.h" |
| 23 | #include "udphandler.h" | 23 | #include "udphandler.h" |
| 24 | +#include "system.h" | ||
| 24 | 25 | ||
| 25 | using namespace Define; | 26 | using namespace Define; |
| 27 | +using namespace System; | ||
| 26 | 28 | ||
| 27 | #define CONFIG_FILE_NAME "/prime/config/config.ini" | 29 | #define CONFIG_FILE_NAME "/prime/config/config.ini" |
| 28 | #define FAVORITE_FILE_NAME "/prime/config/favorite.ini" | 30 | #define FAVORITE_FILE_NAME "/prime/config/favorite.ini" |
| @@ -181,6 +183,15 @@ void Config::applyConfig(){ | @@ -181,6 +183,15 @@ void Config::applyConfig(){ | ||
| 181 | } | 183 | } |
| 182 | break; | 184 | break; |
| 183 | } | 185 | } |
| 186 | + | ||
| 187 | + System::IPData ipdata; | ||
| 188 | + | ||
| 189 | + ipdata.address = QString("%1.%2.%3.%4").arg(configlist.items.ip.d8.d8_0).arg(configlist.items.ip.d8.d8_1).arg(configlist.items.ip.d8.d8_2).arg(configlist.items.ip.d8.d8_3); | ||
| 190 | + ipdata.gateway = QString("%1.%2.%3.%4").arg(configlist.items.gateway.d8.d8_0).arg(configlist.items.gateway.d8.d8_1).arg(configlist.items.gateway.d8.d8_2).arg(configlist.items.gateway.d8.d8_3); | ||
| 191 | + ipdata.netmask = QString("%1.%2.%3.%4").arg(configlist.items.netmask.d8.d8_0).arg(configlist.items.netmask.d8.d8_1).arg(configlist.items.netmask.d8.d8_2).arg(configlist.items.netmask.d8.d8_3); | ||
| 192 | + | ||
| 193 | + System::setIP(ipdata); | ||
| 194 | + | ||
| 184 | } | 195 | } |
| 185 | 196 | ||
| 186 | Define::config_item Config::getConfigValue(Define::ConfigType idx){ | 197 | Define::config_item Config::getConfigValue(Define::ConfigType idx){ |
app/gui/oven_control/configipdlg.cpp
| 1 | #include "configipdlg.h" | 1 | #include "configipdlg.h" |
| 2 | #include "ui_configipdlg.h" | 2 | #include "ui_configipdlg.h" |
| 3 | +#include "config.h" | ||
| 4 | + | ||
| 5 | +using namespace Define; | ||
| 3 | 6 | ||
| 4 | ConfigIpDlg::ConfigIpDlg(QWidget *parent) : | 7 | ConfigIpDlg::ConfigIpDlg(QWidget *parent) : |
| 5 | QDialog(parent), | 8 | QDialog(parent), |
| @@ -21,6 +24,28 @@ ConfigIpDlg::ConfigIpDlg(QWidget *parent) : | @@ -21,6 +24,28 @@ ConfigIpDlg::ConfigIpDlg(QWidget *parent) : | ||
| 21 | ui->ctrNetmask_1->setFormatterWidth(3); | 24 | ui->ctrNetmask_1->setFormatterWidth(3); |
| 22 | ui->ctrNetmask_2->setFormatterWidth(3); | 25 | ui->ctrNetmask_2->setFormatterWidth(3); |
| 23 | ui->ctrNetmask_3->setFormatterWidth(3); | 26 | ui->ctrNetmask_3->setFormatterWidth(3); |
| 27 | + | ||
| 28 | + Config* cfg = Config::getInstance(); | ||
| 29 | + | ||
| 30 | + config_item temp; | ||
| 31 | + temp = cfg->getConfigValue(config_ip); | ||
| 32 | + ui->ctrIp_0->setValue(temp.d8.d8_0); | ||
| 33 | + ui->ctrIp_1->setValue(temp.d8.d8_1); | ||
| 34 | + ui->ctrIp_2->setValue(temp.d8.d8_2); | ||
| 35 | + ui->ctrIp_3->setValue(temp.d8.d8_3); | ||
| 36 | + | ||
| 37 | + temp = cfg->getConfigValue(config_gateway); | ||
| 38 | + ui->ctrGw_0->setValue(temp.d8.d8_0); | ||
| 39 | + ui->ctrGw_1->setValue(temp.d8.d8_1); | ||
| 40 | + ui->ctrGw_2->setValue(temp.d8.d8_2); | ||
| 41 | + ui->ctrGw_3->setValue(temp.d8.d8_3); | ||
| 42 | + | ||
| 43 | + temp = cfg->getConfigValue(config_netmask); | ||
| 44 | + ui->ctrNetmask_0->setValue(temp.d8.d8_0); | ||
| 45 | + ui->ctrNetmask_1->setValue(temp.d8.d8_1); | ||
| 46 | + ui->ctrNetmask_2->setValue(temp.d8.d8_2); | ||
| 47 | + ui->ctrNetmask_3->setValue(temp.d8.d8_3); | ||
| 48 | + | ||
| 24 | } | 49 | } |
| 25 | 50 | ||
| 26 | ConfigIpDlg::~ConfigIpDlg() | 51 | ConfigIpDlg::~ConfigIpDlg() |
| @@ -30,6 +55,27 @@ ConfigIpDlg::~ConfigIpDlg() | @@ -30,6 +55,27 @@ ConfigIpDlg::~ConfigIpDlg() | ||
| 30 | 55 | ||
| 31 | void ConfigIpDlg::on_ctrBtnOk_clicked() | 56 | void ConfigIpDlg::on_ctrBtnOk_clicked() |
| 32 | { | 57 | { |
| 58 | + Config* cfg = Config::getInstance(); | ||
| 59 | + config_item temp; | ||
| 60 | + | ||
| 61 | + temp.d8.d8_0 = (uint8_t)ui->ctrIp_0->value(); | ||
| 62 | + temp.d8.d8_1 = (uint8_t)ui->ctrIp_1->value(); | ||
| 63 | + temp.d8.d8_2 = (uint8_t)ui->ctrIp_2->value(); | ||
| 64 | + temp.d8.d8_3 = (uint8_t)ui->ctrIp_3->value(); | ||
| 65 | + cfg->setConfigValue(config_ip, temp); | ||
| 66 | + | ||
| 67 | + temp.d8.d8_0 = (uint8_t)ui->ctrGw_0->value(); | ||
| 68 | + temp.d8.d8_1 = (uint8_t)ui->ctrGw_1->value(); | ||
| 69 | + temp.d8.d8_2 = (uint8_t)ui->ctrGw_2->value(); | ||
| 70 | + temp.d8.d8_3 = (uint8_t)ui->ctrGw_3->value(); | ||
| 71 | + cfg->setConfigValue(config_gateway, temp); | ||
| 72 | + | ||
| 73 | + temp.d8.d8_0 = (uint8_t)ui->ctrNetmask_0->value(); | ||
| 74 | + temp.d8.d8_1 = (uint8_t)ui->ctrNetmask_1->value(); | ||
| 75 | + temp.d8.d8_2 = (uint8_t)ui->ctrNetmask_2->value(); | ||
| 76 | + temp.d8.d8_3 = (uint8_t)ui->ctrNetmask_3->value(); | ||
| 77 | + cfg->setConfigValue(config_netmask, temp); | ||
| 78 | + | ||
| 33 | accept(); | 79 | accept(); |
| 34 | } | 80 | } |
| 35 | 81 |