lorenzodonini / ocpp-go

Open Charge Point Protocol implementation in Go
MIT License
275 stars 126 forks source link

Query about 3 tier model and how it is implemented in ocpp2.0.1 #106

Closed vec-tr closed 3 years ago

vec-tr commented 3 years ago

Hello @lorenzodonini

My query is how you are planning to adopt 3 tier model in the ocpp2.0.1 implementation?

According to the below definition

type ChargingStationConnection interface {
    ID() string
    TLSConnectionState() *tls.ConnectionState
}

ID gives the charging station id and do we also have a similar struct for chargePointConnection also to browse through different charge points?

lorenzodonini commented 3 years ago

Hello,

ChargingStationConnection is just an interface for wrapping some useful charging stations' properties, apart from the ID, and allow the CSMS to retrieve them at runtime (before, the library only used to pass the id of the charging station, but this is definitely more extensible).

ChargePointConnection is used in ocpp1.6 (since the naming was different), but it follows the same reasoning.

Those interfaces only describe a single connection though. If you want to "browse" through the different charging stations on the CSMS, you need to store the references in a map on your end (see the example for v1.6 https://github.com/lorenzodonini/ocpp-go/blob/master/example/1.6/cs/handler.go#L65).

Let me know if this answered your question.

vec-tr commented 3 years ago

Thanks much for the reply and it solves the doubt.

We get the chargingStation from the list of charingStations and can maintain the hierarchy (chargingPoint and connector) as part of map.

Hope my understanding is right