Skip to content

Commit

Permalink
Add Stop to CSMS and CentralSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
rbright committed Nov 30, 2023
1 parent d214d7c commit cd36be6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ocpp1.6/central_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,10 @@ func (cs *centralSystem) Start(listenPort int, listenPath string) {
cs.server.Start(listenPort, listenPath)
}

func (cs *centralSystem) Stop() {
cs.server.Stop()
}

func (cs *centralSystem) sendResponse(chargePointId string, confirmation ocpp.Response, err error, requestId string) {
if err != nil {
// Send error response
Expand Down
2 changes: 2 additions & 0 deletions ocpp1.6/v16.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ type CentralSystem interface {

// The function blocks forever, so it is suggested to wrap it in a goroutine, in case other functionality needs to be executed on the main program thread.
Start(listenPort int, listenPath string)
// Stops the central system, clearing all pending requests.
Stop()
// Errors returns a channel for error messages. If it doesn't exist it es created.
Errors() <-chan error
}
Expand Down
4 changes: 4 additions & 0 deletions ocpp2.0.1/csms.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,10 @@ func (cs *csms) Start(listenPort int, listenPath string) {
cs.server.Start(listenPort, listenPath)
}

func (cs *csms) Stop() {
cs.server.Stop()
}

func (cs *csms) sendResponse(chargingStationID string, response ocpp.Response, err error, requestId string) {
if err != nil {
// Send error response
Expand Down
2 changes: 2 additions & 0 deletions ocpp2.0.1/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ type CSMS interface {

// The function blocks forever, so it is suggested to wrap it in a goroutine, in case other functionality needs to be executed on the main program thread.
Start(listenPort int, listenPath string)
// Stops the CSMS, clearing all pending requests.
Stop()
// Errors returns a channel for error messages. If it doesn't exist it es created.
Errors() <-chan error
}
Expand Down

0 comments on commit cd36be6

Please sign in to comment.