+import type { JsonObject } from './JsonType.js'
+
export enum IdTagDistribution {
RANDOM = 'random',
ROUND_ROBIN = 'round-robin',
CONNECTOR_AFFINITY = 'connector-affinity'
}
-export interface AutomaticTransactionGeneratorConfiguration {
+export interface AutomaticTransactionGeneratorConfiguration extends JsonObject {
enable: boolean
minDuration: number
maxDuration: number
+import type { JsonObject } from './JsonType.js'
import type { OCPPConfigurationKey } from './ocpp/Configuration.js'
-export type ConfigurationKey = OCPPConfigurationKey & {
+export interface ConfigurationKey extends OCPPConfigurationKey {
visible?: boolean
reboot?: boolean
}
-export interface ChargingStationOcppConfiguration {
+export interface ChargingStationOcppConfiguration extends JsonObject {
configurationKey?: ConfigurationKey[]
}
import type { ChargingStationOcppConfiguration } from './ChargingStationOcppConfiguration.js'
import type { ConnectorStatus } from './ConnectorStatus.js'
import type { EvseTemplate } from './Evse.js'
+import type { JsonObject } from './JsonType.js'
import type { OCPPProtocol } from './ocpp/OCPPProtocol.js'
import type { OCPPVersion } from './ocpp/OCPPVersion.js'
import type {
export type WsOptions = ClientOptions & ClientRequestArgs
-export interface FirmwareUpgrade {
+export interface FirmwareUpgrade extends JsonObject {
versionUpgrade?: {
patternGroup?: number
step?: number
failureStatus?: FirmwareStatus
}
-interface CommandsSupport {
+interface CommandsSupport extends JsonObject {
incomingCommands: Record<IncomingRequestCommand, boolean>
outgoingCommands?: Record<RequestCommand, boolean>
}
import type { SampledValue } from './ocpp/MeterValues.js'
-export type SampledValueTemplate = SampledValue & {
+export interface SampledValueTemplate extends SampledValue {
fluctuationPercent?: number
minimumValue?: number
}
stdDevTimeMeasurement: number
}>
-export type Statistics = {
+export interface Statistics extends WorkerData {
id: string
name: string
uri: string
createdAt: Date
updatedAt?: Date
statisticsData: Map<string | RequestCommand | IncomingRequestCommand, StatisticsData>
-} & WorkerData
+}
export interface InternalTemplateStatistics {
configured: number
Installed = 'Installed'
}
-export type OCPP16FirmwareStatusNotificationRequest = {
+export interface OCPP16FirmwareStatusNotificationRequest extends JsonObject {
status: OCPP16FirmwareStatus
-} & JsonObject
+}
export interface GetDiagnosticsRequest extends JsonObject {
location: string
export type CertificateSignedStatusEnumType = GenericStatusEnumType
-export type CertificateHashDataType = {
+export interface CertificateHashDataType extends JsonObject {
hashAlgorithm: HashAlgorithmEnumType
issuerNameHash: string
issuerKeyHash: string
serialNumber: string
-} & JsonObject
+}
-export type CertificateHashDataChainType = {
+export interface CertificateHashDataChainType extends JsonObject {
certificateType: GetCertificateIdUseEnumType
certificateHashData: CertificateHashDataType
childCertificateHashData?: CertificateHashDataType
-} & JsonObject
+}
-export type OCSPRequestDataType = {
+export interface OCSPRequestDataType extends JsonObject {
hashAlgorithm: HashAlgorithmEnumType
issuerNameHash: string
issuerKeyHash: string
serialNumber: string
responderURL: string
-} & JsonObject
+}
-export type StatusInfoType = {
+export interface StatusInfoType extends JsonObject {
reasonCode: string
additionalInfo?: string
-} & JsonObject
+}
-export type EVSEType = {
+export interface EVSEType extends JsonObject {
id: number
connectorId?: string
-} & JsonObject
+}
REQUEST_STOP_TRANSACTION = 'RequestStopTransaction'
}
-type ModemType = {
+interface ModemType extends JsonObject {
iccid?: string
imsi?: string
-} & JsonObject
+}
-type ChargingStationType = {
+interface ChargingStationType extends JsonObject {
serialNumber?: string
model: string
vendorName: string
firmwareVersion?: string
modem?: ModemType
-} & JsonObject
+}
-export type OCPP20BootNotificationRequest = {
+export interface OCPP20BootNotificationRequest extends JsonObject {
reason: BootReasonEnumType
chargingStation: ChargingStationType
-} & JsonObject
+}
export type OCPP20HeartbeatRequest = EmptyObject
export type OCPP20ClearCacheRequest = EmptyObject
-export type OCPP20StatusNotificationRequest = {
+export interface OCPP20StatusNotificationRequest extends JsonObject {
timestamp: Date
connectorStatus: OCPP20ConnectorStatusEnumType
evseId: number
connectorId: number
-} & JsonObject
+}
-export type OCPP20SetVariablesRequest = {
+export interface OCPP20SetVariablesRequest extends JsonObject {
setVariableData: OCPP20SetVariableDataType[]
-} & JsonObject
+}
-export type OCPP20InstallCertificateRequest = {
+export interface OCPP20InstallCertificateRequest extends JsonObject {
certificateType: InstallCertificateUseEnumType
certificate: string
-} & JsonObject
+}
import type { JsonObject } from '../../JsonType.js'
import type { RegistrationStatusEnumType } from '../Common.js'
-export type OCPP20BootNotificationResponse = {
+export interface OCPP20BootNotificationResponse extends JsonObject {
currentTime: Date
status: RegistrationStatusEnumType
interval: number
statusInfo?: StatusInfoType
-} & JsonObject
+}
-export type OCPP20HeartbeatResponse = {
+export interface OCPP20HeartbeatResponse extends JsonObject {
currentTime: Date
-} & JsonObject
+}
-export type OCPP20ClearCacheResponse = {
+export interface OCPP20ClearCacheResponse extends JsonObject {
status: GenericStatusEnumType
statusInfo?: StatusInfoType
-} & JsonObject
+}
export type OCPP20StatusNotificationResponse = EmptyObject
-export type OCPP20SetVariablesResponse = {
+export interface OCPP20SetVariablesResponse extends JsonObject {
setVariableResult: OCPP20SetVariableResultType[]
-} & JsonObject
+}
-export type OCPP20InstallCertificateResponse = {
+export interface OCPP20InstallCertificateResponse extends JsonObject {
status: InstallCertificateStatusEnumType
statusInfo?: StatusInfoType
-} & JsonObject
+}
MaxSet = 'MaxSet'
}
-type ComponentType = {
+interface ComponentType extends JsonObject {
name: string | OCPP20ComponentName
instance?: string
evse?: EVSEType
-} & JsonObject
+}
type VariableName =
| string
| OCPP20OptionalVariableName
| OCPP20VendorVariableName
-type VariableType = {
+interface VariableType extends JsonObject {
name: VariableName
instance?: string
-} & JsonObject
+}
-export type OCPP20SetVariableDataType = {
+export interface OCPP20SetVariableDataType extends JsonObject {
attributeType?: AttributeEnumType
attributeValue: string
component: ComponentType
variable: VariableType
-} & JsonObject
+}
enum SetVariableStatusEnumType {
Accepted = 'Accepted',
RebootRequired = 'RebootRequired'
}
-export type OCPP20SetVariableResultType = {
+export interface OCPP20SetVariableResultType extends JsonObject {
attributeType?: AttributeEnumType
attributeStatus: SetVariableStatusEnumType
component: ComponentType
variable: VariableType
attributeStatusInfo?: StatusInfoType
-} & JsonObject
+}
-export type OCPP20ComponentVariableType = {
+export interface OCPP20ComponentVariableType extends JsonObject {
component: ComponentType
variable?: VariableType
-} & JsonObject
+}
export type ConfigurationKeyType = string | StandardParametersKey | VendorParametersKey
-export type OCPPConfigurationKey = {
+export interface OCPPConfigurationKey extends JsonObject {
key: ConfigurationKeyType
readonly: boolean
value?: string
-} & JsonObject
+}
enableStatistics: false
})
-watch(getCurrentInstance()?.appContext.config.globalProperties.$templates, () => {
+watch(getCurrentInstance()!.appContext.config.globalProperties.$templates, () => {
state.value.renderTemplates = randomUUID()
})
</script>
import { type App as AppType, createApp, ref } from 'vue'
import ToastPlugin from 'vue-toast-notification'
-import type { ChargingStationData, ConfigurationData } from '@/types'
+import type { ChargingStationData, ConfigurationData, UIServerConfigurationSection } from '@/types'
import { router } from '@/router'
import { UIClient, getFromLocalStorage, setToLocalStorage } from '@/composables'
import App from '@/App.vue'
if (
getFromLocalStorage<number | undefined>('uiServerConfigurationIndex', undefined) == null ||
getFromLocalStorage<number>('uiServerConfigurationIndex', 0) >
- app.config.globalProperties.$configuration.value.uiServer.length - 1
+ (app.config.globalProperties.$configuration.value.uiServer as UIServerConfigurationSection[])
+ .length -
+ 1
) {
setToLocalStorage<number>('uiServerConfigurationIndex', 0)
}
if (app.config.globalProperties.$uiClient == null) {
app.config.globalProperties.$uiClient = UIClient.getInstance(
- app.config.globalProperties.$configuration.value.uiServer[
+ (app.config.globalProperties.$configuration.value.uiServer as UIServerConfigurationSection[])[
getFromLocalStorage<number>('uiServerConfigurationIndex', 0)
]
)
RouterView: (typeof import('vue-router'))['RouterView']
}
interface ComponentCustomProperties {
- $configuration: Ref<import('@/types').ConfigurationData>
- $templates: Ref<string[]>
- $chargingStations: Ref<import('@/types').ChargingStationData[]>
+ $configuration: import('vue').Ref<import('@/types').ConfigurationData>
+ $templates: import('vue').Ref<string[]>
+ $chargingStations: import('vue').Ref<import('@/types').ChargingStationData[]>
$uiClient: import('@/composables').UIClient
}
}
CONNECTOR_AFFINITY = 'connector-affinity'
}
-export interface AutomaticTransactionGeneratorConfiguration {
+export interface AutomaticTransactionGeneratorConfiguration extends JsonObject {
enable: boolean
minDuration: number
maxDuration: number
idTagDistribution?: IdTagDistribution
}
-export interface ChargingStationAutomaticTransactionGeneratorConfiguration {
+export interface ChargingStationAutomaticTransactionGeneratorConfiguration extends JsonObject {
automaticTransactionGenerator?: AutomaticTransactionGeneratorConfiguration
automaticTransactionGeneratorStatuses?: Status[]
}
-export type ChargingStationData = {
+export interface ChargingStationData extends JsonObject {
started: boolean
stationInfo: ChargingStationInfo
connectors: ConnectorStatus[]
Installed = 'Installed'
}
-export interface FirmwareUpgrade {
+export interface FirmwareUpgrade extends JsonObject {
versionUpgrade?: {
patternGroup?: number
step?: number
stopTransactionsOnStopped?: boolean
}
-export type ChargingStationInfo = {
+export interface ChargingStationInfo extends JsonObject {
hashId: string
templateIndex: number
templateName: string
messageTriggerSupport?: Record<MessageTrigger, boolean>
}
-export interface ChargingStationOcppConfiguration {
+export interface ChargingStationOcppConfiguration extends JsonObject {
configurationKey?: ConfigurationKey[]
}
-export type ConfigurationKey = OCPPConfigurationKey & {
+export interface ConfigurationKey extends OCPPConfigurationKey {
visible?: boolean
reboot?: boolean
}
-export type OCPPConfigurationKey = {
+export interface OCPPConfigurationKey extends JsonObject {
key: string
readonly: boolean
value?: string
-} & JsonObject
+}
export enum OCPP16IncomingRequestCommand {
RESET = 'Reset',
} as const
export type MessageTrigger = OCPP16MessageTrigger
-type CommandsSupport = {
+interface CommandsSupport extends JsonObject {
incomingCommands: Record<IncomingRequestCommand, boolean>
outgoingCommands?: Record<RequestCommand, boolean>
}
AMPERE = 'A'
}
-export type ConnectorStatus = {
+export interface ConnectorStatus extends JsonObject {
availability: AvailabilityType
bootStatus?: ChargePointStatus
status?: ChargePointStatus
transactionEnergyActiveImportRegisterValue?: number // In Wh
}
-export type EvseStatus = {
+export interface EvseStatus extends JsonObject {
availability: AvailabilityType
connectors?: ConnectorStatus[]
}
}
export type ChargePointStatus = OCPP16ChargePointStatus
-export type Status = {
+export interface Status extends JsonObject {
start?: boolean
startDate?: Date
lastRunDate?: Date
import type { AuthenticationType, Protocol, ProtocolVersion } from './UIProtocol'
-export type ConfigurationData = {
+export interface ConfigurationData {
uiServer: UIServerConfigurationSection | UIServerConfigurationSection[]
}
-export type UIServerConfigurationSection = {
+export interface UIServerConfigurationSection {
name?: string
host: string
port: number
if (
getFromLocalStorage<number>('uiServerConfigurationIndex', 0) !== state.uiServerIndex
) {
- $uiClient.setConfiguration($configuration.value.uiServer[state.uiServerIndex])
+ $uiClient.setConfiguration(
+ ($configuration.value.uiServer as UIServerConfigurationSection[])[
+ state.uiServerIndex
+ ]
+ )
registerWSEventListeners()
$uiClient.registerWSEventListener(
'open',
0
)
$uiClient.setConfiguration(
- $configuration.value.uiServer[
+ ($configuration.value.uiServer as UIServerConfigurationSection[])[
getFromLocalStorage<number>('uiServerConfigurationIndex', 0)
]
)
import { computed, getCurrentInstance, onMounted, onUnmounted, ref, watch } from 'vue'
import { useToast } from 'vue-toast-notification'
import CSTable from '@/components/charging-stations/CSTable.vue'
-import type { ResponsePayload, SimulatorState, UIServerConfigurationSection } from '@/types'
+import type {
+ ChargingStationData,
+ ResponsePayload,
+ SimulatorState,
+ UIServerConfigurationSection
+} from '@/types'
import Container from '@/components/Container.vue'
import ReloadButton from '@/components/buttons/ReloadButton.vue'
import {
const app = getCurrentInstance()
-watch(app?.appContext.config.globalProperties.$chargingStations, () => {
+watch(app!.appContext.config.globalProperties.$chargingStations, () => {
state.value.renderChargingStations = randomUUID()
})
.listTemplates()
.then((response: ResponsePayload) => {
if (app != null) {
- app.appContext.config.globalProperties.$templates.value = response.templates
+ app.appContext.config.globalProperties.$templates.value = response.templates as string[]
}
})
.catch((error: Error) => {
.listChargingStations()
.then((response: ResponsePayload) => {
if (app != null) {
- app.appContext.config.globalProperties.$chargingStations.value = response.chargingStations
+ app.appContext.config.globalProperties.$chargingStations.value =
+ response.chargingStations as ChargingStationData[]
}
})
.catch((error: Error) => {
unregisterWSEventListeners()
})
-const uiServerConfigurations: { index: number; configuration: UIServerConfigurationSection }[] =
- app?.appContext.config.globalProperties.$configuration.value.uiServer.map(
- (configuration: UIServerConfigurationSection, index: number) => ({
- index,
- configuration
- })
- )
+const uiServerConfigurations: { index: number; configuration: UIServerConfigurationSection }[] = (
+ app?.appContext.config.globalProperties.$configuration.value
+ .uiServer as UIServerConfigurationSection[]
+).map((configuration: UIServerConfigurationSection, index: number) => ({
+ index,
+ configuration
+}))
const startSimulator = (): void => {
uiClient