blob: 68e672646202858bf3d78a84ac9031b50c521563 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef CLIENT_SERVICE_H
#define CLIENT_SERVICE_H
#include <QObject>
#include <QString>
#include <qqmlregistration.h>
#include <memory>
#include "exampleservice.qpb.h"
#include "exampleservice_client.grpc.qpb.h"
class ClientService : public QObject
{
Q_OBJECT
QML_ELEMENT
QML_SINGLETON
public:
explicit ClientService(QObject *parent = nullptr);
Q_INVOKABLE void sendRequest();
Q_INVOKABLE void setMessage();
void errorOccurred();
signals:
void messageRecieved(const QString &value);
void errorRecieved(const QString &value);
private:
std::unique_ptr<qtgrpc::examples::ExampleService::Client> m_client;
std::unique_ptr<qtgrpc::examples::AnswerResponse> m_response;
};
#endif // CLIENT_SERVICE_H
|