
Shanghai Sunmi Technology Co., Ltd. Sweeping Development
Sunmi Scanner User Guide

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 1 -
Document Update Description
Increase access to sweep dock
type interface.
Add code system detail settings.
Increase suffix settings.
Add advanced formatting.
Increase virtual button settings.
Add clear configuration menu.
Increase no direct output.
Increase output code type ID.
Correction section description.
Add suffixes to support "\xxx"
escaping.
Add advanced format support
"\xxx" escaping.
Add broadcast output to support
raw byte array.
Modify some descriptions and
captions.

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 2 -
1. Introduction
Sunmi L2, P2Lite and other scan code special equipment, can be used for commercial
super, industrial, medical, agricultural trade, law enforcement, etc., L2 has two kinds of scan
specs:
NewLand:New NewLand Sweeping Pier, support code see Schedule 1;
Zebra:Zebra Sweeping Pier, support code see Schedule 1;
Honeywell: Honeywell Sweeping Pier, support code see Schedule 1;
Scan Engine is a development-free scanning device. By default, the side key triggers the
scan code function. There are three scan code output results. The default is the analog
keyboard output. The user opens any edit box. After the scan is successful, the scan result is
automatically entered in the edit box.
If the user needs the software to trigger the scan code or needs to customize the scan
code button, it can be set through the interface provided by the scan code service.
The following describes the interface documentation related to the scan code service
(currently support Aidl way and service connection).

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 3 -
2. Connect Service(AIDL)
2.1. AIDL
AIDL is the abbreviation of Android Interface Definition language. It is a description
language of Android's internal process communication interface. Through it, we can define the
communication interface between processes.
2.2. Use AIDL
Establishing a connection can be divided into the following 5 steps:
1. Add the AIDL file included in the resource file to your project.
2. Implement ServiceConnection in the code class that controls scan code.
3. Call ApplicationContext.bindService() and pass it in the ServiceConnection
implementation. Note: bindservice is a non-blocking call, meaning that the call is not
completed immediately after the call is completed. ServiceConnected must prevail.
4. In the ServiceConnection.onServiceConnected() implementation, you receive an IBinder
instance (the invoked Service). Call IScanInterface.Stub.asInterface(service) to convert
the argument to IScanInterface type.
5. Now you can call the methods defined in the IScanInterface interface.
private static ServiceConnection conn = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
scanInterface = IScanInterface.Stub.asInterface(service);
Log.i("setting", "Scanner Service Connected!");
}
@Override
public void onServiceDisconnected(ComponentName name) {
Log.e("setting", "Scanner Service Disconnected!");
scanInterface = null;
}
};
public void bindScannerService() {

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 4 -
Intent intent = new Intent();
intent.setPackage("com.sunmi.scanner");
intent.setAction("com.sunmi.scanner.IScanInterface");
bindService(intent, conn, Service.BIND_AUTO_CREATE);
}

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 5 -
2.3. AIDL Interface
void sendKeyEvent(KeyEvent key)
Custom the trigger key
int getScannerModel()
Get scanner type
Custom the trigger key
fuction:void sendKeyEvent(KeyEvent key)
parameter:
key → KeyEvent
action=KeyEvent.ACTION_UP:start scan
action=KeyEvent.ACTION_DOWN:stop scan
Example:
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// Example: Use the X key value as the trigger sweep key.
if (event.getKeyCode() == x) {
scanInterface.sendKeyEvent(event);
}
return super.dispatchKeyEvent(event);
}
Start scan
fuction:void scan( )
Note:Need to work with the stop() method to start identifying scan codes.
Example:

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 6 -
Stop scan
fuction:void stop( )
Note:Need to work with the scan() method to stop identifying scan codes.
Example:
Get scan type
fuction:int getScannerModel( )
Return:Type:
100 → NONE
101 → P2Lite/V2Pro/P2Pro(em1365/BSM1825)
102 → L2-newland(EM2096)
103 → L2-zabra(SE4710)
104 → L2-HoneyWell(N3601)
105 → L2-HoneyWell(N6603)
106 → L2-Zabra(SE4750)
107 → L2-Zabra(EM1350)
Example:
scanInterface.getScannerModel();

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 7 -
3. Setting
3.1. Clear configuration
Click the menu icon in the top right corner, then click "Clear Config", as shown below:

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 8 -
3.2. Character set selection
Default:UTF-8
Options:UTF-8,GBK,ISO-8859-1,SHITF-JIS
3.3. Prompt mode
Acoustic and vibration alerts are turned on by default.
3.4. Data Output mode
1. Setting
Simulated keyboard output is selected by default.
Broadcast output is turned on by default.
Barcode type is not output by default. Refer to CodeID for details.

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 9 -
Fill in EditText directly, select the “character to button” (output the end character as an
analog button)

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 10 -
2. Brocadcast introduce
Listening broadcast:"com.sunmi.scanner.ACTION_DATA_CODE_RECEIVED"
Field description:
data: character data;
source_byte: Byte array raw data (Excluding the basic settings such as End Character,
CodeID, suffix and advanced settings, etc., requires version 2.3.1 or higher);
Example:
private static final String ACTION_DATA_CODE_RECEIVED =
"com.sunmi.scanner.ACTION_DATA_CODE_RECEIVED";
private static final String DATA = "data";
private static final String SOURCE = "source_byte";
private BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String code = intent.getStringExtra(DATA);
String arr = intent.getByteArrayExtra(SOURCE);
if (code != null && !code.isEmpty()) {
mCode.setText(code);
}
}
};
private void registerReceiver() {
IntentFilter filter = new IntentFilter();
filter.addAction(ACTION_DATA_CODE_RECEIVED);
registerReceiver(receiver, filter);
}
3.5. Scan Trigger
The default hover button is off.

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 11 -
3.6. Scan mode
Default:trigger mode
3.7. Prefix and suffix settings
The suffix and suffix function is disabled by default. It supports "\n", "\t", "\xxx" (three-digit
ASCII decimal value 0-255, requires version 2.2.2 or higher) special characters, if you need to
add "\" please enter"\\":
Can be turned on manually, up to 10 digits

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 12 -
3.8. Decoders
The user can choose to enable or disable the identification code in setting .
Default :fully enabled.
3.9. Doceder Parameterx
Find "Scanner Setting -> Decoder Parameters" from the sweep dock settings to enter the
code system settings page, as follows:

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 13 -
Click on one of the code systems, such as "Code 39", as shown below:

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 14 -
3.10. Advanced Data Formatting
Advanced Data Formatting – Character Replacement, as shown below:
Advanced Data Formatting, default is off, It is turned off by default and can be manually
turned on. It can support up to 10 rules. You can edit and delete the rules. Click “Add” to add,
as shown below:
Supports up to 20 characters, supports "\n", "\t", "\xxx" (three-digit ASCII decimal value 0255, requires version 2.2.5 or higher) special characters, if you need to add "\" please enter"\\".

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 15 -
4. Appendices
4.1. table1

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 16 -
China
Post(HongKong 2of5)

Shanghai Sunmi Technology Co., Ltd. Sweeping Development
- 17 -