Documentation ¶
Overview ¶
Package transport provides the interfaces that are used to communicate between the manager and the gateway and subsequently to the charge station.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Emitter ¶
type Emitter interface { // Emit sends a message, destined for a specific charge station which is identified by its // chargeStationId using a specific ocppVersion, to the gateway. Emit(ctx context.Context, ocppVersion OcppVersion, chargeStationId string, message *Message) error }
Emitter defines the contract for sending messages to the gateway.
type EmitterFunc ¶
type EmitterFunc func(ctx context.Context, ocppVersion OcppVersion, chargeStationId string, message *Message) error
EmitterFunc allows a plain function to be used as an Emitter
func (EmitterFunc) Emit ¶
func (e EmitterFunc) Emit(ctx context.Context, ocppVersion OcppVersion, chargeStationId string, message *Message) error
type ErrorCode ¶
type ErrorCode string
ErrorCode represents an OCPP error code.
const ( ErrorFormatViolation ErrorCode = "FormatViolation" ErrorGenericError ErrorCode = "GenericError" ErrorInternalError ErrorCode = "InternalError" ErrorMessageTypeNotSupported ErrorCode = "MessageTypeNotSupported" ErrorNotImplemented ErrorCode = "NotImplemented" ErrorNotSupported ErrorCode = "NotSupported" ErrorOccurrenceConstraintViolation ErrorCode = "OccurrenceConstraintViolation" ErrorPropertyConstraintViolation ErrorCode = "PropertyConstraintViolation" ErrorProtocolError ErrorCode = "ProtocolError" ErrorRpcFrameworkError ErrorCode = "RpcFrameworkError" ErrorSecurityError ErrorCode = "SecurityError" ErrorTypeConstraintViolation ErrorCode = "TypeConstraintViolation" )
type Listener ¶
type Listener interface { // Connect establishes a connection to the broker and subscribes to receive messages for // either a specific charge station or all charge stations (for a specific OcppVersion). The messages // are delivered to the provided MessageHandler. // // Returns either a Connection on success or an error. Connect(ctx context.Context, ocppVersion OcppVersion, chargeStationId *string, handler MessageHandler) (Connection, error) }
type Message ¶
type Message struct { MessageType MessageType `json:"type"` Action string `json:"action"` MessageId string `json:"id"` RequestPayload json.RawMessage `json:"request,omitempty"` ResponsePayload json.RawMessage `json:"response,omitempty"` ErrorCode ErrorCode `json:"error_code,omitempty"` ErrorDescription string `json:"error_description,omitempty"` State json.RawMessage `json:"state,omitempty"` }
type MessageHandler ¶
type MessageHandlerFunc ¶
type MessageType ¶
type MessageType int
const ( MessageTypeCall MessageType = iota + 2 MessageTypeCallResult MessageTypeCallError )
func (MessageType) String ¶
func (m MessageType) String() string
type OcppVersion ¶
type OcppVersion string
OcppVersion represents the version of OCPP that is being used.
const ( OcppVersion16 OcppVersion = "ocpp1.6" // OCPP 1.6 OcppVersion201 OcppVersion = "ocpp2.0.1" // OCPP 2.0.1 )
type Receiver ¶
type Receiver interface {
Connect(errCh chan error)
}
Receiver is the interface implemented in order to receive messages from the gateway (and thus from the charge station). The Receiver must establish a connection to the gateway and then use a Router to process any messages that are received.
Click to show internal directories.
Click to hide internal directories.