This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
from fastapi import APIRouter
from helper import respond_to
from helper.outside_uhf_reader import rfid_reader
router = APIRouter(prefix='/outside_reader')
@router.get('/get_value',summary='获取外部串口读卡器数据(非USB键盘)')
async def get_value():
try:
data = rfid_reader.getData()
except:
data=""
return respond_to(data=data)
@router.get('/enable',summary='启用外部读卡器')
async def enable():
rfid_reader.start()
return respond_to()
@router.get('/disable',summary='停用外部读卡器')
async def disable():
rfid_reader.stop()