Documentation ¶
Overview ¶
Open Charge Point Protocol (OCPP) is a standard open protocol for communication between Charge Points and a Central System and is designed to accommodate any type of charging technique. This package contains the base interfaces used for the OCPP 1.6 and OCPP 2.0 implementation.
Index ¶
- type Error
- type ErrorCode
- type Feature
- type Profile
- func (p *Profile) AddFeature(feature Feature)
- func (p *Profile) GetFeature(name string) Feature
- func (p *Profile) ParseRequest(featureName string, rawRequest interface{}, ...) (Request, error)
- func (p *Profile) ParseResponse(featureName string, rawResponse interface{}, ...) (Response, error)
- func (p *Profile) SupportsFeature(name string) bool
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
Error wraps an OCPP error, containing an ErrorCode, a Description and the ID of the message.
type Feature ¶
type Feature interface { // Returns the unique name of the feature. GetFeatureName() string // Returns the type of the request message. GetRequestType() reflect.Type // Returns the type of the response message. GetResponseType() reflect.Type }
Feature represents a single functionality, associated to a unique name. Every feature describes a Request and a Response message, specified in the OCPP protocol.
type Profile ¶
Profile defines a specific set of features, grouped by functionality.
Some vendor may want to keep the protocol as slim as possible, and only support some feature profiles. This can easily be achieved by only registering certain profiles, while remaining compliant with the specifications.
func NewProfile ¶
Creates a new profile, identified by a name and a set of features.
func (*Profile) AddFeature ¶
Adds a feature to the profile.
func (*Profile) GetFeature ¶
Retrieves a feature, identified by a unique name. Returns nil in case the feature is not registered with this profile.
func (*Profile) ParseRequest ¶
func (p *Profile) ParseRequest(featureName string, rawRequest interface{}, requestParser func(raw interface{}, requestType reflect.Type) (Request, error)) (Request, error)
ParseRequest checks whether a feature is supported and passes the rawRequest message to the requestParser function. The type of the request message is passed to the requestParser function, which has to perform type assertion.
func (*Profile) ParseResponse ¶
func (p *Profile) ParseResponse(featureName string, rawResponse interface{}, responseParser func(raw interface{}, responseType reflect.Type) (Response, error)) (Response, error)
ParseRequest checks whether a feature is supported and passes the rawResponse message to the responseParser function. The type of the response message is passed to the responseParser function, which has to perform type assertion.
func (*Profile) SupportsFeature ¶
SupportsFeature returns true if a feature matching the the passed name is registered with this profile, false otherwise.