Skip to content

Refactoring J2534#289

Merged
pylessard merged 6 commits intopylessard:masterfrom
kirya-dev:feature/refactoring-j2534
Feb 1, 2026
Merged

Refactoring J2534#289
pylessard merged 6 commits intopylessard:masterfrom
kirya-dev:feature/refactoring-j2534

Conversation

@kirya-dev
Copy link
Copy Markdown
Contributor

@kirya-dev kirya-dev commented Jan 14, 2026

  • Remove extra const ISO15765_CAN_ID_11.
  • Unmix ConnectFlag and TxStatus
  • More readable TxStatus, ConnectFlags and RxStatus;
  • add method check_connection_opened();
  • Fixing overcalling PassThruReadMsgs: Increase Timeout(from 1 to 20 ms) in call PassThruReadMsgs.
  • KLine setup

 - More readable TxStatus, ConnectFlags and RxStatus;
 - add method check_connection_opened();
 - Fixing overcalling PassThruReadMsgs: Increase Timeout(from 1 to 100 ms) in call PassThruReadMsgs.
@pylessard
Copy link
Copy Markdown
Owner

Took a while to check. I activated a CI agent
Is this PR backward compatible?

Comment thread udsoncan/connections.py
def specific_send(self, payload: bytes, timeout: Optional[float] = None) -> None:
if self.conn is None or not self.opened:
raise RuntimeError("Connection is not opened")
self.check_connection_opened()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This change breaks mypy.
You can add an assert to make it happy :
assert self.conn is not None

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed in SyncISOTPNetwork.is_open()

Comment thread udsoncan/connections.py Outdated

def is_open(self) -> bool:
return self.opened
return self.conn and self.opened
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

return self.conn is not None and self.opened

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed in SyncISOTPNetwork.is_open()

Comment thread udsoncan/connections.py
def specific_wait_frame(self, timeout: Optional[float] = None) -> Optional[bytes]:
if not self.opened or self.conn is None:
raise RuntimeError("Connection is not open")
self.check_connection_opened()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Same issue here.
assert self.conn is not None

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed in SyncISOTPNetwork.is_open()

Comment thread udsoncan/connections.py Outdated
else:
self.specific_send(payload)

def check_connection_opened(self):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

return type of func is missing: def check_connection_opened(self) -> None

@kirya-dev kirya-dev force-pushed the feature/refactoring-j2534 branch from 3adf681 to 5a0446b Compare February 1, 2026 15:26
@kirya-dev kirya-dev force-pushed the feature/refactoring-j2534 branch from 5a0446b to ad6f95a Compare February 1, 2026 15:31
@kirya-dev
Copy link
Copy Markdown
Contributor Author

Took a while to check. I activated a CI agent Is this PR backward compatible?

i think yes. There no changes in public API for J2534Connection. Only renamed some const inside low-level J2534 class.

@pylessard
Copy link
Copy Markdown
Owner

Alright!
Is this ready to merge?

@pylessard pylessard merged commit 976b197 into pylessard:master Feb 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants