QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
SerialAutoConnect.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QMap>
4
5#include <functional>
6
7#include "LinkConfiguration.h"
8#include "SerialPortManager.h"
9
12{
14 friend class LinkManagerTest;
15
16public:
17 struct Options
18 {
19 bool pixhawk = false;
20 bool sikRadio = false;
21 bool openPilot = false;
22 };
23
24 using Connect = std::function<void(SharedLinkConfigurationPtr&)>;
27 void update(const QList<SerialPortManager::Port>& ports, const Options& options);
28
29private:
30 static bool _allowed(QGCSerialPortInfo::BoardType_t boardType, const Options& options);
31
32 struct Identity
33 {
34 QString physicalDeviceId;
36 bool bootloader;
37 bool operator==(const Identity&) const = default;
38 };
39
40 SerialPortManager& _ports;
41 Connect _connect;
42 QMap<QString, Identity> _identities;
43 SerialPortSettleTracker _waitingPorts;
44 QMap<QString, SharedLinkConfigurationPtr> _configs;
45};
std::shared_ptr< LinkConfiguration > SharedLinkConfigurationPtr
Application-thread MAVLink serial discovery. LinkManager owns creation and live links.
friend class SerialAutoConnectTest
std::function< void(SharedLinkConfigurationPtr &)> Connect
void update(const QList< SerialPortManager::Port > &ports, const Options &options)
friend class LinkManagerTest
Shared serial inventory and exclusive claims. Called on the application thread.