Documentation
¶
Overview ¶
Contains common and shared data types between OCPP 1.6 messages.
Index ¶
- Constants
- Variables
- func DateTimeIsNull(dateTime *DateTime) bool
- func FormatTimestamp(t time.Time) string
- type AuthorizationStatus
- type CertificateHashData
- type CertificateSigningUse
- type CertificateUse
- type ChargingProfile
- type ChargingProfileKindType
- type ChargingProfilePurposeType
- type ChargingRateUnitType
- type ChargingSchedule
- type ChargingSchedulePeriod
- type DateTime
- type GenericStatus
- type HashAlgorithmType
- type IdTagInfo
- type Location
- type Measurand
- type MeterValue
- type Phase
- type PropertyViolation
- type ReadingContext
- type RecurrencyKindType
- type RemoteStartStopStatus
- type SampledValue
- type StatusInfo
- type UnitOfMeasure
- type ValueFormat
Constants ¶
const ( ChargingProfilePurposeChargePointMaxProfile ChargingProfilePurposeType = "ChargePointMaxProfile" ChargingProfilePurposeTxDefaultProfile ChargingProfilePurposeType = "TxDefaultProfile" ChargingProfilePurposeTxProfile ChargingProfilePurposeType = "TxProfile" ChargingProfileKindAbsolute ChargingProfileKindType = "Absolute" ChargingProfileKindRecurring ChargingProfileKindType = "Recurring" ChargingProfileKindRelative ChargingProfileKindType = "Relative" RecurrencyKindDaily RecurrencyKindType = "Daily" RecurrencyKindWeekly RecurrencyKindType = "Weekly" ChargingRateUnitWatts ChargingRateUnitType = "W" ChargingRateUnitAmperes ChargingRateUnitType = "A" )
const ( ReadingContextInterruptionBegin ReadingContext = "Interruption.Begin" ReadingContextInterruptionEnd ReadingContext = "Interruption.End" ReadingContextOther ReadingContext = "Other" ReadingContextSampleClock ReadingContext = "Sample.Clock" ReadingContextSamplePeriodic ReadingContext = "Sample.Periodic" ReadingContextTransactionBegin ReadingContext = "Transaction.Begin" ReadingContextTransactionEnd ReadingContext = "Transaction.End" ReadingContextTrigger ReadingContext = "Trigger" ValueFormatRaw ValueFormat = "Raw" ValueFormatSignedData ValueFormat = "SignedData" MeasurandCurrentExport Measurand = "Current.Export" MeasurandCurrentImport Measurand = "Current.Import" MeasurandCurrentOffered Measurand = "Current.Offered" MeasurandEnergyActiveExportRegister Measurand = "Energy.Active.Export.Register" MeasurandEnergyActiveImportRegister Measurand = "Energy.Active.Import.Register" MeasurandEnergyRootActiveImportRegister Measurand = "Energy.Root.Active.Import.Register" MeasurandEnergyReactiveExportRegister Measurand = "Energy.Reactive.Export.Register" MeasurandEnergyReactiveImportRegister Measurand = "Energy.Reactive.Import.Register" MeasurandEnergyActiveExportInterval Measurand = "Energy.Active.Export.Interval" MeasurandEnergyActiveImportInterval Measurand = "Energy.Active.Import.Interval" MeasurandEnergyReactiveExportInterval Measurand = "Energy.Reactive.Export.Interval" MeasurandEnergyReactiveImportInterval Measurand = "Energy.Reactive.Import.Interval" MeasurandFrequency Measurand = "Frequency" MeasurandPowerActiveExport Measurand = "Power.Active.Export" MeasurandPowerActiveImport Measurand = "Power.Active.Import" MeasurandPowerFactor Measurand = "Power.Factor" MeasurandPowerOffered Measurand = "Power.Offered" MeasurandPowerReactiveExport Measurand = "Power.Reactive.Export" MeasurandPowerReactiveImport Measurand = "Power.Reactive.Import" MeasurandRPM Measurand = "RPM" MeasurandSoC Measurand = "SoC" MeasurandTemperature Measurand = "Temperature" MeasurandVoltage Measurand = "Voltage" PhaseL1 Phase = "L1" PhaseL2 Phase = "L2" PhaseL3 Phase = "L3" PhaseN Phase = "N" PhaseL1N Phase = "L1-N" PhaseL2N Phase = "L2-N" PhaseL3N Phase = "L3-N" PhaseL1L2 Phase = "L1-L2" PhaseL2L3 Phase = "L2-L3" PhaseL3L1 Phase = "L3-L1" LocationBody Location = "Body" LocationCable Location = "Cable" LocationEV Location = "EV" LocationInlet Location = "Inlet" LocationOutlet Location = "Outlet" UnitOfMeasureWh UnitOfMeasure = "Wh" UnitOfMeasureKWh UnitOfMeasure = "kWh" UnitOfMeasureVarh UnitOfMeasure = "varh" UnitOfMeasureKvarh UnitOfMeasure = "kvarh" UnitOfMeasureW UnitOfMeasure = "W" UnitOfMeasureKW UnitOfMeasure = "kW" UnitOfMeasureVA UnitOfMeasure = "VA" UnitOfMeasureKVA UnitOfMeasure = "kVA" UnitOfMeasureVar UnitOfMeasure = "var" UnitOfMeasureKvar UnitOfMeasure = "kvar" UnitOfMeasureA UnitOfMeasure = "A" UnitOfMeasureV UnitOfMeasure = "V" UnitOfMeasureCelsius UnitOfMeasure = "Celsius" UnitOfMeasureCelcius UnitOfMeasure = "Celcius" UnitOfMeasureFahrenheit UnitOfMeasure = "Fahrenheit" UnitOfMeasureK UnitOfMeasure = "K" UnitOfMeasurePercent UnitOfMeasure = "Percent" )
const (
V16Subprotocol = "ocpp1.6"
)
Variables ¶
var DateTimeFormat = time.RFC3339
DateTimeFormat to be used when serializing all OCPP messages.
The default dateTime format is RFC3339. Change this if another format is desired.
var Validate = ocppj.Validate
Initialize validator
Functions ¶
func DateTimeIsNull ¶
func FormatTimestamp ¶
Types ¶
type AuthorizationStatus ¶
type AuthorizationStatus string
const ( AuthorizationStatusAccepted AuthorizationStatus = "Accepted" AuthorizationStatusBlocked AuthorizationStatus = "Blocked" AuthorizationStatusExpired AuthorizationStatus = "Expired" AuthorizationStatusInvalid AuthorizationStatus = "Invalid" AuthorizationStatusConcurrentTx AuthorizationStatus = "ConcurrentTx" )
type CertificateHashData ¶
type CertificateHashData struct { HashAlgorithm HashAlgorithmType `json:"hashAlgorithm" validate:"required,hashAlgorithm"` IssuerNameHash string `json:"issuerNameHash" validate:"required,max=128"` IssuerKeyHash string `json:"issuerKeyHash" validate:"required,max=128"` SerialNumber string `json:"serialNumber" validate:"required,max=40"` }
CertificateHashDataType
type CertificateSigningUse ¶
type CertificateSigningUse string
Indicates the type of the signed certificate that is returned. When omitted the certificate is used for both the 15118 connection (if implemented) and the Charging Station to CSMS connection. This field is required when a typeOfCertificate was included in the SignCertificateRequest that requested this certificate to be signed AND both the 15118 connection and the Charging Station connection are implemented.
const (
ChargingStationCert CertificateSigningUse = "ChargingStationCertificate"
)
type CertificateUse ¶
type CertificateUse string
Indicates the type of the requested certificate. It is used in GetInstalledCertificateIdsRequest and InstallCertificateRequest messages.
const ( CentralSystemRootCertificate CertificateUse = "CentralSystemRootCertificate" ManufacturerRootCertificate CertificateUse = "ManufacturerRootCertificate" )
type ChargingProfile ¶
type ChargingProfile struct { ChargingProfileId int `json:"chargingProfileId"` TransactionId int `json:"transactionId,omitempty"` StackLevel int `json:"stackLevel" validate:"gte=0"` ChargingProfilePurpose ChargingProfilePurposeType `json:"chargingProfilePurpose" validate:"required,chargingProfilePurpose16"` ChargingProfileKind ChargingProfileKindType `json:"chargingProfileKind" validate:"required,chargingProfileKind16"` RecurrencyKind RecurrencyKindType `json:"recurrencyKind,omitempty" validate:"omitempty,recurrencyKind16"` ValidFrom *DateTime `json:"validFrom,omitempty"` ValidTo *DateTime `json:"validTo,omitempty"` ChargingSchedule *ChargingSchedule `json:"chargingSchedule" validate:"required"` }
func NewChargingProfile ¶
func NewChargingProfile(chargingProfileId int, stackLevel int, chargingProfilePurpose ChargingProfilePurposeType, chargingProfileKind ChargingProfileKindType, schedule *ChargingSchedule) *ChargingProfile
type ChargingProfileKindType ¶
type ChargingProfileKindType string
type ChargingRateUnitType ¶
type ChargingRateUnitType string
type ChargingSchedule ¶
type ChargingSchedule struct { Duration *int `json:"duration,omitempty" validate:"omitempty,gte=0"` StartSchedule *DateTime `json:"startSchedule,omitempty"` ChargingRateUnit ChargingRateUnitType `json:"chargingRateUnit" validate:"required,chargingRateUnit16"` ChargingSchedulePeriod []ChargingSchedulePeriod `json:"chargingSchedulePeriod" validate:"required,min=1"` MinChargingRate *float64 `json:"minChargingRate,omitempty" validate:"omitempty,gte=0"` }
func NewChargingSchedule ¶
func NewChargingSchedule(chargingRateUnit ChargingRateUnitType, schedulePeriod ...ChargingSchedulePeriod) *ChargingSchedule
type ChargingSchedulePeriod ¶
type ChargingSchedulePeriod struct { StartPeriod int `json:"startPeriod" validate:"gte=0"` Limit float64 `json:"limit" validate:"gte=0"` NumberPhases *int `json:"numberPhases,omitempty" validate:"omitempty,gte=0"` }
func NewChargingSchedulePeriod ¶
func NewChargingSchedulePeriod(startPeriod int, limit float64) ChargingSchedulePeriod
type DateTime ¶
DateTime wraps a time.Time struct, allowing for improved dateTime JSON compatibility.
func NewDateTime ¶
Creates a new DateTime struct, embedding a time.Time struct.
func (*DateTime) FormatTimestamp ¶
Formats the UTC timestamp using the DateTimeFormat setting. This function is used during JSON marshaling as well.
func (*DateTime) MarshalJSON ¶
func (*DateTime) UnmarshalJSON ¶
type GenericStatus ¶
type GenericStatus string
Generic Status
const ( GenericStatusAccepted GenericStatus = "Accepted" GenericStatusRejected GenericStatus = "Rejected" )
type HashAlgorithmType ¶
type HashAlgorithmType string
Hash Algorithms
const ( SHA256 HashAlgorithmType = "SHA256" SHA384 HashAlgorithmType = "SHA384" SHA512 HashAlgorithmType = "SHA512" )
type IdTagInfo ¶
type IdTagInfo struct { ExpiryDate *DateTime `json:"expiryDate,omitempty" validate:"omitempty"` ParentIdTag string `json:"parentIdTag,omitempty" validate:"omitempty,max=20"` Status AuthorizationStatus `json:"status" validate:"required,authorizationStatus16"` }
func NewIdTagInfo ¶
func NewIdTagInfo(status AuthorizationStatus) *IdTagInfo
type MeterValue ¶
type MeterValue struct { Timestamp *DateTime `json:"timestamp" validate:"required"` SampledValue []SampledValue `json:"sampledValue" validate:"required,min=1,dive"` }
type PropertyViolation ¶
type PropertyViolation struct {
Property string
}
func (*PropertyViolation) Error ¶
func (e *PropertyViolation) Error() string
type RecurrencyKindType ¶
type RecurrencyKindType string
type RemoteStartStopStatus ¶
type RemoteStartStopStatus string
Remote Start/Stop
const ( RemoteStartStopStatusAccepted RemoteStartStopStatus = "Accepted" RemoteStartStopStatusRejected RemoteStartStopStatus = "Rejected" )
type SampledValue ¶
type SampledValue struct { Value string `json:"value" validate:"required"` Context ReadingContext `json:"context,omitempty" validate:"omitempty,readingContext16"` Format ValueFormat `json:"format,omitempty" validate:"omitempty,valueFormat"` Measurand Measurand `json:"measurand,omitempty" validate:"omitempty,measurand16"` Phase Phase `json:"phase,omitempty" validate:"omitempty,phase16"` Location Location `json:"location,omitempty" validate:"omitempty,location16"` Unit UnitOfMeasure `json:"unit,omitempty" validate:"omitempty,unitOfMeasure"` }
type StatusInfo ¶
type StatusInfo struct { ReasonCode string `json:"reasonCode" validate:"required,max=20"` // A predefined code for the reason why the status is returned in this response. The string is case- insensitive. AdditionalInfo string `json:"additionalInfo,omitempty" validate:"omitempty,max=512"` // Additional text to provide detailed information. }
StatusInfo is an element providing more information about the message status.
func NewStatusInfo ¶
func NewStatusInfo(reasonCode string, additionalInfo string) *StatusInfo
NewStatusInfo creates a StatusInfo struct. If no additional info need to be set, an empty string may be passed.
type UnitOfMeasure ¶
type UnitOfMeasure string
type ValueFormat ¶
type ValueFormat string