-
Notifications
You must be signed in to change notification settings - Fork 197
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 asyncio support [WIP] #359
base: master
Are you sure you want to change the base?
Conversation
fix typo
Handle timeout in aread_response
Merge from upstream
* Comment annotation fixups * Added SdoServer aupload and adownload * Fix missing Network.is_async() uses * Fix workaround in pdo.map.save/asave
What is the best way to deal with var = param.data # Non-async use
var = await param.aget_data() # Async use My goal has been to keep the async and non-async uses of canopen as equal as possible, but this is an area where users will see a difference. |
There is an implementation for |
@acolomb I'm not precisely sure what you mean, so let me guess: You need separate |
Sorry, I was trying to answer your question in the previous comment about synchronous getters / setters used in the properties. What I meant was that instead we already do have methods to access a variable remotely. Those might be a better fit to mirror to the async world: value = sdo_var.raw # This is the usual, terse style recommended in the docs
value = sdo_var.read(fmt='raw') # This also works already
value = await sdo_var.aread(fmt='raw') # Feels like a natural enhancement for async Note that the |
0ac7d49
to
abbc2dc
Compare
* Add support for using dot (.) to address sub-index elements in the OD * Make SdoVariable awaitable for fetching * Fix SdoClient.aabort() that were missing
* Add __repr__ to the object classes * Rename PDO Map to PdoMap * Rename PDO Maps to PdoMaps * Fix iterator in SdoArray * Add alen() to SdoArray and SdoRecord * Add __eq__ to SdoAbordedError
Sorry for late reply here. All of these methods are supported in the async port. In addition to The areas of challenge for async currently are:
|
* Manual merge in improments from master * Remove opinionated set_*() and get_*() for non-async calls * Comment updates
cdd5f6f
to
9dd782e
Compare
…de in async use * Remove duplicated async code in SdoClient * Implemented to thread in aupload() and adownload() * Removed async callbacks * Temporary fix issue with truncated SDO uploads * Temporary fix iterator on SdoArray
* Move loop init to the Network * Remove unused callbacks in LocalNode
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #359 +/- ##
==========================================
- Coverage 71.36% 69.03% -2.34%
==========================================
Files 26 27 +1
Lines 3129 3397 +268
Branches 480 523 +43
==========================================
+ Hits 2233 2345 +112
- Misses 765 906 +141
- Partials 131 146 +15
|
This PR adds support of asyncio to canopen. The overall goals is to make canopen able to be used in either with asyncio or regular synchronous mode (but not at the same time) from the same code base.
Note that this work is still work in progress. This PR was created to discuss the specific solutions for async and non-async as mentioned in #272. This PR closes #272.
Current status until feature complete:
ImplementNot neededABlockUploadStream
,ABlockDownloadStream
andATextIOWrapper
for async inSdoClient
.EcmyConsumer.wait()
for asyncLssMaster
BaseNode402
Network.add_node()