Using C/C++ DLL with Python/Pyserial to communicate with Opticon barcode reader -
Using C/C++ DLL with Python/Pyserial to communicate with Opticon barcode reader -
i have opticon opn-2001 barcode scanner im trying communicate with. officially supports c/c++ , .net wanted utilize python if possible.
i have opened serial connection device (or @ to the lowest degree port(?) when utilize functions dll gives me communications error (-1) when expecting ok (0). i've never used dll's or serial communication bear in mind.
what im wondering if i've made obvious mistakes in calling dll-function or using pyserial. im interested in else having @ sdk. seems expecting 4 byte long comport below. thought work im bit stuck. realize there much can help without actual hardware. give thanks help however!
here code have sofar:
from ctypes import * serial import * opticonlib = windll('csp2.dll') opticonlib.csp2setdebugmode(1) #logs textfile if using debug version of .dll comport = 3 opticonserial = serial( port=comport - 1, baudrate=9600, bytesize=eightbits, parity=parity_odd, stopbits=stopbits_one, timeout=5 ) if opticonserial.isopen(): print ('port open. using ' + opticonserial.name + '.') print (opticonlib.csp2initex(comport)) #gives -1 instead of 0 opticonserial.close()
sdk scanner if want dig deeper
windows keeps lock on serial ports. without looking @ sdk, i'm going guess csp2initex tries open serial port , when gets error windows , fails.
try not opening serial port yourself.
python c++ dll barcode-scanner pyserial
Comments
Post a Comment