<nav id="ccccc"><sup id="ccccc"></sup></nav>
  • <nav id="ccccc"></nav>
    <nav id="ccccc"></nav>
    <sup id="ccccc"></sup><tr id="ccccc"></tr>
  • <tfoot id="ccccc"><noscript id="ccccc"></noscript></tfoot>
  • 影音先锋成人,人妻偷人精品,成人网站中文字幕,,国产乱人伦无码视频,激情婷婷五月天,69avav?cn,国产成人A码男人的天堂国产乱,人妻?无码?中出

    DONSEE東信智能 - 身份證社??ㄗx卡智能終端應用服務商

    eastcoms@qq.com
    400-6722-705
    首頁 > 服務支持專區 > 產品支持 > 常見問題

    Python調用東信QR-M20二維碼掃碼模組示例

    來源:www.www.57bjl.cn   標簽:Python 掃碼 二維碼 模組   發布時間: 2024-9-18 8:59:20

    Python語言開發采用東信QR-M20二維碼模塊,USB接口進行開發,調用了libdonseeQR.so 這個掃碼的接口庫。


    import ctypes

    from ctypes import *

    import sys


    # Define callback function types

    tx_scanner_decode_data_cb_fun = CFUNCTYPE(c_int, c_ubyte, POINTER(c_ubyte), c_int)

    tx_scanner_comm_state_cb_fun = CFUNCTYPE(None, c_ubyte)


    # Load the DLL

    tx_windows_hidpos = ctypes.CDLL("./tx_windows_hidpos.dll")


    # Define function prototypes

    tx_scanner_init = tx_windows_hidpos.tx_scanner_init

    tx_scanner_init.restype = c_int


    tx_scanner_get_version = tx_windows_hidpos.tx_scanner_get_version

    tx_scanner_get_version.argtypes = [POINTER(c_ubyte), c_ubyte]

    tx_scanner_get_version.restype = c_int


    tx_scanner_decode_data_fun_register = tx_windows_hidpos.tx_scanner_decode_data_fun_register

    tx_scanner_decode_data_fun_register.argtypes = [tx_scanner_decode_data_cb_fun]

    tx_scanner_decode_data_fun_register.restype = c_int


    tx_scanner_comm_state_fun_register = tx_windows_hidpos.tx_scanner_comm_state_fun_register

    tx_scanner_comm_state_fun_register.argtypes = [tx_scanner_comm_state_cb_fun]

    tx_scanner_comm_state_fun_register.restype = c_int


    s_uiDecodeCnt = 0


    @tx_scanner_decode_data_cb_fun

    def tx_scanner_sdk_decode_data_cb(ucCodeType, pBuf, uiBufLen):

        global s_uiDecodeCnt

        return 0


    @tx_scanner_comm_state_cb_fun

    def tx_scanner_sdk_comm_state_cb_fun(ucState):

        print(f"scanner usb hidpos state:{ucState}")


    def tx_scanner_sdk_show_menu():

        print("***************************東信QR-M20二維模組Test***************************")

        print("q:quit")

        print("******************************************************")


    def main():

        ucVer = (c_ubyte * 128)()

        iRet = tx_scanner_get_version(ucVer, len(ucVer))

        if iRet > 0:

            strTemp = bytes(ucVer[:iRet]).decode('utf-8')

        print(f"DONSEE QR-M20 Linux python usb hidpos demo ver:{strTemp}")


        # Register decode data callback function

        tx_scanner_decode_data_fun_register(tx_scanner_sdk_decode_data_cb)


        # Register device connection state callback function

        tx_scanner_comm_state_fun_register(tx_scanner_sdk_comm_state_cb_fun)


        # Initialize

        iRet = tx_scanner_init()

        print(f"tx_scanner_init:{iRet}")

        print("q:quit")

        print("***********************東信QR-M20二維模組Test******************************")


        while True:

            cInput = input().lower()

            if cInput == 'q':

                print("quit")

                return


    if __name__ == "__main__":

        main()


     

     
    QQ在線咨詢