Skip to content

Conversation

@cbergmiller
Copy link
Contributor

The API of serial_asyncio.create_serial_connection is different from the async socket API.
Also, the serial kwargs (baudrate etc.) were missing in AsyncioModbusSerialClient.init Method.

Christian Bergmiller added 2 commits January 23, 2018 13:42
try:
yield from self.loop.create_connection(self._create_protocol)
_logger.info('Connected to %s:%s.' % (self.host, self.port))
from serial_asyncio import create_serial_connection
Copy link
Contributor

@dhoomakethu dhoomakethu Jan 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. I updated the pull request.

@dhoomakethu
Copy link
Contributor

@cbergmiller the tests are failing on python3 , please have a look.

Christian Bergmiller added 2 commits January 24, 2018 17:31
:return:
"""
if self._connected:
if self._connected.is_set():
Copy link
Contributor

@dhoomakethu dhoomakethu Jan 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be if self._connected: as you are returning self._connected_event.is_set() from the property _connected?

_logger.info('Protocol made connection.')
if not self._connected:
self._connected = True
if not self._connected_event.is_set():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can directly use the property _connected here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to break compatibility with possible subclasses or mixins. So i created the _connected property that returns the state of the connected event. But you are right it is cleaner to use the _property inside the class as well. I will update the pull request.

@dhoomakethu dhoomakethu added this to the 2.0.0 milestone Jan 31, 2018
@dhoomakethu dhoomakethu merged commit 94a8831 into pymodbus-dev:async May 10, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants