// logger.debug(
// `${this.logPrefix()} ${moduleName}.messageHandler: Worker channel message received: ${JSON.stringify(
// msg,
- // null,
+ // undefined,
// 2,
// )}`,
// );
throw new BaseError(
`Unknown charging station worker event: '${
msg.event
- }' received with data: ${JSON.stringify(msg.data, null, 2)}`,
+ }' received with data: ${JSON.stringify(msg.data, undefined, 2)}`,
);
}
} catch (error) {
public idTagsCache: IdTagsCache;
public automaticTransactionGenerator!: AutomaticTransactionGenerator | undefined;
public ocppConfiguration!: ChargingStationOcppConfiguration | undefined;
- public wsConnection!: WebSocket | null;
+ public wsConnection: WebSocket | null;
public readonly connectors: Map<number, ConnectorStatus>;
public readonly evses: Map<number, EvseStatus>;
public readonly requests: Map<string, CachedRequest>;
this.started = false;
this.starting = false;
this.stopping = false;
+ this.wsConnection = null;
this.wsConnectionRestarted = false;
this.autoReconnectRetryCount = 0;
this.index = index;
const beginId = PerformanceStatistics.beginMeasure(measureId);
writeFileSync(
this.configurationFile,
- JSON.stringify(configurationData, null, 2),
+ JSON.stringify(configurationData, undefined, 2),
'utf8',
);
PerformanceStatistics.endMeasure(measureId, beginId);
throw new BaseError(
`Unknown worker event: '${message.event}' received with data: '${JSON.stringify(
message.data,
- null,
+ undefined,
2,
)}'`,
);
ErrorType.SECURITY_ERROR,
`${commandName} cannot be issued to handle request PDU ${JSON.stringify(
commandPayload,
- null,
+ undefined,
2,
)} while the charging station is in pending state on the central server`,
commandName,
ErrorType.NOT_IMPLEMENTED,
`${commandName} is not implemented to handle request PDU ${JSON.stringify(
commandPayload,
- null,
+ undefined,
2,
)}`,
commandName,
ErrorType.SECURITY_ERROR,
`${commandName} cannot be issued to handle request PDU ${JSON.stringify(
commandPayload,
- null,
+ undefined,
2,
)} while the charging station is not registered on the central server.`,
commandName,
.requestHandler<OCPP16HeartbeatRequest, OCPP16HeartbeatResponse>(
chargingStation,
OCPP16RequestCommand.HEARTBEAT,
- null,
+ undefined,
{
triggerMessage: true,
},
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,
context?: MeterValueContext,
phase?: OCPP16MeterValuePhase,
): OCPP16SampledValue {
- const sampledValueValue = value ?? sampledValueTemplate?.value ?? null;
- const sampledValueContext = context ?? sampledValueTemplate?.context ?? null;
+ const sampledValueValue = value ?? sampledValueTemplate?.value;
+ const sampledValueContext = context ?? sampledValueTemplate?.context;
const sampledValueLocation =
sampledValueTemplate?.location ??
OCPP16ServiceUtils.getMeasurandDefaultLocation(sampledValueTemplate.measurand!);
- const sampledValuePhase = phase ?? sampledValueTemplate?.phase ?? null;
+ const sampledValuePhase = phase ?? sampledValueTemplate?.phase;
return {
...(!isNullOrUndefined(sampledValueTemplate.unit) && {
unit: sampledValueTemplate.unit,
ErrorType.SECURITY_ERROR,
`${commandName} cannot be issued to handle request PDU ${JSON.stringify(
commandPayload,
- null,
+ undefined,
2,
)} while the charging station is in pending state on the central server`,
commandName,
ErrorType.NOT_IMPLEMENTED,
`${commandName} is not implemented to handle request PDU ${JSON.stringify(
commandPayload,
- null,
+ undefined,
2,
)}`,
commandName,
ErrorType.SECURITY_ERROR,
`${commandName} cannot be issued to handle request PDU ${JSON.stringify(
commandPayload,
- null,
+ undefined,
2,
)} while the charging station is not registered on the central server.`,
commandName,
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,
OCPPServiceUtils.ajvErrorsToErrorType(validate.errors!),
'Incoming request PDU is invalid',
commandName,
- JSON.stringify(validate.errors, null, 2),
+ JSON.stringify(validate.errors, undefined, 2),
);
}
OCPPServiceUtils.ajvErrorsToErrorType(validate.errors!),
'Request PDU is invalid',
commandName,
- JSON.stringify(validate.errors, null, 2),
+ JSON.stringify(validate.errors, undefined, 2),
);
}
OCPPServiceUtils.ajvErrorsToErrorType(validate.errors!),
'Response PDU is invalid',
commandName,
- JSON.stringify(validate.errors, null, 2),
+ JSON.stringify(validate.errors, undefined, 2),
);
}
OCPPServiceUtils.ajvErrorsToErrorType(validate.errors!),
'Response PDU is invalid',
commandName,
- JSON.stringify(validate.errors, null, 2),
+ JSON.stringify(validate.errors, undefined, 2),
);
}
throw new BaseError(
`${command} is not implemented to handle message payload ${JSON.stringify(
requestPayload,
- null,
+ undefined,
2,
)}`,
);
const response = JSON.parse(messageEvent.data) as ProtocolResponse;
if (Array.isArray(response) === false) {
- throw new Error(`Response not an array: ${JSON.stringify(response, null, 2)}`);
+ throw new Error(`Response not an array: ${JSON.stringify(response, undefined, 2)}`);
}
const [uuid, responsePayload] = response;
}
this.deleteResponseHandler(uuid);
} else {
- throw new Error(`Not a response to a request: ${JSON.stringify(response, null, 2)}`);
+ throw new Error(`Not a response to a request: ${JSON.stringify(response, undefined, 2)}`);
}
}
}