ESP_MODEM - pppos_client_main_c in C++ problems
Posted: Sun Jan 12, 2025 11:35 pm
Hi Forum.
I have got the pppos_client example included with esp_modem up running in C, so that is nice
But I want to include this into another project written in cpp. That is giving me some grey hairs. I have tried all kind of approaches, but I can not get it do compile correctly. I am using cxx_include/esp_modem_api.hpp and cxx_include/esp_modem_netif.hpp, but is seems that there are some differences, and some functions seems to miss declarations. The functions are there, but as far as I can see, they are not declaired anywhere - eg esp_modem_send_sms function.
This is my list of compile errors. Can someone point me to a direction, how to solve this?
I have got the pppos_client example included with esp_modem up running in C, so that is nice
But I want to include this into another project written in cpp. That is giving me some grey hairs. I have tried all kind of approaches, but I can not get it do compile correctly. I am using cxx_include/esp_modem_api.hpp and cxx_include/esp_modem_netif.hpp, but is seems that there are some differences, and some functions seems to miss declarations. The functions are there, but as far as I can see, they are not declaired anywhere - eg esp_modem_send_sms function.
This is my list of compile errors. Can someone point me to a direction, how to solve this?
Code: Select all
lib/MyModem/MyModem.cpp: In function 'void on_ppp_changed(void*, esp_event_base_t, int32_t, void*)':
lib/MyModem/MyModem.cpp:85:21: error: 'NETIF_PPP_ERRORUSER' was not declared in this scope
85 | if (event_id == NETIF_PPP_ERRORUSER) {
| ^~~~~~~~~~~~~~~~~~~
lib/MyModem/MyModem.cpp:87:33: error: invalid conversion from 'void*' to 'esp_netif_t**' {aka 'esp_netif_obj**'} [-fpermissive]
87 | esp_netif_t **p_netif = event_data;
| ^~~~~~~~~~
| |
| void*
lib/MyModem/MyModem.cpp: In function 'void on_ip_event(void*, esp_event_base_t, int32_t, void*)':
lib/MyModem/MyModem.cpp:108:39: error: invalid conversion from 'int' to 'esp_netif_dns_type_t' [-fpermissive]
108 | esp_netif_get_dns_info(netif, 0, &dns_info);
| ^
| |
| int
In file included from components/esp_modem/include/esp_modem_c_api_types.h:10,
from components/esp_modem_usb_dte/include/esp_modem_usb_c_api.h:9,
from lib/MyModem/MyModem.cpp:10:
C:/Users/Frank.FUTURELIGHT/.platformio/packages/framework-espidf/components/esp_netif/include/esp_netif.h:751:79: note: initializing argument 2 of 'esp_err_t esp_netif_get_dns_info(esp_netif_t*, esp_netif_dns_type_t, esp_netif_dns_info_t*)'
751 | esp_err_t esp_netif_get_dns_info(esp_netif_t *esp_netif, esp_netif_dns_type_t type, esp_netif_dns_info_t *dns);
| ~~~~~~~~~~~~~~~~~~~~~^~~~
lib/MyModem/MyModem.cpp:110:39: error: invalid conversion from 'int' to 'esp_netif_dns_type_t' [-fpermissive]
110 | esp_netif_get_dns_info(netif, 1, &dns_info);
| ^
| |
| int
C:/Users/Frank.FUTURELIGHT/.platformio/packages/framework-espidf/components/esp_netif/include/esp_netif.h:751:79: note: initializing argument 2 of 'esp_err_t esp_netif_get_dns_info(esp_netif_t*, esp_netif_dns_type_t, esp_netif_dns_info_t*)'
751 | esp_err_t esp_netif_get_dns_info(esp_netif_t *esp_netif, esp_netif_dns_type_t type, esp_netif_dns_info_t *dns);
| ~~~~~~~~~~~~~~~~~~~~~^~~~
In file included from C:/Users/Frank.FUTURELIGHT/.platformio/packages/framework-espidf/components/esp_driver_uart/include/driver/uart.h:9,
from components/esp_modem/include/esp_modem_config.h:9,
from components/esp_modem/include/esp_modem_c_api_types.h:9:
lib/MyModem/MyModem.cpp: In member function 'void MyModem::_begin()':
lib/MyModem/MyModem.cpp:138:48: error: 'NETIF_PPP_STATUS' was not declared in this scope
138 | ESP_ERROR_CHECK(esp_event_handler_register(NETIF_PPP_STATUS, ESP_EVENT_ANY_ID, &on_ppp_changed, NULL));
| ^~~~~~~~~~~~~~~~
C:/Users/Frank.FUTURELIGHT/.platformio/packages/framework-espidf/components/esp_common/include/esp_err.h:116:30: note: in definition of macro 'ESP_ERROR_CHECK'
116 | esp_err_t err_rc_ = (x); \
| ^
lib/MyModem/MyModem.cpp:207:13: error: 'esp_modem_sms_txt_mode' was not declared in this scope; did you mean 'esp_modem_set_mode'?
207 | if (esp_modem_sms_txt_mode(dce, true) != ESP_OK || esp_modem_sms_character_set(dce) != ESP_OK) {
| ^~~~~~~~~~~~~~~~~~~~~~
| esp_modem_set_mode
lib/MyModem/MyModem.cpp:207:60: error: 'esp_modem_sms_character_set' was not declared in this scope
207 | if (esp_modem_sms_txt_mode(dce, true) != ESP_OK || esp_modem_sms_character_set(dce) != ESP_OK) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/MyModem/MyModem.cpp:216:15: error: 'esp_modem_send_sms' was not declared in this scope; did you mean 'esp_modem_set_apn'?
216 | err = esp_modem_send_sms(dce, tlf, "Hej Carsten. Dette er en besked sendt fra ESP32 via modem :-)");
| ^~~~~~~~~~~~~~~~~~
| esp_modem_set_apn
lib/MyModem/MyModem.cpp:281:15: error: 'esp_modem_get_imsi' was not declared in this scope; did you mean 'esp_modem_get_mode'?
281 | err = esp_modem_get_imsi(dce, imsi);
| ^~~~~~~~~~~~~~~~~~
| esp_modem_get_mode
*** [.pio\build\ESP32-S3-DevKitC-1U-N8R2\lib3d7\MyModem\MyModem.o] Error 1