API Reference¶
de2120_barcode_scanner¶
Python module for the 2D Barcode Scanner.
This python package is a port of the exisiting [SparkFun DE2120 Arduino Library](https://github.com/sparkfun/SparkFun_DE2120_Arduino_Library)
- class de2120_barcode_scanner.DE2120BarcodeScanner(hard_port=None)[source]¶
Initialize the library with the given port.
- Parameters
hard_port – The port to use to communicate with the module, this is a serial port at 9600 baud rate.
- Returns
The DE2120BarcodeScanner object.
- Return type
Object
- USB_mode(mode)[source]¶
Enable USB communication and set the mode. THIS WILL MAKE THE MODULE UNRESPONSIVE ON COM PORT
- Parameters
mode – string defining what USB mode to set the module in. Valid arguments are “KBD”, “HID”, “232”.
- Returns
true if the command is successfully sent, false otherwise
- Return type
bool
- begin()[source]¶
Initializes the device with basic settings. Calls the is_connected() function
- Returns
Returns true if initialization was successful
- Return type
bool
- change_baud_rate(baud)[source]¶
Change the serial baud rate for the barcode module. Default 115200
- Parameters
baud – baud rate to change to
- Returns
true if command is successfully sent, false otherwise
- Return type
bool
- change_buzzer_tone(tone)[source]¶
Change the buzzer frequency between low, med, and high
- Parameters
tone – int that’s 1 = low, 2 = med, 3 = high frequency
- Returns
true if command is successfully sent, false otherwise
- Return type
bool
- change_reading_area(percent)[source]¶
Change the percentage of the frame to scan for barcodes
- Parameters
percent – Percentage of frame to scan. Valid values are 100, 80, 60, 40, 20 as stated in the DE2120 Scan Setting Manual
- Returns
true if command successfully sent, false otherwise
- Return type
bool
- disable_all_1D()[source]¶
Disable decoding of all 1D symbologies
- Returns
true if the command is successfully sent, false otherwise
- Return type
bool
- disable_all_2D()[source]¶
Disable decoding of all 2D symbologies
- Returns
true if the command is successfully sent, false otherwise
- Return type
bool
- disable_boot_beep()[source]¶
Disable beep on module startup
- Returns
true if command successfully sent, false otherwise
- Return type
bool
- disable_decode_beep()[source]¶
Disable beep on successful read
- Returns
true if command is successfully sent, false otherwise
- Return type
bool
- disable_image_flipping()[source]¶
Disable mirror image reading
- Returns
true if the command is successfully sent, false otherwise
- Return type
bool
- enable_all_1D()[source]¶
Enable decoding of all 1D symbologies
- Returns
true if the command is successfully sent, false otherwise
- Return type
bool
- enable_all_2D()[source]¶
Enable decoding of all 2D symbologies
- Returns
true if the command is successfully sent, false otherwise
- Return type
bool
- enable_boot_beep()[source]¶
Enable beep on module startup
- Returns
true if command is successfully sent, false otherwise
- Return type
bool
- enable_continuous_read(repeat_interval=2)[source]¶
Enable continuous reading of barcodes and set the time interval for same-code reads
- Parameters
repeat_interval – int parameter. 0: same code output 1 times 1: continuous output with same code without interval 2: continuous output with same code, 0.5 second interval (default) 3: continuous output with same code, 1 second interval
- Returns
true if the command is successfully sent, false otherwise
- Return type
bool
- enable_decode_beep()[source]¶
Enable beep on successful read
- Returns
true if command is successfully sent, false otherwise
- Return type
bool
- enable_image_flipping()[source]¶
Enable mirror image reading
- Returns
true if the command successfully sent, false otherwise
- Return type
bool
- enable_manual_trigger()[source]¶
Disable the motioin sensitive and continuous read mode. Return to the default trigger mode.
- Returns
true if the command is successfully sent, false otherwise
- Return type
bool
- enable_motion_sense(sensitivity=20)[source]¶
Enable the motion sensitive read mode and set sensitivity level
- Parameters
sensitivity – int value. The smaller the sensitivity, the more sensitive. Values are taken from the DE2120 settings manual. Valid arguments are: 15 (very high), 20 (high/default), 30 (little high), 50 (general), 100 (low sensitivity)
- Returns
true if command is successfully sent, false otherwise
- Return type
bool
- factory_default()[source]¶
Send command to put the module back into facory default settings. This will disconnect the module from the serial port.
- Returns
True if command successfully received, false
otherwise. :rtype: bool
- is_connected()[source]¶
Ask the DE2120 for the firmware version.
- Returns
Returns true if the DE2120 responds with an ACK.
Retruns false otherwise. :rtype: bool
- light_off()[source]¶
Turn white illumination LED off
- Returns
true if command successfully sent, false otherwise
- Return type
bool
- light_on()[source]¶
Turn white illumination LED on
- Returns
true if command successfully sent, false otherwise
- Return type
bool
- read_barcode()[source]¶
Read from the serial buffer until we hit a new line character
- Returns
the string in the serial buffer
- Return type
bool
- reticle_off()[source]¶
Turn red scan line off
:return true if command successfully sent, false otherwise :rtype: bool
- reticle_on()[source]¶
Turn red scan line on
- Returns
true if command successfully sent, false otherwise
- Return type
bool
- send_command(cmd, arg='')[source]¶
Create command string and send to DE2120 over serial port. Check serial buffer for a response
- Parameters
cmd – The command name
arg – The command variation, if there is one
- Returns
True if the response from DE2120 contains the
ACK character, false otherwise. :rtype: bool