@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.
19 lines (18 loc) • 1.2 kB
TypeScript
import { ICache, OcppError, OcppRequest, OcppResponse, SystemConfig } from '../..';
import { CallAction, OCPPVersionType } from '../../ocpp/rpc/message';
import { HandlerProperties, IMessage, IMessageConfirmation, IMessageHandler, IMessageSender, MessageOrigin } from '../messages';
/**
* Base interface for all OCPP modules.
*
*/
export interface IModule {
config: SystemConfig;
cache: ICache;
sender: IMessageSender;
handler: IMessageHandler;
sendCall(identifier: string, tenantId: string, protocol: OCPPVersionType, action: CallAction, payload: OcppRequest, correlationId?: string, origin?: MessageOrigin): Promise<IMessageConfirmation>;
sendCallResult(correlationId: string, identifier: string, tenantId: string, protocol: OCPPVersionType, action: CallAction, payload: OcppResponse, origin?: MessageOrigin): Promise<IMessageConfirmation>;
sendCallError(correlationId: string, identifier: string, tenantId: string, protocol: OCPPVersionType, action: CallAction, error: OcppError, origin?: MessageOrigin): Promise<IMessageConfirmation>;
handle(message: IMessage<OcppRequest | OcppResponse>, props?: HandlerProperties): Promise<void>;
shutdown(): Promise<void>;
}