import type ChargingStation from './ChargingStation';
import Constants from '../utils/Constants';
import PerformanceStatistics from '../performance/PerformanceStatistics';
+import { RequestCommand } from '../types/ocpp/Requests';
import { Status } from '../types/AutomaticTransactionGenerator';
import Utils from '../utils/Utils';
import logger from '../utils/Logger';
if (this.chargingStation.hasAuthorizedTags()) {
const idTag = this.chargingStation.getRandomIdTag();
if (this.chargingStation.getAutomaticTransactionGeneratorRequireAuthorize()) {
+ this.chargingStation.getConnectorStatus(connectorId).authorizeIdTag = idTag;
// Authorize idTag
- const authorizeResponse = await this.chargingStation.ocppRequestService.sendAuthorize(
- connectorId,
- idTag
- );
+ const authorizeResponse: AuthorizeResponse =
+ (await this.chargingStation.ocppRequestService.sendMessageHandler(
+ RequestCommand.AUTHORIZE,
+ {
+ idTag,
+ }
+ )) as AuthorizeResponse;
this.connectorsStatus.get(connectorId).authorizeRequests++;
if (authorizeResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) {
this.connectorsStatus.get(connectorId).acceptedAuthorizeRequests++;
import { Client, FTPResponse } from 'basic-ftp';
import {
OCPP16AuthorizationStatus,
+ OCPP16AuthorizeResponse,
OCPP16StopTransactionReason,
} from '../../../types/ocpp/1.6/Transaction';
true;
authorized = true;
} else if (this.chargingStation.getMayAuthorizeAtRemoteStart()) {
- const authorizeResponse = await this.chargingStation.ocppRequestService.sendAuthorize(
- transactionConnectorId,
- commandPayload.idTag
- );
+ this.chargingStation.getConnectorStatus(transactionConnectorId).authorizeIdTag =
+ commandPayload.idTag;
+ const authorizeResponse: OCPP16AuthorizeResponse =
+ (await this.chargingStation.ocppRequestService.sendMessageHandler(
+ OCPP16RequestCommand.AUTHORIZE,
+ {
+ idTag: commandPayload.idTag,
+ }
+ )) as OCPP16AuthorizeResponse;
if (authorizeResponse?.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) {
authorized = true;
}
import {
AuthorizeRequest,
- OCPP16AuthorizeResponse,
OCPP16StartTransactionResponse,
OCPP16StopTransactionReason,
OCPP16StopTransactionResponse,
import Constants from '../../../utils/Constants';
import { ErrorType } from '../../../types/ocpp/ErrorType';
import { JsonType } from '../../../types/JsonType';
-import { OCPP16ChargePointErrorCode } from '../../../types/ocpp/1.6/ChargePointErrorCode';
-import { OCPP16ChargePointStatus } from '../../../types/ocpp/1.6/ChargePointStatus';
import { OCPP16DiagnosticsStatus } from '../../../types/ocpp/1.6/DiagnosticsStatus';
import { OCPP16ServiceUtils } from './OCPP16ServiceUtils';
import OCPPError from '../../../exception/OCPPError';
);
}
- public async sendAuthorize(
- connectorId: number,
- idTag?: string
- ): Promise<OCPP16AuthorizeResponse> {
- const payload: AuthorizeRequest = {
- ...(!Utils.isUndefined(idTag) ? { idTag } : { idTag: Constants.DEFAULT_IDTAG }),
- };
- this.chargingStation.getConnectorStatus(connectorId).authorizeIdTag = idTag;
- return (await this.sendMessage(
- Utils.generateUUID(),
- payload,
- OCPP16RequestCommand.AUTHORIZE
- )) as OCPP16AuthorizeResponse;
- }
-
public async sendStartTransaction(
connectorId: number,
idTag?: string
-import {
- AuthorizeResponse,
- StartTransactionResponse,
- StopTransactionReason,
- StopTransactionResponse,
-} from '../../types/ocpp/Transaction';
import {
DiagnosticsStatus,
IncomingRequestCommand,
ResponseType,
SendParams,
} from '../../types/ocpp/Requests';
+import {
+ StartTransactionResponse,
+ StopTransactionReason,
+ StopTransactionResponse,
+} from '../../types/ocpp/Transaction';
-import { BootNotificationResponse } from '../../types/ocpp/Responses';
-import { ChargePointErrorCode } from '../../types/ocpp/ChargePointErrorCode';
-import { ChargePointStatus } from '../../types/ocpp/ChargePointStatus';
import type ChargingStation from '../ChargingStation';
import Constants from '../../utils/Constants';
import { EmptyObject } from '../../types/EmptyObject';
params?: SendParams
): Promise<ResponseType>;
- public abstract sendAuthorize(connectorId: number, idTag?: string): Promise<AuthorizeResponse>;
public abstract sendStartTransaction(
connectorId: number,
idTag?: string