UNPKG

@citrineos/configuration

Version:

The configuration module for OCPP v2.0.1. This module is not intended to be used directly, but rather as a dependency for other modules.

112 lines (111 loc) 9.46 kB
import type { BootstrapConfig, CallAction, HandlerProperties, ICache, IMessage, IMessageHandler, IMessageSender, SystemConfig } from '@citrineos/base'; import { AbstractModule, OCPP1_6, OCPP2_0_1, OCPPValidator } from '@citrineos/base'; import type { IBootRepository, IChangeConfigurationRepository, IDeviceModelRepository, ILocationRepository, IMessageInfoRepository, IOCPPMessageRepository, ITenantRepository } from '@citrineos/data'; import { IdGenerator } from '@citrineos/util'; import type { ILogObj } from 'tslog'; import { Logger } from 'tslog'; import { BootNotificationService } from './BootNotificationService.js'; import { DeviceModelService } from './DeviceModelService.js'; /** * Component that handles Configuration related messages. */ export declare class ConfigurationModule extends AbstractModule { _deviceModelService: DeviceModelService; _requests: CallAction[]; _responses: CallAction[]; protected _bootService: BootNotificationService; private _idGenerator; /** * This is the constructor function that initializes the {@link ConfigurationModule}. * * @param {BootstrapConfig & SystemConfig} config - The `config` contains configuration settings for the module. * * @param {ICache} [cache] - The cache instance which is shared among the modules & Central System to pass information such as blacklisted actions or boot status. * * @param {IMessageSender} [sender] - The `sender` parameter is an optional parameter that represents an instance of the {@link IMessageSender} interface. * It is used to send messages from the central system to external systems or devices. If no `sender` is provided, a default {@link RabbitMqSender} instance is created and used. * * @param {IMessageHandler} [handler] - The `handler` parameter is an optional parameter that represents an instance of the {@link IMessageHandler} interface. * It is used to handle incoming messages and dispatch them to the appropriate methods or functions. If no `handler` is provided, a default {@link RabbitMqReceiver} instance is created and used. * * @param {Logger<ILogObj>} [logger] - The `logger` parameter is an optional parameter that represents an instance of {@link Logger<ILogObj>}. * It is used to propagate system-wide logger settings and will serve as the parent logger for any subcomponent logging. If no `logger` is provided, a default {@link Logger<ILogObj>} instance is created and used. * * @param {IBootRepository} [bootRepository] - An optional parameter of type {@link IBootRepository} which represents a repository for accessing and manipulating authorization data. * If no `bootRepository` is provided, a default {@link SequelizeBootRepository} instance is created and used. * * @param {IDeviceModelRepository} [deviceModelRepository] - An optional parameter of type {@link IDeviceModelRepository} which represents a repository for accessing and manipulating variable data. * If no `deviceModelRepository` is provided, a default {@link sequelize:deviceModelRepository} instance is created and used. * * @param {IMessageInfoRepository} [messageInfoRepository] - An optional parameter of type {@link messageInfoRepository} which * represents a repository for accessing and manipulating message info data. If no `messageInfoRepository` is provided, a default * {@link SequelizeMessageInfoRepository} instance is created and used. * * @param {ILocationRepository} [locationRepository] - An optional parameter of type {@link locationRepository} which * represents a repository for accessing and manipulating location data. If no `locationRepository` is provided, a default * {@link SequelizeLocationRepository} instance is created and used. * * @param {IChangeConfigurationRepository} [changeConfigurationRepository] - An optional parameter of type {@link IChangeConfigurationRepository} which * represents a repository for accessing and manipulating change configuration data. If no `changeConfigurationRepository` is provided, a default * {@link SequelizeChangeConfigurationRepository} instance is created and used. * * @param {IOCPPMessageRepository} [ocppMessageRepository] - An optional parameter of type {@link IOCPPMessageRepository} which * represents a repository for accessing and manipulating call message data. If no `ocppMessageRepository` is provided, a default * {@link SequelizeOCPPMessageRepository} instance is created and used. * * @param {IdGenerator} [idGenerator] - An optional parameter of type {@link IdGenerator} which * represents a generator for ids. * *If no `deviceModelRepository` is provided, a default {@link sequelize:messageInfoRepository} instance is created and used. */ constructor(config: BootstrapConfig & SystemConfig, cache: ICache, sender: IMessageSender, handler: IMessageHandler, logger?: Logger<ILogObj>, ocppValidator?: OCPPValidator, bootRepository?: IBootRepository, deviceModelRepository?: IDeviceModelRepository, messageInfoRepository?: IMessageInfoRepository, locationRepository?: ILocationRepository, changeConfigurationRepository?: IChangeConfigurationRepository, ocppMessageRepository?: IOCPPMessageRepository, idGenerator?: IdGenerator, tenantRepository?: ITenantRepository); protected _tenantRepository: ITenantRepository; get tenantRepository(): ITenantRepository; protected _bootRepository: IBootRepository; get bootRepository(): IBootRepository; protected _deviceModelRepository: IDeviceModelRepository; get deviceModelRepository(): IDeviceModelRepository; protected _messageInfoRepository: IMessageInfoRepository; get messageInfoRepository(): IMessageInfoRepository; protected _locationRepository: ILocationRepository; get locationRepository(): ILocationRepository; protected _changeConfigurationRepository: IChangeConfigurationRepository; get changeConfigurationRepository(): IChangeConfigurationRepository; protected _ocppMessageRepository: IOCPPMessageRepository; get ocppMessageRepository(): IOCPPMessageRepository; /** * Handle OCPP 2.0.1 requests */ protected _handleBootNotification(message: IMessage<OCPP2_0_1.BootNotificationRequest>, props?: HandlerProperties): Promise<void>; protected _handleHeartbeat(message: IMessage<OCPP2_0_1.HeartbeatRequest>, props?: HandlerProperties): Promise<void>; protected _handleNotifyDisplayMessages(message: IMessage<OCPP2_0_1.NotifyDisplayMessagesRequest>, props?: HandlerProperties): Promise<void>; protected _handleFirmwareStatusNotification(message: IMessage<OCPP2_0_1.FirmwareStatusNotificationRequest>, props?: HandlerProperties): Promise<void>; /** * Handle OCPP 2.0.1 responses */ protected _handleChangeAvailability(message: IMessage<OCPP2_0_1.ChangeAvailabilityResponse>, props?: HandlerProperties): void; protected _handleSetNetworkProfile(message: IMessage<OCPP2_0_1.SetNetworkProfileResponse>, props?: HandlerProperties): Promise<void>; protected _handleGetDisplayMessages(message: IMessage<OCPP2_0_1.GetDisplayMessagesResponse>, props?: HandlerProperties): void; protected _handleSetDisplayMessage(message: IMessage<OCPP2_0_1.SetDisplayMessageResponse>, props?: HandlerProperties): Promise<void>; protected _handlePublishFirmware(message: IMessage<OCPP2_0_1.PublishFirmwareResponse>, props?: HandlerProperties): void; protected _handleUnpublishFirmware(message: IMessage<OCPP2_0_1.UnpublishFirmwareResponse>, props?: HandlerProperties): void; protected _handleUpdateFirmware(message: IMessage<OCPP2_0_1.UpdateFirmwareResponse>, props?: HandlerProperties): void; protected _handleReset(message: IMessage<OCPP2_0_1.ResetResponse>, props?: HandlerProperties): void; protected _handleTriggerMessage(message: IMessage<OCPP2_0_1.TriggerMessageResponse>, props?: HandlerProperties): void; protected _handleClearDisplayMessage(message: IMessage<OCPP2_0_1.ClearDisplayMessageResponse>, props?: HandlerProperties): Promise<void>; protected _handleDataTransfer(message: IMessage<OCPP2_0_1.DataTransferRequest | OCPP2_0_1.DataTransferResponse>, props?: HandlerProperties): Promise<void>; /** * Handle OCPP 1.6 requests */ protected _handle16Heartbeat(message: IMessage<OCPP1_6.HeartbeatRequest>, props?: HandlerProperties): Promise<void>; protected _handleOcpp16BootNotification(message: IMessage<OCPP1_6.BootNotificationRequest>, props?: HandlerProperties): Promise<void>; /** * Handle OCPP 1.6 response */ protected _handleOcpp16GetConfiguration(message: IMessage<OCPP1_6.GetConfigurationResponse>, props?: HandlerProperties): Promise<void>; protected _handleOcpp16ChangeConfiguration(message: IMessage<OCPP1_6.ChangeConfigurationResponse>, props?: HandlerProperties): Promise<void>; protected _handleOcpp16TriggerMessage(message: IMessage<OCPP1_6.TriggerMessageResponse>, props?: HandlerProperties): void; protected _handle16Reset(message: IMessage<OCPP1_6.ResetResponse>, props?: HandlerProperties): void; protected _handleOcpp16ChangeAvailability(message: IMessage<OCPP1_6.ChangeAvailabilityResponse>, props?: HandlerProperties): void; protected _handleOcpp16DataTransfer(message: IMessage<OCPP1_6.DataTransferRequest | OCPP1_6.DataTransferResponse>, props?: HandlerProperties): Promise<void>; }