Need help converting GATT_Server example in ESP-IDF to CPP
Posted: Tue Nov 09, 2021 6:51 am
I am facing an issue converting gatt_server example to cpp.
Steps to replicate the error:
Step 1:
I copied gatt_server directory to another directory.
Step 2:
I added
extern "C"
{
void app_main();
}
to the gatt_server.c and renamed it gatt_server.cpp
Step 3:
I built the project as
idf.py build.
I get a lot of error messages like [See the attachment for the build log to know all the errors.]
"crosses initialization of 'esp_err_t add_char_ret'"
./main/main.cpp:305:12: error: enumeration value 'ESP_GATTS_WRITE_EVT' not handled in switch [-Werror=switch]
../main/main.cpp:305:12: error: enumeration value 'ESP_GATTS_EXEC_WRITE_EVT' not handled in switch [-Werror=switch]
../main/main.cpp:305:12: error: enumeration value 'ESP_GATTS_MTU_EVT' not handled in switch [-Werror=switch]
../main/main.cpp:305:12: error: enumeration value 'ESP_GATTS_CONF_EVT' not handled in switch [-Werror=switch]
etc.
I want to know if there is any example cpp project that can be provided?
If not please guide me into removing these errors.
I know that this answers the cross initialization erros:
https://stackoverflow.com/questions/115 ... tion-error
I want to understand the rest.
Steps to replicate the error:
Step 1:
I copied gatt_server directory to another directory.
Step 2:
I added
extern "C"
{
void app_main();
}
to the gatt_server.c and renamed it gatt_server.cpp
Step 3:
I built the project as
idf.py build.
I get a lot of error messages like [See the attachment for the build log to know all the errors.]
"crosses initialization of 'esp_err_t add_char_ret'"
./main/main.cpp:305:12: error: enumeration value 'ESP_GATTS_WRITE_EVT' not handled in switch [-Werror=switch]
../main/main.cpp:305:12: error: enumeration value 'ESP_GATTS_EXEC_WRITE_EVT' not handled in switch [-Werror=switch]
../main/main.cpp:305:12: error: enumeration value 'ESP_GATTS_MTU_EVT' not handled in switch [-Werror=switch]
../main/main.cpp:305:12: error: enumeration value 'ESP_GATTS_CONF_EVT' not handled in switch [-Werror=switch]
etc.
I want to know if there is any example cpp project that can be provided?
If not please guide me into removing these errors.
I know that this answers the cross initialization erros:
https://stackoverflow.com/questions/115 ... tion-error
I want to understand the rest.