lexus2k / tinyproto

Tiny Software Protocol for communication over UART, SPI, etc
GNU General Public License v3.0
225 stars 51 forks source link

Questions on connection management #28

Closed chenlijun99 closed 2 years ago

chenlijun99 commented 2 years ago

Hi @lexus2k & contributors. First, thank you for this excellent library!

I'm trying to implement a socket-like wrapper of tinyproto FD for my project, both in C/C++ and in Python. What I'm having a hard time doing is the connection establishment. In particular I could not find these things:

Have these things ever been considered? Or are there valid reasons not to have them? Would you accept a PR?

lexus2k commented 2 years ago

Hi Lijun

You're right, there is no way to use handlers for connect/disconnect events. tiny_fd_get_status() is the only way now to get the link status. But I think, it is good idea to add on_connect/on_disconnect callbacks to the tinyproto library.

Python PR is approved.

Best regards

lexus2k commented 2 years ago

Hi,

I added connect/disconnect callback. So, you can use them in your code now. Just pull the latest changes from the master branch.

chenlijun99 commented 2 years ago

Thank you for your work!