Documentation
¶
Index ¶
- Constants
- Variables
- type CanValueDef
- type CanValueMap
- type CanVars
- type Cancoder
- type CancoderDef
- type Cancoders
- type Decoder
- func (d *Decoder) Decoder(frame *can.Frame) (values []*CanValueMap, err error)
- func (c *Decoder) Encode(value *CanValueMap) (frame *can.Frame, err error)
- func (d *Decoder) GetEventChannel() <-chan CanValueMap
- func (d *Decoder) GetValue(name CanVars) *CanValueMap
- func (d *Decoder) PushFrame(frame *can.Frame) error
- type EntertainmentCANArbitrationIDs
- type GMLanArbitrationIDs
- type HighSpeedCANArbitrationIDs
Constants ¶
View Source
const ( BREAK_PRESSED = 0x40 BREAK_OPEN = 0x00 WEEL_KEY_SEEK_UP = 0x10 WEEL_KEY_SEEK_DOWN = 0x20 WEEL_KEY_SEEK_PRESSED = 0x30 WEEL_KEY_MUTE_PRESSED = 0x40 WEEL_KEY_MODE_PRESSED = 0x50 WEEL_KEY_UP_PRESSED = 0x04 WEEL_KEY_DOWN_PRESSED = 0x05 WEEL_KEY_VOLUME_UP = 0x01 WEEL_KEY_VOLUME_DOWN = 0x02 DRIVING_LIGHT_OFF = 0x00 DRIVING_LIGHT_PARKING = 0x40 DRIVING_LIGHT_LOW_BEAM = 0xc0 DRIVING_LIGHT_REVERSE = 0x01 LIGHT_LEVELER_HIGH_BEAM_BIT = 0x40 LIGHT_LEVELER_FOG_FRONT_BIT = 0x20 LIGHT_BACK_FOG = 0x80 LIGHT_BACK_HANDBRAKE = 0x01 LIGHT_BACK_WISHWATER = 0x03 // maybe also bulbs? DOOR_STATE_FRONT_LEFT_OPEN = 0x40 DOOR_STATE_FRONT_RIGHT_OPPEN = 0x10 DOOR_STATE_TRUNK_OPEN = 0x04 // guess 5 door car DOOR_STATE_BACK_RIGHT_OPEN = 0x01 DOOR_STATE_BACK_LEFT_OPEN = 0x08 ENGINE_OFF = 0x00 ENGINE_IGNITION_ON = 0x03 ENGINE_STARTER_RUNNING = 0x43 // -> 4 starter -> 3 ignition ENGINE_RUNNING = 0x13 // -> 1 engine running -> 3 ignition ENGINE_RUNNING_DRIVING = 0x23 // -> 2 engine running and driving -> 3 ignition CRUSE_CONTROLL_ON = 0x06 // 0x04 off RANGE_WARNING_OFF = 0x03 RANGE_WARNING_ON = 0x00 AC_MODE_AUTO = 89 AC_MODE_HEAD = 83 AC_MODE_BODY = 85 AC_MODE_FOOD = 87 AC_MODE_HEAD_BODY = 84 AC_MODE_HEAD_FOOD = 88 AC_MODE_BODY_FOOD = 86 AC_MODE_HEAD_BODY_FOOD = 82 DOOR_LOCK_UNLOCK = 0x20 DOOR_LOCK_LOCK = 0x80 DOOR_LOCK_WINDOWS_DOWN = 0x30 DOOR_LOCK_WINDOWS_UP = 0xC0 )
low speed
View Source
const ( // first byte of HsCANRxData HsCANSpeeds = 0x10 // ${1}/10 -> Volt , ( ${2}*256 +${3} ) / 4 -> rmp , ${7} -> speed HSCANTemperatures = 0x11 // ${4} - 40 -> Intake Air Temp , ${2} - 40 -> Coolant Temp , ${5} -> Ambience Temp HSCANMAF = 0x12 // maf = ((can_MsgRx.buf[2] * 256.0f) + can_MsgRx.buf[3]) / 100.0f * 3.6f; mafVolt = can_MsgRx.buf[1] / 51.0f; power = maf * 0.383f; moment = ((float)power / 1.36f * 1000.0f) / (2.0f * 3.1415926f * rpm / 60.0f); // if (firstBoostValRec) // firstBoostVal = can_MsgRx.buf[7], firstBoostValRec = false; // if (can_MsgRx.buf[7] > firstBoostVal) // boost = can_MsgRx.buf[7] - firstBoostVal; // else // boost = 0; HSCANPedalPosition = 0x13 HSCANIncector = 0x14 HSCANPetrolLevel = 0x15 HSCANIgnition = 0x16 HsCANKnockVoltage = 0x17 HsCANKnockControl = 0x18 HSCANLambdaProbe = 0x19 HSCANErrorCodes1 = 0x81 HSCANErrorCodes2 = 0xa9 )
View Source
const EventChannelBufferSize = 100
View Source
const (
FULL_CAPACITY_L = 52
)
View Source
const (
SOME_HIGH_SPEED = 0x00
)
high speed
View Source
const (
SOME_MID_SPEED = 0x00
)
mid speed
Variables ¶
View Source
var CancoderDefs []CancoderDef = []CancoderDef{ OpelAstraHOpc2006, }
all de/encoders
View Source
var OpelAstraHOpc2006EntertainmentCAN []CanValueMap = []CanValueMap{ { ArbitrationID: uint32(EntertainmentCANDisplayTemperature), CanValueDef: CanValueDef{ Unit: "°C", Calculation: "${2} / 2 - 40", Condition: "${0} == 0x46 && ${1} == 0x01", Name: DisplayTemperature, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANSensorTemperature), CanValueDef: CanValueDef{ Unit: "°C", Calculation: "${2} / 2 - 40", Condition: "${0} == 0x46 && ${1} == 0x01", Name: SensorTemperature, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANDate), CanValueDef: CanValueDef{ Unit: "", Calculation: "${2};${3};${4}>>3;((${4}&0x07)<<2)+(${5}>>6);${5}&0x3f;${6}", FormatSeperators: []string{"-", "-", "T", ":", ":"}, Condition: "1 == 1", Name: DateTime, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANAirConditioner), CanValueDef: CanValueDef{ Unit: "°C", Calculation: "(((${3} & 0x03) * 10) + (${5} & 0x3f))-48", Condition: "${0} == 0x22 && ${1} == 0x03", Name: ACTemperature, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANAirConditioner), CanValueDef: CanValueDef{ Unit: "°C", Calculation: "100", Condition: "${0} == 0x22 && ${1} == 0x48", Name: ACTemperature, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANAirConditioner), CanValueDef: CanValueDef{ Unit: "°C", Calculation: "-100", Condition: "${0} == 0x22 && ${1} == 0x4c", Name: ACTemperature, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANAirConditioner), CanValueDef: CanValueDef{ Unit: "", Calculation: "${3} & 0x0f", Condition: "${0} == 0x22 && ${1} == 0x50", Name: ACFanSpeed, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANAirConditioner), CanValueDef: CanValueDef{ Unit: "", Calculation: "${2}", Condition: "${0} == 0x21 && ${1} == 0xe0", Name: ACMode, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANFullLevel), CanValueDef: CanValueDef{ Unit: "l", Calculation: "94-(${2}/2)", Condition: "${0} == 0x46", Name: FullLevelMid, }, }, { ArbitrationID: uint32(EntertainmentCANDistance), CanValueDef: CanValueDef{ Unit: "cm", Calculation: "(${2} * 256 + ${3}) * 1.5748", Condition: "${0} == 0x46", Name: Distance, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANEngineMotion), CanValueDef: CanValueDef{ Unit: "rpm", Calculation: "(${2} * 256 + ${3}) / 4", Condition: "${0} == 0x46", Name: EngineSpeedRPM, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANEngineMotion), CanValueDef: CanValueDef{ Unit: "km/h", Calculation: "${4} * 2", Condition: "${0} == 0x46", Name: VehicleSpeedMid, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANEngineTemperature), CanValueDef: CanValueDef{ Unit: "°C", Calculation: "${2} - 40", Condition: "${0} == 0x46", Name: CoolantTemperature, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANFullInjection), CanValueDef: CanValueDef{ Unit: "x1", Calculation: "${2} * 256 + ${3}", Condition: "${0} == 0x46", Name: FullInjectionMid, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANRange), CanValueDef: CanValueDef{ Unit: "km", Calculation: "(${2} * 256 + ${3}) * 0.5", Condition: "${0} == 0x46", Name: LeftTravelRange, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANRange), CanValueDef: CanValueDef{ Unit: "", Calculation: "${1}", Condition: "${0} == 0x46", Name: RangeWarning, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANDisplayData), CanValueDef: CanValueDef{ Unit: "", Calculation: "${2};${4};${6}", FormatSeperators: []string{",", ","}, Condition: "${0} == 0x23", Name: DisplayR1C1, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANDisplayData), CanValueDef: CanValueDef{ Unit: "", Calculation: "${1};${3};${5};${7}", Condition: "${0} == 0x24", FormatSeperators: []string{",", ",", ","}, Name: DisplayR1C2, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANDisplayData), CanValueDef: CanValueDef{ Unit: "", Calculation: "${2};${4};${6}", FormatSeperators: []string{",", ","}, Condition: "${0} == 0x25", Name: DisplayR1C3, }, TriggerEvent: true, }, { ArbitrationID: uint32(EntertainmentCANDisplayData), CanValueDef: CanValueDef{ Unit: "", Calculation: "${1};${3};${5};${7}", FormatSeperators: []string{",", ",", ","}, Condition: "${0} == 0x26", Name: DisplayR1C4, }, TriggerEvent: true, }, }
View Source
var OpelAstraHOpc2006GMLan []CanValueMap = []CanValueMap{ { ArbitrationID: uint32(GMLanWeelRemoteControll), CanValueDef: CanValueDef{ Unit: "Key Action", Calculation: "${5}", Condition: "${2} == 0x00 && ${3} == 0x00", Name: WeelKey, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanWeelRemoteControll), CanValueDef: CanValueDef{ Unit: "Turn Lights", Calculation: "${4}", Condition: "${2} == 0x00 && ${3} == 0x00", Name: TurnLights, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanBusWakeup), CanValueDef: CanValueDef{ Unit: "Bus Wakeup", Calculation: "1", Condition: "1 == 1", Name: BusWakeup, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanEngineSpeedRPM), CanValueDef: CanValueDef{ Unit: "RPM", Calculation: "(${1}*256 + ${2})/4", Condition: "1 == 1", Name: EngineSpeedRPM, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanEngineSpeedRPM), CanValueDef: CanValueDef{ Unit: "km/h", Calculation: "(${4}*256 + ${5}) / 128", Condition: "1 == 1", Name: VehicleSpeed, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanEngineSpeedRPM), CanValueDef: CanValueDef{ Unit: "", Calculation: "${0}", Condition: "1 == 1", Name: EngineRunningState, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanMilage), CanValueDef: CanValueDef{ Unit: "km", Calculation: "(${2}*65536 + ${3}*256 +${4}) / 64", Condition: "1 == 1", Name: Milage, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanTraveledDistance), CanValueDef: CanValueDef{ Unit: "m", Calculation: "(${1} * 256 + ${2}) * 0.015748", Condition: "1 == 1", Name: TraveledDistance, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanClutchBreak), CanValueDef: CanValueDef{ Unit: "", Calculation: "${2}", Condition: "${0} == 0x00 && ${1} == 0x00", Name: BreakState, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanBatteryVoltage), CanValueDef: CanValueDef{ Unit: "V", Calculation: "${1} / 8", Condition: "1 == 1", Name: BatteryVoltage, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanLedBrightness), CanValueDef: CanValueDef{ Unit: "", Calculation: "${1}", Condition: "${0} == 0x00", Name: LedBrightness, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanFullLevel), CanValueDef: CanValueDef{ Unit: "l", Calculation: "${1}/2+10", Condition: "${0} == 0x00", Name: FullLevel, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanFullInjection), CanValueDef: CanValueDef{ Unit: "x1", Calculation: "(${1} * 256 + ${2})", Condition: "${3} == 0x00", Name: FullInjection, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanLightSwitch), CanValueDef: CanValueDef{ Unit: "", Calculation: "${2}", Condition: "${0} == 0x00 && ${1} == 0x00", Name: LightSwitch, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanLightLevler), CanValueDef: CanValueDef{ Unit: "", Calculation: "${0}", Condition: "1 == 1", Name: LightLeveler, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanLightBack), CanValueDef: CanValueDef{ Unit: "", Calculation: "${1}", Condition: "${0} == 0", Name: LightBack, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanDoorState), CanValueDef: CanValueDef{ Unit: "", Calculation: "${2}", Condition: "${0} == 0 && ${1} == 0", Name: DoorState, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanCoolant), CanValueDef: CanValueDef{ Unit: "°C", Calculation: "${3} - 40", Condition: "${5} == 0x04 && ${6} == 0", Name: CoolantTemperature, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanOutputTemperature), CanValueDef: CanValueDef{ Unit: "°C", Calculation: "${1} / 2 - 40", Condition: "${0} == 0x00", Name: OutdoorTemperature, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanTPMS), CanValueDef: CanValueDef{ Unit: "bar", Calculation: "${2}/25;${3}/25;${4}/25;${5}/25", Condition: "1 == 1", Name: TPMS, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanCruseControl), CanValueDef: CanValueDef{ Unit: "", Calculation: "${5}", Condition: "1 == 1", Name: CruseControl, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanSysTime), CanValueDef: CanValueDef{ Unit: "", Calculation: "${0};${1};${2}", Condition: "1 == 1", Name: SystemTime, }, TriggerEvent: true, }, { ArbitrationID: uint32(GMLanRemoteKey), CanValueDef: CanValueDef{ Unit: "", Calculation: "${1}", Condition: "${0} == 0x02 && ${2} == 0x70 && ${3} == 0xD6", Name: DoorLook, }, }, }
Opel Astra H OPC 2006
View Source
var OpelAstraHOpc2006HighSpeedCAN []CanValueMap = []CanValueMap{
{},
}
Functions ¶
This section is empty.
Types ¶
type CanValueDef ¶
type CanValueMap ¶
type CanValueMap struct { CanValueDef CanValueDef ArbitrationID uint32 TriggerEvent bool OriginalData []byte }
type CanVars ¶
type CanVars string
const ( ACTemperature CanVars = "AC Temperature" // tested ACMode CanVars = "AC Mode" // tested ACFanSpeed CanVars = "AC Fan Speed" // problem with Auto BatteryVoltage CanVars = "Battery Voltage" // tested BusWakeup CanVars = "CAN-Bus Wakeup" // tested BreakState CanVars = "Break State" // tested DateTime CanVars = "Date" // tested EngineSpeedRPM CanVars = "Engine RPM" // tested FullInjection CanVars = "Full Injection" // partialy tested FullInjectionMid CanVars = "Full Injection Mid" FullLevel CanVars = "Full Level" // tested FullLevelMid CanVars = "Full Level Mid" LedBrightness CanVars = "Led Brightness" // tested Milage CanVars = "Milage" // tested OutdoorTemperature CanVars = "Output Temperature" // tested VehicleSpeed CanVars = "Speed" // tested VehicleSpeedMid CanVars = "Speed Mid" WeelKey CanVars = "Weel Remote Key" // tested DisplayR1C1 CanVars = "Display Row 1 Column 1" // tested DisplayR1C2 CanVars = "Display Row 1 Column 2" // tested DisplayR1C3 CanVars = "Display Row 1 Column 3" // tested DisplayR1C4 CanVars = "Display Row 1 Column 4" // tested LightSwitch CanVars = "Light Switch" // tested LightLeveler CanVars = "Light Leveler" // tested LightBack CanVars = "Light Back" // tested DoorState CanVars = "Door State" // tested EngineRunningState CanVars = "Engine State" // tested TurnLights CanVars = "Turn Lights" // dont work CoolantTemperature CanVars = "Coolant Temperature" // tested TPMS CanVars = "Tire Pressure Monitoring System" CruseControl CanVars = "Cruse Control" // tested SystemTime CanVars = "System Time" DisplayTemperature CanVars = "Display Temperature" SensorTemperature CanVars = "Outdoor Sensor Temperature" // tested LeftTravelRange CanVars = "Range" // tested RangeWarning CanVars = "Range Warning" // tested TraveledDistance CanVars = "Traveled Distance" // tested Distance CanVars = "Distance" DoorLook CanVars = "Door Lock" )
type Cancoder ¶
type Cancoder struct { Map []CanValueMap Device string }
type CancoderDef ¶
var OpelAstraHOpc2006 CancoderDef = CancoderDef{ Name: "Opel_Astra_H_OPC_2006", Cancoders: Cancoders{ { Map: OpelAstraHOpc2006GMLan, Device: "can1", }, { Map: OpelAstraHOpc2006EntertainmentCAN, Device: "can0", }, }, }
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
func NewCanCoder ¶ added in v0.0.2
func NewCanCoder(valueMaps []CanValueMap) *Decoder
func (*Decoder) Decoder ¶
func (d *Decoder) Decoder(frame *can.Frame) (values []*CanValueMap, err error)
func (*Decoder) Encode ¶ added in v0.0.2
func (c *Decoder) Encode(value *CanValueMap) (frame *can.Frame, err error)
func (*Decoder) GetEventChannel ¶
func (d *Decoder) GetEventChannel() <-chan CanValueMap
func (*Decoder) GetValue ¶
func (d *Decoder) GetValue(name CanVars) *CanValueMap
type EntertainmentCANArbitrationIDs ¶
type EntertainmentCANArbitrationIDs uint32
Opel's MidSpeed CAN 95k (red(H), yellow(L), green(GND) )
const ( EntertainmentCANDate EntertainmentCANArbitrationIDs = 0x180 // tested EntertainmentCANDistance EntertainmentCANArbitrationIDs = 0x188 EntertainmentCANRadioButtons EntertainmentCANArbitrationIDs = 0x201 EntertainmentCANSteeringWheelButtons EntertainmentCANArbitrationIDs = 0x206 EntertainmentCANACKnobs EntertainmentCANArbitrationIDs = 0x208 EntertainmentCANEngineMotion EntertainmentCANArbitrationIDs = 0x4e8 EntertainmentCANEngineTemperature EntertainmentCANArbitrationIDs = 0x4ec EntertainmentCANFullInjection EntertainmentCANArbitrationIDs = 0x4ed EntertainmentCANRange EntertainmentCANArbitrationIDs = 0x4ee // tested EntertainmentCANDisplayTemperature EntertainmentCANArbitrationIDs = 0x682 // tested EntertainmentCANSensorTemperature EntertainmentCANArbitrationIDs = 0x683 // tested EntertainmentCANTPMSPressure EntertainmentCANArbitrationIDs = 0x684 EntertainmentCANTPMSBattery EntertainmentCANArbitrationIDs = 0x685 EntertainmentCANFullLevel EntertainmentCANArbitrationIDs = 0x68c EntertainmentCANDisplayData EntertainmentCANArbitrationIDs = 0x6c1 // partialy tested EntertainmentCANAirConditioner EntertainmentCANArbitrationIDs = 0x6c8 // -> knöpfe? )
type GMLanArbitrationIDs ¶
type GMLanArbitrationIDs uint32
Opel's LowSpeed SW-CAN 33.3k (Single Wire - ws(H))
const ( GMLanBusWakeup GMLanArbitrationIDs = 0x100 // tested GMLanEngineSpeedRPM GMLanArbitrationIDs = 0x108 // tested GMLanTraveledDistance GMLanArbitrationIDs = 0x110 // Not shure GMLanFullInjection GMLanArbitrationIDs = 0x130 // not valid as it is, seems to be a counter (ml/s or something like that) GMLanCoolant GMLanArbitrationIDs = 0x145 // tested GMLanCruseControl GMLanArbitrationIDs = 0x145 // tested GMLanRemoteKey GMLanArbitrationIDs = 0x160 GMLanWeelRemoteControll GMLanArbitrationIDs = 0x175 // tested GMLanMilage GMLanArbitrationIDs = 0x190 // tested GMLanDoorState GMLanArbitrationIDs = 0x230 // tested GMLanLedBrightness GMLanArbitrationIDs = 0x235 // tested GMLanLightSwitch GMLanArbitrationIDs = 0x305 // tested GMLanLightLevler GMLanArbitrationIDs = 0x350 // tested GMLanClutchBreak GMLanArbitrationIDs = 0x360 // tested (Rücklichter?) GMLanLightBack GMLanArbitrationIDs = 0x370 // tested GMLanFullLevel GMLanArbitrationIDs = 0x375 // tested GMLanSysTime GMLanArbitrationIDs = 0x440 GMLanOutputTemperature GMLanArbitrationIDs = 0x445 // tested GMLanBatteryVoltage GMLanArbitrationIDs = 0x500 // tested GMLanTPMS GMLanArbitrationIDs = 0x530 // unknown )
type HighSpeedCANArbitrationIDs ¶
type HighSpeedCANArbitrationIDs uint32 // 500k
const ( HSCANSAEStandardData HighSpeedCANArbitrationIDs = 0x7e8 // DLC | Mode / Service | PID | Data[1-5] | https://en.wikipedia.org/wiki/OBD-II_PIDs HsCANVehicleSpecificData HighSpeedCANArbitrationIDs = 0x5e8 )
Click to show internal directories.
Click to hide internal directories.