You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
626 B

This file contains ambiguous Unicode characters!

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()
return respond_to()