summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2017-02-02 15:21:04 +0100
committerAndré Hartmann <aha_1980@gmx.de>2017-07-04 05:49:54 +0000
commite23f4ced90381925406bd854dd3b3d1eeb478d87 (patch)
tree9dfc9fd27982c42e76fbdc9816cc6e00932a6e77 /examples
parente257664ae65ce5c51c7edac0a1a9ffaba4baea70 (diff)
QCanBusFrame: Introduce local echo flag
Inspiration for change after reading the SocketCAN mailing list thread: https://marc.info/?l=linux-can&m=147438437202356&w=2 The main usage is, to verify at application stage, that and when a frame was really sent on the bus. For architectures like SocketCAN, where multiple applications can connect to one CAN bus on the same system, this flag also indicates frames that are sent by an other local running application (i.e. not coming from the real bus). Implementations done for SystecCAN, VectorCAN and SocketCAN plugin. PCAN Basic does not seem to have support for this flag. For SocketCAN, see section "4.1.7 RAW socket returned message flags" in https://www.kernel.org/doc/Documentation/networking/can.txt for reference. [ChangeLog][QCanBusFrame] Added local echo flag to mark all echo frames that are generated by the hardware on successful transmission to CAN bus as such. Change-Id: I66d4ce1ec6dfd0a0b994a7b7a9de1a5f503fcb70 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/serialbus/can/mainwindow.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/serialbus/can/mainwindow.cpp b/examples/serialbus/can/mainwindow.cpp
index 19ed560..b0d6972 100644
--- a/examples/serialbus/can/mainwindow.cpp
+++ b/examples/serialbus/can/mainwindow.cpp
@@ -190,13 +190,16 @@ void MainWindow::closeEvent(QCloseEvent *event)
static QString frameFlags(const QCanBusFrame &frame)
{
- if (frame.hasBitrateSwitch() && frame.hasErrorStateIndicator())
- return QStringLiteral(" B E ");
+ QString result = QLatin1String(" --- ");
+
if (frame.hasBitrateSwitch())
- return QStringLiteral(" B - ");
+ result[1] = QLatin1Char('B');
if (frame.hasErrorStateIndicator())
- return QStringLiteral(" - E ");
- return QStringLiteral(" - - ");
+ result[2] = QLatin1Char('E');
+ if (frame.hasLocalEcho())
+ result[3] = QLatin1Char('L');
+
+ return result;
}
void MainWindow::checkMessages()