Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ChargePoints = make(map[string]*ChargePoint)
map to store websocket connections, keys are the chargepoint ids and values are the chargepoint structs which contain the websocket connection
Functions ¶
This section is empty.
Types ¶
type CallError ¶
type CallError struct { MessageTypeId uint8 UniqueId string ErrorCode string ErrorDescription string ErrorDetails interface{} }
Represents OCPP CallError
type CallResult ¶
type CallResult struct { MessageTypeId uint8 UniqueId string Payload *json.RawMessage }
Represents OCPP CallResult
type ChargePoint ¶
type ChargePoint struct { Conn *websocket.Conn // the websocket connection Id string // chargePointId Out chan *[]byte // channel to send messages to the ChargePoint In chan *[]byte // channel to receive messages from the ChargePoint MessageHandlers map[string]func(Payload) Payload // map to store CP initiated actions AfterHandlers map[string]func(Payload) // map to store functions to be called after a CP initiated action Mu sync.Mutex // mutex ensuring that only one message is sent at a time Cr chan *CallResult Ce chan *CallError Timeout time.Duration // timeout for waiting for a response }
Represents a connected ChargePoint (also known as a Charging Station)
func NewChargePoint ¶
func NewChargePoint(conn *websocket.Conn, id string) *ChargePoint
Creates a new ChargePoint
func (*ChargePoint) After ¶
func (cp *ChargePoint) After(action string, f func(Payload)) *ChargePoint
The function to be used by the implementers to register functions to be called after a CP initiated action
func (*ChargePoint) Call ¶
func (cp *ChargePoint) Call(action string, p Payload) (Payload, error)
function to be used by the implementers to execute a CSMS initiated action
func (*ChargePoint) On ¶
func (cp *ChargePoint) On(action string, f func(Payload) Payload) *ChargePoint
The function to be used by the implementers to register CP initiated actions
type Payload ¶
type Payload interface{}
Used as a container is for both Call and CallResult' Payload
type TimeoutError ¶
type TimeoutError struct {
Message string
}
func (*TimeoutError) Error ¶
func (e *TimeoutError) Error() string
Click to show internal directories.
Click to hide internal directories.