Skip to content

Commit

Permalink
Use ChargePointConnection interface in 1.6 central system example
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenzo Donini <lorenzo.donini90@gmail.com>
  • Loading branch information
lorenzodonini committed May 13, 2021
1 parent 6b91815 commit a748928
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions example/1.6/cs/central_system_sim.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@ func main() {
centralSystem.SetRemoteTriggerHandler(handler)
centralSystem.SetSmartChargingHandler(handler)
// Add handlers for dis/connection of charge points
centralSystem.SetNewChargePointHandler(func(chargePointId string) {
handler.chargePoints[chargePointId] = &ChargePointState{connectors: map[int]*ConnectorInfo{}, transactions: map[int]*TransactionInfo{}}
log.WithField("client", chargePointId).Info("new charge point connected")
go exampleRoutine(chargePointId, handler)
centralSystem.SetNewChargePointHandler(func(chargePoint ocpp16.ChargePointConnection) {
handler.chargePoints[chargePoint.ID()] = &ChargePointState{connectors: map[int]*ConnectorInfo{}, transactions: map[int]*TransactionInfo{}}
log.WithField("client", chargePoint.ID()).Info("new charge point connected")
go exampleRoutine(chargePoint.ID(), handler)
})
centralSystem.SetChargePointDisconnectedHandler(func(chargePointId string) {
log.WithField("client", chargePointId).Info("charge point disconnected")
delete(handler.chargePoints, chargePointId)
centralSystem.SetChargePointDisconnectedHandler(func(chargePoint ocpp16.ChargePointConnection) {
log.WithField("client", chargePoint.ID()).Info("charge point disconnected")
delete(handler.chargePoints, chargePoint.ID())
})
ocppj.SetLogger(log)
// Run central system
Expand Down

0 comments on commit a748928

Please sign in to comment.