Index: sources/canbus/frameinterface.h =================================================================== diff -u -r805119c460b4a266d6401c8705f4427e7fbe270f -r56e378f7504701b9e9a9dccaf205aef2fd52c58e --- sources/canbus/frameinterface.h (.../frameinterface.h) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) +++ sources/canbus/frameinterface.h (.../frameinterface.h) (revision 56e378f7504701b9e9a9dccaf205aef2fd52c58e) @@ -1,14 +1,15 @@ /*! * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. - * copyright - * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, - * IN PART OR IN WHOLE, - * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * - * file frameinterface.h - * date 10/26/2019 - * author Behrouz NematiPour + * \file frameinterface.h + * \author (last) Behrouz NematiPour + * \date (last) 07-May-2020 + * \author (original) Behrouz NematiPour + * \date (original) 18-Dec-2019 * */ #pragma once @@ -27,6 +28,7 @@ // forward declarations class tst_canbus; class tst_acknow; +class tst_initializations; // namespace namespace Can { @@ -45,6 +47,7 @@ // friends friend class ::tst_canbus; friend class ::tst_acknow; + friend class ::tst_initializations; /*! * \brief The ChannelGroup enum @@ -60,9 +63,30 @@ QThread *_thread = nullptr; bool _init = false; + + struct Frame { + Can_Id can_Id; + QByteArray data ; + + Frame(Can_Id vCan_Id, const QByteArray &vData) { + can_Id = vCan_Id; + data = vData ; + } + }; + QList _txFrameList; + const quint16 _txFrameList_Max = 4000; // maximum number of frames in the transmit buffer + bool _transmitted = false; + + const quint8 _interval = 7; // keep awake call of the UI board in ms + + QString _timestamp; + // Singleton SINGLETON(FrameInterface) +protected: + void timerEvent(QTimerEvent *); + public slots: bool init(); bool init(QThread &vThread); @@ -76,12 +100,16 @@ void initThread(QThread &vThread); void quitThread(); - void transmitFrame(Can_Id vCan_Id, const QByteArray &vData = 0); ChannelGroup checkChannel(quint32 vFrameId, bool *vOK = nullptr); + void transmitFrame (Can_Id vCan_Id, const QByteArray &vData = 0); + void appendHead (Can_Id vCan_Id, const QByteArray &vData ); + void trnsmtHead (); + void removeHead (); private slots: // Should be private for thread safety and is connected internally. void onFrameTransmit(Can_Id vCan_Id, const QByteArray &vData ); // GUI => CAN void onFrameReceive ( const QCanBusFrame &vFrame ); // GUI <= CAN + void onFrameWritten (qint64 vCount ); // GUI <= CAN signals: /*!