Index: sources/canbus/caninterface.cpp =================================================================== diff -u -r9a3ee027dbc33f39ee7df2a9dc5a7897c6b1854d -rde2f87e15fa05b1c45581cfedd8f1af0c47c2b48 --- sources/canbus/caninterface.cpp (.../caninterface.cpp) (revision 9a3ee027dbc33f39ee7df2a9dc5a7897c6b1854d) +++ sources/canbus/caninterface.cpp (.../caninterface.cpp) (revision de2f87e15fa05b1c45581cfedd8f1af0c47c2b48) @@ -26,7 +26,7 @@ SINGLETON_INIT(CanInterface) /*! - * \brief constructor + * \brief Caninterface Constructor * \param parent object */ CanInterface::CanInterface(QObject *parent) : QObject(parent) {} @@ -62,11 +62,12 @@ void CanInterface::connection() { - connect(_canDevice, SIGNAL(framesReceived()), - this , SLOT ( onRead())); - connect(_canDevice, SIGNAL(errorOccurred(QCanBusDevice::CanBusError)), - this , SLOT ( onError(QCanBusDevice::CanBusError))); - + if (_canDevice) { + connect(_canDevice, SIGNAL(framesReceived()), + this , SLOT ( onRead())); + connect(_canDevice, SIGNAL(errorOccurred(QCanBusDevice::CanBusError)), + this , SLOT ( onError(QCanBusDevice::CanBusError))); + } connect(_MessageHandler, SIGNAL(didActionPerform(QCanBusFrame)), this , SLOT( onActionPerform(QCanBusFrame))); connect(_MessageHandler, SIGNAL(didActionRequest(QCanBusFrame)), @@ -75,13 +76,20 @@ void CanInterface::status(const QString &vDescription, QString vError) { + QString mError=""; + if (_canDevice) { + mError = _canDevice->errorString() + vError; + } + else { + mError = vError; + } _canStatus = tr("%1 '%2[%3]', %4") .arg(vDescription) .arg(_canType) .arg(_canInterface) - .arg(_canDevice->errorString() + vError) + .arg(mError) ; - qDebug() << _canStatus; + // qDebug() << _canStatus; } void CanInterface::send(const QCanBusFrame &vFrame) @@ -155,9 +163,9 @@ const QString flags = frameFlags(frame); - qDebug() << time + flags + view; + // qDebug() << time + flags + view; // TODO : Needs to be investigated on how the messages on canBus will be received. - // my require to be moved at the end of the function. + // may require to be moved at the end of the function, to not to be called for each message. emit didRead(frame); } }