repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
[e-mobility-charging-stations-simulator.git]
/
src
/
charging-station
/
ocpp
/
2.0
/
OCPP20ResponseService.ts
diff --git
a/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts
b/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts
index 971d5b8394652b82e70fb4934f348620847c1298..50566300231ddfe3347870f3234737d64d31df9e 100644
(file)
--- a/
src/charging-station/ocpp/2.0/OCPP20ResponseService.ts
+++ b/
src/charging-station/ocpp/2.0/OCPP20ResponseService.ts
@@
-2,6
+2,7
@@
import type { JSONSchemaType } from 'ajv';
import type { JSONSchemaType } from 'ajv';
+import { OCPP20ServiceUtils } from './OCPP20ServiceUtils';
import { type ChargingStation, ChargingStationConfigurationUtils } from '../../../charging-station';
import { OCPPError } from '../../../exception';
import {
import { type ChargingStation, ChargingStationConfigurationUtils } from '../../../charging-station';
import { OCPPError } from '../../../exception';
import {
@@
-19,8
+20,8
@@
import {
RegistrationStatusEnumType,
type ResponseHandler,
} from '../../../types';
RegistrationStatusEnumType,
type ResponseHandler,
} from '../../../types';
-import {
Constants,
logger } from '../../../utils';
-import { OCPP
20ServiceUtils, OCPPResponseService } from '../internal
';
+import { logger } from '../../../utils';
+import { OCPP
ResponseService } from '../OCPPResponseService
';
const moduleName = 'OCPP20ResponseService';
const moduleName = 'OCPP20ResponseService';
@@
-47,7
+48,7
@@
export class OCPP20ResponseService extends OCPPResponseService {
[
OCPP20RequestCommand.BOOT_NOTIFICATION,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20BootNotificationResponse>(
[
OCPP20RequestCommand.BOOT_NOTIFICATION,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20BootNotificationResponse>(
- '
../../../
assets/json-schemas/ocpp/2.0/BootNotificationResponse.json',
+ 'assets/json-schemas/ocpp/2.0/BootNotificationResponse.json',
moduleName,
'constructor'
),
moduleName,
'constructor'
),
@@
-55,7
+56,7
@@
export class OCPP20ResponseService extends OCPPResponseService {
[
OCPP20RequestCommand.HEARTBEAT,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20HeartbeatResponse>(
[
OCPP20RequestCommand.HEARTBEAT,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20HeartbeatResponse>(
- '
../../../
assets/json-schemas/ocpp/2.0/HeartbeatResponse.json',
+ 'assets/json-schemas/ocpp/2.0/HeartbeatResponse.json',
moduleName,
'constructor'
),
moduleName,
'constructor'
),
@@
-63,7
+64,7
@@
export class OCPP20ResponseService extends OCPPResponseService {
[
OCPP20RequestCommand.STATUS_NOTIFICATION,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20StatusNotificationResponse>(
[
OCPP20RequestCommand.STATUS_NOTIFICATION,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20StatusNotificationResponse>(
- '
../../../
assets/json-schemas/ocpp/2.0/StatusNotificationResponse.json',
+ 'assets/json-schemas/ocpp/2.0/StatusNotificationResponse.json',
moduleName,
'constructor'
),
moduleName,
'constructor'
),
@@
-73,13
+74,17
@@
export class OCPP20ResponseService extends OCPPResponseService {
[
OCPP20IncomingRequestCommand.CLEAR_CACHE,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20ClearCacheResponse>(
[
OCPP20IncomingRequestCommand.CLEAR_CACHE,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20ClearCacheResponse>(
- '
../../../
assets/json-schemas/ocpp/2.0/ClearCacheResponse.json',
+ 'assets/json-schemas/ocpp/2.0/ClearCacheResponse.json',
moduleName,
'constructor'
),
],
]);
moduleName,
'constructor'
),
],
]);
- this.validatePayload.bind(this);
+ this.validatePayload = this.validatePayload.bind(this) as (
+ chargingStation: ChargingStation,
+ commandName: OCPP20RequestCommand,
+ payload: JsonType
+ ) => boolean;
}
public async responseHandler(
}
public async responseHandler(
@@
-164,9
+169,7
@@
export class OCPP20ResponseService extends OCPPResponseService {
{},
{ overwrite: true, save: true }
);
{},
{ overwrite: true, save: true }
);
- chargingStation.heartbeatSetInterval
- ? chargingStation.restartHeartbeat()
- : chargingStation.startHeartbeat();
+ OCPP20ServiceUtils.startHeartbeatInterval(chargingStation, payload.interval);
}
if (Object.values(RegistrationStatusEnumType).includes(payload.status)) {
const logMsg = `${chargingStation.logPrefix()} Charging station in '${
}
if (Object.values(RegistrationStatusEnumType).includes(payload.status)) {
const logMsg = `${chargingStation.logPrefix()} Charging station in '${