mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 04:52:10 -07:00
new: added support for 29bit obd2 identifiers
This commit is contained in:
parent
c3999d6bb5
commit
97b4dcb46e
2 changed files with 6 additions and 3 deletions
|
@ -34,13 +34,14 @@ func (obd *OBD2) Parse(mod *CANModule, msg *Message) bool {
|
||||||
|
|
||||||
odbMessage := &OBD2Message{}
|
odbMessage := &OBD2Message{}
|
||||||
|
|
||||||
if msg.Frame.ID == OBD2BroadcastRequestID {
|
if msg.Frame.ID == OBD2BroadcastRequestID || msg.Frame.ID == OBD2BroadcastRequestID29bit {
|
||||||
// parse as request
|
// parse as request
|
||||||
if odbMessage.ParseRequest(msg.Frame) {
|
if odbMessage.ParseRequest(msg.Frame) {
|
||||||
msg.OBD2 = odbMessage
|
msg.OBD2 = odbMessage
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} else if msg.Frame.ID >= OBD2ECUResponseMinID && msg.Frame.ID <= OBD2ECUResponseMaxID {
|
} else if (msg.Frame.ID >= OBD2ECUResponseMinID && msg.Frame.ID <= OBD2ECUResponseMaxID) ||
|
||||||
|
(msg.Frame.ID >= OBD2ECUResponseMinID29bit && msg.Frame.ID <= OBD2ECUResponseMaxID29bit) {
|
||||||
// parse as response
|
// parse as response
|
||||||
if odbMessage.ParseResponse(msg.Frame) {
|
if odbMessage.ParseResponse(msg.Frame) {
|
||||||
msg.OBD2 = odbMessage
|
msg.OBD2 = odbMessage
|
||||||
|
|
|
@ -13,10 +13,12 @@ import (
|
||||||
|
|
||||||
// https://github.com/ejvaughan/obdii/blob/master/src/OBDII.c
|
// https://github.com/ejvaughan/obdii/blob/master/src/OBDII.c
|
||||||
|
|
||||||
// TODO: add support for 29bit identifiers
|
|
||||||
const OBD2BroadcastRequestID = 0x7DF
|
const OBD2BroadcastRequestID = 0x7DF
|
||||||
const OBD2ECUResponseMinID = 0x7E0
|
const OBD2ECUResponseMinID = 0x7E0
|
||||||
const OBD2ECUResponseMaxID = 0x7EF
|
const OBD2ECUResponseMaxID = 0x7EF
|
||||||
|
const OBD2BroadcastRequestID29bit = 0x18DB33F1
|
||||||
|
const OBD2ECUResponseMinID29bit = 0x18DAF100
|
||||||
|
const OBD2ECUResponseMaxID29bit = 0x18DAF1FF
|
||||||
|
|
||||||
type OBD2Service uint8
|
type OBD2Service uint8
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue