}
}
- void updateHybridState(double speed, double engineSpeed, bool brake) {
+ void updateHybridState(double speed, int engineSpeed, bool brake) {
// Variable to store the current state
HybridState currentState = state.hybridState;
double avgSpeed = 0.0;
// Variable for storing the average value of RPM
- double avgRpm = 0.0;
+ double avgRpm = 0;
if (speed == 0 && engineSpeed <= 600) {
// Set idle state.
}
break;
case VSSPath.vehicleEngineSpeed:
- if (entry.value.hasFloat()) {
- state = state.copyWith(engineSpeed: entry.value.float);
+ if (entry.value.hasUint32()) {
+ state = state.copyWith(engineSpeed: entry.value.uint32);
}
break;
case VSSPath.vehicleFrontLeftTire:
var range = state.range;
var psi = state.frontLeftTire;
var actualSpeed = 0.0;
- var actualRpm = 0.0;
+ var actualRpm = 0;
var actualFuelLevel = 0.0;
var actualInsideTemp = 0.0;
var actualOutsideTemp = 0.0;
@immutable
class Vehicle {
final double speed;
- final double engineSpeed;
+ final int engineSpeed;
final double insideTemperature;
final double outsideTemperature;
final int range;
Vehicle copyWith({
double? speed,
- double? engineSpeed,
+ int? engineSpeed,
double? insideTemperature,
double? outsideTemperature,
int? range,
factory Vehicle.fromMap(Map<String, dynamic> map) {
return Vehicle(
map['speed']?.toDouble() ?? 0.0,
- map['engineSpeed']?.toDouble() ?? 0.0,
+ map['engineSpeed']?.toInt() ?? 0,
map['insideTemperature']?.toDouble() ?? 0.0,
map['outsideTemperature']?.toDouble() ?? 0.0,
map['range']?.toInt() ?? 0,
return other is Vehicle &&
other.speed == speed &&
+ other.engineSpeed == engineSpeed &&
other.insideTemperature == insideTemperature &&
other.outsideTemperature == outsideTemperature &&
other.range == range &&
other.fuelLevel == fuelLevel &&
other.isChildLockActiveLeft == isChildLockActiveLeft &&
other.isChildLockActiveRight == isChildLockActiveRight &&
- other.engineSpeed == engineSpeed &&
other.frontLeftTire == frontLeftTire &&
other.frontRightTire == frontRightTire &&
other.rearLeftTire == rearLeftTire &&
@override
int get hashCode {
return speed.hashCode ^
+ engineSpeed.hashCode ^
insideTemperature.hashCode ^
outsideTemperature.hashCode ^
range.hashCode ^
fuelLevel.hashCode ^
isChildLockActiveLeft.hashCode ^
isChildLockActiveRight.hashCode ^
- engineSpeed.hashCode ^
frontLeftTire.hashCode ^
frontRightTire.hashCode ^
rearLeftTire.hashCode ^