Commit d7c3a65b4700fdec5ae69ccf6e2534fdaa6b4c0b
1 parent
6a81d38e4c
Exists in
master
and in
2 other branches
- 디버깅 포트 변경(4000 -> 40001)
- UDP 전송 아이피를 UI에서 입력하도록 기능 추가
Showing
3 changed files
with
37 additions
and
26 deletions
Show diff stats
app/gui/oven_control/udphandler.cpp
| ... | ... | @@ -43,16 +43,16 @@ void UdpHandler::readPendingDatagrams() |
| 43 | 43 | |
| 44 | 44 | void UdpHandler::processDatagram(QByteArray &datagram) |
| 45 | 45 | { |
| 46 | - sock->writeDatagram(datagram, QHostAddress("192.168.4.191"), 4000); | |
| 46 | + sock->writeDatagram(datagram, QHostAddress("192.168.4.191"), 40001); | |
| 47 | 47 | packet_t *packet = (packet_t *) datagram.data(); |
| 48 | 48 | switch (packet->header) |
| 49 | 49 | { |
| 50 | 50 | case HDR_OVEN_CONTROL: |
| 51 | -// qDebug() << "Received Control"; | |
| 51 | + qDebug() << "Received Control"; | |
| 52 | 52 | processControl((oven_control_t *) packet->body); |
| 53 | 53 | break; |
| 54 | 54 | case HDR_OVEN_STATE: |
| 55 | -// qDebug() << "Received State"; | |
| 55 | + qDebug() << "Received State"; | |
| 56 | 56 | processState((oven_state_t *) packet->body); |
| 57 | 57 | break; |
| 58 | 58 | case HDR_ERROR_CODE: | ... | ... |
app/gui/packet/mainwindow.cpp
| ... | ... | @@ -11,7 +11,7 @@ MainWindow::MainWindow(QWidget *parent) : |
| 11 | 11 | { |
| 12 | 12 | ui->setupUi(this); |
| 13 | 13 | sock = new QUdpSocket(this); |
| 14 | - if (!sock->bind(4000)) | |
| 14 | + if (!sock->bind(40001)) | |
| 15 | 15 | exit(EXIT_FAILURE); |
| 16 | 16 | |
| 17 | 17 | bzero(&control, sizeof(control)); |
| ... | ... | @@ -251,7 +251,7 @@ void MainWindow::on_pushControlButton_clicked() |
| 251 | 251 | memcpy(&c.control, &control, sizeof(this->control)); |
| 252 | 252 | |
| 253 | 253 | QByteArray datagram = QByteArray::fromRawData((char *) &c, sizeof(c)); |
| 254 | - sock->writeDatagram(datagram, QHostAddress("192.168.10.139"), 4000); | |
| 254 | + sock->writeDatagram(datagram, QHostAddress(ui->lineEdit->text()), 4000); | |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | void MainWindow::on_pushStateButton_clicked() |
| ... | ... | @@ -270,5 +270,5 @@ void MainWindow::on_pushStateButton_clicked() |
| 270 | 270 | memcpy(&c.state, &state, sizeof(state)); |
| 271 | 271 | |
| 272 | 272 | QByteArray datagram = QByteArray::fromRawData((char *) &c, sizeof(c)); |
| 273 | - sock->writeDatagram(datagram, QHostAddress("192.168.10.139"), 4000); | |
| 273 | + sock->writeDatagram(datagram, QHostAddress(ui->lineEdit->text()), 4000); | |
| 274 | 274 | } | ... | ... |
app/gui/packet/mainwindow.ui
| ... | ... | @@ -14,32 +14,43 @@ |
| 14 | 14 | <string>Data Viewer</string> |
| 15 | 15 | </property> |
| 16 | 16 | <widget class="QWidget" name="centralWidget"> |
| 17 | - <layout class="QHBoxLayout" name="horizontalLayout"> | |
| 17 | + <layout class="QVBoxLayout" name="verticalLayout_3"> | |
| 18 | 18 | <item> |
| 19 | - <layout class="QVBoxLayout" name="verticalLayout"> | |
| 20 | - <item> | |
| 21 | - <widget class="QTableWidget" name="controlTable"/> | |
| 22 | - </item> | |
| 23 | - <item> | |
| 24 | - <widget class="QPushButton" name="pushControlButton"> | |
| 25 | - <property name="text"> | |
| 26 | - <string>Push</string> | |
| 27 | - </property> | |
| 28 | - </widget> | |
| 29 | - </item> | |
| 30 | - </layout> | |
| 19 | + <widget class="QLineEdit" name="lineEdit"> | |
| 20 | + <property name="text"> | |
| 21 | + <string>192.168.4.199</string> | |
| 22 | + </property> | |
| 23 | + </widget> | |
| 31 | 24 | </item> |
| 32 | 25 | <item> |
| 33 | - <layout class="QVBoxLayout" name="verticalLayout_2"> | |
| 26 | + <layout class="QHBoxLayout" name="horizontalLayout"> | |
| 34 | 27 | <item> |
| 35 | - <widget class="QTableWidget" name="stateTable"/> | |
| 28 | + <layout class="QVBoxLayout" name="verticalLayout"> | |
| 29 | + <item> | |
| 30 | + <widget class="QTableWidget" name="controlTable"/> | |
| 31 | + </item> | |
| 32 | + <item> | |
| 33 | + <widget class="QPushButton" name="pushControlButton"> | |
| 34 | + <property name="text"> | |
| 35 | + <string>Push</string> | |
| 36 | + </property> | |
| 37 | + </widget> | |
| 38 | + </item> | |
| 39 | + </layout> | |
| 36 | 40 | </item> |
| 37 | 41 | <item> |
| 38 | - <widget class="QPushButton" name="pushStateButton"> | |
| 39 | - <property name="text"> | |
| 40 | - <string>Push</string> | |
| 41 | - </property> | |
| 42 | - </widget> | |
| 42 | + <layout class="QVBoxLayout" name="verticalLayout_2"> | |
| 43 | + <item> | |
| 44 | + <widget class="QTableWidget" name="stateTable"/> | |
| 45 | + </item> | |
| 46 | + <item> | |
| 47 | + <widget class="QPushButton" name="pushStateButton"> | |
| 48 | + <property name="text"> | |
| 49 | + <string>Push</string> | |
| 50 | + </property> | |
| 51 | + </widget> | |
| 52 | + </item> | |
| 53 | + </layout> | |
| 43 | 54 | </item> |
| 44 | 55 | </layout> |
| 45 | 56 | </item> | ... | ... |