Skip to content

Commit 906d30e

Browse files
authored
Update README.md
1 parent 71ac462 commit 906d30e

File tree

1 file changed

+66
-1
lines changed

1 file changed

+66
-1
lines changed

README.md

+66-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,67 @@
11
# Barcode
2-
Barcode reader
2+
3+
Barcode reader.
4+
5+
# Use
6+
7+
1. Import `isc.barcode`
8+
2. Run:
9+
10+
```
11+
/// Utility methods
12+
Class isc.barcode.Utils
13+
{
14+
15+
/// Main class to import
16+
Parameter CLASS = "isc.barcode";
17+
18+
/// Gateway name to create/use
19+
Parameter GATEWAY = "Java";
20+
21+
/// Get JGW object
22+
ClassMethod connect(gatewayName As %String = {..#GATEWAY}, path As %String = "barcode-1.0-SNAPSHOT-jar-with-dependencies.jar", Output sc As %Status) As %Net.Remote.Gateway
23+
{
24+
set gateway = ""
25+
set sc = ##class(%Net.Remote.Service).OpenGateway(gatewayName, .gatewayConfig)
26+
quit:$$$ISERR(sc) gateway
27+
set sc = ##class(%Net.Remote.Service).ConnectGateway(gatewayConfig, .gateway, path, $$$YES)
28+
quit gateway
29+
}
30+
31+
/// Get barcode
32+
/// Write $System.Status.GetErrorText(##class(isc.barcode.Utils).getBarCode())
33+
ClassMethod getBarCode(file As %String, debug As %Boolean = {$$$YES}) As %Status
34+
{
35+
#dim gateway as %Net.Remote.Gateway
36+
#dim exception as %Exception.AbstractException
37+
38+
set sc = $$$OK
39+
try {
40+
set gateway = ..connect()
41+
set start = $zh
42+
43+
set reader = ##class(isc.barcode).%New(gateway)
44+
45+
set end1 = $zh
46+
set barcodes = reader.readBarCode(file)
47+
set end2 = $zh
48+
49+
if debug {
50+
write !,"Init: ",end1-start
51+
write !,"Reader: ",end2-end1, !
52+
zw barcodes
53+
//break
54+
}
55+
56+
set sc = gateway.%Disconnect()
57+
58+
} catch ex {
59+
break:debug
60+
set sc = $$$ADDSC(ex.AsStatus(), $g(%objlasterror))
61+
}
62+
63+
quit sc
64+
}
65+
66+
}
67+
```

0 commit comments

Comments
 (0)