QAndroidBinder Class
Racchiude i metodi più importanti della classe Binder di Android. Per saperne di più...
| Intestazione: | #include <QtCore/private/qandroidextras_p.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS CorePrivate) target_link_libraries(mytarget PRIVATE Qt6::CorePrivate) |
| qmake: | QT += core-private |
| A partire da: | Qt 6.2 |
| Stato: | Anteprima tecnologica |
Questa classe è in anteprima tecnologica ed è soggetta a modifiche.
Tipi pubblici
| enum class | CallType { Normal, OneWay } |
Funzioni pubbliche
| 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 |
Descrizione dettagliata
QAndroidBinder è una classe di utilità che racchiude i metodi più importanti di Android Binder.
Documentazione sui tipi dei membri
enum class QAndroidBinder::CallType
Questa enumerazione viene utilizzata con la funzione ` QAndroidBinder::transact()` per descrivere la modalità in cui viene eseguita la chiamata IPC.
| Costante | Valore | Descrizione |
|---|---|---|
QAndroidBinder::CallType::Normal | 0 | IPC normale, ovvero il chiamante attende il risultato dal chiamato |
QAndroidBinder::CallType::OneWay | 1 | IPC unidirezionale: il chiamante ritorna immediatamente, senza attendere il risultato dal chiamato |
Documentazione delle funzioni membro
[explicit] QAndroidBinder::QAndroidBinder()
Crea un nuovo oggetto che può essere utilizzato per eseguire l'IPC.
Vedi anche onTransact e transact.
QAndroidBinder::QAndroidBinder(const QJniObject &binder)
Crea un nuovo oggetto a partire dall'oggetto Java ` binder `.
Vedi anche transact.
QJniObject QAndroidBinder::handle() const
Il valore restituito è utile per richiamare altre API Java non coperte da questo wrapper
[virtual] bool QAndroidBinder::onTransact(int code, const QAndroidParcel &data, const QAndroidParcel &reply, QAndroidBinder::CallType flags)
L'implementazione predefinita è uno stub che restituisce false. L'utente dovrebbe sovrascrivere questo metodo per ottenere i dati della transazione dal chiamante.
L'code è l'azione da eseguire. L'data è il dato marshalato inviato dal chiamante.
The reply is the marshaled data to be sent to the caller.
The flags are the additional operation flags.
Attenzione: questo metodo viene chiamato dal thread di Binder, che è diverso dal thread in cui è stato creato questo oggetto.
Vedi anche transact.
bool QAndroidBinder::transact(int code, const QAndroidParcel &data, QAndroidParcel *reply = nullptr, QAndroidBinder::CallType flags = CallType::Normal) const
Esegue una chiamata IPC
L'code e è l'azione da eseguire. Deve trovarsi tra FIRST_CALL_TRANSACTION e 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.
Restituisce "true" in caso di esito positivo
© 2026 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.