QAndroidBinder Class
Header: | #include <QAndroidBinder> |
qmake: | QT += androidextras |
Since: | Qt 5.10 |
Public Types
enum | CallType { Normal, OneWay } |
Public Functions
QAndroidBinder() | |
QAndroidBinder(const QAndroidJniObject &binder) | |
virtual | ~QAndroidBinder() |
QAndroidJniObject | 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 |
Detailed Description
The QAndroidBinder is a convenience class that wraps the most important Android Binder methods.
Member Type Documentation
enum QAndroidBinder::CallType
This enum is used with QAndroidBinder::transact() to describe the mode in which the IPC call is performed.
Constant | Value | Description |
---|---|---|
QAndroidBinder::Normal |
0 |
normal IPC, meaning that the caller waits the result from the callee |
QAndroidBinder::OneWay |
1 |
one-way IPC, meaning that the caller returns immediately, without waiting for a result from the callee |
Member Function Documentation
QAndroidBinder::QAndroidBinder()
Creates a new object which can be used to perform IPC.
See also onTransact and transact.
QAndroidBinder::QAndroidBinder(const QAndroidJniObject &binder)
Creates a new object from the binder Java object.
See also transact.
[virtual]
QAndroidBinder::~QAndroidBinder()
Destroys the instance of QAndroidBinder. The destructor is virtual.
QAndroidJniObject QAndroidBinder::handle() const
The return value is useful to call other Java API which are not covered by this wrapper
[virtual]
bool QAndroidBinder::onTransact(int code, const QAndroidParcel &data, const QAndroidParcel &reply, QAndroidBinder::CallType flags)
Default implementation is a stub that returns false. The user should override this method to get the transact data from the caller.
The code is the action to perform. The data is the marshaled data sent by the caller. The reply is the marshaled data to be sent to the caller. The flags are the additional operation flags.
Warning: This method is called from Binder's thread which is different from the thread that this object was created.
See also transact.
bool QAndroidBinder::transact(int code, const QAndroidParcel &data, QAndroidParcel *reply = nullptr, QAndroidBinder::CallType flags = CallType::Normal) const
Performs an IPC call
The code is the action to perform. Should be between FIRST_CALL_TRANSACTION and 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.
Returns true on success
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.12/qandroidbinder.html