diff --git a/ocppj/client.go b/ocppj/client.go index 731fb540..496bbc91 100644 --- a/ocppj/client.go +++ b/ocppj/client.go @@ -54,16 +54,31 @@ func NewClient(id string, wsClient ws.WsClient, dispatcher ClientDispatcher, sta return &Client{Endpoint: endpoint, client: wsClient, Id: id, dispatcher: dispatcher, RequestState: stateHandler} } +// Return incoming requests handler. +func (c *Client) GetRequestHandler() func(request ocpp.Request, requestId string, action string) { + return c.requestHandler +} + // Registers a handler for incoming requests. func (c *Client) SetRequestHandler(handler func(request ocpp.Request, requestId string, action string)) { c.requestHandler = handler } +// Return incoming responses handler. +func (c *Client) GetResponseHandler() func(response ocpp.Response, requestId string) { + return c.responseHandler +} + // Registers a handler for incoming responses. func (c *Client) SetResponseHandler(handler func(response ocpp.Response, requestId string)) { c.responseHandler = handler } +// Return incoming error messages handler. +func (c *Client) GetErrorHandler() func(err *ocpp.Error, details interface{}) { + return c.errorHandler +} + // Registers a handler for incoming error messages. func (c *Client) SetErrorHandler(handler func(err *ocpp.Error, details interface{})) { c.errorHandler = handler