moduleName?: string,
methodName?: string
): JSONSchemaType<T> {
- return OCPP16ServiceUtils.parseJsonSchemaFile<T>(
+ return super.parseJsonSchemaFile<T>(
relativePath,
OCPPVersion.VERSION_16,
moduleName,
}
}
- // Helper methods for RequestStartTransaction
private isIdTokenAuthorized (
chargingStation: ChargingStation,
idToken: OCPP20IdTokenType
timestamp: new Date(),
...commandParams,
} as unknown as Request
+ case OCPP20RequestCommand.TRANSACTION_EVENT:
+ return {
+ timestamp: new Date(),
+ ...commandParams,
+ } as unknown as Request
default: {
// OCPPError usage here is debatable: it's an error in the OCPP stack but not targeted to sendError().
- const errorMsg = `Unsupported OCPP command ${commandName} for payload building`
+ const errorMsg = `Unsupported OCPP command ${commandName as string} for payload building`
logger.error(
`${chargingStation.logPrefix()} ${moduleName}.buildRequestPayload: ${errorMsg}`
)
import type { JSONSchemaType } from 'ajv'
-import type { ChargingStation } from '../../../charging-station/index.js'
-
+import { type ChargingStation, resetConnectorStatus } from '../../../charging-station/index.js'
import {
ConnectorStatusEnum,
type GenericResponse,
moduleName?: string,
methodName?: string
): JSONSchemaType<T> {
- return OCPP20ServiceUtils.parseJsonSchemaFile<T>(
+ return super.parseJsonSchemaFile<T>(
relativePath,
OCPPVersion.VERSION_201,
moduleName,
return OCPP20Constants.OCPP_RESPONSE_REJECTED
}
+ connectorStatus.transactionSeqNo = (connectorStatus.transactionSeqNo ?? 0) + 1
+
const transactionEventRequest: OCPP20TransactionEventRequest = {
eventType: OCPP20TransactionEventEnumType.Ended,
evse: {
id: evseId,
},
- seqNo: 0, // This should be managed by the transaction sequence
+ seqNo: connectorStatus.transactionSeqNo,
timestamp: new Date(),
transactionInfo: {
stoppedReason: OCPP20ReasonEnumType.Remote,
OCPP20TransactionEventRequest
>(chargingStation, OCPP20RequestCommand.TRANSACTION_EVENT, transactionEventRequest)
+ resetConnectorStatus(connectorStatus)
await sendAndSetConnectorStatus(chargingStation, connectorId, ConnectorStatusEnum.Available)
return OCPP20Constants.OCPP_RESPONSE_ACCEPTED
transactionId?: number | string
transactionIdTag?: string
transactionRemoteStarted?: boolean
+ transactionSeqNo?: number
transactionSetInterval?: NodeJS.Timeout
transactionStart?: Date
transactionStarted?: boolean
import type { OCPP16StandardParametersKey, OCPP16VendorParametersKey } from './Configuration.js'
import type { OCPP16DiagnosticsStatus } from './DiagnosticsStatus.js'
-export enum OCPP16AvailabilityType {
+export const enum OCPP16AvailabilityType {
Inoperative = 'Inoperative',
Operative = 'Operative',
}
-export enum OCPP16FirmwareStatus {
+export const enum OCPP16FirmwareStatus {
Downloaded = 'Downloaded',
DownloadFailed = 'DownloadFailed',
Downloading = 'Downloading',
Installing = 'Installing',
}
-export enum OCPP16IncomingRequestCommand {
+export const enum OCPP16IncomingRequestCommand {
CANCEL_RESERVATION = 'CancelReservation',
CHANGE_AVAILABILITY = 'ChangeAvailability',
CHANGE_CONFIGURATION = 'ChangeConfiguration',
StatusNotification = 'StatusNotification',
}
-export enum OCPP16RequestCommand {
+export const enum OCPP16RequestCommand {
AUTHORIZE = 'Authorize',
BOOT_NOTIFICATION = 'BootNotification',
DATA_TRANSFER = 'DataTransfer',
STOP_TRANSACTION = 'StopTransaction',
}
-enum ResetType {
+export const enum ResetType {
HARD = 'Hard',
SOFT = 'Soft',
}
import type { OCPPConfigurationKey } from '../Configuration.js'
import type { OCPP16ChargingSchedule } from './ChargingProfile.js'
-export enum OCPP16AvailabilityStatus {
+export const enum OCPP16AvailabilityStatus {
ACCEPTED = 'Accepted',
REJECTED = 'Rejected',
SCHEDULED = 'Scheduled',
}
-export enum OCPP16ChargingProfileStatus {
+export const enum OCPP16ChargingProfileStatus {
ACCEPTED = 'Accepted',
NOT_SUPPORTED = 'NotSupported',
REJECTED = 'Rejected',
UNKNOWN = 'Unknown',
}
-export enum OCPP16ConfigurationStatus {
+export const enum OCPP16ConfigurationStatus {
ACCEPTED = 'Accepted',
NOT_SUPPORTED = 'NotSupported',
REBOOT_REQUIRED = 'RebootRequired',
REJECTED = 'Rejected',
}
-export enum OCPP16DataTransferStatus {
+export const enum OCPP16DataTransferStatus {
ACCEPTED = 'Accepted',
REJECTED = 'Rejected',
UNKNOWN_MESSAGE_ID = 'UnknownMessageId',
REJECTED = 'Rejected',
}
-export enum OCPP16UnlockStatus {
+export const enum OCPP16UnlockStatus {
NOT_SUPPORTED = 'NotSupported',
UNLOCK_FAILED = 'UnlockFailed',
UNLOCKED = 'Unlocked',
ReportDataType,
} from './Variables.js'
-export enum OCPP20IncomingRequestCommand {
+export const enum OCPP20IncomingRequestCommand {
CLEAR_CACHE = 'ClearCache',
GET_BASE_REPORT = 'GetBaseReport',
GET_VARIABLES = 'GetVariables',
SET_VARIABLES = 'SetVariables',
}
-export enum OCPP20RequestCommand {
+export const enum OCPP20RequestCommand {
BOOT_NOTIFICATION = 'BootNotification',
HEARTBEAT = 'Heartbeat',
NOTIFY_REPORT = 'NotifyReport',
import type { JsonObject } from '../JsonType.js'
-export enum GenericStatus {
+export const enum GenericStatus {
Accepted = 'Accepted',
Rejected = 'Rejected',
}
-export enum ErrorType {
+export const enum ErrorType {
// Payload for Action is syntactically incorrect or not conform the PDU structure for Action
FORMAT_VIOLATION = 'FormatViolation',
/** @deprecated use FORMAT_VIOLATION instead */
/* eslint-disable perfectionist/sort-enums */
-export enum MessageType {
+export const enum MessageType {
CALL_MESSAGE = 2, // Caller to Callee
CALL_RESULT_MESSAGE = 3, // Callee to Caller
CALL_ERROR_MESSAGE = 4, // Callee to Caller
-export enum OCPPVersion {
+export const enum OCPPVersion {
VERSION_16 = '1.6',
VERSION_20 = '2.0',
VERSION_201 = '2.0.1',