lorenzodonini / ocpp-go

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

I get problem on ocppj validator when implement CSMS and Central System in one project/package even though with different port and handler #181

Closed dwibudut closed 1 year ago

dwibudut commented 1 year ago

Hello,

I want run the Central System (ocpp1.6) and CSMS (copp2.0.1) in one project/package with different port and handler. But I get problem on ocppj validator when implement CSMS and Central System in one project/package even though with different port and handler using this library:

https://github.com/lorenzodonini/ocpp-go/blob/7652fcf0b6dda9a83d847c506db467b8814cfa4f/ocppj/ocppj.go#L19

Called in ocpp2.0.1 : https://github.com/lorenzodonini/ocpp-go/blob/7652fcf0b6dda9a83d847c506db467b8814cfa4f/ocpp2.0.1/types/types.go#L700

Called in ocpp1.6 : https://github.com/lorenzodonini/ocpp-go/blob/7652fcf0b6dda9a83d847c506db467b8814cfa4f/ocpp1.6/types/types.go#L317

I found validator on the RegisterValidation will override with the last called(init) of ocpp1.6 or 2.0.1 (which one is called last will override)

For example on validator triggerMessageStatus :

https://github.com/lorenzodonini/ocpp-go/blob/7652fcf0b6dda9a83d847c506db467b8814cfa4f/ocpp1.6/remotetrigger/trigger_message.go#L113

https://github.com/lorenzodonini/ocpp-go/blob/7652fcf0b6dda9a83d847c506db467b8814cfa4f/ocpp2.0.1/remotecontrol/trigger_message.go#L111

It will override with the last one.

Is it designed like that or can someone give me a hint/guide for this case, please.

cc: @lorenzodonini

Thx

lorenzodonini commented 1 year ago

Would close the issue for now. In case more instances of conflicting validation tags between v1.6 and v2.0.1 are found, I'm happy to re-open the issue or simply accept more MRs.