Skip to content
This repository was archived by the owner on Mar 1, 2022. It is now read-only.

Commit 82e9a4b

Browse files
author
Darryn Campbell
committed
Adding details to readme
1 parent a30cc3d commit 82e9a4b

File tree

1 file changed

+188
-2
lines changed

1 file changed

+188
-2
lines changed

README.md

Lines changed: 188 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,188 @@
1-
# EnterpriseBarcodePoC
2-
Enterprise Browser Proof of Concept
1+
2+
*This plugin is provided without guarantee or warranty*
3+
=========================================================
4+
5+
# EnterpriseBarcode
6+
This plugin defines an `enterpriseBarcode` object which provides an API for interacting with the hardware scanner on Zebra devices. The enterpriseBarcode object is not available until after the `deviceready` event.
7+
8+
document.addEventListener("deviceready", onDeviceReady, false);
9+
function onDeviceReady() {
10+
console.log(enterpriseBarcode);
11+
}
12+
13+
## Installation
14+
15+
cordova plugin add https://github.com/darryncampbell/EnterpriseBarcodePoC.git
16+
17+
## Supported Platforms
18+
19+
- Android
20+
21+
## enterpriseBarcode.enumerate
22+
23+
Returns the available hardware scanners on the device
24+
25+
enterpriseBarcode.enumerate(enumerateSuccess, enumerateFailure);
26+
27+
### Description
28+
29+
The `enterpriseBarcode.enumerate` function queries the device hardware for available scanners and returns them through the success callback
30+
31+
### Android Quirks
32+
33+
Currently Barcode functionality is only available if the application is built against the Zebra EMDK target, specify this in your project.properties file prior to building
34+
35+
### Example
36+
37+
Output the available scanners to the console
38+
39+
enterpriseBarcode.enumerate(
40+
function(scannersObj)
41+
{
42+
for(scanner in scannersObj.scanners)
43+
{
44+
console.log("Scanner: " + scanner.friendlyName);
45+
}
46+
},
47+
function(status)
48+
{
49+
console.log("Failed to Enumerate Scanners: " + status.message);
50+
}
51+
);
52+
53+
The Scanners are also available through the `enterpriseBarcode.scanners` property after the device ready event.
54+
55+
for(scanner in enterpriseBarcode.scanners)
56+
{
57+
console.log("Scanner: " + scanner.friendlyName);
58+
}
59+
60+
## Barcode Options
61+
62+
Optional parameters to customize the Scanner settings can be provided either through the `setProperties` method or through the `enable` method. These settings will persist until the application is closed.
63+
64+
{ code11Enabled : true,
65+
code128Enabled : true,
66+
code39Enabled : false,
67+
code93Enabled : false,
68+
dataMatrixEnabled : false,
69+
ean8Enabled : true,
70+
ean13Enabled : true,
71+
upcaEnabled : true,
72+
upce1Enabled : false,
73+
pdf417Enabled : true,
74+
friendlyName : '2D Barcode Imager'};
75+
76+
### Options
77+
78+
- __code11Enabled__ : Enable or Disable recognition of the Code 11 Symbology
79+
- __code128Enabled__ : Enable or Disable recognition of the Code 128 Symbology
80+
- __code39Enabled__ : Enable or Disable recognition of the Code 39 Symbology
81+
- __code93Enabled__ : Enable or Disable recognition of the Code 93 Symbology
82+
- __dataMatrixEnabled__ : Enable or Disable recognition of the Data Matrix Symbology
83+
- __ean8Enabled__ : Enable or Disable recognition of the EAN 8 Symbology
84+
- __ean13Enabled__ : Enable or Disable recognition of the EAN 13 Symbology
85+
- __upcaEnabled__ : Enable or Disable recognition of the UPCA Symbology
86+
- __upce1Enabled__ : Enable or Disable recognition of the UPCE1 Symbology
87+
- __pdf417Enabled__ : Enable or Disable recognition of the PDF417 Symbology
88+
- __friendlyName__ : Specifies which scanner should be enabled. __Only applicable to options passed to the enable method.__
89+
90+
### Quirks
91+
92+
Not all barcode scanners will support all symbologies, for instance 2D symbologies like PDF417 will not be supported on 1D laser scanners.
93+
94+
## enterpriseBarcode.enable
95+
96+
Enables the barcode scanner hardware and the associated trigger, so pressing the hardware trigger will initiate a scan.
97+
98+
enterpriseBarcode.enable(enableSuccess, enableFailure, barcodeOptions);
99+
100+
### Description
101+
102+
The Enable method will instruct the scanning hardware to initialise and attach the trigger that can subsequently be used to initiate a scan. The success callback is called firstly to indicate that the scanner has successfully enabled and subsequently on each barcode scan (see example)
103+
104+
### Example
105+
106+
enterpriseBarcode.enable(
107+
function(scannedObj)
108+
{
109+
if (scannedObj.status == "enabled")
110+
console.log("Scanner has successfully enabled");
111+
else
112+
{
113+
console.log("Scan Data: " + scannedObj.data);
114+
console.log("Scan Symbology: " + scannedObj.type);
115+
console.log("Scan Time: " + scannedObj.timestamp);
116+
}
117+
},
118+
function(status)
119+
{
120+
console.log("Enable Failure: " + status.message);
121+
},
122+
{
123+
'friendlyName':'2D Barcode Imager'
124+
}
125+
);
126+
127+
## enterpriseBarcode.disable
128+
129+
Disables the currently enabled barcode scanner hardware and disconnects the associated trigger.
130+
131+
enterpriseBarcode.disable(disableSuccess, disableFailure);
132+
133+
### Description
134+
135+
The Disable method will instruct the currently enabled scanning hardware to deinitialise. Calling `disable` without having previously enabled a scanner will have no effect.
136+
137+
### Example
138+
139+
enterpriseBarcode.disable(
140+
function(status)
141+
{
142+
console.log("Disable Success: " + status.message);
143+
},
144+
function(status)
145+
{
146+
console.log("Disable Failure: " + status.message);
147+
}
148+
);
149+
150+
## enterpriseBarcode.setProperties
151+
152+
Sets any of the properties listed under barcodeOptions to the currently enabled scanner. If there is no currently enabled scanner then this method has no effect.
153+
154+
### Example
155+
156+
enterpriseBarcode.setProperties(
157+
function(status)
158+
{
159+
console.log("Set Properties Success: " + status.message);
160+
},
161+
function(status)
162+
{
163+
console.log("Set Properties Failure: " + status.message);
164+
},
165+
{
166+
'code11Enabled':true,
167+
'code39Enabled':false
168+
}
169+
);
170+
171+
172+
## enterpriseBarcode.getProperties
173+
174+
Retrieves the properties listed under barcodeOptions from the currently enabled scanner. If there is no currently enabled scanner then this method has no effect.
175+
176+
### Example
177+
178+
enterpriseBarcode.getProperties(
179+
function(props)
180+
{
181+
document.getElementById("code11Check").checked = props.code11Enabled;
182+
document.getElementById("code39Check").checked = props.code39Enabled;
183+
},
184+
function(data)
185+
{
186+
console.log("Get Properties Failure: " + status.message);
187+
}
188+
);

0 commit comments

Comments
 (0)