summaryrefslogtreecommitdiff
path: root/plugins/dbus/amb-qt/test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/dbus/amb-qt/test.cpp')
-rw-r--r--plugins/dbus/amb-qt/test.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/plugins/dbus/amb-qt/test.cpp b/plugins/dbus/amb-qt/test.cpp
new file mode 100644
index 00000000..6eb88eb4
--- /dev/null
+++ b/plugins/dbus/amb-qt/test.cpp
@@ -0,0 +1,35 @@
+#include "ambqt.h"
+#include "timestamp.h"
+
+#include <QCoreApplication>
+
+#include <debugout.h>
+#include <iostream>
+
+int main(int argc, char** argv)
+{
+ QCoreApplication app(argc,argv);
+
+ AmbProperty speed;
+
+ double totalLatency=0;
+ int numSamples=0;
+
+ QObject::connect(&speed, &AmbProperty::signalChanged,[&](QVariant val)
+ {
+ double t1 = speed.time();
+ double t2 = amb::currentTime();
+
+ double latency = (t2-t1)*1000.0;
+
+ DebugOut(0)<<"latency: "<<latency<<std::endl;
+ totalLatency+=latency;
+ numSamples++;
+ DebugOut(0)<<"Average: "<<totalLatency / numSamples<<std::endl;
+ });
+
+ speed.setPropertyName("VehicleSpeed");
+ speed.connect();
+
+ return app.exec();
+}