QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
qserialportinfo_android.cpp
Go to the documentation of this file.
1// Copyright (C) 2011-2012 Denis Shienkov <denis.shienkov@gmail.com>
2// Copyright (C) 2011 Sergey Belyashov <Sergey.Belyashov@gmail.com>
3// Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
4// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
5
7#include <QtCore/QStringList>
8
9#include <AndroidSerial.h>
10
11#include "qserialport_p.h"
12#include "qserialportinfo.h"
13#include "qserialportinfo_p.h"
14
15QGC_LOGGING_CATEGORY(QSerialPortInfo_AndroidLog, "Android.AndroidSerialPortInfo")
16
18
20{
21 const QList<QSerialPortInfo> serialPortInfoList = AndroidSerial::availableDevices();
22 ok = !serialPortInfoList.isEmpty();
23 return serialPortInfoList;
24}
25
26QList<QSerialPortInfo> availablePortsBySysfs(bool& ok)
27{
28 ok = false;
29 return QList<QSerialPortInfo>();
30}
31
32QList<QSerialPortInfo> availablePortsByUdev(bool& ok)
33{
34 ok = false;
35 return QList<QSerialPortInfo>();
36}
37
38QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
39{
42 }
43
44 bool ok = false;
45 const QList<QSerialPortInfo> serialPortInfoList = availablePortsByFiltersOfDevices(ok);
46 return (ok ? serialPortInfoList : QList<QSerialPortInfo>());
47}
48
50{
51 return (source.startsWith(QLatin1Char('/')) || source.startsWith(QLatin1String("./")) ||
52 source.startsWith(QLatin1String("../")))
53 ? source
54 : (QLatin1String("/dev/") + source);
55}
56
58{
59 return source.startsWith(QLatin1String("/dev/")) ? source.mid(5) : source;
60}
61
62QT_END_NAMESPACE
#define QGC_LOGGING_CATEGORY(name, categoryStr)
static QString portNameFromSystemLocation(const QString &source)
static QString portNameToSystemLocation(const QString &source)
Provides information about existing serial ports.
static QList< QSerialPortInfo > availablePorts()
Returns a list of available serial ports on the system.
friend QList< QSerialPortInfo > availablePortsByFiltersOfDevices(bool &ok)
QList< QSerialPortInfo > availableDevices()
bool usePosixSerial()
QList< QSerialPortInfo > availablePosixPorts()
QT_BEGIN_NAMESPACE QList< QSerialPortInfo > availablePortsByFiltersOfDevices(bool &ok)
QList< QSerialPortInfo > availablePortsByUdev(bool &ok)
QList< QSerialPortInfo > availablePortsBySysfs(bool &ok)