Blame view

app/gui/oven_control/packetprinter.cpp 1 KB
8c2952457   김태훈   응용 프로그램 추가
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  #include "packetprinter.h"
  #include "ui_packetprinter.h"
  
  #include <QTextStream>
  
  #include "all_share.h"
  
  PacketPrinter::PacketPrinter(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::PacketPrinter)
  {
      ui->setupUi(this);
  }
  
  PacketPrinter::~PacketPrinter()
  {
      delete ui;
  }
  
  void PacketPrinter::printControl(oven_control_t &control)
  {
      QString str;
      QTextStream stream(&str);
  
      stream << "Control
  ";
  
      for (int idx = 0; idx < sizeof(control) / sizeof(unsigned short); idx++)
      {
          QString str;
          stream << str.sprintf("0x%04X 0x%04X
  ", idx, ((unsigned short *) &control)[idx]);
      }
  
      ui->control->setPlainText(str);
  }
  
  void PacketPrinter::printState(oven_state_t &state)
  {
  
      QString str;
      QTextStream stream(&str);
      stream << "State
  ";
  
      for (int idx = 0; idx < sizeof(state) / sizeof(unsigned short); idx++)
      {
          QString str;
          stream << str.sprintf("0x%04X 0x%04X
  ", idx, ((unsigned short *) &state)[idx]);
      }
  
      ui->state->setPlainText(str);
  }