Unexpected implementation for ModbusSerialClient.connected
property
#1854
-
As we can see here the
and here is the
It is so unintuitive that this property rather than returning whether the serial is connected or not, it will actually try to connect if serial is not connected. I am just really curious to know what what is the reasoning behind this, since for other protocols we do not see the same behavior. Here is the
Simple, intuitive and expected. Why not have the same implementation for serial? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
pull requests are welcome. Be aware that connect() work differently for tcp where it connects to the device, as to the serial where it only opens the serial port. Hence the connect as it is implemented are par5 of the retry mechanism |
Beta Was this translation helpful? Give feedback.
-
I understand that in serial, the notion of connection does not make sense the way that we have it in tcp or other transports. I want to send a PR but I need to figure out how it is working right now. That's what I am trying to understand. Was there a specific reason that the property if we change
and then whoever needs to do retry, can have something like:
is this reasonable? |
Beta Was this translation helpful? Give feedback.
-
"git grep" is your friend, I have a lot to do and cannot use a lot of time in teaching you how the code works, sorry. |
Beta Was this translation helpful? Give feedback.
-
Looking forward to see your PR. Well you at least expected others to make explanations, after I had tried to explain the issue: |
Beta Was this translation helpful? Give feedback.
You already got an explanation, if you want changes then please submit a pull request.
The code works as it is, it might work differently and most surely especially the sync part might work better. But please do not expect others to make changes on your behalf.