Showing posts with label ZXing. Show all posts
Showing posts with label ZXing. Show all posts

Monday, June 8, 2015

First commit

  Two weeks passed and right at this point I've made pull request to moVirt repo with my commit. It's not actually "first" commit, there was several of them before the internship starts. And what I want to tell here is Git... I thought that I finally understand how to work with Git with help of my mentor during work on initial commit to apply to Outreachy. But on Friday I was confused and very frustrated again. The idea was to leave all day-by-day commits in my fork (so I could trace my progress later if I'll need to revert something), and send squashed version into main repo to ease reviewing. All my attempts was failed,.. seems like Git tries to reduce all redundancy. So then I decided to create patch which would contain all my commits in single file, then I erased everything in my repo because there was a lot of garbage of branches and merges, and just to avoid redundancy if Git decided just to link to previous commits instead of recreating them from patch, and last step was to apply patch... But who in the world could ever know that applying patch with multiple commits in it leads to reverted order of commits! I was one step before loosing everything I've done during this two weeks. Hopefully I've managed to recreate my progress from reversed commits on the weekend, and also I've made some fixes that I've forgotten before committing.

  So lets leave that freaky unhuman Git and get back to the commit. First thing I've realized learning ZXing that it doesn't assume to be used as a library inside another app. The integration class just makes calls to another app Barcode Scanner (BS) with it's own UI, thus preventing us from drawing any overlays on camera screen. Hopefully BS is a part of ZXing and also Apache licensed, so I've taken all decoder classes and build my own Activity class based on BS's Activity, so that we could decorate camera screen as we like. Also it could improve response time, because we don't need to support all barcodes, just choose one of them and skip guessing time.

  Looking through BS's Activity I've partially learned how parallel threads and handlers works in android. Activity has it's handler which loops through the message queue. Decoder works on another thread and posts messages when barcode has been detected and decoded. While catching such messages we could interact with Activity. All interactions occurs in function handleDecode(...), here we could ask data provider for Host instance which we are looking at, and show any desired information on screen. Also there is viewfinderView class that suits to draw anything on to the screen with Paint and Canvas classes. At this point I've made just simple rectangle that rounds decoded barcode in real-time to mark which one has been decoded if there are several of them on screen.

  Only two weeks (or less) required to bring Augmented Reality support with barcodes into your app. It may look not so fancy, but functional enough. And could be easily extended.

Pic.1. Test view with some fake data.

Tuesday, May 26, 2015

Internship starts!

  Yesterday was my first work day in Outreachy Program under moVirt project, so I'm starting this blog to share my progress and experience during my internship which will lasts the whole summer. I'm gonna post once every two weeks and will write about what have happened during those two weeks.

  As this is my first post and work only begins I'll mark here my plans with moVirt project. The main feature which I'm about to implement it is augmented reality for moVirt which will help maintain servers running oVirt. The point is to mark every server with sticker with some graphical code such as Data Matrix or QR-code (barcode), then focus camera of your smartphone or tablet and you'll see info about virtual machines running on this current host you are looking at.

  My first task was to find any appropriate lib for Android device which will handle barcode processing and suitable to implement inside moVirt app. My eye falls on ZXing Library, it perfectly fits requirements:
  • it could be integrated into android app
  • it's free and open-source under Apache licence
  • it supports many types of barcodes so we can switch between them if necessary

  During upcoming days I'm gonna study documentation for this lib find some examples and tutorials. Also I will try to write some test code for moVirt.