void DisplayRenderer::sendDisplayData(QImage im1, QImage im2) { qDebug() << "sending data for displays"; PC2TB_PACKET outPacket; // pack tha packet: outPacket.magicNumber1 = MAGIC_NUMBER1; outPacket.magicNumber2 = MAGIC_NUMBER2; outPacket.packetVersion = PACKET_VERSION; QTime midnight(0,0); int time_ms = midnight.msecsTo(MainWindow::app()->getTimeBaseTime()); uint32_t time_100us = 10*time_ms; outPacket.pcTime_100us = time_100us; // ALGE text memcpy(outPacket.algeText, algeText().toAscii().data(), ALGE_TEXT_LEN); genMatrixData(im1, 1, outPacket.matrixData1); genMatrixData(im2, 2, outPacket.matrixData2); outPacket.matrixDataValid=1; outPacket.cmdReceiver=COMMAND_INVALID_RECEIVER; outPacket.command=COMMAND_INVALID_CMD; outPacket.crc = CRC8_run((uint8_t*)(&outPacket), (uint16_t)(sizeof(PC2TB_PACKET)-1)); QByteArray datagram; datagram.setRawData((char*)(&outPacket), sizeof(PC2TB_PACKET)); emit sendDatagram(datagram); }
void DialogTimeStampGenerator2::on_pushButton_clicked() { static TB2PC_PACKET p; static ALIVE_PACKET ap; p.magicNumber1 = MAGIC_NUMBER1; p.magicNumber2 = MAGIC_NUMBER2; p.packetVersion = ui->lineEdit_packetVersion->text().toInt(); p.batteryVoltageTB = ui->lineEdit_batteryVoltageTB->text().toInt(); p.triggerStationID = ui->comboBox_triggerStationID->itemData(ui->comboBox_triggerStationID->currentIndex()).toInt(); p.binRssiTS = ui->lineEdit_binRssiTS->text().toInt(); QTime t0(0,0,0); ap.triggerTimeBB = t0.msecsTo(ui->timeEdit_triggerTimeBB->time())*10; ap.triggerTimeTS_L = t0.msecsTo(ui->timeEdit_triggerTimeTS_L->time())*10; ap.triggerTimeTS_R = t0.msecsTo(ui->timeEdit_triggerTimeTS_R->time())*10; ap.batteryVoltageTS = ui->lineEdit_batteryVoltageTS->text().toInt(); ap.batteryVoltageBB = ui->lineEdit_batteryVoltageBB->text().toInt(); ap.boatBoxID = ui->comboBox_boatBoxID->itemData(ui->comboBox_boatBoxID->currentIndex()).toInt(); ap.binRssiBB = ui->lineEdit_binRssiBB->text().toInt(); ap.stationTriggeredAt = ui->comboBox_stationTriggeredAt->itemData(ui->comboBox_stationTriggeredAt->currentIndex()).toInt(); p.tsPacket = ap; p.baseTime_100us = t0.msecsTo(ui->timeEdit_baseTime->time())*10; p.crc = CRC8_run((uint8_t*)(&p), sizeof(p)-1); //printPacket(p); QByteArray datagram; datagram.setRawData((char*)(&p), sizeof(p)); QUdpSocket* udpSocket = new QUdpSocket(this); udpSocket->writeDatagram(datagram.data(), datagram.size(), QHostAddress::Broadcast, UDP_LISTEN_PORT); }