Active Topics

 



Notices


Reply
Thread Tools
Posts: 219 | Thanked: 94 times | Joined on Nov 2009 @ Helsinki, Finland
#51
Originally Posted by lardman View Post
How does the barcode represent your payment info? It would certainly be possible to add a handler for a given barcode type (assuming it's decoded by zbar, try it and see) and have the N900 open the appropriate URL for you. Would that work?
Hopefully I'm not polluting this topic, but here's what I found out when checking the new payment page from my online bank. There's a submit button that is used to start the barcode reading and it opens a pop-up (screen shot attached). I'm under impression that barcode reader attached to computer can fill the input field there (could be just keyboard kind of input that reader provides). Following javascript code is used to open the pop-up and fill the form given as parameter to the function.

edit: Didn't really answer your question about zbar compatibility, but anyways... I guess getting the decode barcode to clipboard is the most simple way to go - and possible the only viable option.

Code:
function barCode(curForm)
{
	var bCode = null;
	bCode = prompt ("Lue laskun viivakoodi ao. tekstikenttään.", "")
	if ( bCode == null)
	 return false
	//* start code may be missing so lets look for version (1/2)
	var bV = bCode.substring(0,1);
	if (bV == "1" || bV == "2") {bCode = "^" + bCode;}
	bV = bCode.substring(1,2);
	var bEr = true;
	if (bV == "1" || bV == "2")
	{
	    bEr = false;
	}
	if ( (bCode.length < 50) || (bEr) )
	{
	    alert("Viivakoodin luku ei onnistu") ;
	    return false;
	}
	if ( curForm.paymentbeneficiaryname.value > " ")
	   alert("Tarkista saajan tilinumero ja nimi, niitä ei korvattu viivakoodilta")
	else
	  curForm.paymenttoaccount.value = bCode.substring(2,16);

	curForm.paymentamount.value = l_z(bCode.substring(16,22) + "," + bCode.substring(22,24));
	curForm.paymentreference.value = l_z(bCode.substring(24,44));
	curForm.paymentduedate.value = bCode.substring(48,50) + "." + bCode.substring(46,48) + "." + bCode.substring(44,46);
	// For application logging
	curForm.newpaymentlogging.value = "1";
	// only euros accepted
	if (bV == "1") {
		curForm.paymentamount.value = " ";
	}
	return false;
}
Attached Images
 

Last edited by naabi; 2009-12-02 at 12:48.
 
Posts: 2,102 | Thanked: 1,309 times | Joined on Sep 2006
#52
I know it's probably out of the scope of mbarcode, but Qt itself has some plugin/scripting oriented functionality. Out of the box you get C(++), Javascript, plus Python and Lua via extra libs (there might be others I don't know about).
Well that is interesting, I was thinking of moving to Qt anyway as that's what Maemo 6 will offer. Currently there isn't much UI (so that bit should be easy enough) and I guess I could leave the camera control stuff in C to avoid changing everything at once.

Do you have a link to any articles about using plugins in e.g. Python in a C/C++ Qt app?

edit: Didn't really answer your question about zbar compatibility, but anyways... I guess getting the decode barcode to clipboard is the most simple way to go - and possible the only viable option.
Well you can copy from the text fields in mbarcode atm, but it would probably be preferable if you could scan the barcode (just test and see if it recognises it) and then open a specific webpage with the barcode number as a parameter. Not sure if that's doable mind you but from the javascript the barcode is chopped into bits, we'd need to see the rest of the code to work out how those bits are used.

Otherwise I do have a DBus method which allows apps to start mbarcode and then they can listen for another DBus signal that contains the decoded information, I suppose it would be possible to write a plugin for the browser to use these two, but not in my area of expertise I'm afraid.
 

The Following 2 Users Say Thank You to lardman For This Useful Post:
Posts: 219 | Thanked: 94 times | Joined on Nov 2009 @ Helsinki, Finland
#53
Originally Posted by lardman View Post
Well you can copy from the text fields in mbarcode atm, but it would probably be preferable if you could scan the barcode (just test and see if it recognises it) and then open a specific webpage with the barcode number as a parameter. Not sure if that's doable mind you but from the javascript the barcode is chopped into bits, we'd need to see the rest of the code to work out how those bits are used.
Sry, the online bank I'm using won't change their web page for me From the Javascript you can see that it just wants the whole data without chopping. The code chops it and fills a form in the web page (bank account, payment amount, reference number etc.).

I think getting a desktop computer like experience is hard in this case. The way barcode reader works is that you put your barcode in the reader and it sends the results to STDOUT and the cursor is supposed to be in the pop-up input field which after reading contains the decoded barcode. So, no interarction is needed between browser and reader which makes this very hard to implement, since I need to use this specific web page.
 
Posts: 3,319 | Thanked: 5,610 times | Joined on Aug 2008 @ Finland
#54
Originally Posted by lardman View Post
Do you have a link to any articles about using plugins in e.g. Python in a C/C++ Qt app?
See http://pythonqt.sourceforge.net/ (I have not used it with the Maemo flavor of Qt yet, only on desktop Qt installs, but unless you do something very QtMaemo-ish, you should be fine).
__________________
Blogging about mobile linux - The Penguin Moves!
Maintainer of PyQt (see introduction and docs), AppWatch, QuickBrownFox, etc
 

The Following 2 Users Say Thank You to attila77 For This Useful Post:
Posts: 13 | Thanked: 6 times | Joined on Nov 2009
#55
@lardman:
I think you are trying to make some "overkill"-app If plugins need to have their own GUI then is't applications, not plugins. In my opinion, the best way to handle this barcodes is:
1) API to other programs (DBus), so your "library app" can call mbarcode, get a barcode and close mbarcode.
2) "plugins" or "callbacks" on Python or any other language, in fact - just one function, that have 2 or more parameters (barcode and type of barcode) and can return a string that you show to user. It will be enough to check barcode on Amazon or any other database and this is easier then "plugins with GUI".
 
Posts: 2,102 | Thanked: 1,309 times | Joined on Sep 2006
#56
Certainly that is an option, but in that case it's the apps that use the data that will need to access the lookup-type plugins, so they would be better contained in a library so that multiple apps can use them.

Also, as a user might just want to scan a barcode that they see, mbarcode will need to know which apps to pass that information to (assuming they are not running), which means apps would need to register an interest in a certain type of barcode/barcode payload type.

I just thought that the plugin method would be less messy and would centralise all the relevant applications in one place.
 

The Following User Says Thank You to lardman For This Useful Post:
jkq's Avatar
Posts: 251 | Thanked: 131 times | Joined on Oct 2009 @ USA
#57
Originally Posted by lardman View Post
Ok, looks like some problem in my DBus signalling code (sending messages out to other interested apps). Does this happen all the time, for every barcode you scan and decode?
It looks that way. I managed to capture 2 more barcodes, and it crashed after each one.

Also, I see 0.0.7-0 in Fremantle's extras-devel, but only 0.0.6-3 in Diablo.

-jkq
__________________
Class .. : Quiet One
Humor .. : [*********-] Alignment: Chaotic Good
Patience : [******----] Weapon(s): Python scripts
Agro ... : [***-------] Relic(s) : N900

Last edited by jkq; 2009-12-02 at 17:36. Reason: comments on version
 
Posts: 2,102 | Thanked: 1,309 times | Joined on Sep 2006
#58
I think the only difference was fixing the rotation stuff so don't worry there.

I'll have a look at the DBus problems asap.
 

The Following User Says Thank You to lardman For This Useful Post:
Posts: 13 | Thanked: 6 times | Joined on Nov 2009
#59
which means apps would need to register an interest in a certain type of barcode/barcode payload type
DBus and/or commandline options will not be enough?

I just thought that the plugin method would be less messy and would centralise all the relevant applications in one place.
Maybe you are right. Also you can implement both ways
 
Posts: 2,102 | Thanked: 1,309 times | Joined on Sep 2006
#60
[QUOTED]Bus and/or commandline options will not be enough?[/QUOTE]

No, not if the user has opened mbarcode to scan a barcode they don't know about, in that case a broadcast message about a barcode won't wake the relevant apps.

But yeah, I think both DBus and plugins should cover most cases
 
Reply

Tags
barcode, camera, mbarcode


 
Forum Jump


All times are GMT. The time now is 22:55.