De :
modb...@googlegroups.com
Envoyé : mardi 15 avril 2014 21:21
À :
modb...@googlegroups.com
Objet : Re: Modbus RTU over TCP
> Hello Jerome,
>
> I've just had a quick look on your fork but it looks very good. Thanks for your contribution.
>
> I'll be glad to know what everyone think about it and to merge it on trunk if no one find
> a problem with this approach.
Hi.
Integrating this shouldn't bring any regression since I don't touch existing code.
However, please note that this code is not complete and probably not safe either. Again, this was rather a first draft that happened to work in my case. I didn't even test connection loss, wrong register number, etc.
- There is only a master example, no slave
- I only created the methods that are called in the rest of the code, I may have missed some
- I'm not sure whether the port should be opened in __init__() or in open(), and whether it should be closed in close() or at instance destruction
- isOpen is not that useful. Should it be done differently ?
- I don't know about flushInput. Is this really what we want to do ? And flushOutput is just void as I didn't know what to fit in.
- More importantly, I kind of stubbed the whole timeout management. My test code works, but it might not be so secure. I tried to fit in the interCharTimeout / baudrate / timeout the rest of the code expects. This is a bit of a trick. We can live with this kind of trick if we don't want to modify the rest of the code, but the values I entered are more or less random. And I didn't think about the possible latency we can expect from the network connection.
This timeout issue is what bothers me the most. This is where I needed your feedback. I entered into Modbus two days ago, all of this is new to me. And I understand that in RTU, since there is no end of frame character, timeouts are critical.
Anyway, I'll be glad is this can be improved and made available to the community.
(Regarding the copyright notices, you can keep or reject them, I don't mind. I didn't take the time to check how the contributors (if any) are credited so I just added that quickly.)
Have a nice day.
--
Jérôme