Simple app to transform IEC 61851-24 CAN bus dump to human readable messages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chademo-log/types.go

175 lines
3.0 KiB

package main
const (
CAN_ID_100 = 0x100
CAN_ID_101 = 0x101
CAN_ID_102 = 0x102
CAN_ID_108 = 0x108
CAN_ID_109 = 0x109
DISABLED VehicleChargingEnabled = iota
ENABLED
PARKING ShiftLeverPosition = iota
OTHER
NORMAL SystemFault = iota
FAULT
CONTACTOR_CLOSED ContactorVehicleStatus = iota
CONTACTOR_OPEN
NO_REQUEST StopRequest = iota
STOP_REQUEST
VEHICLE_WELDING_DETECTION_SUPPORTED SuppVehicleWeldingDetection = iota
VEHICLE_WELDING_DETECTION_NOT_SUPPORTED
STANDBY StationState = iota
CHARGING
CONNECTOR_LOCKED ConnectorLock = iota
CONNECTOR_UNLOCKED
BATTERY_COMPATIBLE BatteryCompatible = iota
BATTERY_INCOMPATIBLE
OPERATING StopControl = iota
SHUTDOWN_STOP
)
type VehicleChargingEnabled uint8
type ShiftLeverPosition uint8
type SystemFault uint8
type ContactorVehicleStatus uint8
type StopRequest uint8
type SuppVehicleWeldingDetection uint8
type StationState uint8
type ConnectorLock uint8
type BatteryCompatible uint8
type StopControl uint8
type CanFrame struct {
canid uint32
payload []uint8
date string
}
func (v VehicleChargingEnabled) String() string {
switch v {
case DISABLED:
return "disabled"
case ENABLED:
return "enabled"
default:
panic("VehicleChargingEnabled not implemented")
}
}
func (s ShiftLeverPosition) String() string {
switch s {
case PARKING:
return "parking"
case OTHER:
return "other"
default:
panic("ShiftLeverPosition not implemented")
}
}
func (s SystemFault) String() string {
switch s {
case NORMAL:
return "normal"
case FAULT:
return "fault"
default:
panic("SystemFault not implemented")
}
}
func (c ContactorVehicleStatus) String() string {
switch c {
case CONTACTOR_CLOSED:
return "contactor closed"
case CONTACTOR_OPEN:
return "contactor open"
default:
panic("ContactorVehicleStatus not implemented")
}
}
func (s StopRequest) String() string {
switch s {
case NO_REQUEST:
return "no request"
case STOP_REQUEST:
return "stop request"
default:
panic("StopRequest not implemented")
}
}
func (s SuppVehicleWeldingDetection) String() string {
switch s {
case VEHICLE_WELDING_DETECTION_NOT_SUPPORTED:
return "not supported"
case VEHICLE_WELDING_DETECTION_SUPPORTED:
return "supported"
default:
panic("SuppVehicleWeldingDetection not implemented")
}
}
func (s StationState) String() string {
switch s {
case CHARGING:
return "charging"
case STANDBY:
return "standby"
default:
panic("StationState not implemented")
}
}
func (c ConnectorLock) String() string {
switch c {
case CONNECTOR_LOCKED:
return "locked"
case CONNECTOR_UNLOCKED:
return "unlocked"
default:
panic("ConnectorLock not implemented")
}
}
func (b BatteryCompatible) String() string {
switch b {
case BATTERY_COMPATIBLE:
return "compatible"
case BATTERY_INCOMPATIBLE:
return "incompatible"
default:
panic("BatteryCompatible not implemented")
}
}
func (s StopControl) String() string {
switch s {
case OPERATING:
return "operating"
case SHUTDOWN_STOP:
return "shutdown or stop charging"
default:
panic("StopControl not implemented")
}
}