12345678910111213141516171819202122232425262728293031323334353637 |
- #include <QGuiApplication>
- #include <QQmlEngine>
- #include <QQuickView>
- #include <QDebug>
- #include "remotecontrolclient.h"
- #include "qgrpchttp2channel.h"
- #include "insecurecredentials.h"
- class NoneCredencials : public QtProtobuf::CallCredentials
- {
- public:
- NoneCredencials() : QtProtobuf::CallCredentials(QtProtobuf::AbstractCredentials::CredentialMap{}) {}
- };
- int main(int argc, char *argv[])
- {
- QGuiApplication app(argc, argv);
- remotecontrol::RemoteControlClient client;
- auto chan = std::shared_ptr<QtProtobuf::QGrpcHttp2Channel>(new QtProtobuf::QGrpcHttp2Channel(QUrl("http://localhost:65001"), QtProtobuf::InsecureCredentials()|NoneCredencials()));
- client.attachChannel(chan);
- QObject::connect(&client, &remotecontrol::RemoteControlClient::ActivationsUpdated, [](const remotecontrol::LayerMatrix &activations) {
- qDebug() << "ActivationsUpdated:" << activations.layer();
- });
- QObject::connect(&client, &remotecontrol::RemoteControlClient::BiasesUpdated, [](const remotecontrol::LayerMatrix &biases) {
- qDebug() << "BiasesUpdated:" << biases.layer();
- });
- QObject::connect(&client, &remotecontrol::RemoteControlClient::WeightsUpdated, [](const remotecontrol::LayerMatrix &weights) {
- qDebug() << "WeightsUpdated:" << weights.layer();
- });
- client.subscribeActivationsUpdates({});
- client.subscribeBiasesUpdates({});
- client.subscribeWeightsUpdates({});
- return app.exec();
- }
|