@citrineos/base
Version:
The base module for OCPP v2.0.1 including all interfaces. This module is not intended to be used directly, but rather as a dependency for other modules.
29 lines (28 loc) • 1.8 kB
TypeScript
import type { SystemConfig } from '../../config/types.js';
import type { ICache } from '../cache/cache.js';
import type { HandlerProperties } from '../messages/internal-types.js';
import { MessageOrigin } from '../messages/internal-types.js';
import type { IMessage } from '../messages/Message.js';
import type { IMessageConfirmation } from '../messages/MessageConfirmation.js';
import type { IMessageHandler } from '../messages/MessageHandler.js';
import type { IMessageSender } from '../messages/MessageSender.js';
import type { OCPPValidator } from '../modules/OCPPValidator.js';
import type { OcppRequest, OcppResponse } from '../../ocpp/internal-types.js';
import type { CallAction, OCPPVersionType } from '../../ocpp/rpc/message.js';
import { OcppError } from '../../ocpp/rpc/message.js';
/**
* Base interface for all OCPP modules.
*
*/
export interface IModule {
config: SystemConfig;
ocppValidator: OCPPValidator;
cache: ICache;
sender: IMessageSender;
handler: IMessageHandler;
sendCall(ocppConnectionName: string, tenantId: number, protocol: OCPPVersionType, action: CallAction, payload: OcppRequest, callbackUrl?: string, correlationId?: string, origin?: MessageOrigin): Promise<IMessageConfirmation>;
sendCallResult(correlationId: string, ocppConnectionName: string, tenantId: number, protocol: OCPPVersionType, action: CallAction, payload: OcppResponse, origin?: MessageOrigin): Promise<IMessageConfirmation>;
sendCallError(correlationId: string, ocppConnectionName: string, tenantId: number, protocol: OCPPVersionType, action: CallAction, error: OcppError, origin?: MessageOrigin): Promise<IMessageConfirmation>;
handle(message: IMessage<OcppRequest | OcppResponse>, props?: HandlerProperties): Promise<void>;
shutdown(): Promise<void>;
}