Skip to content

How can I run ble-serial in the background of another script. #66

Answered by Jakeler
ear0 asked this question in Q&A
Discussion options

You must be logged in to vote

I don't see the complete code, so not entirely sure what is imported and where some variables/functions are coming from. Looks like you are using aiohttp though? Per default it controls the event loop and you should pass the main async function from ble-serial to the app: https://docs.aiohttp.org/en/stable/web_advanced.html#complex-applications

Also you have some sync IO with the Serial part, which can cause issues. If you don't actually need a serial port (for other programs etc.) then you might consider removing this and hook directly into the BLE interface, see the example: #63 (comment)
Instead of asyncio.run it would be the append to your server context.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Jakeler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants