added tons of files for component functionality; manual component adding added temporarily

This commit is contained in:
Carter 2025-02-11 16:31:03 -06:00
parent 58830d480e
commit 45ff49bcea
121 changed files with 25883 additions and 65 deletions

View file

@ -1,8 +1,26 @@
import { pond } from "protobuf-ts/pond";
import { or } from "utils/types";
import { cloneDeep } from "lodash";
import { MarkerData } from "Maps/mapMarkers/Markers";
// import { MarkerData } from "Maps/mapMarkers/Markers";
interface FeatureVersionByPlatform {
photon: string;
electron: string;
v2Wifi: string;
v2Cell: string;
}
const featureVersions: Map<string, FeatureVersionByPlatform> = new Map([
[
"individualCalibrations",
{
photon: "1.19.64",
electron: "1.19.64",
v2Cell: "2.0.44",
v2Wifi: "2.0.44"
}
]
]);
export class Device {
public settings: pond.DeviceSettings = pond.DeviceSettings.create();
public status: pond.DeviceStatus = pond.DeviceStatus.create();
@ -47,18 +65,37 @@ export class Device {
return loc;
}
public getMarkerData(
clickFunc?: (event: React.PointerEvent<HTMLElement>, index: number, isMobile: boolean) => void,
updateFunc?: (location: pond.Location) => void
): MarkerData {
let m: MarkerData = {
longitude: this.location()?.longitude ?? 0,
latitude: this.location()?.latitude ?? 0,
title: this.name(),
colour: this.settings.theme?.color ?? "blue",
clickFunc: clickFunc,
updateFunc: updateFunc
};
return m;
// public getMarkerData(
// clickFunc?: (event: React.PointerEvent<HTMLElement>, index: number, isMobile: boolean) => void,
// updateFunc?: (location: pond.Location) => void
// ): MarkerData {
// let m: MarkerData = {
// longitude: this.location()?.longitude ?? 0,
// latitude: this.location()?.latitude ?? 0,
// title: this.name(),
// colour: this.settings.theme?.color ?? "blue",
// clickFunc: clickFunc,
// updateFunc: updateFunc
// };
// return m;
// }
public featureSupported(feature: string): boolean {
let versions = featureVersions.get(feature);
if (!versions) {
return false;
}
switch (this.settings.platform) {
case pond.DevicePlatform.DEVICE_PLATFORM_PHOTON:
return this.status.firmwareVersion >= versions.photon;
case pond.DevicePlatform.DEVICE_PLATFORM_ELECTRON:
return this.status.firmwareVersion >= versions.electron;
case pond.DevicePlatform.DEVICE_PLATFORM_V2_CELLULAR:
return this.status.firmwareVersion >= versions.v2Cell;
case pond.DevicePlatform.DEVICE_PLATFORM_V2_WIFI:
return this.status.firmwareVersion >= versions.v2Wifi;
default:
return false;
}
}
}