-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add async version of send_message for both tcp and rtu #110
base: master
Are you sure you want to change the base?
Add async version of send_message for both tcp and rtu #110
Conversation
Thanks for this PR! I might need a bit of time to review the PR and test it myself. I'll come back to you. |
You're welcome. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @tiagocoutinho , thanks for your contribution. This is a great addition to uModbus. Just had some comments for you to look at, before we can merge.
I'm personally also not a big fan of the async_send_message
names. Maybe the async method could be moved to an asyncio
module so it could be used like
from umodbus.client.tcp.asyncio import send_message
await send_message(...)
Hi @jaapz, I am in favour of moving the So, long story short, what do you thing about naming the module |
@tiagocoutinho that makes complete sense, calling it |
Co-authored-by: Jaap Broekhuizen <[email protected]>
2acdbae
to
bb7cbbc
Compare
You read my mind :-) |
I think it should be ready for review now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few small changes/comments, almost there! Again, great work, thanks for your contributions and thanks for bearing with me during the review.
I've done another small review, everything else looks good to me. Maybe @OrangeTux can take over from here to test it a bit and get this merged and released? |
Hi @OrangeTux , @jaapz, |
Hey @tiagocoutinho, I just need some time to properly test this before merging. Sorry for the wait, I'm pretty busy at the moment |
Now that #86 is out I feel more comfortable making this PR since the new async/await python 3 syntax makes it impossible to use with python 2.
This PR proposes to add an async version of send_message for both tcp and rtu.
We will be able to write asyncio based clients like this:
We are not restricted to TCP. Any I/O library supporting asyncio StreamReader and StreamWriter interface (example: serial_asyncio) can be used with either the TCP or RTU versions of
async_send_message
.