-
Notifications
You must be signed in to change notification settings - Fork 656
Small fixes in IXXAT exception handling plus default handling in Bus.__new__
#111
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
Conversation
… when hardware cannot be initialized
…on. Added two (private) functions to decode error codes
…ing done in canlib). Added VCIRxQueueEmptyError exception
hardbyte
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks looks good. Only minor suggestions really.
There are a few inconsistencies with the docstrings, can you use triple double quotes """ and add a few annotations e.g. in bus.py.
can/interfaces/ixxat/canlib.py
Outdated
| """ Format a VCI error and attach failed function, decoded HRESULT and arguments | ||
| @TODO: make sure we don't generate another exception | ||
| """ | ||
| buf = ctypes.create_string_buffer(VCI_MAX_ERRSTRLEN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid repeating the same code just call __vciFormatError here and add the arguments to the returned string.
can/interfaces/ixxat/canlib.py
Outdated
| return None | ||
| else: | ||
| raise e | ||
| raise e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you want to add some logging in the event of a VCIError you don't need to catch and re-raise this.
…. Added parameters documentation
|
Thanks Giuseppe |
* Added minimal configuration file example and parameters description * Added support for time.perf_counter in python3. * Better error messages when hardware cannot be initialized * Leave the IXXATBus name when importing * Use time.perf_counter only on python releases >= 3.3 * Handle VCI_E_RXQUEUE_EMPTY with explicit VCIRxQueueEmptyError exception. Added two (private) functions to decode error codes * Module does not depend on ctypes to decode error codes anymore (decoding done in canlib). * Added VCIRxQueueEmptyError exception * Improved docstrings * Ignore utf8 decoding error when formatting vci messages Not specific to IXXAT: * Update can.rc from Bus.__new__ kwargs
Exceptions are now simple CanError subclasses and do not depend on ctypes to decode error codes. Decoding is now done in canlib.
Not related to IXXAT but
interface.Bus.__new__was not updating can.rc from its kwargs interface and bitrate.Apply to the develop branch.