Em Wed, 16 Jan 2019 13:37:58 -0700 James Hilliard <james.hilliard1@xxxxxxxxx> escreveu: > On Wed, Jan 16, 2019 at 7:37 AM Mauro Carvalho Chehab > <mchehab+samsung@xxxxxxxxxx> wrote: > > > > Hi James, > > > > Em Wed, 16 Jan 2019 16:54:55 +0800 > > james.hilliard1@xxxxxxxxx escreveu: > > > > > From: James Hilliard <james.hilliard1@xxxxxxxxx> > > > > > > This is useful for running zbarcam as a systemd service so that other > > > applications can receive scan messages through dbus. > > > > Nice approach! > > > > Yet, I would try to write it on a different way, making sure that it > > could also be using by zbarimg. > > > > I mean, if you add the dbus bindings inside the zbar core, it > > shouldn't matter if the source image comes via a webcam or via a > > scanned image. Both will be able to send the scancodes via dbus. > Which function should I call send_dbus() from in that case? Good question. Tests required, but I suspect that you could add it at processor.c, inside _zbar_process_image(). I suspect that, if you do something like: if(nsyms) { /* FIXME only call after filtering */ _zbar_mutex_lock(&proc->mutex); _zbar_processor_notify(proc, EVENT_OUTPUT); _zbar_mutex_unlock(&proc->mutex); if(proc->handler) proc->handler(img, proc->userdata); + if(proc->is_dbus_enabled) + zbar_send_code_via_dbus(proc->userdata); } should work. You could easily check if this is working by calling: $ ./zbarimg/zbarimg ./examples/barcode.png EAN-13:9876543210128 scanned 1 barcode symbols from 1 images in 0.2 seconds (I would add a flag to allow enabling/disabling it by applications). > > > > As a future approach, we may even think on making the interface > > duplex in the future, e. g. allowing any camera application to > > send an image via dbus and let zbar to decode it and return > > the decoded bar codes. > That could be useful, probably too difficult for me to implement > myself though(I don't write a lot of c usually). As I said, this is just an idea for a future possible development. Not sure how this would actually work, as dbus may not be the best interface for passing images. Thanks, Mauro