Skip to content
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

Master #31

Merged
merged 30 commits into from
Jan 2, 2021
Merged

Master #31

merged 30 commits into from
Jan 2, 2021

Conversation

Nathanrs97
Copy link
Contributor

Overdue pull request of the accidental master branch into main. closes #25

Nathanrs97 and others added 30 commits December 26, 2020 17:19
…messages from the attached XBee in the callback function `_xbee_data_recv_cb(self, message: xbee_message.XBeeMessage) -> None:`,

From the callback, the bytes data is handled in a common handler function `_handle_recv(self, frame: bytes) -> None` which will handle any received frame from either XBee or from a socket.
see #3.
…ver for creating a TCP server for serving TCP connections.

UDP is not currently support as I do not see why UDP would be used over TCP. However, it may be found during testing that UDP is required because of the its overheads.
Issue #4 is mostly covered by this commit. However, some XBee functionality has also been implemenmted in this commit to standardise the receiving handling accross XBee and sockets #3.
…n of the protocol encoders and decoders.

So far, the header and AIPDU have been implemented and tested. In progress of resolving #6.
…ransmitting data to the intermediate server over a TCP socket.

Utilises asyncio transport and protocols for the TCP client service. On connect to the intermediate server, a AIPDU is generated and sent.
A matching AIPDU is expected in response as acknowledgement.
In progress resolve of #8.
…but have not yet tested the json pack and unpacks.

Mostly resolves #6.
…increasing values every 1 second.

Mostly resolves #8 but still need to implement XBee support.
…or the switch between sending emulated frames over an Xbee or a socket.

The emulator initial implemenation is done, you can emulate all frames over XBee or sockets. closes #8
…rotocol factory which can be used for both a server and a client.

Converted the protocol factories previously seperate in the main.py and car_emulator.py to use the protocol_factory factory.
Tested with previous functionality and it works the same.
Added a __hash__ function which returns a hashed version of the IP:port for use with dictionaries storage.
… builds a header, a graph, and a footer.

The graph is updated every second from a shadow data class in the form of a sinewave. Mostly closes #14.
…bstrated away from the application layer.

To make this work between XBee and sockets, I've created a standarised factory base which is used to create an XBee factory, client factory, or a server factory.
Therefore, the Protocol class simply creates the factory (xbee or socket) for its wanted transport layer and the API is the same between them.
The Car Emulator has been ported to use the new protocol handler Protocol and works the same as before the update.
However, the server has not yet been ported and so does not currently work. In progress resolve of #18.
…otocol is defined in the Protocol init SERVER, SOCKET, XBEE.

The SERVER creates both a server factory for handling socket connections and an Xbee factory.
The factory object is passed from the factory itself through the protocol layer to the application layer. The passing is required for the server to know the factory the event came from.
I've tested with both socket and Xbee connected and it works the same as previously. closes #18
…ui clients.

On AIPDU frame it simply adds the client factory to an internal dictionary of clients for the corresponding type.
Then, when a frame is received from a car client it routes it to all gui clients.
closes #12.
…dler is created on another thread with its own event loop so it is not interrupt by the dash application running on the main thread.

Tested by receiving ACPDU frames and saving the RPM value to the shadow for displaying on the graph. closes #15.
On a raw buffer it loops through the buffer and removes decoded frames until the buffer is empty.
On a JSON buffer it uses regex on the decoded bytes to pick out the frames between the { and } characters.
Tested with multiple PDUs in a single frame (on raw) and works fine. closes #20.
…gglable graphs sections.

I need to add more data fields to the togglable graphs section and this will mostly do as a dash for the emulator.
Mostly resolves #22.
Implements #21 - Adding Requirements.txt and Running Documentation
Updated Requirements.txt with Module Versions
@Nathanrs97 Nathanrs97 added the bug Something isn't working label Jan 2, 2021
@Nathanrs97 Nathanrs97 self-assigned this Jan 2, 2021
@Nathanrs97 Nathanrs97 merged commit ddacf7e into main Jan 2, 2021
@Nathanrs97 Nathanrs97 deleted the master branch January 2, 2021 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pull the Master branch into Main
2 participants