You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
problem statement:
i have a ds3608 scanner with image scanning abilities i am using your code to capture image and it does work fine, but only if i continually pull the handle trigger. if i keep the scanner in standby mode for lets say 30sec, it makes a sound and then no matter how many times i pull hard trigger it just doesnt respond, i need to unplug and replug the usb for it to work again. Am i doing something wrong? please check my code below, i just want image scanning ability i do not want barcode so i commented barcode code
i am saving image as a unique file on every hard trigger and setting it back to image mode
please check what the issue is
appreciate your response
import pprint
import time
from PIL import Image
from io import BytesIO
from zebra_scanner import CoreScanner
pp = pprint.PrettyPrinter(indent=4)
cs = CoreScanner()
import uuid
@cs.on_scanner_added
def on_scanner_added(scanner):
print(f"New scanner found: <{scanner.GUID}>")
#pp.pprint(scanner.__dict__)
scanner.pull_trigger()
print("Selecting image type JPEG for this scanner")
scanner.select_image_type("1") # 1 = JPG, 4 = TIFF, 3 = BMP
scanner.select_image_mode()
scanner.fetch_attributes()
skip_scanner = True
for id, attribute in scanner.attributes.items():
if id<10:
skip_scanner = False
pp.pprint({
"id": id,
"datatype": attribute.datatype,
"value": attribute.value,
"permission": attribute.permission
})
else:
#print(f"-DD- Skipping {id}")
pass
if scanner.GUID != "":
print(f"Registering scanner -{scanner.GUID}-")
# @scanner.on_barcode
# def on_barcode(barcode):
# print("Scanned:")
# print(barcode.code, barcode.type)
# # TODO: check if sleep is actually necessary here. maybe waiting 1 second is also too long
# time.sleep(1)
# scanner.select_image_mode()
@scanner.on_image
def on_image(buf):
img = Image.open(BytesIO(buf))
unique_filename = str(uuid.uuid4())
img.save("/home/honda/Documents/backend/zebra_testing/zebra-scanner/dest_folder/"+unique_filename+".jpg", "JPEG")
print("Saved" +unique_filename+ "going back to image mode")
time.sleep(0.1)
# let's go back to image mode
scanner.select_image_mode()
@cs.on_scanner_removed
def on_scanner_removed(scanner):
print("Scanner removed:")
scanner.release_trigger()
# pp.pprint(scanner.__dict__)
while True:
time.sleep(0.1)
# do nothing while the scanner is reading in continous mode
The text was updated successfully, but these errors were encountered:
Hello, first off this is an amazing repo.
problem statement:
i have a ds3608 scanner with image scanning abilities i am using your code to capture image and it does work fine, but only if i continually pull the handle trigger. if i keep the scanner in standby mode for lets say 30sec, it makes a sound and then no matter how many times i pull hard trigger it just doesnt respond, i need to unplug and replug the usb for it to work again. Am i doing something wrong? please check my code below, i just want image scanning ability i do not want barcode so i commented barcode code
i am saving image as a unique file on every hard trigger and setting it back to image mode
please check what the issue is
appreciate your response
The text was updated successfully, but these errors were encountered: