-
Notifications
You must be signed in to change notification settings - Fork 1
Delegate state to link and flow to port (Fix #62) #67
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
base: main
Are you sure you want to change the base?
Delegate state to link and flow to port (Fix #62) #67
Conversation
…t correctly in flush (Fix a breakage from my utf8 PR). Enforce str all the way. Improve comments.
…in endElement). Add to sys.path only if can be done accurately.
…es localNodeID instead of farNodeID).
… on example_cdi_access.py) to diagnose bobjacobsen#62.
… level manually set to logging.INFO or more verbose). Switch create a logger (instead of using logging directly) to make the source of messages clear, that being canlink.py in this case. Add & improve docstrings.
… nodeIdToAlias to populate: Fix bobjacobsen#62). Stream XML continuously (use parser.feed) so CDI branches trigger callbacks as they download.
… [value>255] bytearray error).
…s start of next). Comment questionable check until question in issue bobjacobsen#63 is answered.
…rrent reservation process (collision handler runs it again) unless no collision (fix bobjacobsen#62) as per section 6.2.1 of CAN Frame Tansfer Standard. Fix type for CanLink.State values (some were tuples due to trailing comma, now all are ints--still would compare if the value was always set and compared from the Statet(Enum) subclass, but not technically correct) (related to issue bobjacobsen#62). Add a related docstring.
…Permitted before sending messages (related to issue bobjacobsen#62). Use only one receive thread in cdihandler to avoid missing packets (and rename CDIHandler to PortHandler so as to allow handling different types of messages and memos in future versions). Rename "add" and "pop" to "start" and "end" for clarity. Isolate CDI-specific data by adding Mode to PortHandler (based on what data string was requested and not yet terminated). Add formatted_ex for logging.
…om network or is internal).
…ar size as before _send_frames queue was added): Replace and rework simulation's pumpEvents with sendAll and receiveAll and move them and waitForReady (also reworked) to CanLink to make the features available to (non-simulation) programs.
Ok, it is ready!
|
Before merging I would like to move |
… <-> other layers] <-> application).
^ Ok, the network layer order is modeled consistently (socket <-> [PhysicalLayer <-> other layers] <-> application) as of 087075e. |
…et code rather than application/feature code.
...or now. |
…o isCanceled so it can be abstract and have other implementations). Count sent (allows skipping sleep). Run pollState in sendAll to reduce code required to use sendAll. Reduce commented code to match socket-openlcb-application stack model.
…examples where PhysicalLayer subclass is avaiable).
…ne for count). Reduce OpenLCBNetwork code to use high-level sendAll and receiveAll.
…bclass. Separate RealtimePhysicalLayer from RealtimeRawPhysicalLayer for clarity.
I added some fixes to get examples working again. Assume the PR is ready to review, but we can continue to identify any problems. If already reviewed, see commits above for bugfixes. |
I'm not sure if or how a CS-105 is supposed to respond to example_tcp_message_interface.py (
|
Ok, your version gets a reply so I definitely broke that and SNIP. I will work on those but help would be appreciated. I'm not getting anything from SNIP (example_remote_nodes.py lists nodes but there is no manufacturerName nor userProvidedNodeName, but there is in your upstream version). |
I'll pull this down to test against MRC Nexxt CS as well, it should be very similar to TCS CS-105 in most regards (throttles work identically in 99% of the cases).
I'd expect Train related frames to be identical in all aspects to all other LCC frames, most of these are "I produce event X" or "I react to event Y" in nature. There are a handful of events for controlling trains which JMRI understands today so I'd expect that this might process / ignore them as well. I'll capture some events as this test runs with the CS over USB (no LCC-Buffer involved) and see how it looks. |
(needs confirmation) and bobjacobsen#71. Helps validate pull request bobjacobsen#67.
…et on two different threads!
fbb7313
to
f6c6361
Compare
…se Pythonic underscore convention for private methods.
…"fill*" for clarity.
…er state change and Message).
Hello, I hope this finds you well. Most changes suggested by Balazs (#62 (comment)) are here.
isBadReservation(frame)
isCanceled
(checks if the frame is part of a bad reservation or not in the case of CanLink implementation).PortInterface
superclass added toTcpSocket
andSerialLink
allows the openlcb stack (or other code) to utilize either type of port without conditional code or subclassing OpenLCB protocol implementation classes.All tests pass locally, so I'm not sure why GitHub isn't noticing that. Maybe it will catch up and go green. We'll see.All tests pass, and:Use unittest auto-discovery in github workflow (run-tests.yml): Now it runs all available test files regardless of files being added, renamed, or removed (in this case--there wasn't an abstract LinkLayer test. The file was blank).
There are some things that may be simplified, but I thought it would be good if we both can review this at the same time to get back in sync.Make high-level methods (sendAll
andreceiveAll
) to simplify usage related to the thread-safe refactor.