summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2019-03-21 15:09:49 +0100
committerDominik Holland <dominik.holland@pelagicore.com>2019-04-01 12:44:20 +0000
commit77d182798fa45a7dc16b65aefd35639a77c2fed2 (patch)
tree31e5ad882b493dc06a79da499f2e7f2d6fa52b25 /examples
parentbdf25ced227fbd0b5ec7ec36fe658e62bd763838 (diff)
downloadqtivi-77d182798fa45a7dc16b65aefd35639a77c2fed2.tar.gz
ivigenerator: Add support for pending server replies
By default QtRemoteObjects always wants to return a result for a function call right away. For function calls which take longer this doesn't work very well as the Qt main event loop is blocked until the result is ready and in the meantime no other communication can take place. This commit introduces a workaround for this limitation by generating a interface specific PendingResult object which can be returned as a placeholder to inform the client that the result is not yet ready. The actual result is emitted by the server using the pendingResultAvailable signal with the call-id and the result. To also support returning the result right away the return value always needs to be of type QVariant. This also has the good side effect that the client side always gets informed of whether a call has been finished or not as QtRemoteObjects doesn't provide QRemoteObjectPendingReply<void> for this. Change-Id: I68bf29b84b95042b69b5e1a18096f48ee9da7c7c Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp2
-rw-r--r--examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp b/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp
index 3f20ec9..e266407 100644
--- a/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp
+++ b/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp
@@ -57,7 +57,7 @@ ProcessingService::ProcessingService()
setLastMessage(QStringLiteral("Service online."));
}
-int ProcessingService::process(const QString & data)
+QVariant ProcessingService::process(const QString & data)
{
setLastMessage(QStringLiteral("Processed data \'%1\'").arg(data));
return data.length();
diff --git a/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h b/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h
index 8c7f6b2..1f65e82 100644
--- a/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h
+++ b/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h
@@ -60,7 +60,7 @@ class ProcessingService : public ProcessingServiceSimpleSource
public:
ProcessingService();
- int process(const QString & data) override;
+ QVariant process(const QString & data) override;
};
//! [0]
#endif // PROCESSINGSERVICE_H