Skip to content

Library meant to simplify the usage of DataWedge across Zebra devices

License

Notifications You must be signed in to change notification settings

nilac8991/datawedge-configurator

Repository files navigation

DataWedge Configurator

Library meant to simplify the usage of DataWedge across Zebra devices by using a method oriented approach to setup different aspects of a profile instead of working with multiple nested bunldes which could get messy.

How does it work?

The way this library works is very simple, it is based on builders meaning that you can create and apply configurations for a specific profile just by using methods instead of working with complicated nested bundles. We simplify as much as possible the interface for you and we take care of the rest. It will provide an easier and flexible way of working with DataWedge and also save a good amount of lines of code.

This requires that you already know how DataWedge works on the Zebra devices. If you don't know anything about it please visit the official documentation on TechDocs here and get familiar with it.

Installation

Top level build.gradle

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}

Module level build.gradle

dependencies {
    implementation "com.github.nilac8991:datawedge-configurator:2.0.0"
}

Warning

Please be aware that this library is NOT officially supported by Zebra and it is distributed as is without any guarantee of "eternal" support or updates. I'll do my best to keep it updated as long as I can, so if you plan to use it inside your project remember that this is your choice and you understand the risks.

Status & Support

DataWedge is very big in terms on how many features and parameters it offers, which is also why it took quite some time to map everything into this library.
You will find available most of the features that developers typically use when working traditionally with DataWedge on Zebra devices.

Plugins

Plugin Status Notes
Barcode ${{\color{Dandelion}{\textsf{Partially Supported}}}}$ - NextGen SimulScan Parameters are not supported
- UDI Parameters are not supported
- OCR Parameters are not supported
- Option to enable/disable symbologies is supported but there's no current support to personalise params of a specific symbology
Magnetic Stripe Reader (MSR) ${{\color{BrickRed}{\textsf{Not Supported}}}}$
RFID ${{\color{BrickRed}{\textsf{Not Supported}}}}$ Planned to be added soon
SERIAL ${{\color{BrickRed}{\textsf{Not Supported}}}}$
VOICE ${{\color{ForestGreen}{\textsf{Fully Supported}}}}$
WORKFLOW ${{\color{ForestGreen}{\textsf{Fully Supported}}}}$
Basic Data Formatting (BDF) ${{\color{ForestGreen}{\textsf{Fully Supported}}}}$
Advanced Data Formatting (ADF) ${{\color{BrickRed}{\textsf{Not Supported}}}}$ Not planned to be added anytime soon
TOKENS ${{\color{BrickRed}{\textsf{Not Supported}}}}$ Not planned to be added anytime soon
INTENT ${{\color{ForestGreen}{\textsf{Fully Supported}}}}$
KEYSTROKE ${{\color{ForestGreen}{\textsf{Fully Supported}}}}$
IP ${{\color{ForestGreen}{\textsf{Fully Supported}}}}$
Data Capture Plus (DCP) ${{\color{ForestGreen}{\textsf{Fully Supported}}}}$
Enterprise Keyboard (EKB) ${{\color{ForestGreen}{\textsf{Fully Supported}}}}$

Other Features

  • Create new profiles
  • Associate applications/activities to a profile
  • Disable/Enable the scanner
  • Listen for incoming data/responses from DataWedge via Listeners

Note

Not all the features that DataWedge provides are covered by the library so if you're looking for something in specific, feel free to reach out by writing me an email.

Usage & Examples

Working with the library is very simple, if you had previous experience with DataWedge, you will notice that the methods are following almost everytime the names associated with the original parameters. At the same time whenever you're planning to work on a specific category of settings such as Barcode Input, you will then have to use the BarcodePlugin from the library and same goes also for other plugins such as IntentOutput, Keystroke and others...

Listening for scanning events

DataWedgeWrapper.registerScanReceiver(this, "YourIntentAction",
    object : OnScanIntentListener {
        override fun onScanEvent(intent: Intent) {
            //...
        }
    })

//
DataWedgeWrapper.unregisterScanReceiver(this)

Sending Data

Sending data and listening for last result

DataWedgeWrapper.sendIntentWithLastResult(
    this, Constants.IntentType.SET_CONFIG,
    mainBundle, CommandIdentifier.SET_CONFIG
) { wasSuccessful, resultInfo, resultString, command, profileName ->
    //...
}

Sending data and listening for complete result

DataWedgeWrapper.sendIntentWithCompleteResult(
    this, Constants.IntentType.SET_CONFIG,
    mainBundle, CommandIdentifier.SET_CONFIG
) { resultInfo, resultString, command, profileName ->
    //...
}

Sending data without listening for any result

DataWedgeWrapper.sendIntent(this, Constants.IntentType.SET_CONFIG, mainBundle)

Disable/Suspend/Enable/Resume Scanner

//Disable
ScannerConfigurator.disableScanner(this)

//Suspend
ScannerConfigurator.suspendScanner(this)

//Enable
ScannerConfigurator.enableScanner(this)

//Resume
ScannerConfigurator.resumeScanner(this)

Create new profile with default configurations

val barcodePlugin = BarcodePlugin.Builder()
    .setEnabled(true)
    .create()

val configuratorObj = ProfileConfigurator.Builder()
    .setProfileName("TestProfile")
    .setProfileEnabled(true)
    .addAppAssociation(
        "com.example",
        "com.example.MainActivity"
    )
    .addPlugin(barcodePlugin)
    .setConfigMode(ConfigMode.CREATE_IF_NOT_EXIST)
    .create()

DataWedgeWrapper.sendIntent(this, Constants.IntentType.SET_CONFIG, configuratorObj)

Create new profile with intent output enabled

val barcodePlugin = BarcodePlugin.Builder()
    .setEnabled(true)
    .create()

val intentPlugin = IntentOutputPlugin.Builder()
    .setIntentAction("com.jamesswinton.datawedgewrapper.TEST")
    .setIntentOutputDelivery(IntentOutputDelivery.BROADCAST)
    .setEnabled(true)
    .create()

val keystrokeOutputPlugin = KeystrokeOutputPlugin.Builder()
    .setEnabled(false)
    .create()

val configuratorObj = ProfileConfigurator.Builder()
    .setProfileName("TestProfile")
    .setProfileEnabled(true)
    .addAppAssociation(
        "com.example",
        "com.example.MainActivity"
    )
    .addPlugin(barcodePlugin)
    .addPlugin(intentPlugin)
    .addPlugin(keystrokeOutputPlugin)
    .setConfigMode(ConfigMode.CREATE_IF_NOT_EXIST)
    .create()

DataWedgeWrapper.sendIntent(this, Constants.IntentType.SET_CONFIG, configuratorObj)

Modify symbologies

val barcodePlugin = BarcodePlugin.Builder()
    .enableSymbologies(
        arrayOf(
            BarcodeSymbology.UPC_A,
            BarcodeSymbology.EAN_13,
            BarcodeSymbology.EAN_8,
            BarcodeSymbology.DATAMATRIX
        )
    )
    .create()

// Create Main Bundle
val configuratorObj = ProfileConfigurator.Builder()
    .setProfileName("TestProfile")
    .addPlugin(barcodePlugin)
    .setConfigMode(ConfigMode.OVERWRITE)
    .create()

DataWedgeWrapper.sendIntent(this, Constants.IntentType.SET_CONFIG, configuratorObj)

Authors

  • James Swinton-Bland
  • Daniel Neamtu

License

MIT

About

Library meant to simplify the usage of DataWedge across Zebra devices

Resources

License

Stars

Watchers

Forks

Packages

No packages published