How kolabse/kolabsecarscan works
Project type and purpose
• This is an embedded Arduino library (“KolabseCarsCan”) for decoding CAN-bus messages and storing car state data.
• It provides a set of C++ classes (TemplateCar, PSACar, etc.) that parse raw CAN frames and expose structured data for sketches.
File structure
• Top-level:
– examples/getCarData/getCarData.ino → Arduino sketch demonstrating usage
– src/… → library source files and headers
– library.properties, keywords.txt → Arduino IDE metadata
• Key classes in src/:
– KolabseCarsCan.{cpp,h} → core interface, initialization, CAN frame dispatcher
– TemplateCar.{cpp,h} → abstract base for specific decoders
– PSACar, AllCars → concrete decoders & container for multiple car instances
README
• “Library for storing data about the state of the car and decoding this data from CAN bus messages.”
Main components & interactions
a. External Hardware/Services
– Arduino MCU (host)
– CAN Transceiver / CAN-bus network (external messages)
b. Library Core
– KolabseCarsCan class
• init(), begin(), dispatchFrame(CANFrame)
– TemplateCar (abstract)
• parseFrame(), storeData()
– PSACar (extends TemplateCar)
– Additional Car classes (e.g. your TemplateCar subclass)
– AllCars container
• holds multiple Car instances, iterates to dispatch frames
c. User Sketch
– calls library begin(), polls CAN frames, reads decoded data (e.g. speed, RPM)
Architectural patterns & design principles
• Strategy/Template Method: TemplateCar defines the parsing interface; PSACar provides concrete decoding logic.
• Single Responsibility: KolabseCarsCan handles dispatching frames; Car classes handle data parsing/storage.
• Open/Closed: New car types can be added by subclassing TemplateCar without modifying core code.
• Container: AllCars aggregates multiple decoders and centralizes dispatch.