Commit fd497bc6 authored by Anton Babushkin's avatar Anton Babushkin

Merge branch 'master' into alt_speed_fix

parents b9d8484f 9dea5ac9
This diff is collapsed.
This diff is collapsed.
...@@ -32,8 +32,15 @@ QT += network \ ...@@ -32,8 +32,15 @@ QT += network \
sql \ sql \
declarative declarative
TEMPLATE = app # Setting this variable allows you to include this .pro file in another such that
TARGET = qgroundcontrol # you can set your own TARGET and main() function. This is used by the unit test
# build files to build unit test using all built parts of QGCS except for main.
isEmpty(QGCS_UNITTEST_OVERRIDE) {
TEMPLATE = app
TARGET = qgroundcontrol
SOURCES += src/main.cc
}
BASEDIR = $${IN_PWD} BASEDIR = $${IN_PWD}
linux-g++|linux-g++-64{ linux-g++|linux-g++-64{
debug { debug {
...@@ -556,7 +563,7 @@ contains(DEPENDENCIES_PRESENT, libfreenect) { ...@@ -556,7 +563,7 @@ contains(DEPENDENCIES_PRESENT, libfreenect) {
# Enable only if libfreenect is available # Enable only if libfreenect is available
HEADERS += src/input/Freenect.h HEADERS += src/input/Freenect.h
} }
SOURCES += src/main.cc \ SOURCES += \
src/QGCCore.cc \ src/QGCCore.cc \
src/uas/UASManager.cc \ src/uas/UASManager.cc \
src/uas/UAS.cc \ src/uas/UAS.cc \
......
...@@ -44,14 +44,6 @@ This file is part of the QGROUNDCONTROL project ...@@ -44,14 +44,6 @@ This file is part of the QGROUNDCONTROL project
// Speech synthesis is only supported with MSVC compiler // Speech synthesis is only supported with MSVC compiler
#if _MSC_VER #if _MSC_VER
// Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx // Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx
#define _ATL_APARTMENT_THREADED
#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override something,
//but do not change the name of _Module
extern CComModule _Module;
#include <atlcom.h>
#include <sapi.h> #include <sapi.h>
//using System; //using System;
......
...@@ -65,12 +65,6 @@ extern "C" { ...@@ -65,12 +65,6 @@ extern "C" {
#if _MSC_VER #if _MSC_VER
// Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx // Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx
#define _ATL_APARTMENT_THREADED
#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override something,
//but do not change the name of _Module
extern CComModule _Module;
#include <atlcom.h>
#include <sapi.h> #include <sapi.h>
#endif #endif
......
...@@ -80,88 +80,9 @@ public: ...@@ -80,88 +80,9 @@ public:
* Bit/s, NOT 104'857'600 Bit/s). * Bit/s, NOT 104'857'600 Bit/s).
* *
* @return The nominal data rate of the interface in bit per second, 0 if unknown * @return The nominal data rate of the interface in bit per second, 0 if unknown
* @see getLongTermDataRate() For the mean data rate
* @see getShortTermDataRate() For a the mean data rate of the last seconds
* @see getCurrentDataRate() For the data rate of the last transferred chunk
* @see getMaxDataRate() For the maximum data rate
**/ **/
virtual qint64 getNominalDataRate() const = 0; virtual qint64 getNominalDataRate() const = 0;
/**
* @brief Full duplex support of this interface.
*
* This method returns true if the interface supports full duplex, which implies
* the full datarate when sending and receiving data simultaneously.
*
* @return True if the interface supports full duplex, false otherwise
**/
virtual bool isFullDuplex() const = 0;
/**
* @brief Get the link quality.
*
* The link quality is reported as percent, on a scale from 0 to 100% in 1% increments.
* If this feature is not supported by the interface, a call to this method return -1.
*
* @return The link quality in integer percent or -1 if not supported
**/
virtual int getLinkQuality() const = 0;
/**
* @Brief Get the long term (complete) mean of the data rate
*
* The mean of the total data rate. It is calculated as
* all transferred bits / total link uptime.
*
* @return The mean data rate of the interface in bit per second, 0 if unknown
* @see getNominalDataRate() For the nominal data rate of the interface
* @see getShortTermDataRate() For a the mean data rate of the last seconds
* @see getCurrentDataRate() For the data rate of the last transferred chunk
* @see getMaxDataRate() For the maximum data rate
**/
virtual qint64 getTotalUpstream() = 0;
/**
* @Brief Get the current data rate
*
* The datarate of the last 100 ms
*
* @return The mean data rate of the interface in bit per second, 0 if unknown
* @see getNominalDataRate() For the nominal data rate of the interface
* @see getLongTermDataRate() For the mean data rate
* @see getShortTermDataRate() For a the mean data rate of the last seconds
* @see getMaxDataRate() For the maximum data rate
**/
virtual qint64 getCurrentUpstream() = 0;
/**
* @Brief Get the maximum data rate
*
* The maximum peak data rate.
*
* @return The mean data rate of the interface in bit per second, 0 if unknown
* @see getNominalDataRate() For the nominal data rate of the interface
* @see getLongTermDataRate() For the mean data rate
* @see getShortTermDataRate() For a the mean data rate of the last seconds
* @see getCurrentDataRate() For the data rate of the last transferred chunk
**/
virtual qint64 getMaxUpstream() = 0;
/**
* @Brief Get the total number of bits sent
*
* @return The number of sent bits
**/
virtual qint64 getBitsSent() const = 0;
/**
* @Brief Get the total number of bits received
*
* @return The number of received bits
* @bug Decide if the bits should be counted fromt the instantiation of the interface or if the counter should reset on disconnect.
**/
virtual qint64 getBitsReceived() const = 0;
/** /**
* @brief Connect this interface logically * @brief Connect this interface logically
* *
......
...@@ -1005,67 +1005,3 @@ qint64 MAVLinkSimulationLink::getNominalDataRate() const ...@@ -1005,67 +1005,3 @@ qint64 MAVLinkSimulationLink::getNominalDataRate() const
/* 100 Mbit is reasonable fast and sufficient for all embedded applications */ /* 100 Mbit is reasonable fast and sufficient for all embedded applications */
return 100000000; return 100000000;
} }
qint64 MAVLinkSimulationLink::getTotalUpstream()
{
return 0;
//TODO Add functionality here
// @todo Add functionality here
}
qint64 MAVLinkSimulationLink::getShortTermUpstream()
{
return 0;
}
qint64 MAVLinkSimulationLink::getCurrentUpstream()
{
return 0;
}
qint64 MAVLinkSimulationLink::getMaxUpstream()
{
return 0;
}
qint64 MAVLinkSimulationLink::getBitsSent() const
{
return 0;
}
qint64 MAVLinkSimulationLink::getBitsReceived() const
{
return 0;
}
qint64 MAVLinkSimulationLink::getTotalDownstream()
{
return 0;
}
qint64 MAVLinkSimulationLink::getShortTermDownstream()
{
return 0;
}
qint64 MAVLinkSimulationLink::getCurrentDownstream()
{
return 0;
}
qint64 MAVLinkSimulationLink::getMaxDownstream()
{
return 0;
}
bool MAVLinkSimulationLink::isFullDuplex() const
{
/* Full duplex is no problem when running in pure software, but this is a serial simulation */
return false;
}
int MAVLinkSimulationLink::getLinkQuality() const
{
/* The Link quality is always perfect when running in software */
return 100;
}
...@@ -60,16 +60,6 @@ public: ...@@ -60,16 +60,6 @@ public:
/* Extensive statistics for scientific purposes */ /* Extensive statistics for scientific purposes */
qint64 getNominalDataRate() const; qint64 getNominalDataRate() const;
qint64 getTotalUpstream();
qint64 getShortTermUpstream();
qint64 getCurrentUpstream();
qint64 getMaxUpstream();
qint64 getTotalDownstream();
qint64 getShortTermDownstream();
qint64 getCurrentDownstream();
qint64 getMaxDownstream();
qint64 getBitsSent() const;
qint64 getBitsReceived() const;
QString getName() const; QString getName() const;
int getId() const; int getId() const;
...@@ -80,9 +70,6 @@ public: ...@@ -80,9 +70,6 @@ public:
int getDataBitsType() const; int getDataBitsType() const;
int getStopBitsType() const; int getStopBitsType() const;
int getLinkQuality() const;
bool isFullDuplex() const;
public slots: public slots:
void writeBytes(const char* data, qint64 size); void writeBytes(const char* data, qint64 size);
void readBytes(); void readBytes();
......
...@@ -509,50 +509,3 @@ qint64 OpalLink::getNominalDataRate() const ...@@ -509,50 +509,3 @@ qint64 OpalLink::getNominalDataRate() const
{ {
return 0; //unknown return 0; //unknown
} }
int OpalLink::getLinkQuality() const
{
return -1; //not supported
}
qint64 OpalLink::getTotalUpstream()
{
statisticsMutex.lock();
qint64 totalUpstream = bitsSentTotal / ((MG::TIME::getGroundTimeNow() - connectionStartTime) / 1000);
statisticsMutex.unlock();
return totalUpstream;
}
qint64 OpalLink::getTotalDownstream()
{
statisticsMutex.lock();
qint64 totalDownstream = bitsReceivedTotal / ((MG::TIME::getGroundTimeNow() - connectionStartTime) / 1000);
statisticsMutex.unlock();
return totalDownstream;
}
qint64 OpalLink::getCurrentUpstream()
{
return 0; //unknown
}
qint64 OpalLink::getMaxUpstream()
{
return 0; //unknown
}
qint64 OpalLink::getBitsSent() const
{
return bitsSentTotal;
}
qint64 OpalLink::getBitsReceived() const
{
return bitsReceivedTotal;
}
bool OpalLink::isFullDuplex() const
{
return false;
}
...@@ -79,14 +79,6 @@ public: ...@@ -79,14 +79,6 @@ public:
qint64 getNominalDataRate() const; qint64 getNominalDataRate() const;
bool isFullDuplex() const;
int getLinkQuality() const;
qint64 getTotalUpstream();
qint64 getTotalDownstream();
qint64 getCurrentUpstream();
qint64 getMaxUpstream();
qint64 getBitsSent() const;
qint64 getBitsReceived() const;
bool connect(); bool connect();
...@@ -124,15 +116,8 @@ protected: ...@@ -124,15 +116,8 @@ protected:
int id; int id;
bool connectState; bool connectState;
quint64 bitsSentTotal;
quint64 bitsSentCurrent;
quint64 bitsSentMax;
quint64 bitsReceivedTotal;
quint64 bitsReceivedCurrent;
quint64 bitsReceivedMax;
quint64 connectionStartTime; quint64 connectionStartTime;
QMutex statisticsMutex;
QMutex receiveDataMutex; QMutex receiveDataMutex;
void setName(QString name); void setName(QString name);
......
...@@ -208,7 +208,6 @@ void SerialLink::run() ...@@ -208,7 +208,6 @@ void SerialLink::run()
// qDebug() << "rx of length " << QString::number(readData.length()); // qDebug() << "rx of length " << QString::number(readData.length());
m_bytesRead += readData.length(); m_bytesRead += readData.length();
m_bitsReceivedTotal += readData.length() * 8;
linkErrorCount = 0; linkErrorCount = 0;
} }
} }
...@@ -278,9 +277,6 @@ void SerialLink::writeBytes(const char* data, qint64 size) ...@@ -278,9 +277,6 @@ void SerialLink::writeBytes(const char* data, qint64 size)
m_transmitBuffer.append(byteArray); m_transmitBuffer.append(byteArray);
} }
// Increase write counter
m_bitsSentTotal += size * 8;
// Extra debug logging // Extra debug logging
// qDebug() << byteArray->toHex(); // qDebug() << byteArray->toHex();
} else { } else {
...@@ -321,7 +317,6 @@ void SerialLink::readBytes() ...@@ -321,7 +317,6 @@ void SerialLink::readBytes()
// fprintf(stderr,"%02x ", v); // fprintf(stderr,"%02x ", v);
// } // }
// fprintf(stderr,"\n"); // fprintf(stderr,"\n");
m_bitsReceivedTotal += numBytes * 8;
} }
} }
m_dataMutex.unlock(); m_dataMutex.unlock();
...@@ -420,7 +415,6 @@ bool SerialLink::hardwareConnect() ...@@ -420,7 +415,6 @@ bool SerialLink::hardwareConnect()
this, SLOT(linkError(SerialLinkPortError_t))); this, SLOT(linkError(SerialLinkPortError_t)));
// port->setCommTimeouts(QSerialPort::CtScheme_NonBlockingRead); // port->setCommTimeouts(QSerialPort::CtScheme_NonBlockingRead);
m_connectionStartTime = MG::TIME::getGroundTimeNow();
if (!m_port->open(QIODevice::ReadWrite)) { if (!m_port->open(QIODevice::ReadWrite)) {
emit communicationUpdate(getName(),"Error opening port: " + m_port->errorString()); emit communicationUpdate(getName(),"Error opening port: " + m_port->errorString());
...@@ -532,62 +526,6 @@ qint64 SerialLink::getNominalDataRate() const ...@@ -532,62 +526,6 @@ qint64 SerialLink::getNominalDataRate() const
return dataRate; return dataRate;
} }
qint64 SerialLink::getTotalUpstream()
{
m_statisticsMutex.lock();
return m_bitsSentTotal / ((MG::TIME::getGroundTimeNow() - m_connectionStartTime) / 1000);
m_statisticsMutex.unlock();
}
qint64 SerialLink::getCurrentUpstream()
{
return 0; // TODO
}
qint64 SerialLink::getMaxUpstream()
{
return 0; // TODO
}
qint64 SerialLink::getBitsSent() const
{
return m_bitsSentTotal;
}
qint64 SerialLink::getBitsReceived() const
{
return m_bitsReceivedTotal;
}
qint64 SerialLink::getTotalDownstream()
{
m_statisticsMutex.lock();
return m_bitsReceivedTotal / ((MG::TIME::getGroundTimeNow() - m_connectionStartTime) / 1000);
m_statisticsMutex.unlock();
}
qint64 SerialLink::getCurrentDownstream()
{
return 0; // TODO
}
qint64 SerialLink::getMaxDownstream()
{
return 0; // TODO
}
bool SerialLink::isFullDuplex() const
{
/* Serial connections are always half duplex */
return false;
}
int SerialLink::getLinkQuality() const
{
/* This feature is not supported with this interface */
return -1;
}
QString SerialLink::getPortName() const QString SerialLink::getPortName() const
{ {
return m_portName; return m_portName;
......
...@@ -97,14 +97,6 @@ public: ...@@ -97,14 +97,6 @@ public:
/* Extensive statistics for scientific purposes */ /* Extensive statistics for scientific purposes */
qint64 getNominalDataRate() const; qint64 getNominalDataRate() const;
qint64 getTotalUpstream();
qint64 getCurrentUpstream();
qint64 getMaxUpstream();
qint64 getTotalDownstream();
qint64 getCurrentDownstream();
qint64 getMaxDownstream();
qint64 getBitsSent() const;
qint64 getBitsReceived() const;
void loadSettings(); void loadSettings();
void writeSettings(); void writeSettings();
...@@ -112,8 +104,6 @@ public: ...@@ -112,8 +104,6 @@ public:
void run(); void run();
void run2(); void run2();
int getLinkQuality() const;
bool isFullDuplex() const;
int getId() const; int getId() const;
signals: //[TODO] Refactor to Linkinterface signals: //[TODO] Refactor to Linkinterface
...@@ -161,16 +151,6 @@ protected: ...@@ -161,16 +151,6 @@ protected:
int m_timeout; int m_timeout;
int m_id; int m_id;
quint64 m_bitsSentTotal;
quint64 m_bitsSentShortTerm;
quint64 m_bitsSentCurrent;
quint64 m_bitsSentMax;
quint64 m_bitsReceivedTotal;
quint64 m_bitsReceivedShortTerm;
quint64 m_bitsReceivedCurrent;
quint64 m_bitsReceivedMax;
quint64 m_connectionStartTime;
QMutex m_statisticsMutex;
QMutex m_dataMutex; QMutex m_dataMutex;
QMutex m_writeMutex; QMutex m_writeMutex;
QList<QString> m_ports; QList<QString> m_ports;
......
...@@ -224,7 +224,6 @@ bool TCPLink::hardwareConnect(void) ...@@ -224,7 +224,6 @@ bool TCPLink::hardwareConnect(void)
} }
socketIsConnected = true; socketIsConnected = true;
connectionStartTime = QGC::groundTimeUsecs()/1000;
emit connected(true); emit connected(true);
return true; return true;
...@@ -232,6 +231,7 @@ bool TCPLink::hardwareConnect(void) ...@@ -232,6 +231,7 @@ bool TCPLink::hardwareConnect(void)
void TCPLink::socketError(QAbstractSocket::SocketError socketError) void TCPLink::socketError(QAbstractSocket::SocketError socketError)
{ {
Q_UNUSED(socketError);
emit communicationError(getName(), "Error on socket: " + socket->errorString()); emit communicationError(getName(), "Error on socket: " + socket->errorString());
} }
...@@ -266,60 +266,3 @@ qint64 TCPLink::getNominalDataRate() const ...@@ -266,60 +266,3 @@ qint64 TCPLink::getNominalDataRate() const
{ {
return 54000000; // 54 Mbit return 54000000; // 54 Mbit
} }
\ No newline at end of file
qint64 TCPLink::getTotalUpstream()
{
statisticsMutex.lock();
qint64 totalUpstream = bitsSentTotal / ((QGC::groundTimeUsecs()/1000 - connectionStartTime) / 1000);
statisticsMutex.unlock();
return totalUpstream;
}
qint64 TCPLink::getCurrentUpstream()
{
return 0; // TODO
}
qint64 TCPLink::getMaxUpstream()
{
return 0; // TODO
}
qint64 TCPLink::getBitsSent() const
{
return bitsSentTotal;
}
qint64 TCPLink::getBitsReceived() const
{
return bitsReceivedTotal;
}
qint64 TCPLink::getTotalDownstream()
{
statisticsMutex.lock();
qint64 totalDownstream = bitsReceivedTotal / ((QGC::groundTimeUsecs()/1000 - connectionStartTime) / 1000);
statisticsMutex.unlock();
return totalDownstream;
}
qint64 TCPLink::getCurrentDownstream()
{
return 0; // TODO
}
qint64 TCPLink::getMaxDownstream()
{
return 0; // TODO
}
bool TCPLink::isFullDuplex() const
{
return true;
}
int TCPLink::getLinkQuality() const
{
/* This feature is not supported with this interface */
return -1;
}
...@@ -71,19 +71,9 @@ public: ...@@ -71,19 +71,9 @@ public:
/* Extensive statistics for scientific purposes */ /* Extensive statistics for scientific purposes */
qint64 getNominalDataRate() const; qint64 getNominalDataRate() const;
qint64 getTotalUpstream();
qint64 getCurrentUpstream();
qint64 getMaxUpstream();
qint64 getTotalDownstream();
qint64 getCurrentDownstream();
qint64 getMaxDownstream();
qint64 getBitsSent() const;
qint64 getBitsReceived() const;
void run(); void run();
int getLinkQuality() const;
bool isFullDuplex() const;
int getId() const; int getId() const;
public slots: public slots:
...@@ -105,14 +95,6 @@ protected: ...@@ -105,14 +95,6 @@ protected:
QTcpSocket* socket; QTcpSocket* socket;
bool socketIsConnected; bool socketIsConnected;
quint64 bitsSentTotal;
quint64 bitsSentCurrent;
quint64 bitsSentMax;
quint64 bitsReceivedTotal;
quint64 bitsReceivedCurrent;
quint64 bitsReceivedMax;
quint64 connectionStartTime;
QMutex statisticsMutex;
QMutex dataMutex; QMutex dataMutex;
void setName(QString name); void setName(QString name);
......
...@@ -344,7 +344,6 @@ bool UDPLink::hardwareConnect(void) ...@@ -344,7 +344,6 @@ bool UDPLink::hardwareConnect(void)
emit connected(connectState); emit connected(connectState);
if (connectState) { if (connectState) {
emit connected(); emit connected();
connectionStartTime = QGC::groundTimeUsecs()/1000;
} }
return connectState; return connectState;
} }
...@@ -381,60 +380,3 @@ qint64 UDPLink::getNominalDataRate() const ...@@ -381,60 +380,3 @@ qint64 UDPLink::getNominalDataRate() const
{ {
return 54000000; // 54 Mbit return 54000000; // 54 Mbit
} }
\ No newline at end of file
qint64 UDPLink::getTotalUpstream()
{
statisticsMutex.lock();
qint64 totalUpstream = bitsSentTotal / ((QGC::groundTimeUsecs()/1000 - connectionStartTime) / 1000);
statisticsMutex.unlock();
return totalUpstream;
}
qint64 UDPLink::getCurrentUpstream()
{
return 0; // TODO
}
qint64 UDPLink::getMaxUpstream()
{
return 0; // TODO
}
qint64 UDPLink::getBitsSent() const
{
return bitsSentTotal;
}
qint64 UDPLink::getBitsReceived() const
{
return bitsReceivedTotal;
}
qint64 UDPLink::getTotalDownstream()
{
statisticsMutex.lock();
qint64 totalDownstream = bitsReceivedTotal / ((QGC::groundTimeUsecs()/1000 - connectionStartTime) / 1000);
statisticsMutex.unlock();
return totalDownstream;
}
qint64 UDPLink::getCurrentDownstream()
{
return 0; // TODO
}
qint64 UDPLink::getMaxDownstream()
{
return 0; // TODO
}
bool UDPLink::isFullDuplex() const
{
return true;
}
int UDPLink::getLinkQuality() const
{
/* This feature is not supported with this interface */
return -1;
}
...@@ -73,19 +73,9 @@ public: ...@@ -73,19 +73,9 @@ public:
/* Extensive statistics for scientific purposes */ /* Extensive statistics for scientific purposes */
qint64 getNominalDataRate() const; qint64 getNominalDataRate() const;
qint64 getTotalUpstream();
qint64 getCurrentUpstream();
qint64 getMaxUpstream();
qint64 getTotalDownstream();
qint64 getCurrentDownstream();
qint64 getMaxDownstream();
qint64 getBitsSent() const;
qint64 getBitsReceived() const;
void run(); void run();
int getLinkQuality() const;
bool isFullDuplex() const;
int getId() const; int getId() const;
public slots: public slots:
...@@ -118,14 +108,6 @@ protected: ...@@ -118,14 +108,6 @@ protected:
QList<QHostAddress> hosts; QList<QHostAddress> hosts;
QList<quint16> ports; QList<quint16> ports;
quint64 bitsSentTotal;
quint64 bitsSentCurrent;
quint64 bitsSentMax;
quint64 bitsReceivedTotal;
quint64 bitsReceivedCurrent;
quint64 bitsReceivedMax;
quint64 connectionStartTime;
QMutex statisticsMutex;
QMutex dataMutex; QMutex dataMutex;
void setName(QString name); void setName(QString name);
......
...@@ -123,42 +123,6 @@ qint64 XbeeLink::getNominalDataRate() const ...@@ -123,42 +123,6 @@ qint64 XbeeLink::getNominalDataRate() const
{ {
return this->m_baudRate; return this->m_baudRate;
} }
bool XbeeLink::isFullDuplex() const
{
return false;
}
int XbeeLink::getLinkQuality() const
{
return -1; // TO DO:
}
qint64 XbeeLink::getTotalUpstream()
{
return 0; // TO DO:
}
qint64 XbeeLink::getCurrentUpstream()
{
return 0; // TO DO:
}
qint64 XbeeLink::getMaxUpstream()
{
return 0; // TO DO:
}
qint64 XbeeLink::getBitsSent() const
{
return 0; // TO DO:
}
qint64 XbeeLink::getBitsReceived() const
{
return 0; // TO DO:
}
bool XbeeLink::hardwareConnect() bool XbeeLink::hardwareConnect()
{ {
emit tryConnectBegin(true); emit tryConnectBegin(true);
......
...@@ -35,13 +35,6 @@ public: // virtual functions from LinkInterface ...@@ -35,13 +35,6 @@ public: // virtual functions from LinkInterface
QString getName() const; QString getName() const;
bool isConnected() const; bool isConnected() const;
qint64 getNominalDataRate() const; qint64 getNominalDataRate() const;
bool isFullDuplex() const;
int getLinkQuality() const;
qint64 getTotalUpstream();
qint64 getCurrentUpstream();
qint64 getMaxUpstream();
qint64 getBitsSent() const;
qint64 getBitsReceived() const;
bool connect(); bool connect();
bool disconnect(); bool disconnect();
qint64 bytesAvailable(); qint64 bytesAvailable();
......
...@@ -178,28 +178,28 @@ void UASUnitTest::getSystemType_test() ...@@ -178,28 +178,28 @@ void UASUnitTest::getSystemType_test()
void UASUnitTest::getAirframe_test() void UASUnitTest::getAirframe_test()
{ {
//when uas is constructed, airframe is set to QGC_AIRFRAME_GENERIC which is 0 //when uas is constructed, airframe is set to QGC_AIRFRAME_GENERIC
QCOMPARE(uas->getAirframe(), 0); QVERIFY(uas->getAirframe() == UASInterface::QGC_AIRFRAME_GENERIC);
} }
void UASUnitTest::setAirframe_test() void UASUnitTest::setAirframe_test()
{ {
//check at construction, that airframe=0 (GENERIC) //check at construction, that airframe=0 (GENERIC)
QVERIFY(uas->getAirframe() == 0); QVERIFY(uas->getAirframe() == UASInterface::QGC_AIRFRAME_GENERIC);
//check that set airframe works //check that set airframe works
uas->setAirframe(11); uas->setAirframe(UASInterface::QGC_AIRFRAME_HEXCOPTER);
QVERIFY(uas->getAirframe() == 11); QVERIFY(uas->getAirframe() == UASInterface::QGC_AIRFRAME_HEXCOPTER);
//check that setAirframe will not assign a number to airframe, that is //check that setAirframe will not assign a number to airframe, that is
//not defined in the enum //not defined in the enum
uas->setAirframe(12); uas->setAirframe(UASInterface::QGC_AIRFRAME_END_OF_ENUM);
QVERIFY(uas->getAirframe() == 11); QVERIFY(uas->getAirframe() == UASInterface::QGC_AIRFRAME_HEXCOPTER);
} }
void UASUnitTest::getWaypointList_test() void UASUnitTest::getWaypointList_test()
{ {
QVector<Waypoint*> kk = uas->getWaypointManager()->getWaypointEditableList(); QList<Waypoint*> kk = uas->getWaypointManager()->getWaypointEditableList();
QCOMPARE(kk.count(), 0); QCOMPARE(kk.count(), 0);
Waypoint* wp = new Waypoint(0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,false, false, MAV_FRAME_GLOBAL, MAV_CMD_MISSION_START, "blah"); Waypoint* wp = new Waypoint(0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,false, false, MAV_FRAME_GLOBAL, MAV_CMD_MISSION_START, "blah");
...@@ -232,7 +232,7 @@ void UASUnitTest::getWaypoint_test() ...@@ -232,7 +232,7 @@ void UASUnitTest::getWaypoint_test()
uas->getWaypointManager()->addWaypointEditable(wp, true); uas->getWaypointManager()->addWaypointEditable(wp, true);
QVector<Waypoint*> wpList = uas->getWaypointManager()->getWaypointEditableList(); QList<Waypoint*> wpList = uas->getWaypointManager()->getWaypointEditableList();
QCOMPARE(wpList.count(), 1); QCOMPARE(wpList.count(), 1);
QCOMPARE(static_cast<quint16>(0), static_cast<Waypoint*>(wpList.at(0))->getId()); QCOMPARE(static_cast<quint16>(0), static_cast<Waypoint*>(wpList.at(0))->getId());
...@@ -281,7 +281,7 @@ void UASUnitTest::signalWayPoint_test() ...@@ -281,7 +281,7 @@ void UASUnitTest::signalWayPoint_test()
QCOMPARE(spy2.count(), 1); QCOMPARE(spy2.count(), 1);
uas->getWaypointManager()->clearWaypointList(); uas->getWaypointManager()->clearWaypointList();
QVector<Waypoint*> wpList = uas->getWaypointManager()->getWaypointEditableList(); QList<Waypoint*> wpList = uas->getWaypointManager()->getWaypointEditableList();
QCOMPARE(wpList.count(), 1); QCOMPARE(wpList.count(), 1);
delete uas; delete uas;
uas = NULL; uas = NULL;
...@@ -292,7 +292,7 @@ void UASUnitTest::signalUASLink_test() ...@@ -292,7 +292,7 @@ void UASUnitTest::signalUASLink_test()
{ {
QSignalSpy spy(uas, SIGNAL(modeChanged(int,QString,QString))); QSignalSpy spy(uas, SIGNAL(modeChanged(int,QString,QString)));
uas->setMode(2); uas->setMode(2, 0);
QCOMPARE(spy.count(), 0);// not solve for UAS not receiving message from UAS QCOMPARE(spy.count(), 0);// not solve for UAS not receiving message from UAS
QSignalSpy spyS(LinkManager::instance(), SIGNAL(newLink(LinkInterface*))); QSignalSpy spyS(LinkManager::instance(), SIGNAL(newLink(LinkInterface*)));
...@@ -391,10 +391,10 @@ void UASUnitTest::signalIdUASLink_test() ...@@ -391,10 +391,10 @@ void UASUnitTest::signalIdUASLink_test()
LinkInterface* b = static_cast<LinkInterface*>(links.at(1)); LinkInterface* b = static_cast<LinkInterface*>(links.at(1));
LinkInterface* c = static_cast<LinkInterface*>(links.at(2)); LinkInterface* c = static_cast<LinkInterface*>(links.at(2));
LinkInterface* d = static_cast<LinkInterface*>(links.at(3)); LinkInterface* d = static_cast<LinkInterface*>(links.at(3));
QCOMPARE(a->getName(), QString("serial port COM 17")); QCOMPARE(a->getName(), QString("COM 17"));
QCOMPARE(b->getName(), QString("serial port COM 18")); QCOMPARE(b->getName(), QString("COM 18"));
QCOMPARE(c->getName(), QString("serial port COM 19")); QCOMPARE(c->getName(), QString("COM 19"));
QCOMPARE(d->getName(), QString("serial port COM 20")); QCOMPARE(d->getName(), QString("COM 20"));
LinkManager::instance()->removeLink(myLink4); LinkManager::instance()->removeLink(myLink4);
delete myLink4; delete myLink4;
......
...@@ -144,6 +144,10 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), ...@@ -144,6 +144,10 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
attitudeStamped(false), attitudeStamped(false),
lastAttitude(0), lastAttitude(0),
roll(0.0),
pitch(0.0),
yaw(0.0),
paramsOnceRequested(false), paramsOnceRequested(false),
simulation(0), simulation(0),
......
...@@ -54,7 +54,10 @@ void MAVLinkDecoder::receiveMessage(LinkInterface* link,mavlink_message_t messag ...@@ -54,7 +54,10 @@ void MAVLinkDecoder::receiveMessage(LinkInterface* link,mavlink_message_t messag
uint8_t msgid = message.msgid; uint8_t msgid = message.msgid;
// Handle time sync message // Store an arrival time for this message. This value ends up being calculated later.
quint64 time = 0;
// The SYSTEM_TIME message is special, in that it's handled here for synchronizing the QGC time with the remote time.
if (message.msgid == MAVLINK_MSG_ID_SYSTEM_TIME) if (message.msgid == MAVLINK_MSG_ID_SYSTEM_TIME)
{ {
mavlink_system_time_t timebase; mavlink_system_time_t timebase;
...@@ -65,11 +68,7 @@ void MAVLinkDecoder::receiveMessage(LinkInterface* link,mavlink_message_t messag ...@@ -65,11 +68,7 @@ void MAVLinkDecoder::receiveMessage(LinkInterface* link,mavlink_message_t messag
else else
{ {
QString messageName("%1 (#%2)"); // See if first value is a time value and if it is, use that as the arrival time for this data.
messageName = messageName.arg(messageInfo[msgid].name).arg(msgid);
// See if first value is a time value
quint64 time = 0;
uint8_t fieldid = 0; uint8_t fieldid = 0;
uint8_t* m = ((uint8_t*)(receivedMessages+msgid))+8; uint8_t* m = ((uint8_t*)(receivedMessages+msgid))+8;
if (QString(messageInfo[msgid].fields[fieldid].name) == QString("time_boot_ms") && messageInfo[msgid].fields[fieldid].type == MAVLINK_TYPE_UINT32_T) if (QString(messageInfo[msgid].fields[fieldid].name) == QString("time_boot_ms") && messageInfo[msgid].fields[fieldid].type == MAVLINK_TYPE_UINT32_T)
...@@ -81,21 +80,16 @@ void MAVLinkDecoder::receiveMessage(LinkInterface* link,mavlink_message_t messag ...@@ -81,21 +80,16 @@ void MAVLinkDecoder::receiveMessage(LinkInterface* link,mavlink_message_t messag
time = *((quint64*)(m+messageInfo[msgid].fields[fieldid].wire_offset)); time = *((quint64*)(m+messageInfo[msgid].fields[fieldid].wire_offset));
time = (time+500)/1000; // Scale to milliseconds, round up/down correctly time = (time+500)/1000; // Scale to milliseconds, round up/down correctly
} }
else
{
// First value is not time, send out value 0
emitFieldValue(&message, fieldid, getUnixTimeFromMs(message.sysid, 0));
} }
// Align time to global time // Align UAS time to global time
time = getUnixTimeFromMs(message.sysid, time); time = getUnixTimeFromMs(message.sysid, time);
// Send out field values from 1..n // Send out all field values for this message
for (unsigned int i = 1; i < messageInfo[msgid].num_fields; ++i) for (int i = 0; i < messageInfo[msgid].num_fields; ++i)
{ {
emitFieldValue(&message, i, time); emitFieldValue(&message, i, time);
} }
}
// Send out combined math expressions // Send out combined math expressions
// FIXME XXX TODO // FIXME XXX TODO
......
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