messaging

package
v0.0.0-...-42d5c12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorOCPP16Parse error = errors.New("invalid ocpp 1.6 message")

Functions

func IsOCPP16CallErrorCode

func IsOCPP16CallErrorCode(s OCPP16CallErrorCode) bool

func IsOCPP16MessageType

func IsOCPP16MessageType(s OCPP16MessageType) bool

func UnparseOCPP16Call

func UnparseOCPP16Call(c OCPP16CallMessage) ([]byte, error)

ParseOCPP16 call unparses the struct and marshals it into valid JSON format

func UnparseOCPP16CallError

func UnparseOCPP16CallError(r OCPP16CallError) ([]byte, error)

UnparseOCPP16CallError unparses the struct and marshals it into valid JSON format

func UnparseOCPP16CallResult

func UnparseOCPP16CallResult(r OCPP16CallResult) ([]byte, error)

UnparseOCPP16CallResult unparses the struct and marshals it into valid JSON format

Types

type OCPP16CallError

type OCPP16CallError struct {
	MessageTypeID    OCPP16MessageType
	UniqueID         string
	ErrorCode        OCPP16CallErrorCode
	ErrorDescription string
	ErrorDetails     interface{}
}

func ParseOCPP16CallError

func ParseOCPP16CallError(p []byte) (*OCPP16CallError, error)

ParseOCPP16CallError parses the WebSocket message body ParseOCPP16CallError does not validate if the values are correct, only the types ParseOCPP16CallError also does not validate the payload body

type OCPP16CallErrorCode

type OCPP16CallErrorCode string
const (
	NotImplemented               OCPP16CallErrorCode = "NotImplemented"
	NotSupported                 OCPP16CallErrorCode = "NotSupported"
	InternalError                OCPP16CallErrorCode = "InternalError"
	ProtocolError                OCPP16CallErrorCode = "ProtocolError"
	SecurityError                OCPP16CallErrorCode = "SecurityError"
	FormationViolation           OCPP16CallErrorCode = "FormationViolation"
	PropertyConstraintViolation  OCPP16CallErrorCode = "PropertyConstraintViolation"
	OccurenceConstraintViolation OCPP16CallErrorCode = "OccurenceConstraintViolation"
	TypeConstraintViolation      OCPP16CallErrorCode = "TypeConstraintViolation"
	GenericError                 OCPP16CallErrorCode = "GenericError"
)

type OCPP16CallMessage

type OCPP16CallMessage struct {
	MessageTypeID OCPP16MessageType
	UniqueID      string
	Action        string
	Payload       interface{}
}

func ParseOCPP16Call

func ParseOCPP16Call(p []byte) (*OCPP16CallMessage, error)

ParseOCPP16Call parses the WebSocket message body ParseOCPP16Call does not validate if the values are correct, only the types ParseOCPP16Call also does not validate the payload body

type OCPP16CallResult

type OCPP16CallResult struct {
	MessageTypeID OCPP16MessageType
	UniqueID      string
	Payload       interface{}
}

func ParseOCPP16CallResult

func ParseOCPP16CallResult(p []byte) (*OCPP16CallResult, error)

ParseOCPP16CallResult parses the WebSocket message body ParseOCPP16CallResult does not validate if the values are correct, only the types ParseOCPP16CallResult also does not validate the payload body

type OCPP16ChargePointErrorCode

type OCPP16ChargePointErrorCode string

TODO: Add all error codes from OCPP 1.6J document

const (
	// Wireless communication device reports a weak signal.
	WeakSignal OCPP16ChargePointErrorCode = "WeakSignal"
)

type OCPP16MessageType

type OCPP16MessageType int
const (
	CALL       OCPP16MessageType = 2
	CALLRESULT OCPP16MessageType = 3
	CALLERROR  OCPP16MessageType = 4
)

func GetOCPP16MessageType

func GetOCPP16MessageType(p []byte) (OCPP16MessageType, error)

GetOCPP16MessageType parses the WebSocket message body to get the message type GetOCPP16MessageType only checks if the message is a JSON array, and the MessageTypeId

type OCPP16Status

type OCPP16Status string
const (
	Available     OCPP16Status = "Available"
	Preparing     OCPP16Status = "Preparing"
	Charging      OCPP16Status = "Charging"
	SuspendedEV   OCPP16Status = "SuspendedEV"
	SuspendedEVSE OCPP16Status = "SuspendedEVSE"
	Finishing     OCPP16Status = "Finishing"
	Reserved      OCPP16Status = "Reserved"
	Unavailable   OCPP16Status = "Unavailable"
	Faulted       OCPP16Status = "Faulted"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL