• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

BarcodeScanner: cordova plugin 二维码扫描测试(插件开发测试)代码来源https://gi ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

BarcodeScanner

开源软件地址:

https://gitee.com/mbyte/BarcodeScanner

开源软件介绍:

BarcodeScanner

###自定义更新说明

Cross-platform BarcodeScanner for Cordova / PhoneGap.

Follows the Cordova Plugin spec, so that it works with Plugman.

Supported Platforms

  • Android
  • iOS
  • Windows 8
  • Windows Phone 8

Note: the Android source for this project includes an Android Library Project.plugman currently doesn't support Library Project refs, so its beenprebuilt as a jar library. Any updates to the Library Project should becommitted with an updated jar.

Using the plugin

The plugin creates the object cordova/plugin/BarcodeScanner with the method scan(success, fail).

The following barcode types are currently supported:

Android

  • QR_CODE
  • DATA_MATRIX
  • UPC_E
  • UPC_A
  • EAN_8
  • EAN_13
  • CODE_128
  • CODE_39
  • CODE_93
  • CODABAR
  • ITF
  • RSS14
  • PDF417
  • RSS_EXPANDED

iOS

  • QR_CODE
  • DATA_MATRIX
  • UPC_E
  • UPC_A
  • EAN_8
  • EAN_13
  • CODE_128
  • CODE_39
  • ITF

Windows8

  • UPC_A
  • UPC_E
  • EAN_8
  • EAN_13
  • CODE_39
  • CODE_93
  • CODE_128
  • ITF
  • CODABAR
  • MSI
  • RSS14
  • QR_CODE
  • DATA_MATRIX
  • AZTEC
  • PDF417

Windows Phone 8

  • UPC_A
  • UPC_E
  • EAN_8
  • EAN_13
  • CODE_39
  • CODE_93
  • CODE_128
  • ITF
  • CODABAR
  • MSI
  • RSS14
  • QR_CODE
  • DATA_MATRIX
  • AZTEC
  • PDF417

success and fail are callback functions. Success is passed an object with data, type and cancelled properties. Data is the text representation of the barcode data, type is the type of barcode detected and cancelled is whether or not the user cancelled the scan.

A full example could be:

   cordova.plugins.barcodeScanner.scan(      function (result) {          alert("We got a barcode\n" +                "Result: " + result.text + "\n" +                "Format: " + result.format + "\n" +                "Cancelled: " + result.cancelled);      },       function (error) {          alert("Scanning failed: " + error);      }   );

Encoding a Barcode

The plugin creates the object cordova.plugins.barcodeScanner with the method encode(type, data, success, fail).

Supported encoding types:

  • TEXT_TYPE
  • EMAIL_TYPE
  • PHONE_TYPE
  • SMS_TYPE
A full example could be:   cordova.plugins.barcodeScanner.encode(cordova.plugins.barcodeScanner.Encode.TEXT_TYPE, "http://www.nytimes.com", function(success) {            alert("encode success: " + success);          }, function(fail) {            alert("encoding failed: " + fail);          }        );

Windows8 quirks

Windows 8 implenemtation currently doesn't support encode functionality.

Windows Phone 8 quirks

Windows Phone 8 implenemtation currently doesn't support encode functionality.

Thanks on Github

So many -- check out the original iOS and Android repos.

Licence

The MIT License

Copyright (c) 2010 Matt Kane

Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap