-
-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Not tested with a real telemetry source yet. This does not require any setting to change the telemetry protocol in use, because the ground station uses different ports already, we just listen on each of them in the different telemetry classes and everything will just work. Ref: #17
- Loading branch information
1 parent
8764206
commit 918473d
Showing
5 changed files
with
374 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#ifndef SMARTPORTTELEMETRY_H | ||
#define SMARTPORTTELEMETRY_H | ||
|
||
#include <QObject> | ||
#include <QtQuick> | ||
|
||
#include "constants.h" | ||
|
||
|
||
typedef struct { | ||
uint16_t id; | ||
union { | ||
uint32_t u32; | ||
int32_t i32; | ||
uint16_t u16; | ||
int16_t i16; | ||
uint8_t u8; | ||
uint8_t b[4]; | ||
int8_t i8; | ||
float f; | ||
} data; | ||
uint8_t crc; | ||
} tSPortData; | ||
|
||
|
||
class QUdpSocket; | ||
|
||
class SmartportTelemetry: public QObject { | ||
Q_OBJECT | ||
|
||
public: | ||
explicit SmartportTelemetry(QObject *parent = nullptr); | ||
|
||
|
||
Q_PROPERTY(QString last_heartbeat MEMBER m_last_heartbeat WRITE set_last_heartbeat NOTIFY last_heartbeat_changed) | ||
void set_last_heartbeat(QString last_heartbeat); | ||
|
||
signals: | ||
void last_heartbeat_changed(QString last_heartbeat); | ||
|
||
|
||
private slots: | ||
void processSmartportDatagrams(); | ||
|
||
private: | ||
void init(); | ||
void smartport_read(uint8_t *buf, int buflen); | ||
uint8_t u8CheckCrcSPORT(uint8_t *t); | ||
|
||
void processSmartportMessage(uint8_t *b); | ||
|
||
QUdpSocket *smartportSocket = nullptr; | ||
|
||
QString m_last_heartbeat = "N/A"; | ||
qint64 last_heartbeat_timestamp; | ||
|
||
}; | ||
|
||
#endif //SMARTPORTTELEMETRY_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.