Simple scanning on a Moto device

Team,

Do we still need to add the barcode-moto extension to the build.yml in order to get the scanner going on a Motorola device?

I am having trouble getting the scanner activated on a Moto device with a simple Rhomobile program

I have the barcode extension in the Build.yml as per below:

extensions

- barcode-moto

The code I am using in the controller.rb to invoke the scanner is as follows:

def take

      scanners = Barcode.enumerate()

      scanner = scanners[0]['name']

      puts "take - using scanner: #{scanner}"

      Barcode.enable(url_for(:action => :take_callback), {:name=>scanners[0]['name']})

      redirect :action => :wait

    end

   

  def take_callback

      status = @params['status']

      barcode = @params['barcode']

 

      puts 'take_callback'

      puts 'status = '+status.to_s unless status == nil

      puts 'barcode = '+barcode.to_s unless barcode == nil

 

      WebView.navigate(url_for(:action => :index))

 

      if status == 'ok'

          Alert.show_popup(

              :message => "Barcode["+barcode.to_s+"]",

              :title => "Take barcode",

              :buttons => ["Ok"]

          )

      elsif status == 'cancel'

          Alert.show_popup(

              :message => "Barcode taking was canceled !",

              :title => "Take barcode",

              :buttons => ["Ok"]

          )

      end

And in the wait.erb I have:

<div data-role="page" data-add-back-btn="false">

   <div data-role="content">

    <div> waiting for barcode... </div>

  </div>

</div>

Any assistance would be appreciated.

regards,

Daniel

Robert Galvin
DanielFor moto devices you

Daniel

For moto devices you should be using the Scanner API instead of the Barcode API. The ‘Barcode’ API is a traditional Rhodes API that is primarily used for camera decoding on any device. In order to use enterprise 1D/2D laser/imager scanner on the device you should use the ‘Scanner’ api. When using the Scanner api, just make sure you have app_type:Rhoelements and you can remove barcode-moto

Scanner API:

http://docs.rhomobile.com/rhoelements/scanner

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Daniel Park
Thanks Rob,I have played with

Thanks Rob,

I have played with the scanner API(ad have removed the barcode-moto from the build.yml)  but am not having any luck.

I want to be able to scan a barcode with the simplest / least amount of code for some upcoming training. what I would like to know is which code would I need and where would I need to put it?

Note: the code above was from a Rhodes training lab that Adam held in KL and I would like something similar for the Scanner API.

regards,

Daniel

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Divyansh Madan
Just check this link and the

Just check this link and the code and see if this helps.

https://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/BarcodeRecognizer

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
That example is for the

That example is for the Barcode API, Rob's suggestion was to use the Scanner API (for enterprise devices)

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Robert Galvin
Try this tutorial:http://docs

Try this tutorial:

http://docs.rhomobile.com/rhoelements/rhoelements-tutorial

It uses the Scanner API and also has some downloadable code.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Daniel Park
Thanks Rob,I will go through

Thanks Rob,

I will go through the tutorial.

By the way is there an easy way to download the sample(all in one hit? I would want to download the files one at a time if I can avoid it.

cheers Daniel

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Robert Galvin
On GitHub you just click the

On GitHub you just click the ZIP button and it downloads the project as a zip file.

https://github.com/cfh463/rhoelementstutorial/zipball/master

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Daniel Park
Its OK. I got it. Just hit

Its OK. I got it. Just hit the ZIP button. Thanks again Rob.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Daniel Park
Rob,I downloaded the sample

Rob,

I downloaded the sample app and ran it successfully in RhoSimulator, however when I tried to run it to a device (MC75A), I gor the following error:

9>c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ce\include\xmemory(160) : fatal error C1001: An internal error has occurred in the compiler.

9>(compiler file 'msc1.cpp', line 1411)

9> To work around this problem, try simplifying or changing the program near the locations listed above.

9>Please choose the Technical Support command on the Visual C++

9> Help menu, or open the Technical Support help file for more information

9>Internal Compiler Error in c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ce\bin\x86_arm\cl.exe.  You will be prompted to send an error report to Microsoft later.

9>Build log was saved at "file://c:\MotorolaRhoMobileSuite2.0.5\ruby\lib\ruby\gems\1.9.1\gems\rhodes-3.3.3\platform\wm\bin\Windows Mobile 6.5.3 Professional DTK (ARMV4I)\rhodes\Release\BuildLog.htm"

9>rhodes - 1 error(s), 0 warning(s)

Build complete: 4 Projects succeeded, 1 Projects failed, 0 Projects skipped

Error building

Error in build application

Would you have any ideas on this one?

regards,

Daniel

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Daniel Park
Hmmm... I tried it again and

Hmmm... I tried it again and it worked. I got a feeling that my Visual Studio has a bug (as I haven't had any updates since 2008).

Any thanks again Rob.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
I get that sometimes too with

I get that sometimes too with Visual Studio 2008, it goes away after a system restart... it's a problem with Visual Studio.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments