messageId: string,
messagePayload: JsonType | OCPPError,
messageType: MessageType,
- commandName?: RequestCommand | IncomingRequestCommand,
+ commandName: RequestCommand | IncomingRequestCommand,
params: RequestParams = {
skipBufferingOnError: false,
triggerMessage: false,
return Utils.promiseWithTimeout(
new Promise((resolve, reject) => {
if (chargingStation.getEnableStatistics() === true) {
- chargingStation.performanceStatistics.addRequestStatistic(commandName, messageType);
+ chargingStation.performanceStatistics?.addRequestStatistic(commandName, messageType);
}
const messageToSend = this.buildMessageToSend(
chargingStation,
if (wsOpened) {
const beginId = PerformanceStatistics.beginMeasure(commandName);
try {
- chargingStation.wsConnection.send(messageToSend);
+ chargingStation.wsConnection?.send(messageToSend);
logger.debug(
`${chargingStation.logPrefix()} >> Command '${commandName}' sent ${OCPPServiceUtils.getMessageTypeString(
messageType
*/
function responseCallback(payload: JsonType, requestPayload: JsonType): void {
if (chargingStation.getEnableStatistics() === true) {
- chargingStation.performanceStatistics.addRequestStatistic(
+ chargingStation.performanceStatistics?.addRequestStatistic(
commandName,
MessageType.CALL_RESULT_MESSAGE
);
*/
function errorCallback(error: OCPPError, requestStatistic = true): void {
if (requestStatistic === true && chargingStation.getEnableStatistics() === true) {
- chargingStation.performanceStatistics.addRequestStatistic(
+ chargingStation.performanceStatistics?.addRequestStatistic(
commandName,
MessageType.CALL_ERROR_MESSAGE
);
messageId: string,
messagePayload: JsonType | OCPPError,
messageType: MessageType,
- commandName?: RequestCommand | IncomingRequestCommand,
- responseCallback?: ResponseCallback,
- errorCallback?: ErrorCallback
+ commandName: RequestCommand | IncomingRequestCommand,
+ responseCallback: ResponseCallback,
+ errorCallback: ErrorCallback
): string {
let messageToSend: string;
// Type of message