import logger from '../utils/Logger';
import type ChargingStation from './ChargingStation';
+type ConfigurationKeyOptions = { readonly?: boolean; visible?: boolean; reboot?: boolean };
+type DeleteConfigurationKeyParams = { save?: boolean; caseInsensitive?: boolean };
+type AddConfigurationKeyParams = { overwrite?: boolean; save?: boolean };
+
export class ChargingStationConfigurationUtils {
private constructor() {
// This is intentional
chargingStation: ChargingStation,
key: string | StandardParametersKey,
value: string,
- options: { readonly?: boolean; visible?: boolean; reboot?: boolean } = {
+ options: ConfigurationKeyOptions = {
readonly: false,
visible: true,
reboot: false,
},
- params: { overwrite?: boolean; save?: boolean } = { overwrite: false, save: false }
+ params: AddConfigurationKeyParams = { overwrite: false, save: false }
): void {
- options = options ?? ({} as { readonly?: boolean; visible?: boolean; reboot?: boolean });
+ options = options ?? ({} as ConfigurationKeyOptions);
options.readonly = options?.readonly ?? false;
options.visible = options?.visible ?? true;
options.reboot = options?.reboot ?? false;
public static deleteConfigurationKey(
chargingStation: ChargingStation,
key: string | StandardParametersKey,
- params: { save?: boolean; caseInsensitive?: boolean } = { save: true, caseInsensitive: false }
+ params: DeleteConfigurationKeyParams = { save: true, caseInsensitive: false }
): ConfigurationKey[] {
const keyFound = ChargingStationConfigurationUtils.getConfigurationKey(
chargingStation,
): GetConfigurationResponse {
const configurationKey: OCPPConfigurationKey[] = [];
const unknownKey: string[] = [];
- if (Utils.isEmptyArray(commandPayload.key)) {
+ if (Utils.isEmptyArray(commandPayload.key) === true) {
for (const configuration of chargingStation.ocppConfiguration.configurationKey) {
- if (Utils.isUndefined(configuration.visible)) {
+ if (Utils.isUndefined(configuration.visible) === true) {
configuration.visible = true;
}
if (!configuration.visible) {
key
);
if (keyFound) {
- if (Utils.isUndefined(keyFound.visible)) {
+ if (Utils.isUndefined(keyFound.visible) === true) {
keyFound.visible = true;
}
- if (!keyFound.visible) {
+ if (keyFound.visible === false) {
continue;
}
configurationKey.push({