Skip to content

Commit

Permalink
Block reading data if bad mount point
Browse files Browse the repository at this point in the history
  • Loading branch information
zdanek committed Dec 17, 2024
1 parent cd2b678 commit 9febc9b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/NTRIP/NTRIP.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "PositionManager.h"
#include "NTRIPSettings.h"

QGC_LOGGING_CATEGORY(NTRIPLog, "NTRIP")

NTRIP::NTRIP(QGCApplication* app, QGCToolbox* toolbox)
: QGCTool(app, toolbox)
{
Expand Down Expand Up @@ -241,6 +243,11 @@ void NTRIPTCPLink::_readBytes(void)

// throw new Exception("Got SOURCETABLE - Bad ntrip mount point\n\n" + line);

if (_state == NTRIPState::uninitialised) {
qCDebug(NTRIPLog) << "NTRIP State is uninitialised. Discarding bytes";
_socket->readAll();
return;
}

QByteArray bytes = _socket->readAll();
_parse(bytes);
Expand Down
2 changes: 2 additions & 0 deletions src/NTRIP/NTRIP.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "Drivers/src/rtcm.h"
#include "RTCM/RTCMMavlink.h"

Q_DECLARE_LOGGING_CATEGORY(NTRIPLog)

class NTRIPSettings;

class NTRIPTCPLink : public QThread
Expand Down
1 change: 0 additions & 1 deletion src/QGCLoggingCategory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ QGC_LOGGING_CATEGORY(GeotaggingLog, "GeotaggingLog")
QGC_LOGGING_CATEGORY(RTKGPSLog, "RTKGPSLog")
QGC_LOGGING_CATEGORY(GuidedActionsControllerLog, "GuidedActionsControllerLog")
QGC_LOGGING_CATEGORY(ADSBVehicleManagerLog, "ADSBVehicleManagerLog")
QGC_LOGGING_CATEGORY(NTRIPLog, "NTRIPLog")
QGC_LOGGING_CATEGORY(LocalizationLog, "LocalizationLog")
QGC_LOGGING_CATEGORY(VideoAllLog, kVideoAllLogCategory)
QGC_LOGGING_CATEGORY(JoystickLog, "JoystickLog")
Expand Down

0 comments on commit 9febc9b

Please sign in to comment.