esp-idf-provisioning-android
esp-idf-provisioning-android copied to clipboard
How to I get wireless network IP4 address (of ESP with Wifi, not phone with Wifi) after successful provision in Android

For example in IOS
Can anyone help me?
Hi @LeKyDF , need to provide API to get IP address as it is not available in Android currently.
For the API, is it possible to retrieve the IP address before the BLE provisioning service is closed?
Hi @khushbushah2302 , any answers to this? We understand how to use wifi_prov_mgr_endpoint_register
but not sure how to implement the trigger after ESP get's IP address.
For the API, is it possible to retrieve the IP address before the BLE provisioning service is closed?

@khushbushah2302 , currently, the wifi_prov_mgr_endpoint_register
only supports sending custom data out when received data coming in. However, is it possible that we can send the custom data out without receiving any data?
/* Handler for the optional provisioning endpoint registered by the application.
* The data format can be chosen by applications. Here, we are using plain ascii text.
* Applications can choose to use other formats like protobuf, JSON, XML, etc.
*/
esp_err_t custom_prov_data_handler(uint32_t session_id, const uint8_t *inbuf, ssize_t inlen,
uint8_t **outbuf, ssize_t *outlen, void *priv_data)
{
// Ignore inbuf
if (inbuf) {
ESP_LOGI(TAG, "Received data: %.*s", inlen, (char *)inbuf);
}
// Trigger based on GET_IP EVENTS
char response[] = "{{ipv4.addr}}";
*outbuf = (uint8_t *)strdup(response);
if (*outbuf == NULL) {
ESP_LOGE(TAG, "System out of memory");
return ESP_ERR_NO_MEM;
}
*outlen = strlen(response) + 1; /* +1 for NULL terminating byte */
return ESP_OK;
}