matth-x / MicroOcpp

OCPP 1.6 client for microcontrollers
MIT License
300 stars 131 forks source link

AuthorizeRemoteTxRequests key functional implementation #329

Open imanolmc opened 1 week ago

imanolmc commented 1 week ago

Hello Matth,

We are considering the functional implementation of AuthorizeRemoteTxRequests key in the library. Could you provide any guidance on how to get started?

Thank you in advance for your assistance.

Regards,

Imanol

matth-x commented 1 week ago

Hi @imanolmc,

The relevant point in the code is here:

https://github.com/matth-x/MicroOcpp/blob/8b1f0fdbae8785c49453f0b2d54a1a8db2fbe3ed/src/MicroOcpp/Operations/RemoteStartTransaction.cpp#L100

beginTransaction_authorized assumes that the given idTag is already successfully authorized. In constrast, beginTransaction would try authorizing it again, including sending an Authorize request.

You can alter the configuration mutability here: https://github.com/matth-x/MicroOcpp/blob/8b1f0fdbae8785c49453f0b2d54a1a8db2fbe3ed/src/MicroOcpp/Model/ConnectorBase/ConnectorsCommon.cpp#L39

The parameters for R/W configs look like this:

https://github.com/matth-x/MicroOcpp/blob/8b1f0fdbae8785c49453f0b2d54a1a8db2fbe3ed/src/MicroOcpp/Model/ConnectorBase/Connector.cpp#L50

Again back to RemoteStartTransaction, you can read the configuration value by declaring it there and using the getBool() function similar to here:

https://github.com/matth-x/MicroOcpp/blob/8b1f0fdbae8785c49453f0b2d54a1a8db2fbe3ed/src/MicroOcpp/Model/ConnectorBase/Connector.cpp#L264