matth-x / MicroOcpp

OCPP 1.6 / 2.0.1 client for microcontrollers
MIT License
358 stars 149 forks source link

I don't know where DataTx is activated during bootNotification() function analysis. #124

Closed jpily closed 1 year ago

jpily commented 1 year ago

Dear Math-x I have a question about the library. Hi, I'm leaving a question because I have a question during matth-x function analysis. bootNotification("test1", "test2"); If you use this function, you will not be able to find where it becomes Tx. If you look at the definition in ArduinoOcpp.cpp, there's only json form of writing, and I don't know where to send the Tx.

void bootNotification(const char chargePointModel, const char chargePointVendor, OnReceiveConfListener onConf, OnAbortListener onAbort, OnTimeoutListener onTimeout, OnReceiveErrorListener onError, std::unique_ptr timeout) { if (!ocppEngine) { AO_DBG_ERR("OCPP uninitialized"); //please call OCPP_initialize before return; }

auto credentials = std::unique_ptr(new DynamicJsonDocument( JSON_OBJECT_SIZE(2) + strlen(chargePointModel) + strlen(chargePointVendor) + 2)); (credentials)["chargePointModel"] = (char) chargePointModel; (credentials)["chargePointVendor"] = (char) chargePointVendor;

bootNotification(std::move(credentials), onConf, onAbort, onTimeout, onError, std::move(timeout)); }

void bootNotification(std::unique_ptr payload, OnReceiveConfListener onConf, OnAbortListener onAbort, OnTimeoutListener onTimeout, OnReceiveErrorListener onError, std::unique_ptr timeout) { if (!ocppEngine) { AO_DBG_ERR("OCPP uninitialized"); //please call OCPP_initialize before return; } auto bootNotification = makeOcppOperation( new BootNotification(std::move(payload))); if (onConf) bootNotification->setOnReceiveConfListener(onConf); if (onAbort) bootNotification->setOnAbortListener(onAbort); if (onTimeout) bootNotification->setOnTimeoutListener(onTimeout); if (onError) bootNotification->setOnReceiveErrorListener(onError); if (timeout) bootNotification->setTimeout(std::move(timeout)); else bootNotification->setTimeout(std::unique_ptr(new SuppressedTimeout())); ocppEngine->initiateOperation(std::move(bootNotification)); }

I would appreciate it if you could tell me which part is the function that Tx operates.

matth-x commented 1 year ago

Hi @jpily

Do you mean the route of the bootNotification through the library? It is:

jpily commented 1 year ago

Thank you... You must be busy until late, but thank you very much for taking time for your reply. Ask for additional help.

  1. I want to create a separate function in main.cpp to create Tx and Rx OCPP-J (json format) messages and test them directly on Steve-server. You need to create a transmit/receive function and finally implement the connection with Steve-server without using wifi using TCP/IP using the sim7600 1lc LTE module.

Sending and receiving via AT command is needed, so I would appreciate any advice to create a function.

matth-x commented 1 year ago

Closing this due to inactivity