public override void CanPacketReceived(CanPacket canPacket) { int canOffset = (int)canPacket.CanIdBase10 - (int)BaseAddress; if (IdMatch("0", canOffset)) { SerialNumber = canPacket.GetInt32(1); DeviceId = canPacket.GetInt32(0); } else if (IdMatch("F4", canOffset)) { SOCPercentage = canPacket.GetFloat(1); SOCAh = canPacket.GetFloat(0); } if (IdMatch("F5", canOffset)) { BalancePercentage = canPacket.GetFloat(1); BalanceAh = canPacket.GetFloat(0); } if (IdMatch("F6", canOffset)) { TotalPackCapacity = canPacket.GetUint16(3); DischargeCellVoltageError = canPacket.GetInt16(2); CellTempMargin = canPacket.GetInt16(1); ChargeCellVoltageError = canPacket.GetInt16(0); } if (IdMatch("F7", canOffset)) { PrechargeTimer = canPacket.GetUint8(7); TimerFlag = canPacket.GetUint8(6); PrechargeState = canPacket.GetUint8(1); ContactorStatus = canPacket.GetUint8(0); } if (IdMatch("F8", canOffset)) { CellNumberMaxCell = canPacket.GetInt8(7); CMUNumberMaxCell = canPacket.GetInt8(6); CellNumberMinCell = canPacket.GetInt8(5); CMUNumberMinCell = canPacket.GetInt8(4); MaxCellVoltage = canPacket.GetUint16(1); MinCellVoltage = canPacket.GetUint16(0); } if (IdMatch("F9", canOffset)) { CMUNumberMaxTemp = canPacket.GetInt8(6); CMUNumberMinTemp = canPacket.GetInt8(4); MaxCellTemp = canPacket.GetUint16(1); MinCellTemp = canPacket.GetUint16(0); } if (IdMatch("FA", canOffset)) { BatteryCurrent = canPacket.GetInt32(1); BatteryVoltage = canPacket.GetUint32(0); } if (IdMatch("FB", canOffset)) { BMUFirmwareBuildNumber = canPacket.GetUint16(3); CMUCount = canPacket.GetUint8(5); StatusFlags = canPacket.GetUint8(4); BalanceVoltageThresholdFalling = canPacket.GetUint16(1); BalanceVoltageThresholdRising = canPacket.GetUint16(0); } if (IdMatch("FC", canOffset)) { TwelveVoltCurrentCMUs = canPacket.GetUint16(3); TwelveVoltCurrentFansContactors = canPacket.GetUint16(2); FanSpeed1RPM = canPacket.GetUint16(1); FanSpeed0RPM = canPacket.GetUint16(0); } if (IdMatch("FD", canOffset)) { BMUModelId = canPacket.GetInt8(5); BMUHardwareVersion = canPacket.GetInt16(3); ExtendedStausFlag = canPacket.GetUint32(0); } }