|
| 1 | +package api |
| 2 | + |
| 3 | +import ( |
| 4 | + "time" |
| 5 | + |
| 6 | + "github.com/enbility/spine-go/api" |
| 7 | + "github.com/enbility/spine-go/model" |
| 8 | +) |
| 9 | + |
| 10 | +// Feature client interface were the local feature role is client and the remote feature role is server |
| 11 | +type FeatureClientInterface interface { |
| 12 | + // check if there is a subscription to the remote feature |
| 13 | + HasSubscription() bool |
| 14 | + |
| 15 | + // subscribe to the feature of the entity |
| 16 | + Subscribe() (*model.MsgCounterType, error) |
| 17 | + |
| 18 | + // check if there is a binding to the remote feature |
| 19 | + HasBinding() bool |
| 20 | + |
| 21 | + // bind to the feature of the entity |
| 22 | + Bind() (*model.MsgCounterType, error) |
| 23 | + |
| 24 | + // add a callback function to be invoked once a result or reply message for a msgCounter came in |
| 25 | + AddResponseCallback(msgCounterReference model.MsgCounterType, function func(msg api.ResponseMessage)) error |
| 26 | + |
| 27 | + // add a callback function to be invoked once a result came in |
| 28 | + AddResultCallback(function func(msg api.ResponseMessage)) |
| 29 | +} |
| 30 | + |
| 31 | +// Feature server interface were the local feature role is a server |
| 32 | +type FeatureServerInterface interface { |
| 33 | +} |
| 34 | + |
| 35 | +// Common interface for DeviceClassificationClientInterface and DeviceClassificationServerInterface |
| 36 | +type DeviceClassificationCommonInterface interface { |
| 37 | + // get the current manufacturer details for a remote device entity |
| 38 | + GetManufacturerDetails() (*model.DeviceClassificationManufacturerDataType, error) |
| 39 | +} |
| 40 | + |
| 41 | +// Common interface for DeviceConfigurationClientInterface and DeviceConfigurationServerInterface |
| 42 | +type DeviceConfigurationCommonInterface interface { |
| 43 | + // check if spine.EventPayload Data contains data for a given filter |
| 44 | + // |
| 45 | + // data type will be checked for model.DeviceConfigurationKeyValueListDataType, |
| 46 | + // filter type will be checked for model.DeviceConfigurationKeyValueDescriptionDataType |
| 47 | + CheckEventPayloadDataForFilter(payloadData any, filter any) bool |
| 48 | + |
| 49 | + // Get the description for a given keyId |
| 50 | + // |
| 51 | + // Will return nil if no matching description was found |
| 52 | + GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error) |
| 53 | + |
| 54 | + // Get the description for a given value combination |
| 55 | + // |
| 56 | + // Returns an error if no matching description was found |
| 57 | + GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error) |
| 58 | + |
| 59 | + // Get the key value data for a given keyId |
| 60 | + // |
| 61 | + // Will return nil if no matching data was found |
| 62 | + GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error) |
| 63 | + |
| 64 | + // Get key value data for a given filter |
| 65 | + // |
| 66 | + // Will return nil if no matching data was found |
| 67 | + GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error) |
| 68 | +} |
| 69 | + |
| 70 | +// Common interface for DeviceDiagnosisClientInterface and DeviceDiagnosisServerInterface |
| 71 | +type DeviceDiagnosisCommonInterface interface { |
| 72 | + // get the current diagnosis state for an device entity |
| 73 | + GetState() (*model.DeviceDiagnosisStateDataType, error) |
| 74 | + |
| 75 | + // check if the currently available heartbeat data is within a time duration |
| 76 | + IsHeartbeatWithinDuration(duration time.Duration) bool |
| 77 | +} |
| 78 | + |
| 79 | +// Common interface for ElectricalConnectionClientInterface and ElectricalConnectionServerInterface |
| 80 | +type ElectricalConnectionCommonInterface interface { |
| 81 | + // check if spine.EventPayload Data contains data for a given filter |
| 82 | + // |
| 83 | + // data type will be checked for model.ElectricalConnectionPermittedValueSetListDataType, |
| 84 | + // filter type will be checked for model.ElectricalConnectionParameterDescriptionDataType |
| 85 | + CheckEventPayloadDataForFilter(payloadData any, filter any) bool |
| 86 | + |
| 87 | + // Get the description for a given filter |
| 88 | + // |
| 89 | + // Returns an error if no matching description is found |
| 90 | + GetDescriptionsForFilter( |
| 91 | + filter model.ElectricalConnectionDescriptionDataType, |
| 92 | + ) ([]model.ElectricalConnectionDescriptionDataType, error) |
| 93 | + |
| 94 | + // Get the description for a given parameter description |
| 95 | + // |
| 96 | + // Returns an error if no matching description is found |
| 97 | + GetDescriptionForParameterDescriptionFilter( |
| 98 | + filter model.ElectricalConnectionParameterDescriptionDataType) ( |
| 99 | + *model.ElectricalConnectionDescriptionDataType, error) |
| 100 | + |
| 101 | + // Get the description for a given filter |
| 102 | + // |
| 103 | + // Returns an error if no matching description is found |
| 104 | + GetParameterDescriptionsForFilter( |
| 105 | + filter model.ElectricalConnectionParameterDescriptionDataType, |
| 106 | + ) ([]model.ElectricalConnectionParameterDescriptionDataType, error) |
| 107 | + |
| 108 | + // return permitted values for all Electrical Connections |
| 109 | + GetPermittedValueSetForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) ( |
| 110 | + []model.ElectricalConnectionPermittedValueSetDataType, error) |
| 111 | + |
| 112 | + // returns minimum, maximum, default/pause limit values |
| 113 | + GetPermittedValueDataForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) ( |
| 114 | + float64, float64, float64, error) |
| 115 | + |
| 116 | + // Get the min, max, default current limits for each phase |
| 117 | + GetPhaseCurrentLimits(measDesc []model.MeasurementDescriptionDataType) ( |
| 118 | + resultMin []float64, resultMax []float64, resultDefault []float64, resultErr error) |
| 119 | + |
| 120 | + // Adjust a value to be within the permitted value range |
| 121 | + AdjustValueToBeWithinPermittedValuesForParameterId( |
| 122 | + value float64, parameterId model.ElectricalConnectionParameterIdType) float64 |
| 123 | + |
| 124 | + // Get the characteristics for a given filter |
| 125 | + // |
| 126 | + // Returns an error if no matching description is found |
| 127 | + GetCharacteristicsForFilter( |
| 128 | + filter model.ElectricalConnectionCharacteristicDataType, |
| 129 | + ) ([]model.ElectricalConnectionCharacteristicDataType, error) |
| 130 | +} |
| 131 | + |
| 132 | +// Common interface for LoadControlClientInterface and LoadControlServerInterface |
| 133 | +type LoadControlCommonInterface interface { |
| 134 | + // check if spine.EventPayload Data contains data for a given filter |
| 135 | + // |
| 136 | + // data type will be checked for model.LoadControlLimitListDataType, |
| 137 | + // filter type will be checked for model.LoadControlLimitDescriptionDataType |
| 138 | + CheckEventPayloadDataForFilter(payloadData any, filter any) bool |
| 139 | + |
| 140 | + // Get the description for a given limitId |
| 141 | + // |
| 142 | + // Will return nil if no matching description is found |
| 143 | + GetLimitDescriptionForId(limitId model.LoadControlLimitIdType) ( |
| 144 | + *model.LoadControlLimitDescriptionDataType, error) |
| 145 | + |
| 146 | + // Get the description for a given filter |
| 147 | + // |
| 148 | + // Returns an error if no matching description is found |
| 149 | + GetLimitDescriptionsForFilter( |
| 150 | + filter model.LoadControlLimitDescriptionDataType, |
| 151 | + ) ([]model.LoadControlLimitDescriptionDataType, error) |
| 152 | + |
| 153 | + // Get the description for a given limitId |
| 154 | + // |
| 155 | + // Will return nil if no data is available |
| 156 | + GetLimitDataForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error) |
| 157 | + |
| 158 | + // Get limit data for a given filter |
| 159 | + // |
| 160 | + // Will return nil if no data is available |
| 161 | + GetLimitDataForFilter(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error) |
| 162 | +} |
| 163 | + |
| 164 | +// Common interface for MeasurementClientInterface and MeasurementServerInterface |
| 165 | +type MeasurementCommonInterface interface { |
| 166 | + // check if spine.EventPayload Data contains data for a given filter |
| 167 | + // |
| 168 | + // data type will be checked for model.MeasurementListDataType, |
| 169 | + // filter type will be checked for model.MeasurementDescriptionDataType |
| 170 | + CheckEventPayloadDataForFilter(payloadData any, filter any) bool |
| 171 | + |
| 172 | + // Get the description for a given id |
| 173 | + // |
| 174 | + // Returns an error if no matching description is found |
| 175 | + GetDescriptionForId( |
| 176 | + measurementId model.MeasurementIdType, |
| 177 | + ) (*model.MeasurementDescriptionDataType, error) |
| 178 | + |
| 179 | + // Get the description for a given filter |
| 180 | + // |
| 181 | + // Returns an error if no matching description is found |
| 182 | + GetDescriptionsForFilter( |
| 183 | + filter model.MeasurementDescriptionDataType, |
| 184 | + ) ([]model.MeasurementDescriptionDataType, error) |
| 185 | + |
| 186 | + // Get the constraints for a given filter |
| 187 | + // |
| 188 | + // Returns an error if no matching constraint is found |
| 189 | + GetConstraintsForFilter( |
| 190 | + filter model.MeasurementConstraintsDataType, |
| 191 | + ) ([]model.MeasurementConstraintsDataType, error) |
| 192 | + |
| 193 | + // Get the measuement data for a given measurementId |
| 194 | + // |
| 195 | + // Will return nil if no data is available |
| 196 | + GetDataForId(measurementId model.MeasurementIdType) (*model.MeasurementDataType, error) |
| 197 | + |
| 198 | + // Get measuement data for a given filter |
| 199 | + // |
| 200 | + // Will return nil if no data is available |
| 201 | + GetDataForFilter(filter model.MeasurementDescriptionDataType) ( |
| 202 | + []model.MeasurementDataType, error) |
| 203 | +} |
| 204 | + |
| 205 | +// Common interface for IdentificationClientInterface and IdentificationServerInterface |
| 206 | +type IdentificationCommonInterface interface { |
| 207 | + // check if spine.EventPayload Data contains identification data |
| 208 | + // |
| 209 | + // data type will be checked for model.IdentificationListDataType |
| 210 | + CheckEventPayloadDataForFilter(payloadData any) bool |
| 211 | + |
| 212 | + // return current values for Identification |
| 213 | + GetDataForFilter(filter model.IdentificationDataType) ([]model.IdentificationDataType, error) |
| 214 | +} |
| 215 | + |
| 216 | +// Common interface for IncentiveTableClientInterface and IncentiveTableServerInterface |
| 217 | +type IncentiveTableCommonInterface interface { |
| 218 | + // return list of descriptions for a given filter |
| 219 | + GetDescriptionsForFilter(filter model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error) |
| 220 | + |
| 221 | + // return list of constraints |
| 222 | + GetConstraints() ([]model.IncentiveTableConstraintsType, error) |
| 223 | + |
| 224 | + // return current data for Time Series |
| 225 | + GetData() ([]model.IncentiveTableType, error) |
| 226 | +} |
| 227 | + |
| 228 | +// Common interface for SmartEnergyManagementPsClientInterface and SmartEnergyManagementPsServerInterface |
| 229 | +type SmartEnergyManagementPsCommonInterface interface { |
| 230 | + // return current data for FunctionTypeSmartEnergyManagementPsData |
| 231 | + GetData() (*model.SmartEnergyManagementPsDataType, error) |
| 232 | +} |
| 233 | + |
| 234 | +// Common interface for TimeSeriesClientInterface and TimeSeriesServerInterface |
| 235 | +type TimeSeriesCommonInterface interface { |
| 236 | + // return list of descriptions for a given filter |
| 237 | + GetDescriptionsForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error) |
| 238 | + |
| 239 | + // return current constraints for Time Series |
| 240 | + GetConstraints() ([]model.TimeSeriesConstraintsDataType, error) |
| 241 | + |
| 242 | + // return current data for Time Series for a given filter |
| 243 | + GetDataForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error) |
| 244 | +} |
0 commit comments