ZebraDevs / DataWedge-Ionic-Demo

Demo Ionic application using Datawedge on Zebra mobile devices
Other
43 stars 21 forks source link

Turn Off the light of barcode scanning of Zebra CC5000 device #3

Closed liviso closed 5 years ago

liviso commented 6 years ago

Hi, I am developing an application with the zebra CC5000 device in Android, when I scan a barcode I want the scanner light to turn off and turn on until a service returns information.

I was reviewing the CC5000 device guide, I found that the DataWedge is a utility that adds advanced barcode scanning capability, I'm not sure if the change has to be configured in the dataWedge or something that can be done with the EMDK, or if it really is something that can be done.

Thanks :)

darryncampbell commented 6 years ago

Hi, I found this page: https://developer.zebra.com/docs/DOC-2101. It states that the version of DW on the CC5000 (Concierge) is DW 3.1.6. DataWedge setup information is here: http://techdocs.zebra.com/datawedge/6-8/guide/setup/. You may find it easier to launch the DataWedge application on the device and modify the parameters in Profile0 to see their effect

liviso commented 6 years ago

Yesterday I could turn off the scanner from scanner.disabled, but when it changes activity it turns on again, I need that in the other activity it stays off, I am checking in the documentation. Thanks

darryncampbell commented 6 years ago

Interesting... which sdk are you using for scanner.disabled? I see an SDK documented at https://developer.zebra.com/docs/DOC-2008 but I have never used it. I strongly suspect the SDK will not inter-operate with DataWedge, either you would use the SDK or you would use DataWedge.

liviso commented 6 years ago

I'm using android 5.1, the datawedge version is 86.2.23 in a Device CC5000. I have configured the activities that I use from the emdk:

In the MainActivity when I recover the scanned upc I am turning off the scanner with this:

if(scanner==null && emdkManager!=null){ barcodeManager = (BarcodeManager)emdkManager.getInstance(FEATURE_TYPE.BARCODE); scanner = barcodeManager.getDevice(BarcodeManager.DeviceIdentifier.DEFAULT); try { scanner.triggerType = Scanner.TriggerType.HARD; scanner.disable(); } catch (ScannerException e) { e.printStackTrace(); }}

When I stay in Main Activity the scan is off, Then I move to another activity, at that moment the scanner is turned on again, in the settings of the emdk the property (Barcode Scanner Input is selected as enable) because the data wedge is active.

I still can not find how to make the scanner continue off in PriceVerifierActivity or Video Activity.

I try to send the Scanner reference through an Intent and from the other activity disable it again but it does not disable it, I print the status of the scanner and it prints "disabled", but the scanner continues on.

I think about using fragments instead of activities to solve the problem.

liviso commented 6 years ago

I was able to turn off the scanner, the problem was the finish method () of the previous activity, the problem I have now is that when the scanner light turns on it does not scan a bar code, I do not know if I have to recover it again some profile data.

darryncampbell commented 6 years ago

I am sorry I am not able to help you more but from what I recall, this device handled scanning slightly different from our other scanning devices so without a physical device I am making guesses. You would get better support by contacting our technical support team : https://www.zebra.com/gb/en/about-zebra/contact-zebra/contact-tech-support.html

I had not realised the EMDK supported the CC5000 device but it seems that the device was supported up to and including EMDK 6.7. You might get more reliable behaviour if you disabled DataWedge entirely since use of the EMDK and DataWedge are mutually exclusive, you would not typically combine them in the same application. You should be able to disable DW from the DW settings screen: http://techdocs.zebra.com/datawedge/6-6/guide/settings/

liviso commented 6 years ago

Thanks for this recommendation. I was doing performance tests of the application, after scanning 1:30 hours, turn on the light of the scanner but it does not scan, if I close and open the application, it returns to scan without any problem, the memory remains constant, I have no idea that It may be happening, it does not show any exception, I hope someone can help me.

Memory

captura de pantalla 2018-09-02 a la s 13 14 22

1.- When the application starts, i scan an item, then the scanner is disable, when the information is shown, the scanner is enabled.

`package com.symbol.wmpriceverifier;

import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.view.MotionEvent; import android.view.View; import android.widget.Button; import android.widget.Toast;

import com.symbol.emdk.EMDKManager; import com.symbol.emdk.EMDKManager.FEATURE_TYPE; import com.symbol.emdk.EMDKResults; import com.symbol.emdk.ProfileManager; import com.symbol.emdk.barcode.BarcodeManager; import com.symbol.emdk.barcode.ScanDataCollection; import com.symbol.emdk.barcode.Scanner; import com.symbol.emdk.barcode.ScannerException; import com.symbol.emdk.barcode.StatusData; import com.symbol.wmpriceverifier.mail.EmailContentBuilder; import com.symbol.wmpriceverifier.mail.ErrorEmailBean; import com.symbol.wmpriceverifier.mail.SendNotificationTask; import com.symbol.wmpriceverifier.utils.NetworkDetails; import com.symbol.wmpriceverifier.utils.PriceVerifierConstants; import com.symbol.wmpriceverifier.utils.ToastMessageDuration;

/**

{ /**

}`

NitinkumarPatel1989 commented 5 years ago

Hi, Using below method, you can turn off the barcode scanning of Zebra device. For that, you have to do disable plugin programmatically in onResume() of Activity.

`// define action and data strings String scannerInputPlugin = "com.symbol.datawedge.api.ACTION"; String extraData = "com.symbol.datawedge.api.SCANNER_INPUT_PLUGIN";

public void onResume() {

    // create the intent
        Intent i = new Intent();

    // set the action to perform
        i.setAction(scannerInputPlugin);

    // add additional info
        i.putExtra(extraData, "DISABLE_PLUGIN");

    // send the intent to DataWedge
        this.sendBroadcast(i);

}`

Here is the official link of scanner input plugin.

Moreover, if you try to enable of scanner (code like from link) is not working then you have to initialize Barcode manager and scanner again like below function code.

`//Initialize/Enable Scanner public void initBarcodeAndScanner(){ if (emdkManager != null) { // Acquire the barcode manager resources initBarcodeManager()

    // Enumerate scanner devices
    enumerateScannerDevices()

    initScanner()
}

} **initBarcodeManager(),enumerateScannerDevices(),initScanner()` these three methods, you can find from this link. Hope this answer will help to anyone in future.