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{
40 bool ok = false;
41 const QList<QSerialPortInfo> serialPortInfoList = availablePortsByFiltersOfDevices(ok);
42 return (ok ? serialPortInfoList : QList<QSerialPortInfo>());
43}
44
46{
47 return (source.startsWith(QLatin1Char('/')) || source.startsWith(QLatin1String("./")) ||
48 source.startsWith(QLatin1String("../")))
49 ? source
50 : (QLatin1String("/dev/") + source);
51}
52
54{
55 return source.startsWith(QLatin1String("/dev/")) ? source.mid(5) : source;
56}
57
58QT_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()
friend QList< QSerialPortInfo > availablePortsByFiltersOfDevices(bool &ok)
QList< QSerialPortInfo > availableDevices()
QT_BEGIN_NAMESPACE
QT_BEGIN_NAMESPACE QList< QSerialPortInfo > availablePortsByFiltersOfDevices(bool &ok)
QList< QSerialPortInfo > availablePortsByUdev(bool &ok)
QList< QSerialPortInfo > availablePortsBySysfs(bool &ok)