Usage¶
Important Notice¶
CAN-Interface is not suited for production purposes. It is not guaranteed that CAN-Frames will reach their destination or reach in the right order. Use the CAN-Interface only for purposes where packet loss is tolerable.
Example¶
Preparation¶
- Connect the SUB-D connector from the CAN-Interface with a CAN-Bus
- Make a Wi-Fi connection between a Computer and the access point of the CAN-Interface
- To start the communication with the CAN-Interface send an initialization message to the UDP-Socket
Sending¶
Open an UDP-Socket
Build a Cannelloni Data Package containing the CAN-Frames to send (Header + encoded CAN-Frames)
class CANNELLONIDataPacket(object): """ Header for Cannelloni Data Packet """ def __init__(self): self.version = 0 self.op_code = 0 self.seq_no = 0 self.count = 0
Send the Cannelloni Data Package via UDP to the CAN-Interface
Receiving¶
- Open an UDP-Socket
- Receive the UDP-Packages sent from the CAN-Interface
- Unpack the CAN-Frames using the Cannelloni Data Package
- Decode the CAN-Frames