Skip to content

Multiple CAN bus support #7

@colbycheese55

Description

@colbycheese55

Suggested API
CANBus(bus: str)
Constructor

sendMessage(self, msg: CanMessage) -> None
Sends a CAN message

getReceivedMessages(self, message_name: str) -> list[CanMessage]
Returns a list of received CAN messages of the specified type, then clears the list

Utility API (note that all functions are static)

loggedMessages = dict[str, dict[str, list[CanMessage]]]
ser = Serial()

readMessages() -> NoReturn
Will run infinitely in a thread, reading in messages and putting them in the global dictionary loggedMessages, will be started by the test runner, will first create the serial object (ser)

Clear() -> None
Clears loggedMessages, will be run at the start of each test by the test runner

Implementation Notes

  • make sure to lock loggedMessages
  • in the UART message format, use a few of the upper bits in the length byte to specify which CAN bus

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions