-
Notifications
You must be signed in to change notification settings - Fork 196
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
Network instance is optional in many classes, which requires lot of checking #511
Comments
IMO, the better thing to do would be to improve the documentation to put emphasis on always using BTW, are there use-cases for subclassing the *Base classes you mention?
I would instead prefer keeping the status quo. Footnotes
|
I've added all the runtime checks in PR #513 to ensure the |
Picking up my comment on #513... After some prototyping, I think Would that be a feasible solution? It would require minimal changes only and not touch the "hot" code paths. |
See #525 for a small proof of concept. I will extend that one to cover more instances when the approach is deemed acceptable. |
With reference to #509 - lots of classes depend on an instance of
class Network
and have it as an attribute in order to communicate with the CAN bus. Examples areSdoBase()
,PdoBase()
,NmtBase()
and others. Their constructor does not require aNetwork
argument so the formal type of the attribute isnetwork: Optional[Network] = None
.These attributes are set when a
RemoteNode()
is created and the reference to the network is injected fromRemoteNode.associate_network()
.The effect of this is that we'll need a lot of checks all over the code to ensure network is properly set. E.g. as here from
class EmcyProducer
:Is is a requirement to be able to create these class instances without a functional Network? We could make a default Network-like object that will emulate network operations if we need it to work without an actual CAN bus network.
What do you think we should do here?
The text was updated successfully, but these errors were encountered: