外围键盘和条形码扫描仪
该项目演示了如何将 Flutter 移动应用转变为外围键盘和条形码扫描仪,以将数据输入到 PC 中。
设置 Python 服务器
-
使用 pip 安装 pyautogui、websockets 和 zeroconf。
pip install pyautogui websockets zeroconf
-
如果 Bonjour 服务和 Web 套接字服务器的端口已被占用,请更改端口号。
# Bonjour info = ServiceInfo("_bonsoirdemo._tcp.local.", "Python Web Socket Server._bonsoirdemo._tcp.local.", port=7000, addresses=[ip_address]) # Web Socket Server s = await websockets.serve(server, ip_address, 4000)
如果更改服务器中的 Web 套接字端口,还需要在 Flutter 应用中更改端口。
_connect('${widget.service.ip}:4000');
-
运行服务器
python server.py
设置 Flutter 移动应用
-
从 此处 申请 Dynamsoft 条形码阅读器 SDK 的试用许可证密钥。
-
在
scanner_screen.dart文件中替换许可证密钥。await DCVBarcodeReader.initLicense( 'DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ==');
-
在您的移动设备上运行该应用。
flutter run