from multiprocessing import Process, Queue
from gi.repository import Gtk, GObject
-from sigrok.core import *
+import sigrok.core as sr
def init_and_run(queue):
def datafeed_in(device, packet):
- if packet.type == PacketType.ANALOG:
+ if packet.type == sr.PacketType.ANALOG:
data = packet.payload.data
unit, unit_str = packet.payload.unit, ""
- if unit == Unit.VOLT:
+ if unit == sr.Unit.VOLT:
unit_str = " V"
- elif unit == Unit.OHM:
+ elif unit == sr.Unit.OHM:
unit_str = " Ohm"
- elif unit == Unit.AMPERE:
+ elif unit == sr.Unit.AMPERE:
unit_str = " A"
mqflags, mqflags_str = packet.payload.mq_flags, ""
- if QuantityFlag.AC in mqflags:
+ if sr.QuantityFlag.AC in mqflags:
mqflags_str = " AC"
- elif QuantityFlag.DC in mqflags:
+ elif sr.QuantityFlag.DC in mqflags:
mqflags_str = " DC"
for i in range(packet.payload.num_samples):
dev = "%s %s" % (device.vendor, device.model)
val = "%f%s%s" % (data[0][i], unit_str, mqflags_str)
queue.put((dev, val))
- context = Context_create()
- context.log_level = LogLevel.SPEW
+ context = sr.Context_create()
+ context.log_level = sr.LogLevel.SPEW
drivers_to_use = ['tecpel-dmm-8061-ser']
drivers = [context.drivers[d] for d in drivers_to_use]
devices = [d.scan(conn="/dev/ttyUSB0")[0] for d in drivers]
def on_about(self, action):
about = self.builder.get_object("aboutdialog")
- context = Context_create()
+ context = sr.Context_create()
sr_pkg = context.package_version
sr_lib = context.lib_version
s = "Using libsigrok %s (lib version %s)." % (sr_pkg, sr_lib)