import type { JSONSchemaType } from 'ajv';
import { OCPP20ServiceUtils } from './OCPP20ServiceUtils';
-import { type ChargingStation, ChargingStationConfigurationUtils } from '../../../charging-station';
+import { type ChargingStation, addConfigurationKey } from '../../../charging-station';
import { OCPPError } from '../../../exception';
import {
ErrorType,
- type JsonObject,
type JsonType,
type OCPP20BootNotificationResponse,
type OCPP20ClearCacheResponse,
export class OCPP20ResponseService extends OCPPResponseService {
public jsonIncomingRequestResponseSchemas: Map<
OCPP20IncomingRequestCommand,
- JSONSchemaType<JsonObject>
+ JSONSchemaType<JsonType>
>;
private responseHandlers: Map<OCPP20RequestCommand, ResponseHandler>;
- private jsonSchemas: Map<OCPP20RequestCommand, JSONSchemaType<JsonObject>>;
+ private jsonSchemas: Map<OCPP20RequestCommand, JSONSchemaType<JsonType>>;
public constructor() {
// if (new.target?.name === moduleName) {
this.emptyResponseHandler.bind(this) as ResponseHandler,
],
]);
- this.jsonSchemas = new Map<OCPP20RequestCommand, JSONSchemaType<JsonObject>>([
+ this.jsonSchemas = new Map<OCPP20RequestCommand, JSONSchemaType<JsonType>>([
[
OCPP20RequestCommand.BOOT_NOTIFICATION,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20BootNotificationResponse>(
ErrorType.NOT_IMPLEMENTED,
`${commandName} is not implemented to handle response PDU ${JSON.stringify(
payload,
- null,
+ undefined,
2,
)}`,
commandName,
ErrorType.SECURITY_ERROR,
`${commandName} cannot be issued to handle response PDU ${JSON.stringify(
payload,
- null,
+ undefined,
2,
)} while the charging station is not registered on the central server.`,
commandName,
payload: OCPP20BootNotificationResponse,
): void {
if (payload.status === RegistrationStatusEnumType.ACCEPTED) {
- ChargingStationConfigurationUtils.addConfigurationKey(
+ addConfigurationKey(
chargingStation,
OCPP20OptionalVariableName.HeartbeatInterval,
payload.interval.toString(),