Blame view

app/gui/oven_control/system.cpp 827 Bytes
17ad56e3e   김태훈   시스템 적용 함수 추가
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  #include "system.h"
  
  void System::setIP(System::IPData &data)
  {
      QString ifconfig = QString("ifconfig eth0 %1 netmask %2 up").arg(data.address, data.netmask);
      QString route = QString("route del default; route add default gw %1").arg(data.gateway);
  
      system(ifconfig.toLocal8Bit().constData());
      system(route.toLocal8Bit().constData());
  }
  
  void System::setBacklight(int level)
  {
      QString command = QString("echo %1 > /sys/class/backlight/backlight_lvds.19/brightness").arg(level);
      system(command.toLocal8Bit().constData());
  }
2c27c52f8   김태훈   볼륨 조절 추가
17
18
19
20
21
22
23
24
25
26
27
28
29
  
  void System::setVolume(int percentage)
  {
      static int last = -1;
  
      if (percentage == last)
          return;
  
      last = percentage;
  
      QString command = QString("/usr/bin/amixer -c 0 sset 'PCM',0 %1% %1% on").arg(percentage);
      system(command.toLocal8Bit().constData());
  }