[
OCPP16IncomingRequestCommand.RESET,
OCPP16ServiceUtils.parseJsonSchemaFile<ResetRequest>(
- '../../../assets/json-schemas/ocpp/1.6/Reset.json'
+ '../../../assets/json-schemas/ocpp/1.6/Reset.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.CLEAR_CACHE,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ClearCacheRequest>(
- '../../../assets/json-schemas/ocpp/1.6/ClearCache.json'
+ '../../../assets/json-schemas/ocpp/1.6/ClearCache.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.UNLOCK_CONNECTOR,
OCPP16ServiceUtils.parseJsonSchemaFile<UnlockConnectorRequest>(
- '../../../assets/json-schemas/ocpp/1.6/UnlockConnector.json'
+ '../../../assets/json-schemas/ocpp/1.6/UnlockConnector.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.GET_CONFIGURATION,
OCPP16ServiceUtils.parseJsonSchemaFile<GetConfigurationRequest>(
- '../../../assets/json-schemas/ocpp/1.6/GetConfiguration.json'
+ '../../../assets/json-schemas/ocpp/1.6/GetConfiguration.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.CHANGE_CONFIGURATION,
OCPP16ServiceUtils.parseJsonSchemaFile<ChangeConfigurationRequest>(
- '../../../assets/json-schemas/ocpp/1.6/ChangeConfiguration.json'
+ '../../../assets/json-schemas/ocpp/1.6/ChangeConfiguration.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.GET_DIAGNOSTICS,
OCPP16ServiceUtils.parseJsonSchemaFile<GetDiagnosticsRequest>(
- '../../../assets/json-schemas/ocpp/1.6/GetDiagnostics.json'
+ '../../../assets/json-schemas/ocpp/1.6/GetDiagnostics.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.SET_CHARGING_PROFILE,
OCPP16ServiceUtils.parseJsonSchemaFile<SetChargingProfileRequest>(
- '../../../assets/json-schemas/ocpp/1.6/SetChargingProfile.json'
+ '../../../assets/json-schemas/ocpp/1.6/SetChargingProfile.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.CLEAR_CHARGING_PROFILE,
OCPP16ServiceUtils.parseJsonSchemaFile<ClearChargingProfileRequest>(
- '../../../assets/json-schemas/ocpp/1.6/ClearChargingProfile.json'
+ '../../../assets/json-schemas/ocpp/1.6/ClearChargingProfile.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.CHANGE_AVAILABILITY,
OCPP16ServiceUtils.parseJsonSchemaFile<ChangeAvailabilityRequest>(
- '../../../assets/json-schemas/ocpp/1.6/ChangeAvailability.json'
+ '../../../assets/json-schemas/ocpp/1.6/ChangeAvailability.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.REMOTE_START_TRANSACTION,
OCPP16ServiceUtils.parseJsonSchemaFile<RemoteStartTransactionRequest>(
- '../../../assets/json-schemas/ocpp/1.6/RemoteStartTransaction.json'
+ '../../../assets/json-schemas/ocpp/1.6/RemoteStartTransaction.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.REMOTE_STOP_TRANSACTION,
OCPP16ServiceUtils.parseJsonSchemaFile<RemoteStopTransactionRequest>(
- '../../../assets/json-schemas/ocpp/1.6/RemoteStopTransaction.json'
+ '../../../assets/json-schemas/ocpp/1.6/RemoteStopTransaction.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.TRIGGER_MESSAGE,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16TriggerMessageRequest>(
- '../../../assets/json-schemas/ocpp/1.6/TriggerMessage.json'
+ '../../../assets/json-schemas/ocpp/1.6/TriggerMessage.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.DATA_TRANSFER,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DataTransferRequest>(
- '../../../assets/json-schemas/ocpp/1.6/DataTransfer.json'
+ '../../../assets/json-schemas/ocpp/1.6/DataTransfer.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.UPDATE_FIRMWARE,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16UpdateFirmwareRequest>(
- '../../../assets/json-schemas/ocpp/1.6/UpdateFirmware.json'
+ '../../../assets/json-schemas/ocpp/1.6/UpdateFirmware.json',
+ moduleName,
+ 'constructor'
),
],
]);
chargingStation: ChargingStation,
commandPayload: ResetRequest
): GenericResponse {
- this.asyncResource
- .runInAsyncScope(
- chargingStation.reset.bind(chargingStation) as (
- this: ChargingStation,
- ...args: any[]
- ) => Promise<void>,
- chargingStation,
- `${commandPayload.type}Reset` as OCPP16StopTransactionReason
- )
- .catch(() => {
- /* This is intentional */
- });
+ this.runInAsyncScope(
+ chargingStation.reset.bind(chargingStation) as (
+ this: ChargingStation,
+ ...args: any[]
+ ) => Promise<void>,
+ chargingStation,
+ `${commandPayload.type}Reset` as OCPP16StopTransactionReason
+ ).catch(() => {
+ /* This is intentional */
+ });
logger.info(
`${chargingStation.logPrefix()} ${
commandPayload.type
): GetConfigurationResponse {
const configurationKey: OCPPConfigurationKey[] = [];
const unknownKey: string[] = [];
- if (Utils.isEmptyArray(commandPayload.key) === true) {
+ if (Utils.isUndefined(commandPayload.key) === true) {
for (const configuration of chargingStation.ocppConfiguration.configurationKey) {
if (Utils.isUndefined(configuration.visible) === true) {
configuration.visible = true;
value: configuration.value,
});
}
- } else {
+ } else if (Utils.isNotEmptyArray(commandPayload.key) === true) {
for (const key of commandPayload.key) {
const keyFound = ChargingStationConfigurationUtils.getConfigurationKey(
chargingStation,
- key
+ key,
+ true
);
if (keyFound) {
if (Utils.isUndefined(keyFound.visible) === true) {
const connectorStatus = chargingStation.getConnectorStatus(commandPayload.connectorId);
if (
!Utils.isNullOrUndefined(commandPayload.connectorId) &&
- !Utils.isEmptyArray(connectorStatus?.chargingProfiles)
+ Utils.isNotEmptyArray(connectorStatus?.chargingProfiles)
) {
connectorStatus.chargingProfiles = [];
logger.debug(
let clearedCP = false;
for (const connectorId of chargingStation.connectors.keys()) {
if (
- !Utils.isEmptyArray(chargingStation.getConnectorStatus(connectorId)?.chargingProfiles)
+ Utils.isNotEmptyArray(chargingStation.getConnectorStatus(connectorId)?.chargingProfiles)
) {
chargingStation
.getConnectorStatus(connectorId)
if (
chargingStation.getLocalAuthListEnabled() === true &&
chargingStation.hasAuthorizedTags() === true &&
- !Utils.isEmptyString(
+ Utils.isNotEmptyString(
chargingStation.authorizedTagsCache
.getAuthorizedTags(
ChargingStationUtils.getAuthorizationFile(chargingStation.stationInfo)
const retrieveDate = Utils.convertToDate(commandPayload.retrieveDate);
const now = Date.now();
if (retrieveDate?.getTime() <= now) {
- this.asyncResource
- .runInAsyncScope(
- this.updateFirmware.bind(this) as (
- this: OCPP16IncomingRequestService,
- ...args: any[]
- ) => Promise<void>,
- this,
- chargingStation
- )
- .catch(() => {
- /* This is intentional */
- });
+ this.runInAsyncScope(
+ this.updateFirmware.bind(this) as (
+ this: OCPP16IncomingRequestService,
+ ...args: any[]
+ ) => Promise<void>,
+ this,
+ chargingStation
+ ).catch(() => {
+ /* This is intentional */
+ });
} else {
setTimeout(() => {
this.updateFirmware(chargingStation).catch(() => {
}
if (
chargingStation.stationInfo?.firmwareUpgrade?.failureStatus &&
- !Utils.isEmptyString(chargingStation.stationInfo?.firmwareUpgrade?.failureStatus)
+ Utils.isNotEmptyString(chargingStation.stationInfo?.firmwareUpgrade?.failureStatus)
) {
await chargingStation.ocppRequestService.requestHandler<
OCPP16FirmwareStatusNotificationRequest,
ftpClient = new Client();
const accessResponse = await ftpClient.access({
host: uri.host,
- ...(!Utils.isEmptyString(uri.port) && { port: Utils.convertToInt(uri.port) }),
- ...(!Utils.isEmptyString(uri.username) && { user: uri.username }),
- ...(!Utils.isEmptyString(uri.password) && { password: uri.password }),
+ ...(Utils.isNotEmptyString(uri.port) && { port: Utils.convertToInt(uri.port) }),
+ ...(Utils.isNotEmptyString(uri.username) && { user: uri.username }),
+ ...(Utils.isNotEmptyString(uri.password) && { password: uri.password }),
});
let uploadResponse: FTPResponse;
if (accessResponse.code === 220) {