Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
barcode-scan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Andrés Branas
barcode-scan
Commits
ee4bd87a
Commit
ee4bd87a
authored
Oct 16, 2017
by
Oscar Fuentes
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into development
parents
e2e97195
ec9b0861
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
2 deletions
+41
-2
src/android/com/cocodin/barcodescan/plugin/PluginHelper.java
+41
-2
No files found.
src/android/com/cocodin/barcodescan/plugin/PluginHelper.java
View file @
ee4bd87a
package
com
.
cocodin
.
barcodescan
.
plugin
;
package
com
.
cocodin
.
barcodescan
.
plugin
;
import
java.util.Objects
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.ExecutorService
;
import
com.zebra.adc.decoder.Barcode2DWithSoft
;
import
com.zebra.adc.decoder.Barcode2DWithSoft
;
...
@@ -13,6 +12,10 @@ import org.apache.cordova.PluginResult.Status;
...
@@ -13,6 +12,10 @@ import org.apache.cordova.PluginResult.Status;
import
org.json.JSONArray
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
android.content.BroadcastReceiver
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
com.phonegap.plugins.barcodescanner.BarcodeScanner
;
import
com.phonegap.plugins.barcodescanner.BarcodeScanner
;
...
@@ -25,7 +28,10 @@ public class PluginHelper {
...
@@ -25,7 +28,10 @@ public class PluginHelper {
private
static
boolean
threadStop
=
true
;
private
static
boolean
threadStop
=
true
;
private
static
ExecutorService
executor
;
private
static
ExecutorService
executor
;
private
static
Barcode2DWithSoft
mInstance
;
private
static
Barcode2DWithSoft
mInstance
;
private
static
JSONArray
Devices
=
new
JSONArray
().
put
(
"camera"
).
put
(
"c4050"
);
private
static
boolean
MQuireOn
=
false
;
private
static
BroadcastReceiver
barcodeScannerBroadcastReceiver
;
private
static
JSONArray
Devices
=
new
JSONArray
().
put
(
"camera"
).
put
(
"c4050"
).
put
(
"NQuire300"
);
private
static
CallbackContext
cbContext
;
public
static
void
scan
(
CordovaInterface
cordova
,
CordovaWebView
webView
,
JSONArray
args
,
public
static
void
scan
(
CordovaInterface
cordova
,
CordovaWebView
webView
,
JSONArray
args
,
final
CallbackContext
callbackContext
)
{
final
CallbackContext
callbackContext
)
{
...
@@ -71,6 +77,13 @@ public class PluginHelper {
...
@@ -71,6 +77,13 @@ public class PluginHelper {
barcodeScanner
.
cordova
=
cordova
;
barcodeScanner
.
cordova
=
cordova
;
barcodeScanner
.
webView
=
webView
;
barcodeScanner
.
webView
=
webView
;
barcodeScanner
.
execute
(
"scan"
,
new
JSONArray
(),
callbackContext
);
barcodeScanner
.
execute
(
"scan"
,
new
JSONArray
(),
callbackContext
);
}
else
if
(
device
.
equalsIgnoreCase
(
Devices
.
getString
(
2
)))
{
Context
context
=
cordova
.
getActivity
();
cbContext
=
callbackContext
;
if
(!
MQuireOn
)
{
initMquire
(
context
);
}
}
}
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -82,4 +95,29 @@ public class PluginHelper {
...
@@ -82,4 +95,29 @@ public class PluginHelper {
final
CallbackContext
callbackContext
)
{
final
CallbackContext
callbackContext
)
{
callbackContext
.
sendPluginResult
(
new
PluginResult
(
Status
.
OK
,
Devices
));
callbackContext
.
sendPluginResult
(
new
PluginResult
(
Status
.
OK
,
Devices
));
}
}
public
static
void
initMquire
(
Context
context
)
{
Intent
intent
=
new
Intent
(
"ACTION_BAR_SCANCFG"
);
intent
.
putExtra
(
"EXTRA_SCAN_MODE"
,
3
);
intent
.
putExtra
(
"EXTRA_SCAN_AUTOENT"
,
0
);
intent
.
putExtra
(
"EXTRA_SCAN_NOTY_LED"
,
1
);
intent
.
putExtra
(
"EXTRA_SCAN_NOTY_SND"
,
1
);
context
.
sendBroadcast
(
intent
);
MQuireOn
=
true
;
barcodeScannerBroadcastReceiver
=
new
BroadcastReceiver
()
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
final
String
scanResult_1
=
intent
.
getStringExtra
(
"SCAN_BARCODE1"
);
final
String
scanStatus
=
intent
.
getStringExtra
(
"SCAN_STATE"
);
if
(
null
==
scanResult_1
||
null
==
scanStatus
||
scanResult_1
.
isEmpty
()
||
scanStatus
.
isEmpty
())
{
return
;
}
if
(
"ok"
.
equals
(
scanStatus
))
{
cbContext
.
success
(
scanResult_1
);
}
}
};
context
.
registerReceiver
(
barcodeScannerBroadcastReceiver
,
new
IntentFilter
(
"nlscan.action.SCANNER_RESULT"
));
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment