dayjaby / zebra-scanner

Read barcodes in python with zebra barcode scanner
MIT License
24 stars 18 forks source link

Can you help me out in getting started? #30

Open samridhsri opened 1 year ago

samridhsri commented 1 year ago

Since, this SDK does not support python natively. Can you help me out in steps to get started with this Zebra Scanner SDK to create applications. Though, I have the developer guide for the SDK but still I am newbie so facing difficulty.

dayjaby commented 1 year ago

Have a look at the virtual void functions in CoreScanner: https://github.com/dayjaby/zebra-scanner/blob/master/src/BoostPythonCoreScanner.h

These are callback functions, that the Zebra SDK will call when something specific happens (e.g. OnBarcodeEvent gets called when a barcode gets scanned). So our only job is to implement them here in C++. Most callbacks get some XML string that we have to parse for that. The OnBarcodeEvent implementation (https://github.com/dayjaby/zebra-scanner/blob/master/src/BoostPythonCoreScanner.cpp#L438) is very simple:

  1. Find the Scanner s that matches the scannerID in the XML
  2. Convert the hexadecimal datalabel to a normal string
  3. Create a Barcode object o
  4. Do a callback on the python function s.OnBarcode(o)

Do you have more specific questions?

MehmetEminMizrak commented 10 months ago

(tamirtakip_virtual) PS C:\Users\Dell\Desktop\python tamirtakip> pip install zebra-scanner Collecting zebra-scanner Using cached zebra-scanner-0.2.5.tar.gz (8.9 kB) Preparing metadata (setup.py) ... done Building wheels for collected packages: zebra-scanner Building wheel for zebra-scanner (setup.py) ... error error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [20 lines of output] C:\Users\Dell\Desktop\python tamirtakip\tamirtakip_virtual\lib\site-packages\setuptools\dist.py:314: InformationOnly: Normalizing 'v0.2.5' to '0.2.5' self.metadata.version = self._normalize_version(self.metadata.version) running bdist_wheel running build running build_ext building 'zebra_scanner' extension creating build creating build\temp.win-amd64-cpython-310 creating build\temp.win-amd64-cpython-310\Release creating build\temp.win-amd64-cpython-310\Release\Users creating build\temp.win-amd64-cpython-310\Release\Users\Dell creating build\temp.win-amd64-cpython-310\Release\Users\Dell\AppData creating build\temp.win-amd64-cpython-310\Release\Users\Dell\AppData\Local creating build\temp.win-amd64-cpython-310\Release\Users\Dell\AppData\Local\Temp creating build\temp.win-amd64-cpython-310\Release\Users\Dell\AppData\Local\Temp\pip-install-ma6lfntr creating build\temp.win-amd64-cpython-310\Release\Users\Dell\AppData\Local\Temp\pip-install-ma6lfntr\zebra-scanner_40c40a00c55249c6aa0633c50e122f29 creating build\temp.win-amd64-cpython-310\Release\Users\Dell\AppData\Local\Temp\pip-install-ma6lfntr\zebra-scanner_40c40a00c55249c6aa0633c50e122f29\src "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I/usr/include/zebra-scan ner "-IC:\Users\Dell\Desktop\python tamirtakip\tamirtakip_virtual\lib\site-packages\pybind11\include" -IC:\Users\Dell\AppData\Local\Temp\pip-install-ma6lfntr\zebra-scanner_40c40a00 c55249c6aa0633c50e122f29\src "-IC:\Users\Dell\Desktop\python tamirtakip\tamirtakip_virtual\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0 _x64qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64qbz5n2kfra8p0\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.190 41.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windo ws Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /EHsc /TpC:\Users\Dell\AppData\Local\Temp\pip-install-ma6lfntr\zebra -scanner_40c40a00c55249c6aa0633c50e122f29\src\BoostPythonCoreScanner.cpp /Fobuild\temp.win-amd64-cpython-310\Release\Users\Dell\AppData\Local\Temp\pip-install-ma6lfntr\zebra-scanner_40c40a00c55249c6aa0633c50e122f29\src\BoostPythonCoreScanner.obj -Wno-deprecated -std=c++11 -fvisibility=hidden cl: Komut sat\x8dr\x8d error D8021: ge‡ersiz say\x8dsal ba§\x8dms\x8dz de§iŸken '/Wno-deprecated' error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe' failed with exit code 2 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for zebra-scanner Running setup.py clean for zebra-scanner Failed to build zebra-scanner ERROR: Could not build wheels for zebra-scanner, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 23.3.1 -> 23.3.2 [notice] To update, run: python.exe -m pip install --upgrade pip (tamirtakip_virtual) PS C:\Users\Dell\Desktop\python tamirtakip>

help

dayjaby commented 10 months ago

I never used or tested it on windows. This is not a pure python package, it also requires some C++ compiling. If you find a solution for this on windows let me know :)