29 #include <grpcpp/channel.h>
30 #include <grpcpp/impl/codegen/byte_buffer.h>
31 #include <grpcpp/impl/codegen/client_context.h>
32 #include <grpcpp/impl/codegen/sync_stream.h>
33 #include <grpcpp/security/credentials.h>
35 #include "qabstractgrpccredentials.h"
36 #include "qgrpcasyncreply.h"
37 #include "qgrpcsubscription.h"
38 #include "qabstractgrpcclient.h"
39 #include "qgrpccredentials.h"
40 #include "qprotobufserializerregistry_p.h"
41 #include "qtprotobuflogging.h"
43 namespace QtProtobuf {
46 class QGrpcChannelSubscription :
public QObject {
51 QGrpcChannelSubscription(grpc::Channel *channel,
const QString &method,
const QByteArray &data, QObject *parent =
nullptr);
52 ~QGrpcChannelSubscription();
58 void dataReady(
const QByteArray &data);
66 grpc::ClientContext context;
67 grpc::ClientReader<grpc::ByteBuffer> *reader =
nullptr;
71 class QGrpcChannelCall :
public QObject {
76 QGrpcChannelCall(grpc::Channel *channel,
const QString &method,
const QByteArray &data, QObject *parent =
nullptr);
91 grpc::ClientContext context;
95 struct QGrpcChannelPrivate {
97 std::shared_ptr<grpc::Channel> m_channel;
99 QGrpcChannelPrivate(
const QUrl &url, std::shared_ptr<grpc::ChannelCredentials> credentials);
100 ~QGrpcChannelPrivate();
102 void call(
const QString &method,
const QString &service,
const QByteArray &args, QGrpcAsyncReply *reply);
103 QGrpcStatus call(
const QString &method,
const QString &service,
const QByteArray &args, QByteArray &ret);
104 void subscribe(QGrpcSubscription *subscription,
const QString &service, QAbstractGrpcClient *client);