QAndroidBinder Class

Umfasst die wichtigsten Methoden der Android Binder Klasse. Mehr...

Kopfzeile: #include <QtCore/private/qandroidextras_p.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::CorePrivate)
qmake: QT += core-private
Seit: Qt 6.2
Status: Vorläufig

Diese Klasse befindet sich in der Entwicklung und kann sich noch ändern.

Öffentliche Typen

enum class CallType { Normal, OneWay }

Öffentliche Funktionen

QAndroidBinder()
QAndroidBinder(const QJniObject &binder)
QJniObject handle() const
virtual bool onTransact(int code, const QAndroidParcel &data, const QAndroidParcel &reply, QAndroidBinder::CallType flags)
bool transact(int code, const QAndroidParcel &data, QAndroidParcel *reply = nullptr, QAndroidBinder::CallType flags = CallType::Normal) const

Detaillierte Beschreibung

QAndroidBinder ist eine Komfortklasse, die die wichtigsten Android-Binder-Methoden umhüllt.

Dokumentation der Mitgliedstypen

enum class QAndroidBinder::CallType

Diese Aufzählung wird mit QAndroidBinder::transact() verwendet, um den Modus zu beschreiben, in dem der IPC-Aufruf ausgeführt wird.

KonstanteWertBeschreibung
QAndroidBinder::CallType::Normal0normale IPC, d.h. der Aufrufende wartet auf das Ergebnis des Aufgerufenen
QAndroidBinder::CallType::OneWay1Einweg-IPC, d.h. der Aufrufer kehrt sofort zurück, ohne auf ein Ergebnis des Aufrufers zu warten

Dokumentation der Mitgliedsfunktionen

[explicit] QAndroidBinder::QAndroidBinder()

Erzeugt ein neues Objekt, das zur Durchführung von IPC verwendet werden kann.

Siehe auch onTransact und transact.

QAndroidBinder::QAndroidBinder(const QJniObject &binder)

Erzeugt ein neues Objekt aus dem Java-Objekt binder.

Siehe auch transact.

QJniObject QAndroidBinder::handle() const

Der Rückgabewert ist nützlich, um andere Java-APIs aufzurufen, die nicht von diesem Wrapper abgedeckt werden

[virtual] bool QAndroidBinder::onTransact(int code, const QAndroidParcel &data, const QAndroidParcel &reply, QAndroidBinder::CallType flags)

Die Standardimplementierung ist ein Stub, der false zurückgibt. Der Benutzer sollte diese Methode außer Kraft setzen, um die Transaktionsdaten vom Aufrufer zu erhalten.

Die code ist die auszuführende Aktion. data sind die vom Aufrufer gesendeten Daten in Form von Datenpaketen.
The reply is the marshaled data to be sent to the caller.
The flags are the additional operation flags.

Warnung: Diese Methode wird vom Binder-Thread aus aufgerufen, der sich von dem Thread unterscheidet, in dem dieses Objekt erstellt wurde.

Siehe auch transact.

bool QAndroidBinder::transact(int code, const QAndroidParcel &data, QAndroidParcel *reply = nullptr, QAndroidBinder::CallType flags = CallType::Normal) const

Führt einen IPC-Aufruf aus

Die code ist die auszuführende Aktion. Sollte zwischen FIRST_CALL_TRANSACTION und LAST_CALL_TRANSACTION liegen.
The data is the marshaled data to send to the target.
The reply (if specified) is the marshaled data to be received from the target. May be nullptr if you are not interested in the return value.
The flags are the additional operation flags.

Gibt bei Erfolg true zurück

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.