diff --git a/src/comm/LinkInterface.h b/src/comm/LinkInterface.h index 9ecf75ac1d537ae2f1458e246bd19c422f413c72..96810861af5053bbc4acf8e30b96b21b0f44825c 100644 --- a/src/comm/LinkInterface.h +++ b/src/comm/LinkInterface.h @@ -80,88 +80,9 @@ public: * Bit/s, NOT 104'857'600 Bit/s). * * @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; - /** - * @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 * diff --git a/src/comm/MAVLinkSimulationLink.cc b/src/comm/MAVLinkSimulationLink.cc index a75042bf372b60a214ac80d6f3877fbc5c781e52..f384f460485397ba353ac7768653abde395bb770 100644 --- a/src/comm/MAVLinkSimulationLink.cc +++ b/src/comm/MAVLinkSimulationLink.cc @@ -1004,68 +1004,4 @@ qint64 MAVLinkSimulationLink::getNominalDataRate() const { /* 100 Mbit is reasonable fast and sufficient for all embedded applications */ 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; -} +} \ No newline at end of file diff --git a/src/comm/MAVLinkSimulationLink.h b/src/comm/MAVLinkSimulationLink.h index f5befb91fc5fbd6e4d2a363cc2dd8546a0e4dc3e..2c6c9ed691bd0214a949481df2d7f7525b55b886 100644 --- a/src/comm/MAVLinkSimulationLink.h +++ b/src/comm/MAVLinkSimulationLink.h @@ -60,16 +60,6 @@ public: /* Extensive statistics for scientific purposes */ 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; int getId() const; @@ -80,9 +70,6 @@ public: int getDataBitsType() const; int getStopBitsType() const; - int getLinkQuality() const; - bool isFullDuplex() const; - public slots: void writeBytes(const char* data, qint64 size); void readBytes(); diff --git a/src/comm/OpalLink.cc b/src/comm/OpalLink.cc index 62a09dbda44d86a12e9f6bd08fb076a074474704..98d2204741b48cdc744ed6ea07924d3e647e39aa 100644 --- a/src/comm/OpalLink.cc +++ b/src/comm/OpalLink.cc @@ -508,51 +508,4 @@ bool OpalLink::disconnect() qint64 OpalLink::getNominalDataRate() const { 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; -} +} \ No newline at end of file diff --git a/src/comm/OpalLink.h b/src/comm/OpalLink.h index bfbdfdb676e79b2a752cbe70241b10ea8040d473..04d6eda4773be443e489791ed5fdb2e94b071ca3 100644 --- a/src/comm/OpalLink.h +++ b/src/comm/OpalLink.h @@ -79,14 +79,6 @@ public: 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(); @@ -124,15 +116,8 @@ protected: int id; bool connectState; - quint64 bitsSentTotal; - quint64 bitsSentCurrent; - quint64 bitsSentMax; - quint64 bitsReceivedTotal; - quint64 bitsReceivedCurrent; - quint64 bitsReceivedMax; quint64 connectionStartTime; - QMutex statisticsMutex; QMutex receiveDataMutex; void setName(QString name); diff --git a/src/comm/SerialLink.cc b/src/comm/SerialLink.cc index 6ae7105f59b6d00e123f77f037c61c914b083a84..e11f5a40f2ddd459bfe1f08a7e85ce55843c7a94 100644 --- a/src/comm/SerialLink.cc +++ b/src/comm/SerialLink.cc @@ -208,7 +208,6 @@ void SerialLink::run() // qDebug() << "rx of length " << QString::number(readData.length()); m_bytesRead += readData.length(); - m_bitsReceivedTotal += readData.length() * 8; linkErrorCount = 0; } } @@ -278,9 +277,6 @@ void SerialLink::writeBytes(const char* data, qint64 size) m_transmitBuffer.append(byteArray); } - // Increase write counter - m_bitsSentTotal += size * 8; - // Extra debug logging // qDebug() << byteArray->toHex(); } else { @@ -321,7 +317,6 @@ void SerialLink::readBytes() // fprintf(stderr,"%02x ", v); // } // fprintf(stderr,"\n"); - m_bitsReceivedTotal += numBytes * 8; } } m_dataMutex.unlock(); @@ -420,7 +415,6 @@ bool SerialLink::hardwareConnect() this, SLOT(linkError(SerialLinkPortError_t))); // port->setCommTimeouts(QSerialPort::CtScheme_NonBlockingRead); - m_connectionStartTime = MG::TIME::getGroundTimeNow(); if (!m_port->open(QIODevice::ReadWrite)) { emit communicationUpdate(getName(),"Error opening port: " + m_port->errorString()); @@ -532,62 +526,6 @@ qint64 SerialLink::getNominalDataRate() const 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 { return m_portName; diff --git a/src/comm/SerialLink.h b/src/comm/SerialLink.h index 2bde8be22bbbfb1fd14c2feb09f36c00fdbd6607..88069568514b2504d1d34fcb51975c44e5174122 100644 --- a/src/comm/SerialLink.h +++ b/src/comm/SerialLink.h @@ -97,14 +97,6 @@ public: /* Extensive statistics for scientific purposes */ qint64 getNominalDataRate() const; - qint64 getTotalUpstream(); - qint64 getCurrentUpstream(); - qint64 getMaxUpstream(); - qint64 getTotalDownstream(); - qint64 getCurrentDownstream(); - qint64 getMaxDownstream(); - qint64 getBitsSent() const; - qint64 getBitsReceived() const; void loadSettings(); void writeSettings(); @@ -112,8 +104,6 @@ public: void run(); void run2(); - int getLinkQuality() const; - bool isFullDuplex() const; int getId() const; signals: //[TODO] Refactor to Linkinterface @@ -161,16 +151,6 @@ protected: int m_timeout; 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_writeMutex; QList m_ports; diff --git a/src/comm/TCPLink.cc b/src/comm/TCPLink.cc index f56ef84d3892df20241db3eeb7fc24d7b87bedf6..1ffc8277b4aee76d33dff7f1f4e6f7b0d7740169 100644 --- a/src/comm/TCPLink.cc +++ b/src/comm/TCPLink.cc @@ -224,7 +224,6 @@ bool TCPLink::hardwareConnect(void) } socketIsConnected = true; - connectionStartTime = QGC::groundTimeUsecs()/1000; emit connected(true); return true; @@ -232,6 +231,7 @@ bool TCPLink::hardwareConnect(void) void TCPLink::socketError(QAbstractSocket::SocketError socketError) { + Q_UNUSED(socketError); emit communicationError(getName(), "Error on socket: " + socket->errorString()); } @@ -265,61 +265,4 @@ void TCPLink::setName(QString name) qint64 TCPLink::getNominalDataRate() const { return 54000000; // 54 Mbit -} - -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; -} +} \ No newline at end of file diff --git a/src/comm/TCPLink.h b/src/comm/TCPLink.h index 6c6131d6f4d3bdc85d2d190746e55ad1e39e6927..2b6a9a2c948c34d608abe631c0bbad312fefec54 100644 --- a/src/comm/TCPLink.h +++ b/src/comm/TCPLink.h @@ -71,19 +71,9 @@ public: /* Extensive statistics for scientific purposes */ qint64 getNominalDataRate() const; - qint64 getTotalUpstream(); - qint64 getCurrentUpstream(); - qint64 getMaxUpstream(); - qint64 getTotalDownstream(); - qint64 getCurrentDownstream(); - qint64 getMaxDownstream(); - qint64 getBitsSent() const; - qint64 getBitsReceived() const; void run(); - int getLinkQuality() const; - bool isFullDuplex() const; int getId() const; public slots: @@ -105,14 +95,6 @@ protected: QTcpSocket* socket; bool socketIsConnected; - quint64 bitsSentTotal; - quint64 bitsSentCurrent; - quint64 bitsSentMax; - quint64 bitsReceivedTotal; - quint64 bitsReceivedCurrent; - quint64 bitsReceivedMax; - quint64 connectionStartTime; - QMutex statisticsMutex; QMutex dataMutex; void setName(QString name); diff --git a/src/comm/UDPLink.cc b/src/comm/UDPLink.cc index 2ce6e75abd51d94857221cc658ba7e779c37fbd4..02f05bbc7fe2fadc1c70539f4450a6a5606b2016 100644 --- a/src/comm/UDPLink.cc +++ b/src/comm/UDPLink.cc @@ -344,7 +344,6 @@ bool UDPLink::hardwareConnect(void) emit connected(connectState); if (connectState) { emit connected(); - connectionStartTime = QGC::groundTimeUsecs()/1000; } return connectState; } @@ -380,61 +379,4 @@ void UDPLink::setName(QString name) qint64 UDPLink::getNominalDataRate() const { return 54000000; // 54 Mbit -} - -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; -} +} \ No newline at end of file diff --git a/src/comm/UDPLink.h b/src/comm/UDPLink.h index 4973eaf230dc41624107c65600712302bdda426f..b7ca551050fdcb36a8dd594ecca96633ce583460 100644 --- a/src/comm/UDPLink.h +++ b/src/comm/UDPLink.h @@ -73,19 +73,9 @@ public: /* Extensive statistics for scientific purposes */ qint64 getNominalDataRate() const; - qint64 getTotalUpstream(); - qint64 getCurrentUpstream(); - qint64 getMaxUpstream(); - qint64 getTotalDownstream(); - qint64 getCurrentDownstream(); - qint64 getMaxDownstream(); - qint64 getBitsSent() const; - qint64 getBitsReceived() const; void run(); - int getLinkQuality() const; - bool isFullDuplex() const; int getId() const; public slots: @@ -118,14 +108,6 @@ protected: QList hosts; QList ports; - quint64 bitsSentTotal; - quint64 bitsSentCurrent; - quint64 bitsSentMax; - quint64 bitsReceivedTotal; - quint64 bitsReceivedCurrent; - quint64 bitsReceivedMax; - quint64 connectionStartTime; - QMutex statisticsMutex; QMutex dataMutex; void setName(QString name); diff --git a/src/comm/XbeeLink.cpp b/src/comm/XbeeLink.cpp index 08b62369d67ec490effeb6a41e00b4f384ebae99..c0851379b7d0196d97aa146760b7cc754d462560 100644 --- a/src/comm/XbeeLink.cpp +++ b/src/comm/XbeeLink.cpp @@ -123,42 +123,6 @@ qint64 XbeeLink::getNominalDataRate() const { 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() { emit tryConnectBegin(true); diff --git a/src/comm/XbeeLink.h b/src/comm/XbeeLink.h index 4159cf959388b8636f46dfd4c3280eaac56f2c0b..90640c0c19b3bcf932e24894507f188ee86603bf 100644 --- a/src/comm/XbeeLink.h +++ b/src/comm/XbeeLink.h @@ -35,13 +35,6 @@ public: // virtual functions from LinkInterface QString getName() const; bool isConnected() 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 disconnect(); qint64 bytesAvailable();