Skip to content
  • Can J1939 Example

    Unsolved General and Desktop
    3
    0 Votes
    3 Posts
    404 Views
    Y

    @JKSH thanks for the reply.

    I want to implement DTC parsing and want to develop GUI based on data received through it.

    Mainly I want belwo 2 things to implement.
    1.DTC parsing to get SPN/FMI details.
    2.Decoding PGN and related details from received CAN frame.

  • 0 Votes
    3 Posts
    487 Views
    M

    How did you come to the conclusion that the image does not support that module? Looks like socketCAN will support that module so as long as socketCAN is part of that recipe then you should be okay.

  • send message with Peak can bus

    Unsolved General and Desktop
    11
    0 Votes
    11 Posts
    1k Views
    R

    Thanks Pablo, with "CAN Bus example" it works. Now I have to understand why my code doesn't work

  • 0 Votes
    2 Posts
    935 Views
    JonBJ

    @simone-malvezzi
    No, Qt does not supply a set of measurement conversion tables, that's not its job. You could write it yourself, see if there is any pre-written C++ libraries/tables provided, or possibly grab them off the net, either dynamically or statically.

    As an aside, you will have to decide how "complete" you want to be. Personally I am great fan of Imperial instead of this Metric rubbish, but even I don't measure in "rods", "poles" & "perches" (e.g. http://www.northcravenheritage.org.uk/NCHTJto2009/Journals/2006/RodsPolesPerches/RodsPolesPerches.html) ;-) Though --- and I'm sure you're fascinated --- in winter I measure temperature in Centigrade but in summer I measure in Farenheit....

  • QTimers and QThreads

    Unsolved General and Desktop
    2
    0 Votes
    2 Posts
    485 Views
    jsulmJ

    @TMJJ001 said in QTimers and QThreads:

    connect(&cThread,SIGNAL(started()),this,SLOT(DoWork()));

    You do NOT execute DoWork() in that thread, you execute it in the GUI thread.
    Take a closer look at the example here: https://doc.qt.io/qt-5/qthread.html

  • 0 Votes
    11 Posts
    2k Views
    B

    @aha_1980 said in Problem reading a message from a QCanBusDevice.:

    A circular buffer will not help to filter out messages you are not interested in.

    I want to use it to store the messages in order to avoid two device attempting to access to the network at the same time

  • 0 Votes
    11 Posts
    967 Views
    B

    @aha_1980 Thanks you.
    Regards,

  • 0 Votes
    11 Posts
    4k Views
    B

    @aha_1980 i call setConfiguration parameter in my class constructor.
    Here is my class header

    #ifndef CANOPENDEVICE_H #define CANOPENDEVICE_H #include <QObject> #include <QSettings> #include <QQmlEngine> #include "protocolmanager.h" #include "ByteArrayQmlWrapper.h" #include "objectdictionary.h" #include "TypesQmlWrapper.h" #include "QQmlVarPropertyHelpers.h" #include "QQmlConstRefPropertyHelpers.h" #include "QQmlPtrPropertyHelpers.h" #include "edsreader.h" #include "QQmlEnumClassHelper.h" #include "QQmlObjectListModel.h" #include "QQmlListPropertyHelper.h" QML_ENUM_CLASS (CanOpenNmtCmd, StartNode = 0x01, StopNode = 0x02, SetPreOp = 0x80, ResetNode = 0x81, ResetComm = 0x82, NB_CMDS) QML_ENUM_CLASS (CanOpenLssCommands, SwitchState = 0x04, ChangeNodeId = 0x11, ChangeBitrate = 0x13, StoreConfig = 0x17, NB_CMDS) class CanOpenDevice: public QObject { Q_OBJECT QML_WRITABLE_VAR_PROPERTY(CanOpenNodeId,nodeId) QML_WRITABLE_VAR_PROPERTY (bool, isMaster) QML_WRITABLE_PTR_PROPERTY (QCanBusDevice, device) QML_WRITABLE_PTR_PROPERTY(ProtocolManager,protocolManager) QML_WRITABLE_VAR_PROPERTY (QString, edsFileName) QML_WRITABLE_VAR_PROPERTY(QString,deviceName) QML_WRITABLE_VAR_PROPERTY(QStringList,deviceInfo) QML_WRITABLE_VAR_PROPERTY(QStringList,subEntriesList) QML_WRITABLE_VAR_PROPERTY(QStringList,entries) QML_WRITABLE_VAR_PROPERTY(QString, deviceProfile) public: explicit CanOpenDevice(QObject *parent=Q_NULLPTR); CanOpenDevice(const CanOpenNodeId &nodeId,const QString &identNumber,QObject *parent=nullptr); void init(void); void start(); void stop(void); void reset(void); void createDevice(QString plugin,QString interface); void setConfiguration(int key); ProtocolManager * getProtocolManger(); ObjectDictionary * getObjectDictionary(); Q_INVOKABLE ByteArrayWrapper * createBufferFromInt8 (const QmlBiggestInt value); Q_INVOKABLE ByteArrayWrapper * createBufferFromInt16 (const QmlBiggestInt value); Q_INVOKABLE ByteArrayWrapper * createBufferFromInt32 (const QmlBiggestInt value); Q_INVOKABLE ByteArrayWrapper * createBufferFromUInt8 (const QmlBiggestInt value); Q_INVOKABLE ByteArrayWrapper * createBufferFromUInt16 (const QmlBiggestInt value); Q_INVOKABLE ByteArrayWrapper * createBufferFromUInt32 (const QmlBiggestInt value); Q_INVOKABLE ByteArrayWrapper * createBufferFromHex (const QString & hex); Q_INVOKABLE ByteArrayWrapper * createBufferFromString (const QString & str); Q_INVOKABLE ByteArrayWrapper * readValue (const int index, const int subIndex); Q_INVOKABLE void changeValue (const int index, const int subIndex, ByteArrayWrapper * buffer); Q_INVOKABLE void sendNmtChangeRequest (const int nodeId, const CanOpenNmtCmd::Type state); Q_INVOKABLE void sendLssActionRequest (const CanOpenLssCommands::Type cmd, const int argument = 0); Q_INVOKABLE void sendSdoReadRequest (const int nodeId, const int index, const int subIndex, const bool blockMode = false); Q_INVOKABLE void sendSdoWriteRequest (const int nodeId, const int index, const int subIndex, ByteArrayWrapper * buffer); Q_INVOKABLE void writeValuetoSubEntry(ObjDicIndex index,ObjDicSubIndex subIndex,QString value); Q_INVOKABLE QString getParameterNameforSubEntry(QString subEntry); void getWritableEntries(); Q_INVOKABLE QString entryParamName(QString idxStr); Q_INVOKABLE QString getDefaultValue(QString subIdx); Q_INVOKABLE void modifyValue(QString val,QString subEntry); Q_INVOKABLE QStringList getSubEntries(QString entry); Q_INVOKABLE void dataToCan(QString entry); public slots: Q_INVOKABLE void loadObjectDictionary(QString edsFilePath); //Q_INVOKABLE bool writeValueToEntry(); protected slots: //void onCanOpenParamChanged(void); signals: void initialized(quint32 bitRateKey,QString plugin="systeccan",QString interface = "can"); void started(void); void stopped(void); void reseting(void); void EntryWritten(); void loaded(QString edsFilePath); private: bool m_ready; bool m_running; QString m_interface; QString m_plugin; EdsReader *m_edsReader; QSettings *m_setting; ObjectDictionary *m_obd; }; #endif // CANOPENDEVICE_H
  • 0 Votes
    4 Posts
    1k Views
    B

    @mrjj thank you for you response. My further goal is to expose all this data to a qml application that will allow me to configure my devices correctly. For know i'll try what you suggested.

  • 0 Votes
    2 Posts
    703 Views
    aha_1980A

    @MrBrightSide8: Please tell us more about your setup: Which Operating System are you using, which CAN hardware (and therefore which QCanBus plugin).

    Are you generating this error frame or does it occur without cause?

    Also, I noticed that the CAN bus example will freeze when it encounters an ErrorFrame. Is that an expected behavior?

    Of course this is not expected. I remember playing with error frames some weeks ago and cannot confirm your observation. Can you put a breakpoint when this happens and show me the contents of the error frame in the debugger window? Thanks.

  • 0 Votes
    3 Posts
    1k Views
    K

    @Xatyrian said in How to use QSocketNotifier on write mode on sockets:

    all the time even if there is nothing that has been written !

    It is right behavior, please read how its work (e.g. about select() and so on).

    It need to use like this (e.g. for writing):

    Add data to be written to some internal buffer. Enable the write notifier. When the write notifier fired, just take all data from the buffer and send to ::send/::write. When the write notifier fired again, check for p.3.. If a buffer is empty - just disable wrute notifier.

    AFAIK, there are no ways to know that the data are written physically, to client.

    BTW: You can use qtserialbus module which implements the SocketCAN support (as I can see from your tag), just use a newest Qt version, as 5.3 is too old.

  • 0 Votes
    3 Posts
    2k Views
    T

    Hi,

    Thanks for the quick answer. Now I understand I didn't asked my question correctly.
    I know it is possible to do this, but I actually want to combine a qml into my .ui widget.
    I finally found a tutorial for this (https://www.ics.com/blog/combining-qt-widgets-and-qml-qwidgetcreatewindowcontainer). It says it is only possible to do this from qt 5.0. For my embedded system I'm working with 4.7. So this isn't possible for me.

    Kind regards

  • 0 Votes
    2 Posts
    1k Views
    SGaistS

    Hi and welcome to devnet,

    The module being pretty new (maybe even technical preview), I'd recommend posting this question on the interest mailing list. You'll find there QtCanBus developers/maintainers. This forum is more user oriented.