Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt RPC with gRPC over USB

Qt RPC with gRPC over USB

Scheduled Pinned Locked Moved Unsolved General and Desktop
rpcqrpcusbpigweed
7 Posts 3 Posters 943 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Elian
    wrote on 12 Dec 2023, 16:48 last edited by
    #1

    Hi, I'd like to try Qt's RPC classes but I struggle to understand how to use it (using Qt 6.5.3).

    Basically we have a MCU connected to USB which has RPC capabilities with Pigweed RPC and we are able to communicate with it over USB with a simple CLI program. The device is the RPC server and is used to configure and control the device.

    Now I have to make a GUI version of the client and I saw that Qt has a RPC and protobuf capabilities. I am able to compile the proto files of the server in C++ and generate the client gRPc class.
    However I do not understand how to add a channel to enable the communication with the device over USB. Notably I seems I have to use a class that inherits QAbstractGrpcChannel but I can't find examples of how to make yours.
    I see that there exists HTTP 2 channel and a native channel, but the first one I think is not what I need and the second one simply does not exists in my Qt installation, even though a file qgrpcchannel.h with the class exists in Qt's sources.

    #include <QGrpcChannel> // 'QGrpcChannel' file not found
    

    Do you have example of how I could make that work or is it not made for that usage ?

    Thank you for your help !

    J 1 Reply Last reply 13 Dec 2023, 06:35
    0
    • E Elian
      12 Dec 2023, 16:48

      Hi, I'd like to try Qt's RPC classes but I struggle to understand how to use it (using Qt 6.5.3).

      Basically we have a MCU connected to USB which has RPC capabilities with Pigweed RPC and we are able to communicate with it over USB with a simple CLI program. The device is the RPC server and is used to configure and control the device.

      Now I have to make a GUI version of the client and I saw that Qt has a RPC and protobuf capabilities. I am able to compile the proto files of the server in C++ and generate the client gRPc class.
      However I do not understand how to add a channel to enable the communication with the device over USB. Notably I seems I have to use a class that inherits QAbstractGrpcChannel but I can't find examples of how to make yours.
      I see that there exists HTTP 2 channel and a native channel, but the first one I think is not what I need and the second one simply does not exists in my Qt installation, even though a file qgrpcchannel.h with the class exists in Qt's sources.

      #include <QGrpcChannel> // 'QGrpcChannel' file not found
      

      Do you have example of how I could make that work or is it not made for that usage ?

      Thank you for your help !

      J Online
      J Online
      jsulm
      Lifetime Qt Champion
      wrote on 13 Dec 2023, 06:35 last edited by
      #2

      @Elian Did you add

      find_package(Qt6 REQUIRED COMPONENTS Grpc)
      target_link_libraries(mytarget PRIVATE Qt6::Grpc)
      

      to your CMake file?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      E 1 Reply Last reply 15 Dec 2023, 00:23
      1
      • J jsulm
        13 Dec 2023, 06:35

        @Elian Did you add

        find_package(Qt6 REQUIRED COMPONENTS Grpc)
        target_link_libraries(mytarget PRIVATE Qt6::Grpc)
        

        to your CMake file?

        E Offline
        E Offline
        Elian
        wrote on 15 Dec 2023, 00:23 last edited by Elian
        #3

        @jsulm Yes these are in my CMakeLists.

        And when I go to my Qt install Qt/6.5.3/gcc_64/include/QtGrpc (on Linux Mint 20.04) I do not see a header file named QGrpcChannel, even though the doc says it should exist https://doc.qt.io/qt-6.5/qgrpcchannel.html

        Am I doing it wrong ? What I'd like is to send RPC commands over a USB serial device using HDLC. But the more I look and it looks like this module is not appropriate for it.

        J S 2 Replies Last reply 15 Dec 2023, 06:21
        0
        • E Elian
          15 Dec 2023, 00:23

          @jsulm Yes these are in my CMakeLists.

          And when I go to my Qt install Qt/6.5.3/gcc_64/include/QtGrpc (on Linux Mint 20.04) I do not see a header file named QGrpcChannel, even though the doc says it should exist https://doc.qt.io/qt-6.5/qgrpcchannel.html

          Am I doing it wrong ? What I'd like is to send RPC commands over a USB serial device using HDLC. But the more I look and it looks like this module is not appropriate for it.

          J Online
          J Online
          jsulm
          Lifetime Qt Champion
          wrote on 15 Dec 2023, 06:21 last edited by
          #4

          @Elian Does your project actually build? The error you posted comes from code model and can be wrong.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • E Elian
            15 Dec 2023, 00:23

            @jsulm Yes these are in my CMakeLists.

            And when I go to my Qt install Qt/6.5.3/gcc_64/include/QtGrpc (on Linux Mint 20.04) I do not see a header file named QGrpcChannel, even though the doc says it should exist https://doc.qt.io/qt-6.5/qgrpcchannel.html

            Am I doing it wrong ? What I'd like is to send RPC commands over a USB serial device using HDLC. But the more I look and it looks like this module is not appropriate for it.

            S Offline
            S Offline
            semlanik
            wrote on 4 Jan 2024, 06:01 last edited by
            #5

            @Elian It sounds like an issue. I will check.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              semlanik
              wrote on 4 Jan 2024, 06:05 last edited by
              #6

              Ah right we excluded native gRPC channel from packaging, also note that we discontinue its support in 6.7 already. Please use QGrpcHttp2Channel instead.

              You need to build QtGRPC with native gRPC feature enabled to make QGrpcChannel available.

              E 1 Reply Last reply 9 Jan 2024, 17:55
              0
              • S semlanik
                4 Jan 2024, 06:05

                Ah right we excluded native gRPC channel from packaging, also note that we discontinue its support in 6.7 already. Please use QGrpcHttp2Channel instead.

                You need to build QtGRPC with native gRPC feature enabled to make QGrpcChannel available.

                E Offline
                E Offline
                Elian
                wrote on 9 Jan 2024, 17:55 last edited by
                #7

                @semlanik ah I see. Thank you for your answer.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved