Skip to main content

Android HTTP API

While DXU Service is enabled and running, DXU Android provides an HTTP endpoint that can be used by local applications to control the scanner. This is useful for web-based applications that need to be able to control the scanner.

Conventions

In the documentation below, the following conventions are used:

  • dxuPort is used to indicate the port on which DXU is running. The default value is 8080.

  • Only localhost connections are allowed, i.e. connections to http://127.0.0.1:dxuPort/scan.

  • All APIs, unless otherwise noted, are HTTP GET methods.

  • API responses return no content unless otherwise indicated.

APIs

Start scan trigger

Causes the device's scanner to turn on and scan a barcode.

URI/scan?action=start_trigger
Optional Query Parameterstimeout=[integer] where timeout is the number of milliseconds delay before the barcode scan attempt times out. Default value is 3000 (3 seconds).
Success Response200 OK when the scanner could be turned on.
Error Response500 INTERNAL SERVER ERROR when the scanner could not be turned on.
Available sinceDXU Agent 1.0

Release scan trigger

Causes the device's scanner to turn off and stop any barcode scan attempt in progress.

URI/scan?action=stop_trigger
Success Response200 OK when the scanner could be turned off.
Error Response500 INTERNAL SERVER ERROR when the scanner could not be turned off.
Available sinceDXU Agent 1.0

Register scan start listener

Register a scan start listener to be notified when a scan started event is triggered.

URI/scan?action=start_listener
Success Response200 OK when the listener could be registered
Error Response500 INTERNAL SERVER ERROR when the listener could not be registered
Available sinceDXU Agent 1.0

Register stop scan listener

Register a scan stop listener to be notified when a scan stopped event is triggered.

URI/scan?action=stop_listener
Success Response200 OK when the listener could be registered
Error Response500 INTERNAL SERVER ERROR when the listener could not be registered
Available sinceDXU Agent 1.0

Register a scan timeout listener

Register a scan timeout listener to be notified when a scan timeout event is triggered.

URI/scan?action=timeout_listener
Success Response200 OK when the listener could be registered
Error Response500 INTERNAL SERVER ERROR when the listener could not be registered
Available sinceDXU Agent 1.0

Register a scan read listener

Register a scan read listener to be notified when a read event is triggered and received data is ready

URI/scan?action=read_listener
Optional Query Parametersoutput=[value] where output specifies the format in which the barcode data should be returned. The default value is text. Valid values are text, json and xml.
Success Response200 OK when data is available. Data is returned in the format specified using the output parameter.

text example:
353309092150281

json example:
{"codeID":7,"dataAsText":"353309092150281\n","rawData":[51,53,51,51,48,57,48,57,50,49,53,48,50,56,49]}

xml example:
<com.datalogic.decode.Barcode>
<codeID>7</codeID>
<dataAsText>353309092150281 </dataAsText>
<rawData>MzUzMzA5MDkyMTUwMjgx</rawData>
</com.datalogic.decode.Barcode>

Error Response500 INTERNAL SERVER ERROR when the data could not be retrieved.
Available sinceDXU Agent 1.0

Disable all physical triggers

Use to disable all physical triggers on the device.

URI/scan?action=disable_all_triggers
Success Response200 OK when the physical triggers were successfully disabled
Error Response500 INTERNAL SERVER ERROR when the physical triggers couldn't be disabled
Available sinceDXU Agent 1.29

Enable all physical triggers

Use to enable all physical triggers on the device.

URI/scan?action=enable_all_triggers
Success Response200 OK when the physical triggers were successfully enabled
Error Response500 INTERNAL SERVER ERROR when the physical triggers couldn't be enabled
Available sinceDXU Agent 1.29

Disable keyboard wedge

Use to disable the keyboard wedge feature.

URI/scan?action=disable_keyboardWedge
Success Response200 OK when keyboard wedge was successfully disabled
Error Response500 INTERNAL SERVER ERROR when keyboard wedge couldn't be disabled
Available sinceDXU Agent 1.29

Enable keyboard wedge

Use to enable the keyboard wedge feature.

URI/scan?action=enable_keyboardWedge
Success Response200 OK when keyboard wedge was successfully enabled
Error Response500 INTERNAL SERVER ERROR when keyboard wedge couldn't be enabled
Available sinceDXU Agent 1.29