UNPKG

@citrineos/reporting

Version:

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

71 lines (70 loc) 5.38 kB
import { AbstractModule, CallAction, HandlerProperties, ICache, IMessage, IMessageHandler, IMessageSender, OCPP2_0_1, SystemConfig } from '@citrineos/base'; import { IDeviceModelRepository, ISecurityEventRepository, IVariableMonitoringRepository } from '@citrineos/data'; import { ILogObj, Logger } from 'tslog'; import { DeviceModelService } from './services'; /** * Component that handles provisioning related messages. */ export declare class ReportingModule extends AbstractModule { /** * Get Base Report variables. While NotifyReport requests correlated with a GetBaseReport's requestId * are still being sent, cache value is 'ongoing'. Once a NotifyReport with tbc === false (or undefined) * is received, cache value is 'complete'. */ static readonly GET_BASE_REPORT_REQUEST_ID_MAX = 10000000; static readonly GET_BASE_REPORT_ONGOING_CACHE_VALUE = "ongoing"; static readonly GET_BASE_REPORT_COMPLETE_CACHE_VALUE = "complete"; _deviceModelService: DeviceModelService; /** * Fields */ _requests: CallAction[]; _responses: CallAction[]; protected _deviceModelRepository: IDeviceModelRepository; protected _securityEventRepository: ISecurityEventRepository; protected _variableMonitoringRepository: IVariableMonitoringRepository; /** * Constructor */ /** * This is the constructor function that initializes the {@link ReportingModule}. * * @param {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 sub-component logging. If no `logger` is provided, a default {@link Logger<ILogObj>} 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 {ISecurityEventRepository} [securityEventRepository] - An optional parameter of type {@link ISecurityEventRepository} which represents a repository for accessing security event notification data. * * @param {IVariableMonitoringRepository} [variableMonitoringRepository] - An optional parameter of type {@link IVariableMonitoringRepository} which represents a repository for accessing and manipulating monitoring data. */ constructor(config: SystemConfig, cache: ICache, sender?: IMessageSender, handler?: IMessageHandler, logger?: Logger<ILogObj>, deviceModelRepository?: IDeviceModelRepository, securityEventRepository?: ISecurityEventRepository, variableMonitoringRepository?: IVariableMonitoringRepository); get deviceModelRepository(): IDeviceModelRepository; /** * Handle Requests */ protected _handleLogStatusNotification(message: IMessage<OCPP2_0_1.LogStatusNotificationRequest>, props?: HandlerProperties): Promise<void>; protected _handleNotifyCustomerInformation(message: IMessage<OCPP2_0_1.NotifyCustomerInformationRequest>, props?: HandlerProperties): Promise<void>; protected _handleNotifyMonitoringReport(message: IMessage<OCPP2_0_1.NotifyMonitoringReportRequest>, props?: HandlerProperties): Promise<void>; protected _handleNotifyReport(message: IMessage<OCPP2_0_1.NotifyReportRequest>, props?: HandlerProperties): Promise<void>; protected _handleSecurityEventNotification(message: IMessage<OCPP2_0_1.SecurityEventNotificationRequest>, props?: HandlerProperties): Promise<void>; /** * Handle responses */ protected _handleGetBaseReport(message: IMessage<OCPP2_0_1.GetBaseReportResponse>, props?: HandlerProperties): void; protected _handleGetReport(message: IMessage<OCPP2_0_1.GetReportResponse>, props?: HandlerProperties): void; protected _handleGetMonitoringReport(message: IMessage<OCPP2_0_1.GetMonitoringReportResponse>, props?: HandlerProperties): Promise<void>; protected _handleGetLog(message: IMessage<OCPP2_0_1.GetLogResponse>, props?: HandlerProperties): void; protected _handleCustomerInformation(message: IMessage<OCPP2_0_1.CustomerInformationResponse>, props?: HandlerProperties): void; }