Compare commits
81 Commits
Author | SHA1 | Date |
---|---|---|
![]() |
862df88970 | 6 years ago |
![]() |
262217b924 | 6 years ago |
![]() |
e96eb9f788 | 7 years ago |
![]() |
4c73d76692 | 7 years ago |
![]() |
42b5382510 | 7 years ago |
![]() |
78179ce570 | 7 years ago |
![]() |
271be5d3ff | 7 years ago |
![]() |
0a295f537e | 7 years ago |
![]() |
1adba48ddc | 7 years ago |
![]() |
5817a3daba | 7 years ago |
![]() |
a4de46f9a9 | 7 years ago |
![]() |
9c24fc78b2 | 7 years ago |
![]() |
12a74d03d4 | 8 years ago |
![]() |
a6d370a9c1 | 8 years ago |
![]() |
eff0c5ad12 | 8 years ago |
![]() |
e8352c7017 | 8 years ago |
![]() |
74ed8c0b60 | 8 years ago |
![]() |
f25c0e17d8 | 8 years ago |
![]() |
fffa63ca2b | 8 years ago |
![]() |
42f2b70e64 | 8 years ago |
![]() |
012924fbe2 | 8 years ago |
![]() |
ddc385641a | 8 years ago |
![]() |
620292c509 | 8 years ago |
![]() |
0420d5e093 | 8 years ago |
![]() |
57312a0638 | 8 years ago |
![]() |
e2b37c32b1 | 8 years ago |
![]() |
2e4b14b92f | 8 years ago |
![]() |
55d2eb971b | 8 years ago |
![]() |
d01cd6d527 | 8 years ago |
![]() |
06bcda3157 | 8 years ago |
![]() |
f9a19e0a02 | 8 years ago |
![]() |
25dd873d9c | 8 years ago |
![]() |
80a9f61b6f | 8 years ago |
![]() |
a0e55f235c | 8 years ago |
![]() |
a4c0efc0df | 8 years ago |
![]() |
c2d583f19a | 8 years ago |
![]() |
4ee36d1612 | 8 years ago |
![]() |
15bf53e14d | 8 years ago |
![]() |
b88a7b71a7 | 9 years ago |
![]() |
d9b56d2dc1 | 9 years ago |
![]() |
810f9370ca | 9 years ago |
![]() |
036fc30d48 | 9 years ago |
![]() |
821d04a78b | 9 years ago |
![]() |
942104916b | 9 years ago |
![]() |
edea60fe71 | 9 years ago |
![]() |
68af856b35 | 9 years ago |
![]() |
aa61f18265 | 9 years ago |
![]() |
4363c85149 | 9 years ago |
![]() |
c4cbf10976 | 9 years ago |
![]() |
473f4366a5 | 9 years ago |
![]() |
2c45929800 | 9 years ago |
![]() |
ed794e98a3 | 9 years ago |
![]() |
5e90f25b0b | 9 years ago |
![]() |
9a91962027 | 9 years ago |
![]() |
9a2a98bd90 | 9 years ago |
![]() |
79a2b019f4 | 9 years ago |
![]() |
94db7bfc02 | 9 years ago |
![]() |
ce4d4a976a | 9 years ago |
![]() |
6d5fd9d7ac | 9 years ago |
![]() |
ee0fec3321 | 9 years ago |
![]() |
3df696a1f7 | 9 years ago |
![]() |
36205f8ceb | 9 years ago |
![]() |
187919609b | 9 years ago |
![]() |
6cf7c2f57e | 9 years ago |
![]() |
926983115f | 9 years ago |
![]() |
9bbcfc2f99 | 9 years ago |
![]() |
827c4d6497 | 9 years ago |
![]() |
9ba118bcd0 | 9 years ago |
![]() |
af3c505882 | 9 years ago |
![]() |
8fa0c69bc1 | 9 years ago |
![]() |
dadb8dbc9f | 9 years ago |
![]() |
a9584bae77 | 9 years ago |
![]() |
eb9a4ca4cb | 9 years ago |
![]() |
318681d66b | 9 years ago |
![]() |
e9113c48ad | 9 years ago |
![]() |
f87c16e58f | 9 years ago |
![]() |
1b9d5451ed | 9 years ago |
![]() |
8cae60cdee | 9 years ago |
![]() |
7a9f146278 | 9 years ago |
![]() |
9c212838cc | 9 years ago |
![]() |
c851635522 | 9 years ago |
@ -1 +1 @@
|
||||
@import url("http://fonts.googleapis.com/css?family=Ubuntu:400,700|Cabin+Condensed:400,600");
|
||||
@import url("https://fonts.googleapis.com/css?family=Ubuntu:400,700|Cabin+Condensed:400,600");
|
||||
|
@ -0,0 +1,27 @@
|
||||
var Quagga = require('../lib/quagga').default;
|
||||
|
||||
var buffer = require('fs').readFileSync('../test/fixtures/code_128/image-001.jpg');
|
||||
|
||||
decode(buffer);
|
||||
function decode(buff){
|
||||
Quagga.decodeSingle({
|
||||
src: buff,
|
||||
numOfWorkers: 0,
|
||||
inputStream: {
|
||||
mime: "image/jpeg",
|
||||
size: 800,
|
||||
area: {
|
||||
top: "10%",
|
||||
right: "5%",
|
||||
left: "5%",
|
||||
bottom: "10%"
|
||||
}
|
||||
}
|
||||
}, function(result) {
|
||||
if (result.codeResult) {
|
||||
console.log("result", result.codeResult.code);
|
||||
} else {
|
||||
console.log("not detected");
|
||||
}
|
||||
});
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
i.icon-24-scan{
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ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c/AgwAjW3JwqIUjSYAAAAASUVORK5CYII=");
|
||||
display: inline-block;
|
||||
background-repeat: no-repeat;
|
||||
line-height: 24px;
|
||||
margin-top: 1px;
|
||||
vertical-align: text-top;
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
$overlayWidth: $videoWidth;
|
||||
$overlayHeadline: 16px;
|
||||
$overlayHeadlineMargin: 14px;
|
||||
$overlayPadding: 20px;
|
||||
$overlayHeight: $videoHeight + $overlayHeadlineMargin + $overlayHeadline;
|
||||
|
||||
.scanner-overlay {
|
||||
display: none;
|
||||
width: $overlayWidth;
|
||||
height: $overlayHeight;
|
||||
position: absolute;
|
||||
padding: $overlayPadding;
|
||||
top: 50%;
|
||||
margin-top: -($overlayHeight)/2 - $overlayPadding;
|
||||
left: 50%;
|
||||
margin-left: -($overlayWidth + 2*$overlayPadding)/2;
|
||||
background-color: $overlayBackground;
|
||||
@include box-shadow(#333333 0px 4px 10px);
|
||||
|
||||
& > .header{
|
||||
position: relative;
|
||||
margin-bottom: $overlayHeadlineMargin;
|
||||
h4, .close{
|
||||
line-height: $overlayHeadline;
|
||||
}
|
||||
h4{
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
.close{
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
height: $overlayHeadline;
|
||||
width: $overlayHeadline;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
& > .body{
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
@import "phone/core";
|
||||
@import "phone/viewport";
|
||||
@import "phone/overlay";
|
@ -1,4 +0,0 @@
|
||||
@include tablet {
|
||||
/* tablet styles */
|
||||
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
$tablet_upper: 1024px;
|
||||
$phone_upper: 603px;
|
||||
|
||||
@mixin phone {
|
||||
@media (max-width: $phone_upper) {
|
||||
@content;
|
||||
}
|
||||
|
||||
} // @mixin phone
|
||||
|
||||
@mixin tablet {
|
||||
|
||||
@media (min-width: $phone_upper+1) and (max-width: $tablet_upper) {
|
||||
@content;
|
||||
}
|
||||
|
||||
} // @mixin tablet
|
@ -1,7 +0,0 @@
|
||||
$background_color: #FFF;
|
||||
$overlayBackground: #FFF;
|
||||
$videoWidth: 640px;
|
||||
$videoHeight: 480px;
|
||||
|
||||
$text-font: Ubuntu, sans-serif;
|
||||
$header-font: 'Cabin Condensed', sans-serif;
|
@ -1,89 +0,0 @@
|
||||
#interactive.viewport{
|
||||
width: $videoWidth;
|
||||
height: $videoHeight;
|
||||
}
|
||||
|
||||
#interactive.viewport canvas, video{
|
||||
float: left;
|
||||
width: $videoWidth;
|
||||
height: $videoHeight;
|
||||
&.drawingBuffer{
|
||||
margin-left: -$videoWidth;
|
||||
}
|
||||
}
|
||||
|
||||
.controls {
|
||||
fieldset {
|
||||
border: none;
|
||||
}
|
||||
.input-group {
|
||||
float: left;
|
||||
input, button {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
.reader-config-group {
|
||||
float: right;
|
||||
|
||||
label {
|
||||
display: block;
|
||||
span {
|
||||
width: 11rem;
|
||||
display: inline-block;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
&:after {
|
||||
content:'';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
|
||||
#result_strip{
|
||||
margin: 10px 0;
|
||||
border-top: 1px solid #EEE;
|
||||
border-bottom: 1px solid #EEE;
|
||||
padding: 10px 0;
|
||||
|
||||
& > ul {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style-type: none;
|
||||
width: auto;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
white-space: nowrap;
|
||||
|
||||
& > li{
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: $videoWidth/4;
|
||||
.thumbnail{
|
||||
padding: 5px;
|
||||
margin: 4px;
|
||||
border: 1px dashed #CCC;
|
||||
|
||||
img{
|
||||
max-width: $videoWidth/4 - 20px;
|
||||
}
|
||||
.caption{
|
||||
white-space: normal;
|
||||
h4{
|
||||
text-align: center;
|
||||
word-wrap: break-word;
|
||||
height: 40px;
|
||||
margin: 0px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:after{
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/* LESS - http://lesscss.org style sheet */
|
||||
/* Palette color codes */
|
||||
/* Palette URL: http://paletton.com/#uid=31g0q0kHZAviRSkrHLOGomVNzac */
|
||||
|
||||
/* Feel free to copy&paste color codes to your application */
|
||||
|
||||
|
||||
/* MIXINS */
|
||||
|
||||
/* As hex codes */
|
||||
|
||||
$color-primary-0: #FFC600; /* Main Primary color */
|
||||
$color-primary-1: #FFDD69;
|
||||
$color-primary-2: #FFCE22;
|
||||
$color-primary-3: #B78E00;
|
||||
$color-primary-4: #513F00;
|
||||
|
||||
$color-secondary-1-0: #0A4DB7; /* Main Secondary color (1) */
|
||||
$color-secondary-1-1: #6C9CE8;
|
||||
$color-secondary-1-2: #2E6FD6;
|
||||
$color-secondary-1-3: #073379;
|
||||
$color-secondary-1-4: #021636;
|
||||
|
||||
$color-secondary-2-0: #5809BB; /* Main Secondary color (2) */
|
||||
$color-secondary-2-1: #A36BE9;
|
||||
$color-secondary-2-2: #782DD8;
|
||||
$color-secondary-2-3: #3A077C;
|
||||
$color-secondary-2-4: #190237;
|
||||
|
||||
|
||||
|
||||
/* As RGBa codes */
|
||||
|
||||
$rgba-primary-0: rgba(255,198, 0,1); /* Main Primary color */
|
||||
$rgba-primary-1: rgba(255,221,105,1);
|
||||
$rgba-primary-2: rgba(255,206, 34,1);
|
||||
$rgba-primary-3: rgba(183,142, 0,1);
|
||||
$rgba-primary-4: rgba( 81, 63, 0,1);
|
||||
|
||||
$rgba-secondary-1-0: rgba( 10, 77,183,1); /* Main Secondary color (1) */
|
||||
$rgba-secondary-1-1: rgba(108,156,232,1);
|
||||
$rgba-secondary-1-2: rgba( 46,111,214,1);
|
||||
$rgba-secondary-1-3: rgba( 7, 51,121,1);
|
||||
$rgba-secondary-1-4: rgba( 2, 22, 54,1);
|
||||
|
||||
$rgba-secondary-2-0: rgba( 88, 9,187,1); /* Main Secondary color (2) */
|
||||
$rgba-secondary-2-1: rgba(163,107,233,1);
|
||||
$rgba-secondary-2-2: rgba(120, 45,216,1);
|
||||
$rgba-secondary-2-3: rgba( 58, 7,124,1);
|
||||
$rgba-secondary-2-4: rgba( 25, 2, 55,1);
|
||||
|
||||
|
||||
|
||||
/* Generated by Paletton.com © 2002-2014 */
|
||||
/* http://paletton.com */
|
@ -1 +0,0 @@
|
||||
@import url('http://fonts.googleapis.com/css?family=Ubuntu:400,700|Cabin+Condensed:400,600');
|
@ -1,15 +0,0 @@
|
||||
@include phone {
|
||||
#container{
|
||||
width: 300px;
|
||||
margin: 10px auto;
|
||||
@include box-shadow(none);
|
||||
|
||||
form.voucher-form{
|
||||
input{
|
||||
&.voucher-code{
|
||||
width: 180px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
@include phone {
|
||||
$overlayWidth: $videoWidth;
|
||||
$overlayHeadline: 16px;
|
||||
$overlayHeadlineMargin: 14px;
|
||||
$overlayPadding: 20px;
|
||||
$overlayHeight: $videoHeight + $overlayHeadlineMargin + $overlayHeadline;
|
||||
|
||||
.overlay.scanner {
|
||||
width: $overlayWidth;
|
||||
height: $overlayHeight;
|
||||
padding: $overlayPadding;
|
||||
margin-top: -($overlayHeight)/2 - $overlayPadding;
|
||||
margin-left: -($overlayWidth + 2*$overlayPadding)/2;
|
||||
background-color: $overlayBackground;
|
||||
@include box-shadow(none);
|
||||
|
||||
& > .header{
|
||||
margin-bottom: $overlayHeadlineMargin;
|
||||
h4, .close{
|
||||
line-height: $overlayHeadline;
|
||||
}
|
||||
.close{
|
||||
height: $overlayHeadline;
|
||||
width: $overlayHeadline;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
@include phone {
|
||||
$videoWidth: 300px;
|
||||
$videoHeight: 400px;
|
||||
|
||||
#interactive.viewport{
|
||||
width: $videoWidth;
|
||||
height: $videoWidth;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#interactive.viewport canvas, video{
|
||||
margin-top: ($videoWidth - $videoHeight)/2;
|
||||
width: $videoWidth;
|
||||
height: $videoHeight;
|
||||
&.drawingBuffer{
|
||||
margin-left: -$videoWidth;
|
||||
}
|
||||
}
|
||||
|
||||
#result_strip{
|
||||
margin-top: 5px;
|
||||
padding-top: 5px;
|
||||
ul.thumbnails{
|
||||
& > li{
|
||||
width: $videoWidth/2;
|
||||
.thumbnail{
|
||||
.imgWrapper{
|
||||
width: $videoWidth/2 - 20px;
|
||||
height: $videoWidth/2 - 20px;
|
||||
overflow: hidden;
|
||||
img{
|
||||
margin-top: (($videoWidth/2 - 20px) - ($videoHeight/2 - 20px))/2;
|
||||
width: $videoWidth/2 - 20px;
|
||||
height: $videoHeight/2 - 20px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
|
||||
@import "compass/css3";
|
||||
@import "variables";
|
||||
@import "utility";
|
||||
|
||||
/* usual styles */
|
||||
|
||||
@import "fonts";
|
||||
@import "viewport";
|
||||
@import "overlay";
|
||||
@import "icons";
|
||||
|
||||
@import "tablet";
|
||||
@import "phone";
|
@ -1,56 +0,0 @@
|
||||
@import "compass/css3";
|
||||
@import "variables";
|
||||
@import "utility";
|
||||
|
||||
/* usual styles */
|
||||
@import "colors";
|
||||
@import "fonts";
|
||||
@import "viewport";
|
||||
@import "overlay";
|
||||
@import "icons";
|
||||
|
||||
@import "tablet";
|
||||
@import "phone";
|
||||
|
||||
body{
|
||||
background-color: #FFF;
|
||||
margin: 0px;
|
||||
font-family: $text-font;
|
||||
color: #1e1e1e;
|
||||
font-weight: normal;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
h1,h2,h3,h4 {
|
||||
font-family: $header-font;
|
||||
}
|
||||
|
||||
header {
|
||||
background: $color-primary-0;
|
||||
padding: 1em;
|
||||
.headline {
|
||||
width: 640px;
|
||||
margin: 0 auto;
|
||||
h1 {
|
||||
color: $color-primary-1;
|
||||
font-size: 3em;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
h2 {
|
||||
margin-top: 0.2em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
footer {
|
||||
background: $color-secondary-1-0;
|
||||
color: $color-secondary-1-1;
|
||||
padding: 1em 2em 2em;
|
||||
}
|
||||
|
||||
#container{
|
||||
width: 640px;
|
||||
margin: 20px auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXAIBAAKBgQC9ORap3LvRegtrhRc8dLdH9Bp2QokcKEsWbtvyhtjisRRm2slK
|
||||
A6Q11McB/YTb7oImFfNaCX+7vdM1oVXVLJ0ekQaNljXG5Dy7DXEcT1V6gpN4xmZJ
|
||||
8f/KZ45VBINN0Ha74L7nS4kgImh5yvNolNr4IdlSjGf09kciFy8S3kPlGQIDAQAB
|
||||
AoGAYDlaxBCC1liY3Bl3IoA7//QrTL4zGUWIQaUoZmGag1UHifJycBf/9nv4o5N3
|
||||
b5wPRSzebofsE93JPTmI+3nPf62k5rS2xOo8swwOZc+f5/v0EnUNixD7P0jBiLVR
|
||||
B8kbMvNdNn33HuynW1/MSBFE0cfeDH2i8SVl+Z+fHYIUW10CQQD0yWB8xeM8AxYB
|
||||
/ZZWClem6gf1lQAYLzid3x51pkLqRFpX+rG251cSBUouE+kVO14j2xrBqCyyOwNu
|
||||
17eazy3DAkEAxeQdWP9b11ihKOf/kjXiczltLnBsotn6K9EEAe0QuH/6iXLm86mL
|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cdqPvlR8lpMCoVekVTBT
|
||||
MQswCQYDVQQGEwJBVDEPMA0GA1UECBMGU3R5cmlhMQ0wCwYDVQQHEwRHcmF6MREw
|
||||
DwYDVQQKEwhRdWFnZ2FKUzERMA8GA1UEAxMIcXVhZ2dhanOCCQC1AzfeTq+15TAM
|
||||
BgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACyzC/CKL1mgTuNgFDuUf6u+
|
||||
YMnqlc9wcnEaFuvXnkSh6fT+qMZm188C/tlZwcWTrGmoCM0K6mX1TpHOjm8vbeXZ
|
||||
diezAVGIVN3VoHqm6yJldI2rgFI9r5BfwAWYC8XNjqnT3U6cm4k8iC7jmLC+dT9r
|
||||
Ysx2ucAF6lNHayekRmNq
|
||||
-----END CERTIFICATE-----
|
@ -0,0 +1,30 @@
|
||||
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
|
||||
# generate server.xml with the following command:
|
||||
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
|
||||
# run as follows:
|
||||
# python simple-https-server.py
|
||||
# then in your browser, visit:
|
||||
# https://localhost:4443
|
||||
|
||||
import BaseHTTPServer, SimpleHTTPServer
|
||||
import ssl
|
||||
import sys, getopt
|
||||
|
||||
host = 'localhost'
|
||||
port = 4443
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:],"",["host=", "port="])
|
||||
except getopt.GetoptError:
|
||||
print 'simple-https-server.py --host <host> --port <port>'
|
||||
sys.exit(2)
|
||||
for opt, arg in opts:
|
||||
if opt in ("--host"):
|
||||
host = arg
|
||||
elif opt in ("--port"):
|
||||
port = int(arg)
|
||||
print 'host is ', host
|
||||
print 'port is ', port
|
||||
|
||||
httpd = BaseHTTPServer.HTTPServer((host, port), SimpleHTTPServer.SimpleHTTPRequestHandler)
|
||||
httpd.socket = ssl.wrap_socket (httpd.socket, certfile='./server.pem', server_side=True)
|
||||
httpd.serve_forever()
|
@ -0,0 +1,17 @@
|
||||
|
||||
export function enumerateDevices() {
|
||||
if (navigator.mediaDevices
|
||||
&& typeof navigator.mediaDevices.enumerateDevices === 'function') {
|
||||
return navigator.mediaDevices.enumerateDevices();
|
||||
}
|
||||
return Promise.reject(new Error('enumerateDevices is not defined'));
|
||||
};
|
||||
|
||||
export function getUserMedia(constraints) {
|
||||
if (navigator.mediaDevices
|
||||
&& typeof navigator.mediaDevices.getUserMedia === 'function') {
|
||||
return navigator.mediaDevices
|
||||
.getUserMedia(constraints);
|
||||
}
|
||||
return Promise.reject(new Error('getUserMedia is not defined'));
|
||||
}
|
@ -0,0 +1,146 @@
|
||||
// Scraped from https://github.com/exif-js/exif-js
|
||||
|
||||
const ExifTags = {0x0112: "orientation"};
|
||||
export const AvailableTags = Object.keys(ExifTags).map(key => ExifTags[key]);
|
||||
|
||||
export function findTagsInObjectURL(src, tags = AvailableTags) {
|
||||
if (/^blob\:/i.test(src)) {
|
||||
return objectURLToBlob(src)
|
||||
.then(readToBuffer)
|
||||
.then(buffer => findTagsInBuffer(buffer, tags));
|
||||
}
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
export function base64ToArrayBuffer(dataUrl) {
|
||||
const base64 = dataUrl.replace(/^data\:([^\;]+)\;base64,/gmi, ''),
|
||||
binary = atob(base64),
|
||||
len = binary.length,
|
||||
buffer = new ArrayBuffer(len),
|
||||
view = new Uint8Array(buffer);
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
view[i] = binary.charCodeAt(i);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
function readToBuffer(blob) {
|
||||
return new Promise(resolve => {
|
||||
const fileReader = new FileReader();
|
||||
fileReader.onload = function(e) {
|
||||
return resolve(e.target.result);
|
||||
};
|
||||
fileReader.readAsArrayBuffer(blob);
|
||||
});
|
||||
}
|
||||
|
||||
function objectURLToBlob(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const http = new XMLHttpRequest();
|
||||
http.open("GET", url, true);
|
||||
http.responseType = "blob";
|
||||
http.onreadystatechange = function () {
|
||||
if (http.readyState === XMLHttpRequest.DONE && (http.status === 200 || http.status === 0)) {
|
||||
resolve(this.response);
|
||||
}
|
||||
};
|
||||
http.onerror = reject;
|
||||
http.send();
|
||||
});
|
||||
}
|
||||
|
||||
export function findTagsInBuffer(file, selectedTags = AvailableTags) {
|
||||
const dataView = new DataView(file),
|
||||
length = file.byteLength,
|
||||
exifTags = selectedTags.reduce((result, selectedTag) => {
|
||||
const exifTag = Object.keys(ExifTags).filter(tag => ExifTags[tag] === selectedTag)[0];
|
||||
if (exifTag) {
|
||||
result[exifTag] = selectedTag;
|
||||
}
|
||||
return result;
|
||||
}, {});
|
||||
let offset = 2,
|
||||
marker;
|
||||
|
||||
if ((dataView.getUint8(0) !== 0xFF) || (dataView.getUint8(1) !== 0xD8)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (offset < length) {
|
||||
if (dataView.getUint8(offset) !== 0xFF) {
|
||||
return false;
|
||||
}
|
||||
|
||||
marker = dataView.getUint8(offset + 1);
|
||||
if (marker === 0xE1) {
|
||||
return readEXIFData(dataView, offset + 4, exifTags);
|
||||
} else {
|
||||
offset += 2 + dataView.getUint16(offset + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function readEXIFData(file, start, exifTags) {
|
||||
if (getStringFromBuffer(file, start, 4) !== "Exif") {
|
||||
return false;
|
||||
}
|
||||
|
||||
const tiffOffset = start + 6;
|
||||
let bigEnd,
|
||||
tags;
|
||||
|
||||
if (file.getUint16(tiffOffset) === 0x4949) {
|
||||
bigEnd = false;
|
||||
} else if (file.getUint16(tiffOffset) === 0x4D4D) {
|
||||
bigEnd = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file.getUint16(tiffOffset + 2, !bigEnd) !== 0x002A) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const firstIFDOffset = file.getUint32(tiffOffset + 4, !bigEnd);
|
||||
if (firstIFDOffset < 0x00000008) {
|
||||
return false;
|
||||
}
|
||||
|
||||
tags = readTags(file, tiffOffset, tiffOffset + firstIFDOffset, exifTags, bigEnd);
|
||||
return tags;
|
||||
}
|
||||
|
||||
function readTags(file, tiffStart, dirStart, strings, bigEnd) {
|
||||
const entries = file.getUint16(dirStart, !bigEnd),
|
||||
tags = {};
|
||||
|
||||
for (let i = 0; i < entries; i++) {
|
||||
const entryOffset = dirStart + i * 12 + 2,
|
||||
tag = strings[file.getUint16(entryOffset, !bigEnd)];
|
||||
if (tag) {
|
||||
tags[tag] = readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd);
|
||||
}
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
|
||||
function readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd) {
|
||||
const type = file.getUint16(entryOffset + 2, !bigEnd),
|
||||
numValues = file.getUint32(entryOffset + 4, !bigEnd);
|
||||
|
||||
switch (type) {
|
||||
case 3:
|
||||
if (numValues === 1) {
|
||||
return file.getUint16(entryOffset + 8, !bigEnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getStringFromBuffer(buffer, start, length) {
|
||||
let outstr = "";
|
||||
for (let n = start; n < start + length; n++) {
|
||||
outstr += String.fromCharCode(buffer.getUint8(n));
|
||||
}
|
||||
return outstr;
|
||||
}
|
@ -0,0 +1,257 @@
|
||||
import BarcodeReader from './barcode_reader';
|
||||
|
||||
function TwoOfFiveReader(opts) {
|
||||
BarcodeReader.call(this, opts);
|
||||
this.barSpaceRatio = [1, 1];
|
||||
}
|
||||
|
||||
var N = 1,
|
||||
W = 3,
|
||||
properties = {
|
||||
START_PATTERN: {value: [W, N, W, N, N, N]},
|
||||
STOP_PATTERN: {value: [W, N, N, N, W]},
|
||||
CODE_PATTERN: {value: [
|
||||
[N, N, W, W, N],
|
||||
[W, N, N, N, W],
|
||||
[N, W, N, N, W],
|
||||
[W, W, N, N, N],
|
||||
[N, N, W, N, W],
|
||||
[W, N, W, N, N],
|
||||
[N, W, W, N, N],
|
||||
[N, N, N, W, W],
|
||||
[W, N, N, W, N],
|
||||
[N, W, N, W, N]
|
||||
]},
|
||||
SINGLE_CODE_ERROR: {value: 0.78, writable: true},
|
||||
AVG_CODE_ERROR: {value: 0.30, writable: true},
|
||||
FORMAT: {value: "2of5"}
|
||||
};
|
||||
|
||||
const startPatternLength = properties.START_PATTERN.value.reduce((sum, val) => sum + val, 0);
|
||||
|
||||
TwoOfFiveReader.prototype = Object.create(BarcodeReader.prototype, properties);
|
||||
TwoOfFiveReader.prototype.constructor = TwoOfFiveReader;
|
||||
|
||||
TwoOfFiveReader.prototype._findPattern = function(pattern, offset, isWhite, tryHarder) {
|
||||
var counter = [],
|
||||
self = this,
|
||||
i,
|
||||
counterPos = 0,
|
||||
bestMatch = {
|
||||
error: Number.MAX_VALUE,
|
||||
code: -1,
|
||||
start: 0,
|
||||
end: 0
|
||||
},
|
||||
error,
|
||||
j,
|
||||
sum,
|
||||
epsilon = self.AVG_CODE_ERROR;
|
||||
|
||||
isWhite = isWhite || false;
|
||||
tryHarder = tryHarder || false;
|
||||
|
||||
if (!offset) {
|
||||
offset = self._nextSet(self._row);
|
||||
}
|
||||
|
||||
for ( i = 0; i < pattern.length; i++) {
|
||||
counter[i] = 0;
|
||||
}
|
||||
|
||||
for ( i = offset; i < self._row.length; i++) {
|
||||
if (self._row[i] ^ isWhite) {
|
||||
counter[counterPos]++;
|
||||
} else {
|
||||
if (counterPos === counter.length - 1) {
|
||||
sum = 0;
|
||||
for ( j = 0; j < counter.length; j++) {
|
||||
sum += counter[j];
|
||||
}
|
||||
error = self._matchPattern(counter, pattern);
|
||||
if (error < epsilon) {
|
||||
bestMatch.error = error;
|
||||
bestMatch.start = i - sum;
|
||||
bestMatch.end = i;
|
||||
return bestMatch;
|
||||
}
|
||||
if (tryHarder) {
|
||||
for (j = 0; j < counter.length - 2; j++) {
|
||||
counter[j] = counter[j + 2];
|
||||
}
|
||||
counter[counter.length - 2] = 0;
|
||||
counter[counter.length - 1] = 0;
|
||||
counterPos--;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
counterPos++;
|
||||
}
|
||||
counter[counterPos] = 1;
|
||||
isWhite = !isWhite;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
TwoOfFiveReader.prototype._findStart = function() {
|
||||
var self = this,
|
||||
leadingWhitespaceStart,
|
||||
offset = self._nextSet(self._row),
|
||||
startInfo,
|
||||
narrowBarWidth = 1;
|
||||
|
||||
while (!startInfo) {
|
||||
startInfo = self._findPattern(self.START_PATTERN, offset, false, true);
|
||||
if (!startInfo) {
|
||||
return null;
|
||||
}
|
||||
narrowBarWidth = Math.floor((startInfo.end - startInfo.start) / startPatternLength);
|
||||
leadingWhitespaceStart = startInfo.start - narrowBarWidth * 5;
|
||||
if (leadingWhitespaceStart >= 0) {
|
||||
if (self._matchRange(leadingWhitespaceStart, startInfo.start, 0)) {
|
||||
return startInfo;
|
||||
}
|
||||
}
|
||||
offset = startInfo.end;
|
||||
startInfo = null;
|
||||
}
|
||||
};
|
||||
|
||||
TwoOfFiveReader.prototype._verifyTrailingWhitespace = function(endInfo) {
|
||||
var self = this,
|
||||
trailingWhitespaceEnd;
|
||||
|
||||
trailingWhitespaceEnd = endInfo.end + ((endInfo.end - endInfo.start) / 2);
|
||||
if (trailingWhitespaceEnd < self._row.length) {
|
||||
if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {
|
||||
return endInfo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
TwoOfFiveReader.prototype._findEnd = function() {
|
||||
var self = this,
|
||||
endInfo,
|
||||
tmp,
|
||||
offset;
|
||||
|
||||
self._row.reverse();
|
||||
offset = self._nextSet(self._row);
|
||||
endInfo = self._findPattern(self.STOP_PATTERN, offset, false, true);
|
||||
self._row.reverse();
|
||||
|
||||
if (endInfo === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// reverse numbers
|
||||
tmp = endInfo.start;
|
||||
endInfo.start = self._row.length - endInfo.end;
|
||||
endInfo.end = self._row.length - tmp;
|
||||
|
||||
return endInfo !== null ? self._verifyTrailingWhitespace(endInfo) : null;
|
||||
};
|
||||
|
||||
TwoOfFiveReader.prototype._decodeCode = function(counter) {
|
||||
var j,
|
||||
self = this,
|
||||
sum = 0,
|
||||
normalized,
|
||||
error,
|
||||
epsilon = self.AVG_CODE_ERROR,
|
||||
code,
|
||||
bestMatch = {
|
||||
error: Number.MAX_VALUE,
|
||||
code: -1,
|
||||
start: 0,
|
||||
end: 0
|
||||
};
|
||||
|
||||
for ( j = 0; j < counter.length; j++) {
|
||||
sum += counter[j];
|
||||
}
|
||||
for (code = 0; code < self.CODE_PATTERN.length; code++) {
|
||||
error = self._matchPattern(counter, self.CODE_PATTERN[code]);
|
||||
if (error < bestMatch.error) {
|
||||
bestMatch.code = code;
|
||||
bestMatch.error = error;
|
||||
}
|
||||
}
|
||||
if (bestMatch.error < epsilon) {
|
||||
return bestMatch;
|
||||
}
|
||||
};
|
||||
|
||||
TwoOfFiveReader.prototype._decodePayload = function(counters, result, decodedCodes) {
|
||||
var i,
|
||||
self = this,
|
||||
pos = 0,
|
||||
counterLength = counters.length,
|
||||
counter = [0, 0, 0, 0, 0],
|
||||
code;
|
||||
|
||||
while (pos < counterLength) {
|
||||
for (i = 0; i < 5; i++) {
|
||||
counter[i] = counters[pos] * this.barSpaceRatio[0];
|
||||
pos += 2;
|
||||
}
|
||||
code = self._decodeCode(counter);
|
||||
if (!code) {
|
||||
return null;
|
||||
}
|
||||
result.push(code.code + "");
|
||||
decodedCodes.push(code);
|
||||
}
|
||||
return code;
|
||||
};
|
||||
|
||||
TwoOfFiveReader.prototype._verifyCounterLength = function(counters) {
|
||||
return (counters.length % 10 === 0);
|
||||
};
|
||||
|
||||
TwoOfFiveReader.prototype._decode = function() {
|
||||
var startInfo,
|
||||
endInfo,
|
||||
self = this,
|
||||
code,
|
||||
result = [],
|
||||
decodedCodes = [],
|
||||
counters;
|
||||
|
||||
startInfo = self._findStart();
|
||||
if (!startInfo) {
|
||||
return null;
|
||||
}
|
||||
decodedCodes.push(startInfo);
|
||||
|
||||
endInfo = self._findEnd();
|
||||
if (!endInfo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
counters = self._fillCounters(startInfo.end, endInfo.start, false);
|
||||
if (!self._verifyCounterLength(counters)) {
|
||||
return null;
|
||||
}
|
||||
code = self._decodePayload(counters, result, decodedCodes);
|
||||
if (!code) {
|
||||
return null;
|
||||
}
|
||||
if (result.length < 5) {
|
||||
return null;
|
||||
}
|
||||
|
||||
decodedCodes.push(endInfo);
|
||||
return {
|
||||
code: result.join(""),
|
||||
start: startInfo.start,
|
||||
end: endInfo.end,
|
||||
startInfo: startInfo,
|
||||
decodedCodes: decodedCodes
|
||||
};
|
||||
};
|
||||
|
||||
export default TwoOfFiveReader;
|
@ -0,0 +1,251 @@
|
||||
import BarcodeReader from './barcode_reader';
|
||||
import ArrayHelper from '../common/array_helper';
|
||||
|
||||
function Code93Reader() {
|
||||
BarcodeReader.call(this);
|
||||
}
|
||||
|
||||
const ALPHABETH_STRING = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*";
|
||||
|
||||
var properties = {
|
||||
ALPHABETH_STRING: {value: ALPHABETH_STRING},
|
||||
ALPHABET: {value: ALPHABETH_STRING.split('').map(char => char.charCodeAt(0))},
|
||||
CHARACTER_ENCODINGS: {value: [
|
||||
0x114, 0x148, 0x144, 0x142, 0x128, 0x124, 0x122, 0x150, 0x112, 0x10A,
|
||||
0x1A8, 0x1A4, 0x1A2, 0x194, 0x192, 0x18A, 0x168, 0x164, 0x162, 0x134,
|
||||
0x11A, 0x158, 0x14C, 0x146, 0x12C, 0x116, 0x1B4, 0x1B2, 0x1AC, 0x1A6,
|
||||
0x196, 0x19A, 0x16C, 0x166, 0x136, 0x13A, 0x12E, 0x1D4, 0x1D2, 0x1CA,
|
||||
0x16E, 0x176, 0x1AE, 0x126, 0x1DA, 0x1D6, 0x132, 0x15E
|
||||
]},
|
||||
ASTERISK: {value: 0x15E},
|
||||
FORMAT: {value: "code_93", writeable: false}
|
||||
};
|
||||
|
||||
Code93Reader.prototype = Object.create(BarcodeReader.prototype, properties);
|
||||
Code93Reader.prototype.constructor = Code93Reader;
|
||||
|
||||
Code93Reader.prototype._decode = function() {
|
||||
var self = this,
|
||||
counters = [0, 0, 0, 0, 0, 0],
|
||||
result = [],
|
||||
start = self._findStart(),
|
||||
decodedChar,
|
||||
lastStart,
|
||||
pattern,
|
||||
nextStart;
|
||||
|
||||
if (!start) {
|
||||
return null;
|
||||
}
|
||||
nextStart = self._nextSet(self._row, start.end);
|
||||
|
||||
do {
|
||||
counters = self._toCounters(nextStart, counters);
|
||||
pattern = self._toPattern(counters);
|
||||
if (pattern < 0) {
|
||||
return null;
|
||||
}
|
||||
decodedChar = self._patternToChar(pattern);
|
||||
if (decodedChar < 0){
|
||||
return null;
|
||||
}
|
||||
result.push(decodedChar);
|
||||
lastStart = nextStart;
|
||||
nextStart += ArrayHelper.sum(counters);
|
||||
nextStart = self._nextSet(self._row, nextStart);
|
||||
} while (decodedChar !== '*');
|
||||
result.pop();
|
||||
|
||||
if (!result.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!self._verifyEnd(lastStart, nextStart, counters)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!self._verifyChecksums(result)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
result = result.slice(0, result.length - 2);
|
||||
if ((result = self._decodeExtended(result)) === null) {
|
||||
return null;
|
||||
};
|
||||
|
||||
return {
|
||||
code: result.join(""),
|
||||
start: start.start,
|
||||
end: nextStart,
|
||||
startInfo: start,
|
||||
decodedCodes: result
|
||||
};
|
||||
};
|
||||
|
||||
Code93Reader.prototype._verifyEnd = function(lastStart, nextStart) {
|
||||
if (lastStart === nextStart || !this._row[nextStart]) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
Code93Reader.prototype._patternToChar = function(pattern) {
|
||||
var i,
|
||||
self = this;
|
||||
|
||||
for (i = 0; i < self.CHARACTER_ENCODINGS.length; i++) {
|
||||
if (self.CHARACTER_ENCODINGS[i] === pattern) {
|
||||
return String.fromCharCode(self.ALPHABET[i]);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
Code93Reader.prototype._toPattern = function(counters) {
|
||||
const numCounters = counters.length;
|
||||
let pattern = 0;
|
||||
let sum = 0;
|
||||
for (let i = 0; i < numCounters; i++) {
|
||||
sum += counters[i];
|
||||
}
|
||||
|
||||
for (let i = 0; i < numCounters; i++) {
|
||||
let normalized = Math.round(counters[i] * 9 / sum);
|
||||
if (normalized < 1 || normalized > 4) {
|
||||
return -1;
|
||||
}
|
||||
if ((i & 1) === 0) {
|
||||
for (let j = 0; j < normalized; j++) {
|
||||
pattern = (pattern << 1) | 1;
|
||||
}
|
||||
} else {
|
||||
pattern <<= normalized;
|
||||
}
|
||||
}
|
||||
|
||||
return pattern;
|
||||
};
|
||||
|
||||
Code93Reader.prototype._findStart = function() {
|
||||
var self = this,
|
||||
offset = self._nextSet(self._row),
|
||||
patternStart = offset,
|
||||
counter = [0, 0, 0, 0, 0, 0],
|
||||
counterPos = 0,
|
||||
isWhite = false,
|
||||
i,
|
||||
j,
|
||||
whiteSpaceMustStart;
|
||||
|
||||
for ( i = offset; i < self._row.length; i++) {
|
||||
if (self._row[i] ^ isWhite) {
|
||||
counter[counterPos]++;
|
||||
} else {
|
||||
if (counterPos === counter.length - 1) {
|
||||
// find start pattern
|
||||
if (self._toPattern(counter) === self.ASTERISK) {
|
||||
whiteSpaceMustStart = Math.floor(Math.max(0, patternStart - ((i - patternStart) / 4)));
|
||||
if (self._matchRange(whiteSpaceMustStart, patternStart, 0)) {
|
||||
return {
|
||||
start: patternStart,
|
||||
end: i
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
patternStart += counter[0] + counter[1];
|
||||
for ( j = 0; j < 4; j++) {
|
||||
counter[j] = counter[j + 2];
|
||||
}
|
||||
counter[4] = 0;
|
||||
counter[5] = 0;
|
||||
counterPos--;
|
||||
} else {
|
||||
counterPos++;
|
||||
}
|
||||
counter[counterPos] = 1;
|
||||
isWhite = !isWhite;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
Code93Reader.prototype._decodeExtended = function(charArray) {
|
||||
const length = charArray.length;
|
||||
const result = [];
|
||||
for (let i = 0; i < length; i++) {
|
||||
const char = charArray[i];
|
||||
if (char >= 'a' && char <= 'd') {
|
||||
if (i > (length - 2)) {
|
||||
return null;
|
||||
}
|
||||
const nextChar = charArray[++i];
|
||||
const nextCharCode = nextChar.charCodeAt(0);
|
||||
let decodedChar;
|
||||
switch (char) {
|
||||
case 'a':
|
||||
if (nextChar >= 'A' && nextChar <= 'Z') {
|
||||
decodedChar = String.fromCharCode(nextCharCode - 64);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
if (nextChar >= 'A' && nextChar <= 'E') {
|
||||
decodedChar = String.fromCharCode(nextCharCode - 38);
|
||||
} else if (nextChar >= 'F' && nextChar <= 'J') {
|
||||
decodedChar = String.fromCharCode(nextCharCode - 11);
|
||||
} else if (nextChar >= 'K' && nextChar <= 'O') {
|
||||
decodedChar = String.fromCharCode(nextCharCode + 16);
|
||||
} else if (nextChar >= 'P' && nextChar <= 'S') {
|
||||
decodedChar = String.fromCharCode(nextCharCode + 43);
|
||||
} else if (nextChar >= 'T' && nextChar <= 'Z') {
|
||||
decodedChar = String.fromCharCode(127);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
if (nextChar >= 'A' && nextChar <= 'O') {
|
||||
decodedChar = String.fromCharCode(nextCharCode - 32);
|
||||
} else if (nextChar === 'Z') {
|
||||
decodedChar = ':';
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
if (nextChar >= 'A' && nextChar <= 'Z') {
|
||||
decodedChar = String.fromCharCode(nextCharCode + 32);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
result.push(decodedChar);
|
||||
} else {
|
||||
result.push(char);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
Code93Reader.prototype._verifyChecksums = function(charArray) {
|
||||
return this._matchCheckChar(charArray, charArray.length - 2, 20)
|
||||
&& this._matchCheckChar(charArray, charArray.length - 1, 15);
|
||||
};
|
||||
|
||||
Code93Reader.prototype._matchCheckChar = function(charArray, index, maxWeight) {
|
||||
const arrayToCheck = charArray.slice(0, index);
|
||||
const length = arrayToCheck.length;
|
||||
const weightedSums = arrayToCheck.reduce((sum, char, i) => {
|
||||
const weight = (((i * -1) + (length - 1)) % maxWeight) + 1;
|
||||
const value = this.ALPHABET.indexOf(char.charCodeAt(0));
|
||||
return sum + (weight * value);
|
||||
}, 0);
|
||||
|
||||
const checkChar = this.ALPHABET[(weightedSums % 47)];
|
||||
return checkChar === charArray[index].charCodeAt(0);
|
||||
};
|
||||
|
||||
export default Code93Reader;
|
@ -0,0 +1,51 @@
|
||||
import EANReader from './ean_reader';
|
||||
|
||||
function EAN2Reader() {
|
||||
EANReader.call(this);
|
||||
}
|
||||
|
||||
var properties = {
|
||||
FORMAT: {value: "ean_2", writeable: false}
|
||||
};
|
||||
|
||||
EAN2Reader.prototype = Object.create(EANReader.prototype, properties);
|
||||
EAN2Reader.prototype.constructor = EAN2Reader;
|
||||
|
||||
EAN2Reader.prototype.decode = function(row, start) {
|
||||
this._row = row;
|
||||
var counters = [0, 0, 0, 0],
|
||||
codeFrequency = 0,
|
||||
i = 0,
|
||||
offset = start,
|
||||
end = this._row.length,
|
||||
code,
|
||||
result = [],
|
||||
decodedCodes = [];
|
||||
|
||||
for (i = 0; i < 2 && offset < end; i++) {
|
||||
code = this._decodeCode(offset);
|
||||
if (!code) {
|
||||
return null;
|
||||
}
|
||||
decodedCodes.push(code);
|
||||
result.push(code.code % 10);
|
||||
if (code.code >= this.CODE_G_START) {
|
||||
codeFrequency |= 1 << (1 - i);
|
||||
}
|
||||
if (i != 1) {
|
||||
offset = this._nextSet(this._row, code.end);
|
||||
offset = this._nextUnset(this._row, offset);
|
||||
}
|
||||
}
|
||||
|
||||
if (result.length != 2 || (parseInt(result.join("")) % 4) !== codeFrequency) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
code: result.join(""),
|
||||
decodedCodes,
|
||||
end: code.end
|
||||
};
|
||||
};
|
||||
|
||||
export default EAN2Reader;
|
@ -0,0 +1,84 @@
|
||||
import EANReader from './ean_reader';
|
||||
|
||||
function EAN5Reader() {
|
||||
EANReader.call(this);
|
||||
}
|
||||
|
||||
var properties = {
|
||||
FORMAT: {value: "ean_5", writeable: false}
|
||||
};
|
||||
|
||||
const CHECK_DIGIT_ENCODINGS = [24, 20, 18, 17, 12, 6, 3, 10, 9, 5];
|
||||
|
||||
EAN5Reader.prototype = Object.create(EANReader.prototype, properties);
|
||||
EAN5Reader.prototype.constructor = EAN5Reader;
|
||||
|
||||
EAN5Reader.prototype.decode = function(row, start) {
|
||||
this._row = row;
|
||||
var counters = [0, 0, 0, 0],
|
||||
codeFrequency = 0,
|
||||
i = 0,
|
||||
offset = start,
|
||||
end = this._row.length,
|
||||
code,
|
||||
result = [],
|
||||
decodedCodes = [];
|
||||
|
||||
for (i = 0; i < 5 && offset < end; i++) {
|
||||
code = this._decodeCode(offset);
|
||||
if (!code) {
|
||||
return null;
|
||||
}
|
||||
decodedCodes.push(code);
|
||||
result.push(code.code % 10);
|
||||
if (code.code >= this.CODE_G_START) {
|
||||
codeFrequency |= 1 << (4 - i);
|
||||
}
|
||||
if (i != 4) {
|
||||
offset = this._nextSet(this._row, code.end);
|
||||
offset = this._nextUnset(this._row, offset);
|
||||
}
|
||||
}
|
||||
|
||||
if (result.length != 5) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (extensionChecksum(result) !== determineCheckDigit(codeFrequency)) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
code: result.join(""),
|
||||
decodedCodes,
|
||||
end: code.end
|
||||
};
|
||||
};
|
||||
|
||||
function determineCheckDigit(codeFrequency) {
|
||||
var i;
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (codeFrequency === CHECK_DIGIT_ENCODINGS[i]) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function extensionChecksum(result) {
|
||||
var length = result.length,
|
||||
sum = 0,
|
||||
i;
|
||||
|
||||
for (i = length - 2; i >= 0; i -= 2) {
|
||||
sum += result[i];
|
||||
}
|
||||
sum *= 3;
|
||||
for (i = length - 1; i >= 0; i -= 2) {
|
||||
sum += result[i];
|
||||
}
|
||||
sum *= 3;
|
||||
return sum % 10;
|
||||
}
|
||||
|
||||
export default EAN5Reader;
|
After Width: | Height: | Size: 174 KiB |
After Width: | Height: | Size: 178 KiB |
After Width: | Height: | Size: 171 KiB |
After Width: | Height: | Size: 162 KiB |
After Width: | Height: | Size: 164 KiB |
After Width: | Height: | Size: 145 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 168 KiB |
After Width: | Height: | Size: 156 KiB |
After Width: | Height: | Size: 183 KiB |
After Width: | Height: | Size: 173 KiB |
After Width: | Height: | Size: 169 KiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 187 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 143 KiB |
After Width: | Height: | Size: 160 KiB |
After Width: | Height: | Size: 151 KiB |
After Width: | Height: | Size: 128 KiB |
After Width: | Height: | Size: 154 KiB |
After Width: | Height: | Size: 111 KiB |
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 121 KiB |
After Width: | Height: | Size: 144 KiB |
After Width: | Height: | Size: 140 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 140 KiB |
After Width: | Height: | Size: 111 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 91 KiB |
@ -0,0 +1,36 @@
|
||||
|
||||
let devices = [],
|
||||
stream,
|
||||
_constraints,
|
||||
_supported = true;
|
||||
|
||||
export function enumerateDevices() {
|
||||
console.log("enumerateDevices!!!!");
|
||||
return Promise.resolve(devices);
|
||||
};
|
||||
|
||||
export function getUserMedia(constraints) {
|
||||
console.log("getUserMedia!!!!");
|
||||
_constraints = constraints;
|
||||
if (_supported) {
|
||||
return Promise.resolve(stream);
|
||||
}
|
||||
return Promise.reject(new Error("das"));
|
||||
}
|
||||
|
||||
export function setDevices(newDevices) {
|
||||
devices = [...newDevices];
|
||||
}
|
||||
|
||||
export function setStream(newStream) {
|
||||
stream = newStream;
|
||||
}
|
||||
|
||||
export function getConstraints() {
|
||||
return _constraints;
|
||||
}
|
||||
|
||||
export function setSupported(supported) {
|
||||
console.log("Supported: " + supported);
|
||||
_supported = supported;
|
||||
}
|