5566影音先锋,无码国内精品人妻少妇蜜桃视频,东北老妇爽大叫受不了,精品无线一线二线三线

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

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

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

來源:www.tengrise.com   標簽: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在線咨詢
主站蜘蛛池模板: 福建省| 界首市| 峨眉山市| 涟水县| 峨山| 天祝| 谢通门县| 芮城县| 阳城县| 梁河县| 华安县| 台湾省| 洛川县| 龙泉市| 齐河县| 商丘市| 赫章县| 苍梧县| 嘉荫县| 九龙城区| 团风县| 丹江口市| 大同县| 镇康县| 罗江县| 博爱县| 文成县| 奇台县| 称多县| 海阳市| 准格尔旗| 夹江县| 曲沃县| 陆川县| 南安市| 塘沽区| 上思县| 金沙县| 昌图县| 垦利县| 和平县|