How to know device got IP is through Ethernet Interface - ESP32

#1

If you are asking a question, please follow this template:

  1. My goal is: To confirm my device successfully got IP through ethernet interface.
  2. My actions are: I am using the function ```
    bool mgos_net_get_ip_info(enum mgos_net_if_type if_type, int if_instance,
    struct mgos_net_ip_info *ip_info);
3. The result I see is: This fuction is always returing false
4. My expectation & question is: Please help me how to know IP address is assigned through ethernet interface.

    Please have a look on my below code:

         if(mgos_net_get_ip_info(MGOS_NET_IF_TYPE_ETHERNET, MGOS_NET_IF_TYPE_ETHERNET, &deviceNwkInfo))
          {
        printf("True\n");
        }
        else{
        printf("False\n");
        }


Thanks and regards
Lokesh
#2

The second argument of mgos_net_get_ip_info, if_instance, should be 0 (zero);

mgos_net_get_ip_info(MGOS_NET_IF_TYPE_ETHERNET, 0, &deviceNwkInfo);