- if packet.type == sr.PacketType.ANALOG:
- self.measured.emit(device, packet.payload)
+ if packet.type != sr.PacketType.ANALOG:
+ return
+
+ if not len(packet.payload.channels):
+ return
+
+ # TODO: find a device with multiple channels in one packet
+ channel = packet.payload.channels[0]
+
+ # the most recent value
+ value = packet.payload.data[0][-1]
+
+ self.measured.emit(device, channel,
+ (value, packet.payload.unit, packet.payload.mq_flags))