QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
AndroidSerial::PortListener Class Referenceabstract

#include <AndroidSerialJni.h>

Public Member Functions

virtual bool newDataArrived (const char *bytes, int length)=0
virtual void bytesWritten (int count)=0
virtual void resourceErrorArrived (ResourceErrorReason reason, const QString &detail)=0

Protected Member Functions

 PortListener ()=default
 ~PortListener ()=default

Detailed Description

What a registered port hears from Java. Java calls on a thread of its own, and AndroidSerial holds a lock meanwhile that unregisterPort() takes, so neither function may wait for the port's thread or unregister.

Definition at line 68 of file AndroidSerialJni.h.

Constructor & Destructor Documentation

◆ PortListener()

AndroidSerial::PortListener::PortListener ( )
protecteddefault

Referenced by ~PortListener().

◆ ~PortListener()

AndroidSerial::PortListener::~PortListener ( )
protecteddefault

References PortListener().

Member Function Documentation

◆ bytesWritten()

virtual void AndroidSerial::PortListener::bytesWritten ( int count)
pure virtual

This many of the bytes handed to writeAsync() are done with: the device has taken them, or purgeBuffers() discarded them unsent.

Referenced by AndroidSerial::deliverBytesWritten(), and AndroidSerial::selfTest().

◆ newDataArrived()

virtual bool AndroidSerial::PortListener::newDataArrived ( const char * bytes,
int length )
pure virtual

Takes the port's input and returns whether the port has room for more. If not, Java's read thread stops reading the device, which holds its input back, until startReading() is called for the port.

Referenced by AndroidSerial::deliverNewData(), and AndroidSerial::selfTest().

◆ resourceErrorArrived()

virtual void AndroidSerial::PortListener::resourceErrorArrived ( ResourceErrorReason reason,
const QString & detail )
pure virtual

The port can no longer transfer data. The detail is what the failure itself says, such as the message of Java's exception, or nothing.

Referenced by AndroidSerial::deliverResourceError(), and AndroidSerial::selfTest().


The documentation for this class was generated from the following file: