From 057e2042576fb5f4dd4c201f1bd0f64c35ccf961 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 2 Jan 2022 11:08:12 +0100 Subject: [PATCH] Reorganize more sensibly types definition MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStation.ts | 3 ++- src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts | 2 +- src/types/ChargingStationTemplate.ts | 2 +- src/types/{Connectors.ts => ConnectorStatus.ts} | 8 ++------ src/types/MeasurandPerPhaseSampledValueTemplates.ts | 6 +++++- 5 files changed, 11 insertions(+), 10 deletions(-) rename src/types/{Connectors.ts => ConnectorStatus.ts} (84%) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 00cfce9f..ad4dac38 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -5,7 +5,6 @@ import { BootNotificationResponse, RegistrationStatus } from '../types/ocpp/Resp import ChargingStationConfiguration, { ConfigurationKey } from '../types/ChargingStationConfiguration'; import ChargingStationTemplate, { CurrentType, PowerUnits, Voltage } from '../types/ChargingStationTemplate'; import { ConnectorPhaseRotation, StandardParametersKey, SupportedFeatureProfiles, VendorDefaultParametersKey } from '../types/ocpp/Configuration'; -import { ConnectorStatus, SampledValueTemplate } from '../types/Connectors'; import { MeterValueMeasurand, MeterValuePhase } from '../types/ocpp/MeterValues'; import { WSError, WebSocketCloseEventStatusCode } from '../types/WebSocket'; import WebSocket, { ClientOptions, Data, OPEN } from 'ws'; @@ -17,6 +16,7 @@ import ChargingStationInfo from '../types/ChargingStationInfo'; import { ChargingStationWorkerMessageEvents } from '../types/ChargingStationWorker'; import { ClientRequestArgs } from 'http'; import Configuration from '../utils/Configuration'; +import { ConnectorStatus } from '../types/ConnectorStatus'; import Constants from '../utils/Constants'; import { ErrorType } from '../types/ocpp/ErrorType'; import FileUtils from '../utils/FileUtils'; @@ -29,6 +29,7 @@ import OCPPIncomingRequestService from './ocpp/OCPPIncomingRequestService'; import OCPPRequestService from './ocpp/OCPPRequestService'; import { OCPPVersion } from '../types/ocpp/OCPPVersion'; import PerformanceStatistics from '../performance/PerformanceStatistics'; +import { SampledValueTemplate } from '../types/MeasurandPerPhaseSampledValueTemplates'; import { StopTransactionReason } from '../types/ocpp/Transaction'; import { URL } from 'url'; import Utils from '../utils/Utils'; diff --git a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts index 289b00ea..f55c7429 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts @@ -6,7 +6,7 @@ import ChargingStation from '../../ChargingStation'; import { ErrorType } from '../../../types/ocpp/ErrorType'; import OCPPError from '../../../exception/OCPPError'; import { RequestCommand } from '../../../types/ocpp/Requests'; -import { SampledValueTemplate } from '../../../types/Connectors'; +import { SampledValueTemplate } from '../../../types/MeasurandPerPhaseSampledValueTemplates'; import Utils from '../../../utils/Utils'; import logger from '../../../utils/Logger'; diff --git a/src/types/ChargingStationTemplate.ts b/src/types/ChargingStationTemplate.ts index 8d0b044e..5d553318 100644 --- a/src/types/ChargingStationTemplate.ts +++ b/src/types/ChargingStationTemplate.ts @@ -1,7 +1,7 @@ import ChargingStationConfiguration from './ChargingStationConfiguration'; import { ClientOptions } from 'ws'; import { ClientRequestArgs } from 'http'; -import { ConnectorStatus } from './Connectors'; +import { ConnectorStatus } from './ConnectorStatus'; import { OCPPProtocol } from './ocpp/OCPPProtocol'; import { OCPPVersion } from './ocpp/OCPPVersion'; diff --git a/src/types/Connectors.ts b/src/types/ConnectorStatus.ts similarity index 84% rename from src/types/Connectors.ts rename to src/types/ConnectorStatus.ts index 027ac645..c63dd3db 100644 --- a/src/types/Connectors.ts +++ b/src/types/ConnectorStatus.ts @@ -1,12 +1,8 @@ -import { MeterValue, SampledValue } from './ocpp/MeterValues'; - import { AvailabilityType } from './ocpp/Requests'; import { ChargePointStatus } from './ocpp/ChargePointStatus'; import { ChargingProfile } from './ocpp/ChargingProfile'; - -export interface SampledValueTemplate extends SampledValue { - fluctuationPercent?: number; -} +import { MeterValue } from './ocpp/MeterValues'; +import { SampledValueTemplate } from './MeasurandPerPhaseSampledValueTemplates'; export interface ConnectorStatus { availability: AvailabilityType; diff --git a/src/types/MeasurandPerPhaseSampledValueTemplates.ts b/src/types/MeasurandPerPhaseSampledValueTemplates.ts index c78d9ebd..9240fde2 100644 --- a/src/types/MeasurandPerPhaseSampledValueTemplates.ts +++ b/src/types/MeasurandPerPhaseSampledValueTemplates.ts @@ -1,4 +1,8 @@ -import { SampledValueTemplate } from './Connectors'; +import { SampledValue } from './ocpp/MeterValues'; + +export interface SampledValueTemplate extends SampledValue { + fluctuationPercent?: number; +} export default interface MeasurandPerPhaseSampledValueTemplates { L1?: SampledValueTemplate; -- 2.34.1