-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Description
Below is the OutputProtocol example from the documentation. Is there a way to pass to it user data that is configured at instantiation time? E.g. passing to serial_asyncio.create_serial_connection() a user value that will be propagated to the callback functions of OutputProtocol's ?
The difficulty I have is 1) I don't control the instantiation of this object and 2) I am not familiar with *args and **kwargs in case they hold the answer.
I could try to set the value myself in the protocol returned by serial_asyncio.create_serial_connection() but is there a guarantee that it will be called before the first callback is invoked?
import asyncio
import serial_asyncio
class OutputProtocol(asyncio.Protocol):
def connection_made(self, transport):
self.transport = transport
print('port opened', transport)
...
charterchap and sirtoobii
Metadata
Metadata
Assignees
Labels
No labels