import itertools
import qtcompat
import sigrok.core as sr
-import time
import util
try:
self.sort(0)
return item
- @QtCore.Slot(object, object, object)
- def update(self, device, channel, data):
+ @QtCore.Slot(float, sr.classes.Device, sr.classes.Channel, tuple)
+ def update(self, timestamp, device, channel, data):
'''Update the data for the device (+channel) with the most recent
measurement from the given payload.'''
# The samples role is a dictionary that contains the old samples for each unit.
# Should be trimmed periodically, otherwise it grows larger and larger.
- sample = (time.time(), value)
+ sample = (timestamp, value)
traces = item.data(MeasurementDataModel.tracesRole)
traces[unit].append(sample)
import qtcompat
import re
import sigrok.core as sr
+import time
QtCore = qtcompat.QtCore
QtGui = qtcompat.QtGui
'''Helper class that does the actual work in another thread.'''
'''Signal emitted when new data arrived.'''
- measured = QtCore.Signal(object, object, object)
+ measured = QtCore.Signal(float, sr.classes.Device, sr.classes.Channel, tuple)
'''Signal emmited in case of an error.'''
error = QtCore.Signal(str)
self.session.stop()
def callback(self, device, packet):
+ now = time.time()
+
if not sr:
# In rare cases it can happen that the callback fires while
# the interpreter is shutting down. Then the sigrok module
# The most recent value.
value = packet.payload.data[0][-1]
- self.measured.emit(device, channel,
+ self.measured.emit(now, device, channel,
(value, packet.payload.unit, packet.payload.mq_flags))
# Signal used to start the worker across threads.