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. How to develop CAN plugin while debugging

How to develop CAN plugin while debugging

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 340 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.
  • F Offline
    F Offline
    federdalla
    wrote on last edited by
    #1

    Hi everybody!

    I would like to develop a canbus plugin, to be compatible with Qt interface of QCanBusDevice .
    To do so i created a project, in which main folder I have this *.pro file:

    TEMPLATE = subdirs
    SUBDIRS = can canusb_vcp
    can.depends = canusb_vcp
    

    then i have two subdirectories, one named can, that is simply the canbus example for qt, but with *.pro file modified like so:

    QT += serialbus widgets serialport
    requires(qtConfig(combobox))
    
    TARGET = can
    TEMPLATE = app
    CONFIG += debug_and_release
    
    SOURCES += \
        bitratebox.cpp \
        connectdialog.cpp \
        main.cpp \
        mainwindow.cpp \
        sendframebox.cpp
    
    HEADERS += \
        bitratebox.h \
        connectdialog.h \
        mainwindow.h \
        sendframebox.h
    
    FORMS   += mainwindow.ui \
        connectdialog.ui \
        sendframebox.ui
    
    RESOURCES += can.qrc
    
    include(../canusb_vcp/canusb_vcp.pri)
    

    as you can see i am including the plugin i am trying to implement

    and then the can plugin has one *.pro file, and one *.pri file:

    canusb_vcp.pro

    QT += serialbus serialport
    
    TEMPLATE = lib
    CONFIG += shared
    CONFIG += debug_and_release
    
    TARGET = canusb_vcp
    
    SOURCES += \
        canusbvcpplugin.cpp \
        canusbvcpbackend.cpp
    
    HEADERS += \
        canusbvcpplugin.h \
        canusbvcpbackend.h \
        canusbvcpbackend_p.h
    
    DISTFILES += \
        plugin.json
    

    canusb_vcp.pri

    LIBTARGET = canusb_vcp
    BASEDIR   = $${PWD}
    INCLUDEPATH *= $${BASEDIR}/canusb_vcp
    LIBS += -L$${DESTDIR} -lcanusb_vcp
    

    this way, after compilation of the project, i can copy the canusb_vcp.dll and put it in the folder of can example executable.
    Then, it runs ok.

    At this point, i would like to continue with the development, but at the same time i would like to debug.
    Can anyone tell me how could i debug a plugin, having a project structured like this? Maybe i should structure it differently?

    Thanks in advance

    aha_1980A 1 Reply Last reply
    1
    • F federdalla

      Hi everybody!

      I would like to develop a canbus plugin, to be compatible with Qt interface of QCanBusDevice .
      To do so i created a project, in which main folder I have this *.pro file:

      TEMPLATE = subdirs
      SUBDIRS = can canusb_vcp
      can.depends = canusb_vcp
      

      then i have two subdirectories, one named can, that is simply the canbus example for qt, but with *.pro file modified like so:

      QT += serialbus widgets serialport
      requires(qtConfig(combobox))
      
      TARGET = can
      TEMPLATE = app
      CONFIG += debug_and_release
      
      SOURCES += \
          bitratebox.cpp \
          connectdialog.cpp \
          main.cpp \
          mainwindow.cpp \
          sendframebox.cpp
      
      HEADERS += \
          bitratebox.h \
          connectdialog.h \
          mainwindow.h \
          sendframebox.h
      
      FORMS   += mainwindow.ui \
          connectdialog.ui \
          sendframebox.ui
      
      RESOURCES += can.qrc
      
      include(../canusb_vcp/canusb_vcp.pri)
      

      as you can see i am including the plugin i am trying to implement

      and then the can plugin has one *.pro file, and one *.pri file:

      canusb_vcp.pro

      QT += serialbus serialport
      
      TEMPLATE = lib
      CONFIG += shared
      CONFIG += debug_and_release
      
      TARGET = canusb_vcp
      
      SOURCES += \
          canusbvcpplugin.cpp \
          canusbvcpbackend.cpp
      
      HEADERS += \
          canusbvcpplugin.h \
          canusbvcpbackend.h \
          canusbvcpbackend_p.h
      
      DISTFILES += \
          plugin.json
      

      canusb_vcp.pri

      LIBTARGET = canusb_vcp
      BASEDIR   = $${PWD}
      INCLUDEPATH *= $${BASEDIR}/canusb_vcp
      LIBS += -L$${DESTDIR} -lcanusb_vcp
      

      this way, after compilation of the project, i can copy the canusb_vcp.dll and put it in the folder of can example executable.
      Then, it runs ok.

      At this point, i would like to continue with the development, but at the same time i would like to debug.
      Can anyone tell me how could i debug a plugin, having a project structured like this? Maybe i should structure it differently?

      Thanks in advance

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi @federdalla,

      I'm the maintainer of QtCanBus, and I'd love to integrate this plugin in the official repo. Do you have any plans open-sourcing it?

      Regarding your problem: I think it should be enough to add LIBS += -L<path/to/compiled-plugin> to the can.pro file. Qt Creator then setup the library search path so when running the CAN Example, the plugin can be loaded.

      You have already set up the dependencies correctly, so the plugin should be rebuild after changes before starting the example.

      Best regards, and I hope we can integrate your plugin into Qt soon :)

      Regards

      Qt has to stay free or it will die.

      1 Reply Last reply
      1
      • F Offline
        F Offline
        federdalla
        wrote on last edited by
        #3

        Hi @aha_1980

        thank you for your answer, I will try your solution as soon as I can.

        I think it would be ok for me to open source it.
        If you could provide me info on how I can contribute, it would be easier.

        Maybe we can get in touch with private messages.

        Regards,

        Federico

        aha_1980A 1 Reply Last reply
        1
        • F federdalla

          Hi @aha_1980

          thank you for your answer, I will try your solution as soon as I can.

          I think it would be ok for me to open source it.
          If you could provide me info on how I can contribute, it would be easier.

          Maybe we can get in touch with private messages.

          Regards,

          Federico

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi @federdalla,

          I'll be very glad to help you - just feel free ping me. I'll just be a bit busy this week...

          I think you should get something up and running first before we talk about the steps to get the plugin merged.

          Best regards

          Qt has to stay free or it will die.

          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