From a748928291f86a98a3c91f4d34803adde42e2ec3 Mon Sep 17 00:00:00 2001 From: Lorenzo Donini Date: Thu, 13 May 2021 17:22:17 +0200 Subject: [PATCH] Use ChargePointConnection interface in 1.6 central system example Signed-off-by: Lorenzo Donini --- example/1.6/cs/central_system_sim.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/example/1.6/cs/central_system_sim.go b/example/1.6/cs/central_system_sim.go index b298f47e..218ec3d4 100644 --- a/example/1.6/cs/central_system_sim.go +++ b/example/1.6/cs/central_system_sim.go @@ -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