44 lines
1.2 KiB
Markdown
44 lines
1.2 KiB
Markdown
# DBC Package
|
|
|
|
CAN database (DBC) signal definitions and parsing utilities.
|
|
|
|
## Structure
|
|
|
|
- `models/` - Core types (DBCCollection, CANMessage, CANSignal)
|
|
- `state/` - State tracking for CAN signals
|
|
- `diagnostics/` - Diagnostic signal handling
|
|
- `fm29_*/`, `n60/` - Generated packages from DBC files (stubs by default)
|
|
|
|
## Generated Packages
|
|
|
|
The `fm29_*` and `n60` packages contain CAN signal definitions generated from DBC files. By default, these are stubs that return empty collections.
|
|
|
|
To generate real definitions, you need:
|
|
1. DBC source files (from CEC-Common repo or equivalent)
|
|
2. The `cantool` from `pkg/can-go`
|
|
|
|
## Generating DBC Code
|
|
|
|
```bash
|
|
# From cloud-services root
|
|
go run ./pkg/can-go/cmd/cantool generate /path/to/dbc/files ./pkg/dbc
|
|
```
|
|
|
|
Or use the generate script:
|
|
```bash
|
|
./scripts/generate-dbc.sh /path/to/dbc/files
|
|
```
|
|
|
|
## When Do You Need Real DBC Packages?
|
|
|
|
- **Gateway**: Uses only `dbc/models` - stubs are fine
|
|
- **Optimus**: Needs real DBC for CAN signal parsing
|
|
- **Ditto**: Needs real DBC for digital twin state
|
|
- **Beacon**: Needs real DBC for diagnostic alerts
|
|
|
|
## Adding New DBC Versions
|
|
|
|
1. Add DBC files to source directory
|
|
2. Run cantool generate
|
|
3. Update `new_dbc_collection.go` to include new version
|