@@ -3,49 +3,60 @@ package component
33import "github.com/ChargePi/ocpp-manager/ocpp_v201/variables"
44
55type Component interface {
6- // Essentially a component type.
7- GetName () ComponentName
8- // Instance ID where a component can be addressed
6+
7+ // GetName Essentially a component type.
8+ GetName () Name
9+
10+ // GetInstanceId returns the unique instance ID of this component.
911 GetInstanceId () string
12+
1013 // RegisterSubComponent registers a sub-component to this component.
1114 RegisterSubComponent (component Component )
15+
1216 // UnregisterSubComponent unregisters a sub-component from this component.
1317 UnregisterSubComponent (component Component )
18+
1419 // GetSubComponents returns all sub-components of this component.
1520 GetSubComponents () []Component
1621
17- // Required variables for this component
18- GetRequiredVariables () []variables.Variable
19- // Suported variables for this component
20- GetSupportedVariables () []variables.Variable
22+ // GetRequiredVariables returns required variables for this component
23+ GetRequiredVariables () []variables.VariableName
24+
25+ // GetSupportedVariables returns supported variables (both required and optional) for this component
26+ GetSupportedVariables () []variables.VariableName
2127
28+ // GetVariable retrieves a variable by its name.
2229 GetVariable (key variables.VariableName , opts ... GetSetVariableOption ) (* variables.Variable , error )
30+
31+ // UpdateVariable updates a variable's attribute with a new value.
2332 UpdateVariable (variable variables.VariableName , attribute string , value interface {}, opts ... GetSetVariableOption ) error
33+
34+ // Validate checks if the variable is valid for this component.
2435 Validate (key variables.VariableName ) bool
2536}
2637
27- type ComponentName string
38+ type Name string
2839
2940const (
30- ComponentNameOCPPCommCtrlr ComponentName = "OCPPCommCtrlr"
31- ComponentNameLocalAuthListCtrlr ComponentName = "LocalAuthListCtrlr"
32- ComponentNameTxCtrlr ComponentName = "TxCtrlr"
33- ComponentNameDeviceDataCtrlr ComponentName = "DeviceDataCtrlr"
34- ComponentNameSecurityCtrlr ComponentName = "SecurityCtrlr"
35- ComponentNameClockCtrlr ComponentName = "ClockCtrlr"
36- ComponentNameCustomizationCtrlr ComponentName = "CustomizationCtrlr"
37- ComponentNameSampledDataCtrlr ComponentName = "SampledDataCtrlr"
38- ComponentNameAlignedDataCtrlr ComponentName = "AlignedDataCtrlr"
39- ComponentNameReservationCtrlr ComponentName = "ReservationCtrlr"
40- ComponentNameSmartChargingCtrlr ComponentName = "SmartChargingCtrlr"
41- ComponentNameTariffCostCtrlr ComponentName = "TariffCostCtrlr"
42- ComponentNameMonitoringCtrlr ComponentName = "MonitoringCtrlr"
43- ComponentNameDisplayMessageCtrlr ComponentName = "DisplayMessageCtrlr"
44- ComponentNameISO15118Ctrlr ComponentName = "ISO15118Ctrlr"
45- ComponentNameAuthCtrlr ComponentName = "AuthCtrlr"
46- ComponentNameAuthCacheCtrlr ComponentName = "AuthCacheCtrlr"
47- ComponentNameChargingStation ComponentName = "ChargingStation"
48- ComponentNameEVSE ComponentName = "EVSE"
49- ComponentNameConnector ComponentName = "Connector"
50- ComponentNameConnectedEV ComponentName = "ConnectedEV"
41+ ComponentNameOCPPCommCtrlr Name = "OCPPCommCtrlr"
42+ ComponentNameLocalAuthListCtrlr Name = "LocalAuthListCtrlr"
43+ ComponentNameTxCtrlr Name = "TxCtrlr"
44+ ComponentNameDeviceDataCtrlr Name = "DeviceDataCtrlr"
45+ ComponentNameSecurityCtrlr Name = "SecurityCtrlr"
46+ ComponentNameClockCtrlr Name = "ClockCtrlr"
47+ ComponentNameCustomizationCtrlr Name = "CustomizationCtrlr"
48+ ComponentNameSampledDataCtrlr Name = "SampledDataCtrlr"
49+ ComponentNameAlignedDataCtrlr Name = "AlignedDataCtrlr"
50+ ComponentNameReservationCtrlr Name = "ReservationCtrlr"
51+ ComponentNameSmartChargingCtrlr Name = "SmartChargingCtrlr"
52+ ComponentNameTariffCostCtrlr Name = "TariffCostCtrlr"
53+ ComponentNameMonitoringCtrlr Name = "MonitoringCtrlr"
54+ ComponentNameDisplayMessageCtrlr Name = "DisplayMessageCtrlr"
55+ ComponentNameISO15118Ctrlr Name = "ISO15118Ctrlr"
56+ ComponentNameAuthCtrlr Name = "AuthCtrlr"
57+ ComponentNameAuthCacheCtrlr Name = "AuthCacheCtrlr"
58+ ComponentNameChargingStation Name = "ChargingStation"
59+ ComponentNameEVSE Name = "EVSE"
60+ ComponentNameConnector Name = "Connector"
61+ ComponentNameConnectedEV Name = "ConnectedEV"
5162)
0 commit comments