npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

motorola-datawedge-cordova-plugin

v1.0.0

Published

Cordova Motorola DataWedge Plugin ============

Downloads

65

Readme

Cordova Motorola DataWedge Plugin

This is a Cordova/Phonegap plugin to interact with Motorola ruggedized devices' Barcode Scanners and Magnetic Stripe Readers (eg, ET1, MC40, TC55). The plugin works by interacting with the "DataWedge" application configured to output scan and magstripe events.

=============

This plugin is compatible with plugman. To install, run the following from your project command line: $ cordova plugin add https://github.com/BlueFletch/motorola-datawedge-cordova-plugin.git

==============

  1. Broadcast an intent from the Default (0) profile. This can be a custom action of your choosing. NOTE: Category must be empty.
  2. Create a custom profile associated to your app, and send a "startActivity" intent. This must use the default plugin action: "com.bluefletch.motorola.datawedge.ACTION" and EMPTY category.

The DataWedge User Guide is located here: https://launchpad.motorolasolutions.com/documents/dw_user_guide.html

Intent configuration: https://launchpad.motorolasolutions.com/documents/dw_user_guide.html#_intent_output

Special configuration for option 2:

  1. You'll need to first create a Profile in your DataWedge Application to run startActivity for an intent on scan/magstripe events as applicable. NOTE: you MUST set the action to: "com.bluefletch.motorola.datawedge.ACTION" and category to EMPTY/BLANK
  2. Associate your app to the DataWedge profile so it loads with your app. Configure this under (Your profile) > Associated apps > New app/activity (menu button) > (Select your app)
  3. Lastly, you need to set your application to be "singleTop" in Cordova. This will make sure each scan doesn't launch a new instance of your app. Add the following to your config.xml: <preference name="AndroidLaunchMode" value="singleTop" />
  1. First, you need to "activate" the plugin and OPTIONALLY tell it what intent to listen for. Default is "com.bluefletch.motorola.datawedge.ACTION"
   document.addEventListener("deviceready", function(){ 
      if (window.datawedge) {
      	 datawedge.start(); //uses default
         //datawedge.start("com.yourintent.whatever_you_configured_to_broadcast_in_default_profile");
      }
   });
  1. Register for callbacks for barcode scanning and/or magnetic stripe reads:
   document.addEventListener("deviceready", function(){ 
       ...
       datawedge.registerForBarcode(function(data){
           var labelType = data.type,
               barcode   = data.barcode;

           console.log("Barcode scanned.  Label type is: " + labelType + ", " + barcode);
           
           //TODO: handle barcode/label type
       });
       //This function will be passed an array with the read values for each track.  
       //NOTE: If a track could not be read, it will contain null
       datawedge.registerForMagstripe(function(tracks){
       	   var track1, track2;
           console.log("read magstripe value : " + JSON.stringify(tracks));

           //read track 1
           if (tracks[0]) {
              //track 1 uses carets as dividers
              track1 = tracks[0].split('^');
              
              var cc = {
                 number : track1[0].substr(2), //strip leading %B
                 name : track1[1].trim(),
                 expr : '20' + track1[2].substr(0,2) + '-' + track1[2].substr(2,2)
              };

              //TODO: handle track 1
           } 
           else if (tracks[1]) {
           	  track2 = tracks[1];
              
              //TODO: handle track 2
           } 
           else {
              //ERROR: track 3 almost never has anything in it
           }
		
       });

=============

============== Copyright 2014 BlueFletch Mobile

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.