X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcharging-station%2Focpp%2F1.6%2FOCPP16IncomingRequestService.ts;h=9424fcf2c697d6112e26c0c841ae53f092d332d0;hb=0ac97927984473fcb11a177f013b0e112638e050;hp=e6b8cc979317eeeecd7e0112ad5b928fae8b9750;hpb=268a74bb051fcbbad532fd833f0d8fd2b33b6c64;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index e6b8cc97..9424fcf2 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -8,14 +8,17 @@ import type { JSONSchemaType } from 'ajv'; import { Client, type FTPResponse } from 'basic-ftp'; import tar from 'tar'; -import { OCPP16ServiceUtils } from './OCPP16ServiceUtils'; +import { + type ChargingStation, + ChargingStationConfigurationUtils, + ChargingStationUtils, +} from '../../../charging-station'; import { OCPPError } from '../../../exception'; import { type ChangeAvailabilityRequest, type ChangeAvailabilityResponse, type ChangeConfigurationRequest, type ChangeConfigurationResponse, - ChargingProfilePurposeType, type ClearChargingProfileRequest, type ClearChargingProfileResponse, ErrorType, @@ -36,6 +39,7 @@ import { OCPP16ChargePointErrorCode, OCPP16ChargePointStatus, type OCPP16ChargingProfile, + OCPP16ChargingProfilePurposeType, type OCPP16ClearCacheRequest, type OCPP16DataTransferRequest, type OCPP16DataTransferResponse, @@ -73,14 +77,8 @@ import { type UnlockConnectorRequest, type UnlockConnectorResponse, } from '../../../types'; -import { Constants } from '../../../utils/Constants'; -import { logger } from '../../../utils/Logger'; -import { Utils } from '../../../utils/Utils'; -import type { ChargingStation } from '../../ChargingStation'; -import { ChargingStationConfigurationUtils } from '../../ChargingStationConfigurationUtils'; -import { ChargingStationUtils } from '../../ChargingStationUtils'; -import { OCPPConstants } from '../OCPPConstants'; -import { OCPPIncomingRequestService } from '../OCPPIncomingRequestService'; +import { Constants, Utils, logger } from '../../../utils'; +import { OCPP16ServiceUtils, OCPPConstants, OCPPIncomingRequestService } from '../internal'; const moduleName = 'OCPP16IncomingRequestService'; @@ -539,14 +537,14 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { } if ( commandPayload.csChargingProfiles.chargingProfilePurpose === - ChargingProfilePurposeType.CHARGE_POINT_MAX_PROFILE && + OCPP16ChargingProfilePurposeType.CHARGE_POINT_MAX_PROFILE && commandPayload.connectorId !== 0 ) { return OCPPConstants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED; } if ( commandPayload.csChargingProfiles.chargingProfilePurpose === - ChargingProfilePurposeType.TX_PROFILE && + OCPP16ChargingProfilePurposeType.TX_PROFILE && (commandPayload.connectorId === 0 || chargingStation.getConnectorStatus(commandPayload.connectorId)?.transactionStarted === false) @@ -890,14 +888,14 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { connectorId: number, cp: OCPP16ChargingProfile ): boolean { - if (cp && cp.chargingProfilePurpose === ChargingProfilePurposeType.TX_PROFILE) { + if (cp && cp.chargingProfilePurpose === OCPP16ChargingProfilePurposeType.TX_PROFILE) { OCPP16ServiceUtils.setChargingProfile(chargingStation, connectorId, cp); logger.debug( `${chargingStation.logPrefix()} Charging profile(s) set at remote start transaction on connector id ${connectorId}: %j`, cp ); return true; - } else if (cp && cp.chargingProfilePurpose !== ChargingProfilePurposeType.TX_PROFILE) { + } else if (cp && cp.chargingProfilePurpose !== OCPP16ChargingProfilePurposeType.TX_PROFILE) { logger.warn( `${chargingStation.logPrefix()} Not allowed to set ${ cp.chargingProfilePurpose