Notices


Reply
Thread Tools
Posts: 1,522 | Thanked: 392 times | Joined on Jul 2010 @ São Paulo, Brazil
#501
I think it was called somthing like 'foveal imaging", where a higher resolution close up and a lower resolution full frame are combined
 
Posts: 78 | Thanked: 32 times | Joined on May 2008
#502
Hi guys.

First of all, thank you for your devotion for developing an useful app for all of us!

I'm currently embarking on a project, where I use the output string of mBarcode as a parameter for my webapp. And by webapp, I mean just a local html file.

So far, I have done this by adding my own custom provider. (GREAT function btw!)

I would like to further integrate mBarcode in my webapp though. I have an idea, but I'm not at all sure, that it can be done.

I'm thinking this:

Launching a script from the press on a button in my local html file.

The script will launch mBarcode and give it focus.

mBarcode scans a barcode as usual.

The script recieves the outputted string and opens up a browserwindow using the url "/barcode/index.html?<recieved_string>" This shouldn't require user-action.

I've been looking at the plugin-toturial at http://vcs.maemo.org/svn/maemo-barco...ugins/TUTORIAL , but I would prefer the script-way, as it seems a bit more in-range for me. Mostly due to my newbness.

I'm not sure whether or not the browser can even launch a script though. Can it, or is there a security-violation in the process?

I'm also VERY uncertain as to what the script must contain to be succesful. I can see, that when I launch mBarcode from xterm and scan a barcode, the outputted string is apparing in xterm alongside general runtime info. Is there a way to snatch it from there?

It seems that @lamle on page 24 was trying to do something roughly like this. At the time, it didn't seem easy to implement mBarcode into other apps. In the earlier posts in this thread, there also seemed to be focus on giving other applications access to mBarcode. I'm not sure how the status is on these things as of now though.

So, that's the story.

I'm hugely grateful for any guidance on all of this. I'm pretty much on a blank page trying to make the webapp-mBarcode a one-click experience.

I'm very aware that using html as a program interface is a bit newbish. It does make for some great compatibility across devices though! And it's the only way I'm able to design layouts at the moment

Thanks in advance y'all!
 
Posts: 1,994 | Thanked: 3,342 times | Joined on Jun 2010 @ N900: Battery low. N950: torx 4 re-used once and fine; SIM port torn apart
#503
Quick reply...
Maybe, a local HTML can launch a program, though it depends on browser and its understanding of security.
The problem is, I don't see a way how can mbarcode return string to HTML file: mbarcode doesn't close itself upon reading the barcode, and barcode information is given only to plugins.

However, making a plugin isn't that difficult. Actually, C++ Qt code is quite portable, as Qt is cross-platform.

Theoretically, you could do it this way:
1. local HTML file starts mbarcode (you can try making such an HTML file right now, without studying C++ and Qt);
2. mbarcode scans a barcode;
3. user clicks your plugin in the list (you should have a plugin ready, compiled, workable for this step);
4. the plugin opens HTML file *.html?barcodetype=type&barcodedata=data (again, some C++ code in plugin is needed);
5. The HTML file does whatever you want it to do based on barcodetype and barcodedata (you can test it without a plugin, right now, by typing different values in the URL; it seems it wouldn't be a problem for you to make such an HTML).

I'm attaching code of my workable plugin.

Now, my plugin just puts all the information into one string, and I don't know how to open an HTML file. Ask somebody else about it. Here is some reference documentation:
http://doc.qt.nokia.com/qt-maemo-4.6/

I just have the simplest Qt plugin for mbarcode: two code files, and nothing else. It can be compiled on the N900 itself without problems.

1. Remove .txt from three attached files and unzip one .zip file.
Then you will get two .cpp files, one .xml file and one .so file.
moc.cpp was created by moc and doesn't need to be changed (mostly).
moc.cpp and MBEAN.cpp should be situated in one directory as moc.cpp uses MBEAN.cpp.
.xml file should be moved to /usr/share/mbarcode/plugins/mbean.xml
.so file (ready-to-go, compiled plugin) should be moved to /usr/share/mbarcode/plugins/
2.0. If you don't want to compile, just take the MBEAN.so file and put it into /usr/share/mbarcode/plugins; mbarcode will use it
2.1. To compile, go in X Terminal to the directory where you store moc.cpp and MBEAN.cpp, and run:

g++ -c -pipe -O4 -Wall moc.cpp -o moc.o

g++ -Wall -Wl,-O4 -lQtCore -lQtGui -lQtXml moc.o -o /usr/share/mbarcode/plugins/mbean.so

g++ -Wall -Wl,-O4 -lQtCore -lQtGui -lQtXml moc.o -o /usr/share/mbarcode/plugins/mbean.so -shared


Right now I need to add more information into XML file. In most cases, you can see barcode's country; some countries aren't in the list yet. Later not only EAN-13, but also other codes might be added. The problem is that with time the XML can become too large. The advantage is that you don't need to wait for the developer to add something: you can edit XML by hand.
-------------------------------------------------
For you to make your own plugin:

-lQtXml option is caused by my operations with an XML file; your plugin most likely wouldn't need this.

You can also remove the following lines from MBEAN.cpp:
#include <QtXml/QDomDocument>
#include <QtXml/QDomElement>
#include <QtXml/QDomNode>
#include <QtCore/QStack>

Functions
QStack<QDomNode> findchildren(QDomNode parent, QString data);
QString printstack(QStack<QDomNode> stack, QString data);
can also be removed from class ShowDialogAction.

Don't hesitate to ask questions; somebody will give an answer.
Attached Files
File Type: txt moc.cpp.txt (3.7 KB, 93 views)
File Type: txt MBEAN.cpp.txt (4.6 KB, 95 views)
File Type: txt mbean.xml.txt (4.1 KB, 87 views)
File Type: zip MBEAN.zip (16.1 KB, 90 views)
 

The Following 2 Users Say Thank You to Wikiwide For This Useful Post:
Posts: 78 | Thanked: 32 times | Joined on May 2008
#504
Hi Wikiwide.

Thank you so much for your thorough answer!

I'll be looking into creating my own plugin based on the substantial material you have provided here. There should be enough to keep occupied for a while, but I'm sure that it wil be managable given the great help

I'm still looking for a way to launch a shell script from within the browser though. That's almost imperative for the webapp to be user-friendly.

It's not all troubles though. It's pretty easy to use the url-parameter by just extracting digits only from window.location.href using RegExp.

In my webapp, I use my own xml-file containing the ingredientslist of different products. The different products are stored under their barcode string. Thus the webapp displays the ingredientslist based on the url-parameter it gets passed

Thank you once again, I'll do some code-diving
 

The Following User Says Thank You to MOC For This Useful Post:
Posts: 2,102 | Thanked: 1,309 times | Joined on Sep 2006
#505
The other option, though it may not help you here, is to listen for the DBus message which is broadcast when a barcode is decoded.

I'm not sure if there's a javascript way to grab DBus messages mind you.
 

The Following User Says Thank You to lardman For This Useful Post:
Posts: 252 | Thanked: 252 times | Joined on Nov 2009
#506
@MOC: You might also be interested in having a look at the tutorial for creating mBarcode plugins in C++/Qt found here in the wiki.
 
Posts: 78 | Thanked: 32 times | Joined on May 2008
#507
Hi guys.

Thanks for the replies!

I'm thinking of doing this through QtWRT, as it seems to be the easiest way for me.

@dragly Thanks for the link, I'm running Windows though, and I must admit, that I'm not up to running Linux for that purpose alone.

Right now, I really just need to do two things with QtWRT. Find out how to start up mBarcode from inside my webapp, listening to the DBus signal and use it as an url parameter.
 
Posts: 252 | Thanked: 252 times | Joined on Nov 2009
#508
Sounds like you've got a decent plan there. I believe that the tutorial might be useful even if you are running Windows as long as you are using the Nokia Qt SDK. You should at least be able to compile the plugin and move this to ~/.config/mbarcode/plugins on your device to load it.

However, if you figure out your ways with QtWRT, I suppose you should choose whatever suits you best. In any case, good luck, and don't hesitate to ask if you have any further questions.
 
Posts: 1,994 | Thanked: 3,342 times | Joined on Jun 2010 @ N900: Battery low. N950: torx 4 re-used once and fine; SIM port torn apart
#509
MBarcode crashes quite often, after one or several barcodes were scanned and it is needed to scan one more.

VideoWidget::start(): Called with startEvenIfNotYetStarted = false and lensCoverOpen = true
VideoWidget::start(): Setting pipeline state
GST error: v412camsrc_calls.c(1558): gst_v412camsrc_grab_frame (): /Gst
Pipeline:test-camera/GstV412CamSrc:camera_src
readyAborted

Version: 0.2.2-4

EDIT: Steps to crash.
1. Start MBarcode;
2. Scan one barcode or several barcodes;
3. On a results page, lock the screen (make it black) by side slider or allow the screen to be locked automatically after some time;
4. Unlock the screen;
5. Click 'Back' on results page;
6. MBarcode crashes.

Last edited by Wikiwide; 2010-09-22 at 10:44. Reason: Clarification
 
Posts: 252 | Thanked: 252 times | Joined on Nov 2009
#510
That is strange. Is it happening when you go back from the previous results?
 
Reply

Tags
barcode, camera, mbarcode


 
Forum Jump


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