Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions example/1.6/cs/central_system_sim.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"os"
"strconv"
"time"
Expand Down Expand Up @@ -234,7 +233,7 @@ func main() {
})
// set message hook
centralSystem.SetMessageHooks(func(direction, chargePointID, msgType string, payload []byte) {
fmt.Printf("direction:%s \n cpid:%s \n msgType: %s \n payload: %s\n", direction, chargePointID, msgType, string(payload))
log.Infof("direction:%s \n cpid:%s \n msgType: %s \n payload: %s\n", direction, chargePointID, msgType, string(payload))
})
ocppj.SetLogger(log.WithField("logger", "ocppj"))
ws.SetLogger(log.WithField("logger", "websocket"))
Expand Down
2 changes: 1 addition & 1 deletion ocpp1.6/v16.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func NewCentralSystem(endpoint *ocppj.Server, server ws.Server) CentralSystem {
}
server.AddSupportedSubprotocol(types.V16Subprotocol)
if endpoint == nil {
endpoint = ocppj.NewServer(server, nil, nil, nil,
endpoint = ocppj.NewServer(server, nil, nil,
core.Profile,
localauth.Profile,
firmware.Profile,
Expand Down
4 changes: 2 additions & 2 deletions ocppj/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type MessageHooks func(direction string, chargePointID string, messageType strin
// s := ocppj.NewServer(ws.NewServer(), nil, nil)
//
// The dispatcher's associated ClientState will be set during initialization.
func NewServer(wsServer ws.Server, dispatcher ServerDispatcher, stateHandler ServerState, msgHooks MessageHooks, profiles ...*ocpp.Profile) *Server {
func NewServer(wsServer ws.Server, dispatcher ServerDispatcher, stateHandler ServerState, profiles ...*ocpp.Profile) *Server {
if dispatcher == nil {
dispatcher = NewDefaultServerDispatcher(NewFIFOQueueMap(0))
}
Expand All @@ -66,7 +66,7 @@ func NewServer(wsServer ws.Server, dispatcher ServerDispatcher, stateHandler Ser
for _, profile := range profiles {
s.AddProfile(profile)
}
s.MessageHooks = msgHooks
//s.MessageHooks = msgHooks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed entirely

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK,already deleted

return &s
}

Expand Down