Commit 79948c12 authored by lm's avatar lm

Working on 2D map

parent 094d0521
...@@ -143,7 +143,6 @@ void UDPLink::removeHost(const QString& hostname) ...@@ -143,7 +143,6 @@ void UDPLink::removeHost(const QString& hostname)
} }
} }
void UDPLink::writeBytes(const char* data, qint64 size) void UDPLink::writeBytes(const char* data, qint64 size)
{ {
// Broadcast to all connected systems // Broadcast to all connected systems
...@@ -151,18 +150,26 @@ void UDPLink::writeBytes(const char* data, qint64 size) ...@@ -151,18 +150,26 @@ void UDPLink::writeBytes(const char* data, qint64 size)
{ {
QHostAddress currentHost = hosts.at(h); QHostAddress currentHost = hosts.at(h);
quint16 currentPort = ports.at(h); quint16 currentPort = ports.at(h);
//#define UDPLINK_DEBUG
#ifdef UDPLINK_DEBUG
QString bytes; QString bytes;
QString ascii; QString ascii;
//qDebug() << "WRITING DATA TO" << currentHost.toString() << currentPort;
for (int i=0; i<size; i++) { for (int i=0; i<size; i++) {
unsigned char v = data[i]; unsigned char v = data[i];
bytes.append(QString().sprintf("%02x ", v)); bytes.append(QString().sprintf("%02x ", v));
if (data[i] > 31 && data[i] < 127)
{
ascii.append(data[i]); ascii.append(data[i]);
} }
else
{
ascii.append(219);
}
}
qDebug() << "Sent" << size << "bytes to" << currentHost.toString() << ":" << currentPort << "data:"; qDebug() << "Sent" << size << "bytes to" << currentHost.toString() << ":" << currentPort << "data:";
qDebug() << bytes; qDebug() << bytes;
qDebug() << "ASCII:" << ascii; qDebug() << "ASCII:" << ascii;
#endif
socket->writeDatagram(data, size, currentHost, currentPort); socket->writeDatagram(data, size, currentHost, currentPort);
} }
} }
......
#include "QGCMapWidget.h" #include "QGCMapWidget.h"
#include "UASInterface.h" #include "UASInterface.h"
#include "UASManager.h"
QGCMapWidget::QGCMapWidget(QWidget *parent) : QGCMapWidget::QGCMapWidget(QWidget *parent) :
mapcontrol::OPMapWidget(parent) mapcontrol::OPMapWidget(parent)
{ {
//UAV = new mapcontrol::UAVItem();
connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(addUAS(UASInterface*)));
foreach (UASInterface* uas, UASManager::instance()->getUASList())
{
addUAS(uas);
}
UAV->setVisible(true);
UAV->setPos(40, 8);
UAV->show();
} }
/** /**
...@@ -31,7 +41,9 @@ void QGCMapWidget::updateGlobalPosition(UASInterface* uas, double lat, double lo ...@@ -31,7 +41,9 @@ void QGCMapWidget::updateGlobalPosition(UASInterface* uas, double lat, double lo
Q_UNUSED(usec); Q_UNUSED(usec);
Q_UNUSED(alt); // FIXME Use altitude Q_UNUSED(alt); // FIXME Use altitude
UAV->setPos(lat, lon);
UAV->show();
qDebug() << "Updating 2D map position";
// QPointF coordinate; // QPointF coordinate;
// coordinate.setX(lon); // coordinate.setX(lon);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment