QAndroidBinder Class

Android Binderクラスの最も重要なメソッドをラップします。詳細...

ヘッダー #include <QtCore/private/qandroidextras_p.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::CorePrivate)
qmake: QT += core-private
以来:Qt 6.2
ステータス暫定版

このクラスは開発中であり、変更される可能性があります。

パブリックな型

enum class CallType { Normal, OneWay }

パブリック関数

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

詳しい説明

QAndroidBinderは、最も重要なAndroid Binderメソッドをラップした便利なクラスです。

メンバ型の説明

enum class QAndroidBinder::CallType

この列挙型は、QAndroidBinder::transact ()とともに使用され、IPC呼び出しが実行されるモードを記述する。

定数説明
QAndroidBinder::CallType::Normal0通常のIPC、つまり、呼び出し側は着呼側からの結果を待ちます。
QAndroidBinder::CallType::OneWay1一方向IPC、つまり、呼び出し側は、着呼側からの結果を待たずに、すぐに戻る。

メンバ関数ドキュメント

[explicit] QAndroidBinder::QAndroidBinder()

IPC を実行するために使用できる新しいオブジェクトを作成する。

onTransact およびtransactも参照のこと

QAndroidBinder::QAndroidBinder(const QJniObject &binder)

binder Javaオブジェクトから新しいオブジェクトを作成します。

transactも参照してください

QJniObject QAndroidBinder::handle() const

戻り値は、このラッパーでカバーされていない他のJava APIを呼び出すのに便利です。

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

デフォルトの実装は false を返すスタブである。呼び出し元から取引データを取得するには、このメソッドをオーバーライドする必要があります。

code は実行するアクションである。data は呼び出し元から送られたマーシャリングされたデータである。
The reply is the marshaled data to be sent to the caller.
The flags are the additional operation flags.

警告 このメソッドは、このオブジェクトが作成されたスレッドとは異なるバインダーのスレッドから呼び出されます。

transactも参照してください

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

IPCコールを実行する

code は実行するアクションである。FIRST_CALL_TRANSACTIONと LAST_CALL_TRANSACTIONの間でなければならない。
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.

成功時に true を返す

© 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.