Documentation ¶
Overview ¶
Package handlers defines the interfaces implemented by handlers for OCPP messages and the types used when routing those messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallHandler ¶
type CallHandler interface { // HandleCall receives the charge station identifier and the OCPP request message // and returns either the OCPP response message or an error. HandleCall(ctx context.Context, chargeStationId string, request ocpp.Request) (response ocpp.Response, err error) }
CallHandler is the interface implemented by handlers that are designed to process an OCPP Call.
type CallHandlerFunc ¶
type CallHandlerFunc func(ctx context.Context, chargeStationId string, request ocpp.Request) (response ocpp.Response, err error)
CallHandlerFunc allows a plain function to be used as a CallHandler.
type CallMaker ¶
type CallMaker interface { // Send receives the charge station id and the request to send. It may return an error. Send(ctx context.Context, chargeStationId string, request ocpp.Request) error }
CallMaker is the interface used by handlers (and other parts of the system) that want to initiate an OCPP call from the CSMS.
type CallResultHandler ¶
type CallResultHandler interface { // HandleCallResult receives the charge station id, OCPP Request message and OCPP Response message // along with any cached state. It may return an error. HandleCallResult(ctx context.Context, chargeStationId string, request ocpp.Request, response ocpp.Response, state any) error }
CallResultHandler is the interface implemented by the handlers that are designed to process an OCPP CallResult.
type CallResultHandlerFunc ¶
type CallResultHandlerFunc func(ctx context.Context, chargeStationId string, request ocpp.Request, response ocpp.Response, state any) error
CallResultHandlerFunc allows a plain function to be used as a CallResultHandler
type CallResultRoute ¶
type CallResultRoute struct { NewRequest func() ocpp.Request // Function used for creating an empty request NewResponse func() ocpp.Response // Function used for creating an empty response RequestSchema string // JSON schema file that corresponds to the request data structure ResponseSchema string // JSON schema file that corresponds to the response data structure Handler CallResultHandler // Function to process a call result }
CallResultRoute is the configuration that is used by the Router for process an OCPP CallResult. In the Router this is indexed by the OCPP Action (of the corresponding Call).
type CallRoute ¶
type CallRoute struct { NewRequest func() ocpp.Request // Function used for creating an empty request RequestSchema string // JSON schema file that corresponds to the request data structure ResponseSchema string // JSON schema file that corresponds to the response data structure Handler CallHandler // Function to process a call }
CallRoute is the configuration that is used by the Router for processing an OCPP Call. In the Router this is indexed by the OCPP Action.
type OcppCallMaker ¶
type OcppCallMaker struct { Emitter transport.Emitter // used to send the message to the charge station OcppVersion transport.OcppVersion // identifies the OCPP version that the messages are for Actions map[reflect.Type]string // the OCPP Action associated with a specific ocpp.Request object }
OcppCallMaker is an implementation of the CallMaker interface for a specific set of OCPP messages.
type Router ¶
type Router struct { Emitter transport.Emitter // used to send responses to the gateway SchemaFS fs.FS // used to obtain schema files OcppVersion transport.OcppVersion // the OCPP version that this router supports CallRoutes map[string]CallRoute // the set of routes for incoming calls (indexed by action) CallResultRoutes map[string]CallResultRoute // the set of routes for call results (indexed by action) }
Router is the primary implementation of the transport.Router interface.
Directories ¶
Path | Synopsis |
---|---|
Package has2be defines handlers for processing Has2Be OCPP 1.6 extension messages.
|
Package has2be defines handlers for processing Has2Be OCPP 1.6 extension messages. |
Package ocpp16 defines handlers for processing OCPP 1.6 messages.
|
Package ocpp16 defines handlers for processing OCPP 1.6 messages. |
Package ocpp201 defines handlers for processing OCPP 2.0.1 messages.
|
Package ocpp201 defines handlers for processing OCPP 2.0.1 messages. |