Commit 17ad56e3e2bf0ac89b97da4ce504305d3c9eca57

Authored by 김태훈
1 parent 098a9d5bf2
Exists in master and in 2 other branches fhd, fhd-demo

시스템 적용 함수 추가

app/gui/oven_control/oven_control.pro
... ... @@ -97,7 +97,8 @@ SOURCES += main.cpp\
97 97 inputoverwatcher.cpp \
98 98 modelsettingwindow.cpp \
99 99 gasmodelsettingwindow.cpp \
100   - electricmodelsettingwindow.cpp
  100 + electricmodelsettingwindow.cpp \
  101 + system.cpp
101 102  
102 103 HEADERS += mainwindow.h \
103 104 cook.h \
... ... @@ -184,7 +185,8 @@ HEADERS += mainwindow.h \
184 185 inputoverwatcher.h \
185 186 modelsettingwindow.h \
186 187 gasmodelsettingwindow.h \
187   - electricmodelsettingwindow.h
  188 + electricmodelsettingwindow.h \
  189 + system.h
188 190  
189 191 FORMS += mainwindow.ui \
190 192 manualcookwindow.ui \
... ...
app/gui/oven_control/system.cpp
... ... @@ -0,0 +1,16 @@
  1 +#include "system.h"
  2 +
  3 +void System::setIP(System::IPData &data)
  4 +{
  5 + QString ifconfig = QString("ifconfig eth0 %1 netmask %2 up").arg(data.address, data.netmask);
  6 + QString route = QString("route del default; route add default gw %1").arg(data.gateway);
  7 +
  8 + system(ifconfig.toLocal8Bit().constData());
  9 + system(route.toLocal8Bit().constData());
  10 +}
  11 +
  12 +void System::setBacklight(int level)
  13 +{
  14 + QString command = QString("echo %1 > /sys/class/backlight/backlight_lvds.19/brightness").arg(level);
  15 + system(command.toLocal8Bit().constData());
  16 +}
... ...
app/gui/oven_control/system.h
... ... @@ -0,0 +1,18 @@
  1 +#ifndef SYSTEM_H
  2 +#define SYSTEM_H
  3 +
  4 +
  5 +#include <QtCore>
  6 +
  7 +namespace System {
  8 +struct IpData
  9 +{
  10 + QString address;
  11 + QString netmask;
  12 + QString gateway;
  13 +};
  14 +
  15 +void setIp(Data &data);
  16 +}
  17 +
  18 +#endif // SYSTEM_H
... ...