main.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <QGuiApplication>
  2. #include <QQmlEngine>
  3. #include <QQuickView>
  4. #include <QDebug>
  5. #include "remotecontrolclient.h"
  6. #include "qgrpchttp2channel.h"
  7. #include "insecurecredentials.h"
  8. class NoneCredencials : public QtProtobuf::CallCredentials
  9. {
  10. public:
  11. NoneCredencials() : QtProtobuf::CallCredentials(QtProtobuf::AbstractCredentials::CredentialMap{}) {}
  12. };
  13. int main(int argc, char *argv[])
  14. {
  15. QGuiApplication app(argc, argv);
  16. remotecontrol::RemoteControlClient client;
  17. auto chan = std::shared_ptr<QtProtobuf::QGrpcHttp2Channel>(new QtProtobuf::QGrpcHttp2Channel(QUrl("http://localhost:65001"), QtProtobuf::InsecureCredentials()|NoneCredencials()));
  18. client.attachChannel(chan);
  19. QObject::connect(&client, &remotecontrol::RemoteControlClient::ActivationsUpdated, [](const remotecontrol::LayerMatrix &activations) {
  20. qDebug() << "ActivationsUpdated:" << activations.layer();
  21. });
  22. QObject::connect(&client, &remotecontrol::RemoteControlClient::BiasesUpdated, [](const remotecontrol::LayerMatrix &biases) {
  23. qDebug() << "BiasesUpdated:" << biases.layer();
  24. });
  25. QObject::connect(&client, &remotecontrol::RemoteControlClient::WeightsUpdated, [](const remotecontrol::LayerMatrix &weights) {
  26. qDebug() << "WeightsUpdated:" << weights.layer();
  27. });
  28. client.subscribeActivationsUpdates({});
  29. client.subscribeBiasesUpdates({});
  30. client.subscribeWeightsUpdates({});
  31. return app.exec();
  32. }