Documentation
¶
Index ¶
- func ParseJsonMessage(dataJson string) ([]interface{}, error)
- func ParseRawJsonMessage(dataJson []byte) ([]interface{}, error)
- type ParserV2
- type RequestResponseResult
- func (r *RequestResponseResult) AddRequest(request ocpp.Message)
- func (r *RequestResponseResult) AddRequestError(err string)
- func (r *RequestResponseResult) AddResponse(response ocpp.Message)
- func (r *RequestResponseResult) AddResponseError(err string)
- func (r *RequestResponseResult) AddResponseErrorError(err string)
- func (r *RequestResponseResult) AddResponseErrorResult(response ocpp.Message)
- func (r *RequestResponseResult) GetRequest() (ocpp.Message, bool)
- func (r *RequestResponseResult) GetResponse() (ocpp.Message, bool)
- func (r *RequestResponseResult) GetResponseError() (ocpp.Message, bool)
- func (r *RequestResponseResult) IsValid() bool
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseJsonMessage ¶
ParseJsonMessage Unmarshals an OCPP-J json object from a JSON string. Returns the array of elements contained in the message.
func ParseRawJsonMessage ¶
ParseRawJsonMessage Unmarshals an OCPP-J json object from a byte array. Returns the array of elements contained in the message.
Types ¶
type ParserV2 ¶ added in v0.3.0
type ParserV2 struct {
// contains filtered or unexported fields
}
ParserV2 is used for parsing multiple OCPP-J messages. It is stateful, as it will all results of the parsing process. Particularly needed for parsing files that contain request-response pairs, where the response is dependent on the request. It will return a map of unique IDs to RequestResponseResult, where RequestResponseResult is a struct that contains the parsed message and any errors that occurred during parsing.
func NewParserV2 ¶ added in v0.3.0
type RequestResponseResult ¶ added in v0.3.0
type RequestResponseResult struct {
// Request is the parsed OCPP request message.
Request Result
// Response can be either ocpp.CallResult or ocpp.CallError (or nil if no request was provided).
Response Result
// ResponseError
ResponseError Result
}
func NewRequestResponseResult ¶ added in v0.3.0
func NewRequestResponseResult() *RequestResponseResult
func (*RequestResponseResult) AddRequest ¶ added in v0.3.0
func (r *RequestResponseResult) AddRequest(request ocpp.Message)
func (*RequestResponseResult) AddRequestError ¶ added in v0.3.0
func (r *RequestResponseResult) AddRequestError(err string)
func (*RequestResponseResult) AddResponse ¶ added in v0.3.0
func (r *RequestResponseResult) AddResponse(response ocpp.Message)
func (*RequestResponseResult) AddResponseError ¶ added in v0.3.0
func (r *RequestResponseResult) AddResponseError(err string)
func (*RequestResponseResult) AddResponseErrorError ¶ added in v0.4.0
func (r *RequestResponseResult) AddResponseErrorError(err string)
func (*RequestResponseResult) AddResponseErrorResult ¶ added in v0.4.0
func (r *RequestResponseResult) AddResponseErrorResult(response ocpp.Message)
func (*RequestResponseResult) GetRequest ¶ added in v0.3.0
func (r *RequestResponseResult) GetRequest() (ocpp.Message, bool)
func (*RequestResponseResult) GetResponse ¶ added in v0.3.0
func (r *RequestResponseResult) GetResponse() (ocpp.Message, bool)
func (*RequestResponseResult) GetResponseError ¶ added in v0.4.0
func (r *RequestResponseResult) GetResponseError() (ocpp.Message, bool)
func (*RequestResponseResult) IsValid ¶ added in v0.3.0
func (r *RequestResponseResult) IsValid() bool