trigger the laser scanner on a TC21 programmatically

// Expert user has replied.
R Rory Stam 10 months 4 weeks ago
142 1 0

Hello,

I'm trying to figure out how I can trigger the laser scanner on a TC21 programmatically.

I'm developing a testcase (with Appium and Java on Eclipse) to perform a functional test on a application what is installed on a physical Zebra TC21 which is connected to my laptop.
Because the application is able to scan items I would like to trigger the laser scanner and point the device to a barcode.
First I tried to execute an 'adb shell input keyevent' (L1,L2,R1,R2 buttons ) commands to trigger de laser scanner but it didn't work.
Even when I assign the volume down button to the scan button in the key programmer and programmatically press the key driver.pressKey(new KeyEvent(AndroidKey.VOLUME_DOWN)); 
the laser scanner isn't triggered but triggers the volume down, so it looks like the KeyEvent pressKey is not the same as manual triggering the button.
When I enable the Data Capture Plus Button I cannot see the element when I fetch the getPageSource().
Also I've been reading about Soft Scan Trigger in the TechDocs section I'm not did not succeed to send a broadcast to the application.
When I instantiate the Intent object every time I get a Exception in thread "main" java.lang.RuntimeException: Stub!

Can someone help me with this or having others ideas please help me to point me to the right direction?
Thanks in advance.
 

Please Register or Login to post a reply

1 Replies

S Sean Kennedy

Dont try to override the external buttons - you do not need to do this.

There is a simpler method to do this - in Datawedge - you use the Soft-Scan feature.
In techdocs starting here:  

https://techdocs.zebra.com/datawedge/13-0/guide/about/

Look at the Datacapture Sample app here:

https://techdocs.zebra.com/datawedge/13-0/guide/samples/barcode1/

As you see in the UI - there is a Soft-Scan button - this is the programmatical method to indicate to Datawedge to begin scanning.

The Very Basic verison of using Datawedge in a Lightweight manner is the second sample I always refer to - which is "Basic Intent" sample app found here:

https://techdocs.zebra.com/datawedge/13-0/guide/samples/basicintent1/

FYI - These samples expect to use Android Studio - and not the legacy eclipse-based projects - so you may need to re-adjust for this in your code / project.

CONTACT
Can’t find what you’re looking for?