Skip to content

Commit

Permalink
#260 - move data type enum to src and rename
Browse files Browse the repository at this point in the history
  • Loading branch information
RChandler234 committed Dec 21, 2024
1 parent a62d95c commit 4e514f0
Show file tree
Hide file tree
Showing 34 changed files with 100 additions and 100 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';
import { decimalPipe } from 'src/utils/pipes.utils';
import { GraphData } from 'src/utils/types.utils';

Expand All @@ -26,7 +26,7 @@ export class AccelerationGraphsComponent implements OnInit {
maxDataPoints = 400;

ngOnInit() {
this.storage.get(IdentifierDataType.XYZAccel).subscribe((value) => {
this.storage.get(DataTypeEnum.XYZAccel).subscribe((value) => {
const x1 = decimalPipe(value.values[0]);
const y1 = decimalPipe(value.values[1]);
const time = +value.time;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';
import { GraphData } from 'src/utils/types.utils';

@Component({
Expand All @@ -13,7 +13,7 @@ export default class AccelerationOverTimeDisplayComponent implements OnInit {
data: GraphData[] = [];

ngOnInit() {
this.storage.get(IdentifierDataType.ACCELERATION).subscribe((value) => {
this.storage.get(DataTypeEnum.ACCELERATION).subscribe((value) => {
this.data.push({ x: new Date().getTime(), y: parseInt(value.values[0]) });
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';

@Component({
selector: 'brake-pressure-display',
Expand All @@ -12,7 +12,7 @@ export default class BrakePressureDisplayComponent implements OnInit {
brakePressure: number = 0;

ngOnInit() {
this.storage.get(IdentifierDataType.BRAKE_PRESSURE).subscribe((value) => {
this.storage.get(DataTypeEnum.BRAKE_PRESSURE).subscribe((value) => {
this.brakePressure = parseInt(value.values[0]);
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';

@Component({
selector: 'driver-component',
Expand All @@ -12,7 +12,7 @@ export class DriverComponent implements OnInit {
driver: string = 'No Driver';

ngOnInit() {
this.storage.get(IdentifierDataType.DRIVER).subscribe((value) => {
this.storage.get(DataTypeEnum.DRIVER).subscribe((value) => {
[this.driver] = value.values || ['No Driver'];
});
console.log(this.driver);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Input, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';

@Component({
selector: 'latency-display',
Expand All @@ -16,10 +16,10 @@ export default class LatencyDisplayComponent implements OnInit {
newLatency: number = 0;

ngOnInit(): void {
this.storage.get(IdentifierDataType.LATENCY).subscribe((value) => {
this.storage.get(DataTypeEnum.LATENCY).subscribe((value) => {
this.latency = parseInt(value.values[0]);
});
this.storage.get(IdentifierDataType.NEW_LATENCY).subscribe((value) => {
this.storage.get(DataTypeEnum.NEW_LATENCY).subscribe((value) => {
this.newLatency = parseInt(value.values[0]);
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';
import { floatPipe } from 'src/utils/pipes.utils';

// need access motor temp, motor consumption, and motor cooling
Expand All @@ -19,13 +19,13 @@ export default class MotorInfoComponent implements OnInit {
piechartData: { value: number; name: string }[] = [];

ngOnInit() {
this.storage.get(IdentifierDataType.MOTOR_TEMP).subscribe((value) => {
this.storage.get(DataTypeEnum.MOTOR_TEMP).subscribe((value) => {
this.motorTemp = floatPipe(value.values[0]);
});
this.storage.get(IdentifierDataType.MOTOR_USAGE).subscribe((value) => {
this.storage.get(DataTypeEnum.MOTOR_USAGE).subscribe((value) => {
this.motorUsage = floatPipe(value.values[0]);
});
this.storage.get(IdentifierDataType.COOL_USAGE).subscribe((value) => {
this.storage.get(DataTypeEnum.COOL_USAGE).subscribe((value) => {
this.coolUsage = floatPipe(value.values[0]);
});
this.piechartData = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, HostListener, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';
import { floatPipe } from 'src/utils/pipes.utils';

@Component({
Expand All @@ -20,19 +20,19 @@ export default class RasberryPiComponent implements OnInit {
isMobile = window.innerWidth < this.mobileThreshold;

ngOnInit() {
this.storage.get(IdentifierDataType.CPUUsage).subscribe((value) => {
this.storage.get(DataTypeEnum.CPUUsage).subscribe((value) => {
this.cpuUsage = floatPipe(value.values[0]);
});
this.storage.get(IdentifierDataType.CPUTemp).subscribe((value) => {
this.storage.get(DataTypeEnum.CPUTemp).subscribe((value) => {
this.cpuTemp = floatPipe(value.values[0]);
});
this.storage.get(IdentifierDataType.RAMUsage).subscribe((value) => {
this.storage.get(DataTypeEnum.RAMUsage).subscribe((value) => {
this.ramUsage = Math.round((1 - floatPipe(value.values[0]) / 8000) * 100);
});
this.storage.get(IdentifierDataType.WIFIRSSI).subscribe((value) => {
this.storage.get(DataTypeEnum.WIFIRSSI).subscribe((value) => {
this.wifiRSSI = floatPipe(value.values[0]);
});
this.storage.get(IdentifierDataType.MCS).subscribe((value) => {
this.storage.get(DataTypeEnum.MCS).subscribe((value) => {
this.mcs = floatPipe(value.values[0]);
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';

@Component({
selector: 'speed-display',
Expand All @@ -12,7 +12,7 @@ export default class SpeedDisplayComponent implements OnInit {
speed: number = 0;

ngOnInit() {
this.storage.get(IdentifierDataType.SPEED).subscribe((value) => {
this.storage.get(DataTypeEnum.SPEED).subscribe((value) => {
this.speed = parseInt(value.values[0]);
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';
import { GraphData } from 'src/utils/types.utils';

@Component({
Expand All @@ -13,7 +13,7 @@ export default class SpeedOverTimeDisplayComponent implements OnInit {
data: GraphData[] = [];

ngOnInit() {
this.storage.get(IdentifierDataType.SPEED).subscribe((value) => {
this.storage.get(DataTypeEnum.SPEED).subscribe((value) => {
this.data.push({ x: new Date().getTime(), y: parseInt(value.values[0]) });
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';
import { floatPipe } from 'src/utils/pipes.utils';

/**
Expand All @@ -18,7 +18,7 @@ export class SteeringAngleDisplayComponent implements OnInit {
steeringAngle: number = 0;

ngOnInit() {
this.storage.get(IdentifierDataType.STEERING_ANGLE).subscribe((value) => {
this.storage.get(DataTypeEnum.STEERING_ANGLE).subscribe((value) => {
this.steeringAngle = floatPipe(value.values[0]);
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';

@Component({
selector: 'torque-display',
Expand All @@ -12,7 +12,7 @@ export default class TorqueDisplayComponent implements OnInit {
torque: number = 0;

ngOnInit() {
this.storage.get(IdentifierDataType.TORQUE).subscribe((value) => {
this.storage.get(DataTypeEnum.TORQUE).subscribe((value) => {
this.torque = parseInt(value.values[0]);
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Input, OnInit } from '@angular/core';
import Theme from 'src/services/theme.service';
import { StyleVariant } from 'src/utils/enumerations/style-variant';
import { StyleVariant } from 'src/utils/style-variant';

/**
* Custom typography component that allows for the use of different styles of text.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum IdentifierDataType {
export enum DataTypeEnum {
DRIVER = 'Driver',
LOCATION = 'location',
POINTS = 'GPS/Location',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, HostListener, Input, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';

@Component({
selector: 'charging-page-mobile',
Expand All @@ -19,7 +19,7 @@ export default class ChargingPageMobileComponent implements OnInit {
this.time = new Date();
}, 1000);

this.storage.get(IdentifierDataType.LOCATION).subscribe((value) => {
this.storage.get(DataTypeEnum.LOCATION).subscribe((value) => {
[this.location] = value.values || ['No Location Set'];
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, HostListener, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';

/**
* Container for the Charging page, obtains data from the storage service.
Expand All @@ -22,7 +22,7 @@ export default class ChargingPageComponent implements OnInit {
this.time = new Date();
}, 1000);

this.storage.get(IdentifierDataType.LOCATION).subscribe((value) => {
this.storage.get(DataTypeEnum.LOCATION).subscribe((value) => {
[this.location] = value.values || ['No Location Set'];
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';
import { floatPipe } from 'src/utils/pipes.utils';

enum BMSMODE {
Expand Down Expand Up @@ -28,7 +28,7 @@ export default class BMSModeDisplayComponent implements OnInit {
};

ngOnInit() {
this.storage.get(IdentifierDataType.BMS_MODE).subscribe((value) => {
this.storage.get(DataTypeEnum.BMS_MODE).subscribe((value) => {
this.bmsMode = floatPipe(value.values[0]) as BMSMODE;
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import Theme from 'src/services/theme.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';
import { floatPipe } from 'src/utils/pipes.utils';

@Component({
Expand All @@ -17,7 +17,7 @@ export default class ActiveStatusComponent implements OnInit {
intervalId!: NodeJS.Timeout;

ngOnInit() {
this.storage.get(IdentifierDataType.BMS_MODE).subscribe((value) => {
this.storage.get(DataTypeEnum.BMS_MODE).subscribe((value) => {
const statusStateValue = floatPipe(value.values[0]);
if (this.isActive) {
if (!(statusStateValue === 2)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import Theme from 'src/services/theme.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';
import { floatPipe } from 'src/utils/pipes.utils';

@Component({
Expand All @@ -17,7 +17,7 @@ export default class BalancingStatusComponent implements OnInit {
intervalId!: NodeJS.Timeout;

ngOnInit() {
this.storage.get(IdentifierDataType.STATUS_BALANCING).subscribe((value) => {
this.storage.get(DataTypeEnum.STATUS_BALANCING).subscribe((value) => {
const statusBalancingValue = floatPipe(value.values[0]);
if (this.isBalancing) {
if (!(statusBalancingValue === 1)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';
import { floatPipe } from 'src/utils/pipes.utils';

@Component({
Expand All @@ -13,7 +13,7 @@ export default class CurrentDisplayComponent implements OnInit {
amps: number = 0;

ngOnInit() {
this.storage.get(IdentifierDataType.CURRENT).subscribe((value) => {
this.storage.get(DataTypeEnum.CURRENT).subscribe((value) => {
this.amps = floatPipe(value.values[0]);
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, HostListener, OnInit, inject } from '@angular/core';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';
import { floatPipe } from 'src/utils/pipes.utils';
import Storage from 'src/services/storage.service';

Expand All @@ -19,19 +19,19 @@ export class BatteryInfoDisplayComponent implements OnInit {
isMobile = window.innerWidth < this.mobileThreshold;

ngOnInit() {
this.storage.get(IdentifierDataType.PACK_TEMP).subscribe((value) => {
this.storage.get(DataTypeEnum.PACK_TEMP).subscribe((value) => {
this.packTemp = floatPipe(value.values[0]);
});
this.storage.get(IdentifierDataType.PACK_VOLTAGE).subscribe((value) => {
this.storage.get(DataTypeEnum.PACK_VOLTAGE).subscribe((value) => {
this.voltage = floatPipe(value.values[0]);
});
this.storage.get(IdentifierDataType.STATE_OF_CHARGE).subscribe((value) => {
this.storage.get(DataTypeEnum.STATE_OF_CHARGE).subscribe((value) => {
this.stateOfCharge = floatPipe(value.values[0]);
});
this.storage.get(IdentifierDataType.CHARGE_CURRENT_LIMIT).subscribe((value) => {
this.storage.get(DataTypeEnum.CHARGE_CURRENT_LIMIT).subscribe((value) => {
this.chargeCurrentLimit = floatPipe(value.values[0]);
});
this.storage.get(IdentifierDataType.DISCHARGE_CURRENT_LIMIT).subscribe((value) => {
this.storage.get(DataTypeEnum.DISCHARGE_CURRENT_LIMIT).subscribe((value) => {
this.dischargeCurrentLimit = floatPipe(value.values[0]);
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, HostListener, OnInit, inject } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { DataTypeEnum } from 'src/data-type.enum';
import { floatPipe } from 'src/utils/pipes.utils';
import { GraphData } from 'src/utils/types.utils';

Expand Down Expand Up @@ -29,11 +29,11 @@ export default class CellTempDisplayComponent implements OnInit {
}

ngOnInit() {
this.storage.get(IdentifierDataType.CELL_TEMP_HIGH).subscribe((value) => {
this.storage.get(DataTypeEnum.CELL_TEMP_HIGH).subscribe((value) => {
this.maxTemp = floatPipe(value.values[0]);
this.cellTempData.push({ x: +value.time, y: this.maxTemp });
});
this.storage.get(IdentifierDataType.CELL_TEMP_AVG).subscribe((value) => {
this.storage.get(DataTypeEnum.CELL_TEMP_AVG).subscribe((value) => {
this.avgTemp = floatPipe(value.values[0]);
});
}
Expand Down
Loading

0 comments on commit 4e514f0

Please sign in to comment.