#include "packetprinter.h" #include "ui_packetprinter.h" #include #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\n"; for (int idx = 0; idx < sizeof(control) / sizeof(unsigned short); idx++) { QString str; stream << str.sprintf("0x%04X 0x%04X\n", idx, ((unsigned short *) &control)[idx]); } ui->control->setPlainText(str); } void PacketPrinter::printState(oven_state_t &state) { QString str; QTextStream stream(&str); stream << "State\n"; for (int idx = 0; idx < sizeof(state) / sizeof(unsigned short); idx++) { QString str; stream << str.sprintf("0x%04X 0x%04X\n", idx, ((unsigned short *) &state)[idx]); } ui->state->setPlainText(str); }