QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
AndroidSerialJni.h File Reference
#include <chrono>
#include <QtCore/QByteArray>
#include <QtCore/QLoggingCategory>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include "AndroidSerialApp.h"
#include "AndroidSerialPort.h"
#include "AndroidSerialPortInfo.h"
Include dependency graph for AndroidSerialJni.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  AndroidSerial::PortListener

Namespaces

namespace  AndroidSerial

Typedefs

using AndroidSerial::PortHandle = qint64
 Names an open port in every call to Java and in Java's callbacks. registerPort() makes one.

Enumerations

enum class  AndroidSerial::FlowControl {
  AndroidSerial::None = 0 , AndroidSerial::RtsCts , AndroidSerial::DtrDsr , AndroidSerial::XonXoff ,
  AndroidSerial::XonXoffInline
}
enum class  AndroidSerial::Result : int {
  AndroidSerial::Ok = 0 , AndroidSerial::Failed = -1 , AndroidSerial::IoError = -2 , AndroidSerial::Unsupported = -3 ,
  AndroidSerial::NotOpen = -4 , AndroidSerial::DeviceNotFound = -5 , AndroidSerial::PermissionDenied = -6 , AndroidSerial::AlreadyOpen = -7 ,
  AndroidSerial::PermissionRequested = -8 , AndroidSerial::PermissionPending = -9 , AndroidSerial::PermissionAwaitsAndroid = -10 , AndroidSerial::PermissionAwaitsFocus = -11 ,
  AndroidSerial::AmbiguousName = -12
}
enum class  AndroidSerial::ResourceErrorReason : int { AndroidSerial::DeviceDetached = 1 , AndroidSerial::ReadFailed = 2 , AndroidSerial::WriteFailed = 3 }
 Why a port can no longer transfer data. QGCUsbSerialResourceError.java lists the same values. More...

Functions

PortHandle AndroidSerial::registerPort (PortListener *listener)
 Returns a handle under which Java's callbacks reach the listener until unregisterPort() has returned.
void AndroidSerial::unregisterPort (PortHandle handle)
bool AndroidSerial::deliverNewData (PortHandle handle, const char *bytes, int length)
void AndroidSerial::deliverBytesWritten (PortHandle handle, int count)
void AndroidSerial::deliverResourceError (PortHandle handle, ResourceErrorReason reason, const QString &detail)
QList< QSerialPortInfo > AndroidSerial::availablePorts ()
QList< QSerialPortInfo > AndroidSerial::portsAwaitingPermission ()
 The ports of attached devices that still need USB permission.
bool AndroidSerial::hasPermission (const QString &portName)
 Whether QGC may open the device of this port.
bool AndroidSerial::requestPermission (const QString &portName)
bool AndroidSerial::isPermissionDenied (const QString &portName)
bool AndroidSerial::isPortNameValid (const QString &portName)
 Whether an attached device has a port with this name.
bool AndroidSerial::isPortOpen (const QString &portName)
PortHandle AndroidSerial::getPortHandle (const QString &portName)
 The handle of the open port with this name, or kNoPort.
QString AndroidSerial::getLastErrorDetail ()
int AndroidSerial::open (const QString &portName, PortHandle handle)
Result AndroidSerial::close (PortHandle handle)
Result AndroidSerial::startReading (PortHandle handle)
Result AndroidSerial::stopReading (PortHandle handle)
 Stops delivering the port's input until startReading(); what arrives meanwhile is dropped.
bool AndroidSerial::isReading (PortHandle handle)
QByteArray AndroidSerial::read (PortHandle handle, int length, std::chrono::milliseconds timeout)
int AndroidSerial::write (PortHandle handle, const char *data, int length, std::chrono::milliseconds timeout)
 Returns length, or a Result: Failed if the write timed out, otherwise what writeWithProgress() reports.
int AndroidSerial::writeWithProgress (PortHandle handle, const char *data, int length, std::chrono::milliseconds timeout)
int AndroidSerial::writeAsync (PortHandle handle, const char *data, int length)
Result AndroidSerial::setParameters (PortHandle handle, qint32 baudRate, QSerialPort::DataBits dataBits, QSerialPort::StopBits stopBits, QSerialPort::Parity parity)
FlowControl AndroidSerial::getFlowControl (PortHandle handle)
 None also if the port cannot be asked.
Result AndroidSerial::setFlowControl (PortHandle handle, QSerialPort::FlowControl flowControl)
QList< FlowControl > AndroidSerial::getSupportedFlowControl (PortHandle handle)
 The flow control the port's driver has.
bool AndroidSerial::getXon (PortHandle handle)
 Under XON/XOFF flow control, false while the device has paused transmission.
Result AndroidSerial::setLatencyTimer (PortHandle handle, int milliseconds)
 Sets how long an FTDI chip holds back a partly filled packet, 1 to 255 ms. No other chip supports it.
Result AndroidSerial::setBreak (PortHandle handle, bool set)
Result AndroidSerial::purgeBuffers (PortHandle handle, QSerialPort::Directions directions)
Result AndroidSerial::setDataTerminalReady (PortHandle handle, bool set)
Result AndroidSerial::setRequestToSend (PortHandle handle, bool set)
QSerialPort::PinoutSignals AndroidSerial::getControlLines (PortHandle handle)
 The control lines that are active.
bool AndroidSerial::isControlLineActive (PortHandle handle, QSerialPort::PinoutSignal line)
 Whether this one of the control lines is active.
QSerialPort::PinoutSignals AndroidSerial::getSupportedControlLines (PortHandle handle)
 The control lines the port has at all. None also if the port cannot be asked.
bool AndroidSerial::isControlLineSupported (PortHandle handle, QSerialPort::PinoutSignal line)
 Whether the port has this one of the control lines.
Result AndroidSerial::echoToCallbacks (PortHandle handle, const char *data, int length, int deliveredLength, int written, ResourceErrorReason reason, const QString &detail)
QStringList AndroidSerial::unboundJavaNames ()

Variables

constexpr const char * AndroidSerial::kJniUsbSerialManagerClassName = "org/mavlink/qgroundcontrol/serial/QGCUsbSerialManager"
constexpr PortHandle AndroidSerial::kNoPort = 0